OSDN Git Service

r224をNetBeans用に設定変更.
authoryuki <yuki@c066991c-cf13-ec4a-a49a-846e61667af5>
Sat, 2 May 2009 08:30:36 +0000 (08:30 +0000)
committeryuki <yuki@c066991c-cf13-ec4a-a49a-846e61667af5>
Sat, 2 May 2009 08:30:36 +0000 (08:30 +0000)
git-svn-id: http://192.168.11.7/svn/saccubus/trunk@2 c066991c-cf13-ec4a-a49a-846e61667af5

34 files changed:
vhook/Makefile [new file with mode: 0644]
vhook/chat/chat.c [new file with mode: 0644]
vhook/chat/chat.h [new file with mode: 0644]
vhook/chat/chat_slot.c [new file with mode: 0644]
vhook/chat/chat_slot.h [new file with mode: 0644]
vhook/chat/process_chat.c [new file with mode: 0644]
vhook/chat/process_chat.h [new file with mode: 0644]
vhook/comment/com_surface.c [new file with mode: 0644]
vhook/comment/com_surface.h [new file with mode: 0644]
vhook/comment/shadow.c [new file with mode: 0644]
vhook/comment/shadow.h [new file with mode: 0644]
vhook/comment/surf_util.c [new file with mode: 0644]
vhook/comment/surf_util.h [new file with mode: 0644]
vhook/common/framehook_ext.h [new file with mode: 0644]
vhook/framehook.c [new file with mode: 0644]
vhook/framehook.h [new file with mode: 0644]
vhook/header.h [new file with mode: 0644]
vhook/main.c [new file with mode: 0644]
vhook/main.h [new file with mode: 0644]
vhook/mydef.h [new file with mode: 0644]
vhook/nbproject/Makefile-Debug.mk [new file with mode: 0644]
vhook/nbproject/Makefile-Release.mk [new file with mode: 0644]
vhook/nbproject/Makefile-impl.mk [new file with mode: 0644]
vhook/nbproject/Package-Debug.bash [new file with mode: 0644]
vhook/nbproject/Package-Release.bash [new file with mode: 0644]
vhook/nbproject/configurations.xml [new file with mode: 0644]
vhook/nbproject/project.properties [new file with mode: 0644]
vhook/nbproject/project.xml [new file with mode: 0644]
vhook/nicodef.h [new file with mode: 0644]
vhook/process.c [new file with mode: 0644]
vhook/process.h [new file with mode: 0644]
vhook/struct_define.h [new file with mode: 0644]
vhook/util.c [new file with mode: 0644]
vhook/util.h [new file with mode: 0644]

diff --git a/vhook/Makefile b/vhook/Makefile
new file mode 100644 (file)
index 0000000..30bc678
--- /dev/null
@@ -0,0 +1,92 @@
+#
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:                called before 'help' target
+#     .help-post:               called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
diff --git a/vhook/chat/chat.c b/vhook/chat/chat.c
new file mode 100644 (file)
index 0000000..1ee9448
--- /dev/null
@@ -0,0 +1,154 @@
+#include <SDL/SDL_endian.h>\r
+#include <stdio.h>\r
+\r
+#include <stdlib.h>\r
+#include "chat.h"\r
+#include "../mydef.h"\r
+#include "../nicodef.h"\r
+\r
+int initChat(FILE* log,CHAT* chat,const char* file_path,CHAT_SLOT* slot,int video_length){\r
+       int i;\r
+       int max_no = INTEGER_MIN;\r
+       int min_no = INTEGER_MAX;\r
+       int max_item;\r
+       chat->slot = slot;\r
+       FILE* com_f = fopen(file_path,"rb");\r
+       if(com_f == NULL){\r
+               fputs("[chat/init]failed to open comment file.\n",log);\r
+               return FALSE;\r
+       }\r
+       /*\97v\91f\90\94\82Ì\8eæ\93¾*/\r
+       if(fread(&max_item,sizeof(max_item),1,com_f) <= 0){\r
+               fputs("[chat/init]failed to read the number of comments.\n",log);\r
+               return FALSE;\r
+       }\r
+       max_item = SDL_SwapLE32(max_item);\r
+       fprintf(log,"[chat/init]%d comments.\n",max_item);\r
+       chat->max_item = max_item;\r
+       //\83A\83C\83e\83\80\94z\97ñ\82Ì\8am\95Û\r
+       chat->item = malloc(sizeof(CHAT_ITEM) * max_item);\r
+       if(chat->item == NULL){\r
+               fputs("[chat/init]failed to malloc for comment.\n",log);\r
+               return FALSE;\r
+       }\r
+       /*\8cÂ\95Ê\97v\91f\82Ì\8f\89\8aú\89»*/\r
+       CHAT_ITEM* item;\r
+       int no;\r
+       int vpos;\r
+       int location;\r
+       int size;\r
+       int color;\r
+       int str_length;\r
+       Uint16* str;\r
+       for(i=0;i<max_item;i++){\r
+               item = &chat->item[i];\r
+               item->chat = chat;\r
+               item->showed = FALSE;\r
+               //\83R\83\81\83\93\83g\94Ô\8d\86\r
+               if(fread(&no,sizeof(no),1,com_f) <= 0){\r
+                       fputs("[chat/init]failed to read comment number.\n",log);\r
+                       return FALSE;\r
+               }\r
+               no = SDL_SwapLE32(no);\r
+               max_no = MAX(max_no,no);\r
+               min_no = MIN(min_no,no);\r
+               //vpos\r
+               if(fread(&vpos,sizeof(vpos),1,com_f) <= 0){\r
+                       fputs("[chat/init]failed to read comment vpos.\n",log);\r
+                       return FALSE;\r
+               }\r
+               vpos = SDL_SwapLE32(vpos);\r
+               //\95\8e\9a\82Ì\8fê\8f\8a\r
+               if(fread(&location,sizeof(location),1,com_f) <= 0){\r
+                       fputs("[chat/init]failed to read comment location.\n",log);\r
+                       return FALSE;\r
+               }\r
+               location = SDL_SwapLE32(location);\r
+               //\83T\83C\83Y\r
+               if(fread(&size,sizeof(size),1,com_f) <= 0){\r
+                       fputs("[chat/init]failed to read comment size.\n",log);\r
+                       return FALSE;\r
+               }\r
+               size = SDL_SwapLE32(size);\r
+               //\90F\r
+               if(fread(&color,sizeof(color),1,com_f) <= 0){\r
+                       fputs("[chat/init]failed to read comment color.\n",log);\r
+                       return FALSE;\r
+               }\r
+               color = SDL_SwapLE32(color);\r
+               //\95\8e\9a\90\94\r
+               if(fread(&str_length,sizeof(str_length),1,com_f) <= 0){\r
+                       fputs("[chat/init]failed to read comment length.\n",log);\r
+                       return FALSE;\r
+               }\r
+               str_length = SDL_SwapLE32(str_length);\r
+               //\95\8e\9a\97ñ\r
+               str = malloc(str_length);\r
+               if(str == NULL){\r
+                       fputs("[chat/init]failed to malloc for comment text.\n",log);\r
+                       return FALSE;\r
+               }\r
+               if(fread(str,str_length,1,com_f) <= 0){\r
+                       fputs("[chat/init]failed to read comment text.\n",log);\r
+                       return FALSE;\r
+               }\r
+               //\95Ï\90\94\83Z\83b\83g\r
+               item->no = no;\r
+               item->vpos = vpos;\r
+               item->location = location;\r
+               item->size = size;\r
+               item->color = color;\r
+               item->str = str;\r
+               /*\93à\95\94\8f\88\97\9d\82æ\82è*/\r
+               if(location != CMD_LOC_DEF){\r
+                       item->vstart = vpos;\r
+                       item->vend = vpos + TEXT_SHOW_SEC - TEXT_AHEAD_SEC;\r
+               }else{\r
+                       item->vstart = vpos - TEXT_AHEAD_SEC;\r
+                       item->vend = item->vstart + TEXT_SHOW_SEC;\r
+               }\r
+               int fix = item->vend - video_length;\r
+               if(fix > 0){\r
+                       item->vend -= fix;\r
+                       item->vpos -= fix;\r
+                       item->vstart -= fix;\r
+                       fprintf(log,"[chat/fix]comment %d time adjusted.\n",i);\r
+               }\r
+               /*\93à\95\94\8f\88\97\9d\82æ\82è\81@\82¨\82í\82è*/\r
+       }\r
+       fclose(com_f);\r
+       chat->max_no = max_no;\r
+       chat->min_no = min_no;\r
+       return TRUE;\r
+}\r
+\r
+void closeChat(CHAT* chat){\r
+       int i;\r
+       int max_item = chat->max_item;\r
+       for(i=0;i<max_item;i++){\r
+               free((void*)chat->item[i].str);\r
+       }\r
+       free(chat->item);\r
+}\r
+\r
+/*\r
+ * \83C\83e\83\8c\81[\83^\82ð\83\8a\83Z\83b\83g\82·\82é\81B\r
+ */\r
+void resetChatIterator(CHAT* chat){\r
+       chat->iterator_index = 0;\r
+}\r
+/*\r
+ * \83C\83e\83\8c\81[\83^\82ð\93¾\82é\r
+ */\r
+CHAT_ITEM* getChatShowed(CHAT* chat,int now_vpos){\r
+       int *i = &chat->iterator_index;\r
+       int max_item = chat->max_item;\r
+       CHAT_ITEM* item;\r
+       for(;*i<max_item;(*i)++){\r
+               item = &chat->item[*i];\r
+               if(now_vpos >= item->vstart && now_vpos <= item->vend && !item->showed){\r
+                       return item;\r
+               }\r
+       }\r
+       return NULL;\r
+}\r
diff --git a/vhook/chat/chat.h b/vhook/chat/chat.h
new file mode 100644 (file)
index 0000000..08ee058
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef CHAT_H_\r
+#define CHAT_H_\r
+\r
+#include <SDL/SDL.h>\r
+#include "../struct_define.h"\r
+\r
+struct CHAT_ITEM{\r
+       //\8fê\8f\8a\82Ì\93Á\92è\r
+       int no;\r
+       int vpos;\r
+       int location;\r
+       //\95\8e\9a\82Ì\8fC\8fü\r
+       int size;\r
+       int color;\r
+       Uint16* str;\r
+       //\93à\95\94\8f\88\97\9d\82Å\8eg\82¤\r
+       int vstart;\r
+       int vend;\r
+       int showed;\r
+       //\83\8a\83t\83@\83\8c\83\93\83X\r
+       CHAT* chat;\r
+};\r
+\r
+struct CHAT{\r
+       int max_no;\r
+       int min_no;\r
+       //\83A\83C\83e\83\80\r
+       int max_item;\r
+       int iterator_index;\r
+       CHAT_ITEM* item;\r
+       //\83\8a\83t\83@\83\8c\83\93\83X\r
+       CHAT_SLOT* slot;\r
+};\r
+\r
+#include "chat_slot.h"\r
+struct CHAT_SET{\r
+       CHAT chat;\r
+       CHAT_SLOT slot;\r
+};\r
+\r
+//\8f\89\8aú\89»\r
+int initChat(FILE* log,CHAT* chat,const char* file_path,CHAT_SLOT* slot,int video_length);\r
+void closeChat();\r
+//\83C\83e\83\8c\81[\83^\r
+void resetChatIterator(CHAT* chat);\r
+CHAT_ITEM* getChatShowed(CHAT* chat,int now_vpos);\r
+\r
+#endif /*CHAT_H_*/\r
diff --git a/vhook/chat/chat_slot.c b/vhook/chat/chat_slot.c
new file mode 100644 (file)
index 0000000..a04d902
--- /dev/null
@@ -0,0 +1,164 @@
+#include "chat.h"\r
+#include "chat_slot.h"\r
+#include "process_chat.h"\r
+#include "../mydef.h"\r
+#include "../comment/com_surface.h"\r
+#include "../nicodef.h"\r
+#include "../util.h"\r
+#include <SDL/SDL.h>\r
+#include <stdio.h>\r
+#include <string.h>\r
+\r
+int initChatSlot(FILE* log,CHAT_SLOT* slot,int max_slot,CHAT* chat){\r
+       slot->max_item=max_slot;\r
+       slot->chat = chat;\r
+       slot->item = malloc(sizeof(CHAT_SLOT_ITEM) * max_slot);\r
+       if(slot->item == NULL){\r
+               fputs("failed to malloc for comment slot.\n",log);\r
+               return FALSE;\r
+       }\r
+       int i;\r
+       CHAT_SLOT_ITEM* item;\r
+       for(i=0;i<max_slot;i++){\r
+               item = &slot->item[i];\r
+               item->used = FALSE;\r
+               item->slot = slot;\r
+               item->surf=NULL;\r
+       }\r
+       return TRUE;\r
+}\r
+void closeChatSlot(CHAT_SLOT* slot){\r
+       int i;\r
+       CHAT_SLOT_ITEM* item;\r
+       for(i=0;i<slot->max_item;i++){\r
+               item = &slot->item[i];\r
+               SDL_FreeSurface(item->surf);\r
+       }\r
+       //\83A\83C\83e\83\80\82ð\8fÁ\8b\8e\81B\r
+       free(slot->item);\r
+}\r
+\r
+void deleteChatSlot(CHAT_SLOT* slot,CHAT_SLOT_ITEM* item){\r
+       item->chat_item=NULL;\r
+       SDL_FreeSurface(item->surf);\r
+       item->surf = NULL;\r
+       item->used = FALSE;\r
+}\r
+\r
+void deleteChatSlotFromIndex(CHAT_SLOT* slot,int index){\r
+       CHAT_SLOT_ITEM* item = &slot->item[index];\r
+       deleteChatSlot(slot,item);\r
+}\r
+\r
+/*\r
+ * \83X\83\8d\83b\83g\82É\92Ç\89Á\82·\82é\81B\r
+ */\r
+void addChatSlot(DATA* data,CHAT_SLOT* slot,CHAT_ITEM* item,int video_width,int video_height){\r
+       //\82à\82¤\8c©\82¹\82ç\82ê\82½\81B\r
+       item->showed = TRUE;\r
+       if(slot->max_item <= 0){\r
+               return;\r
+       }\r
+       SDL_Surface* surf = makeCommentSurface(data,item,video_width,video_height);\r
+       /*\8aJ\82«\83X\83\8d\83b\83g\83\8b\8c\9f\8dõ*/\r
+       int i;\r
+       int cnt = -1;\r
+       int slot_max = slot->max_item;\r
+       for(i=0;i<slot_max;i++){\r
+               if(!slot->item[i].used){\r
+                       cnt = i;\r
+                       break;\r
+               }\r
+               if(cnt < 0 || slot->item[cnt].chat_item->vend > slot->item[i].chat_item->vend){\r
+                       cnt = i;\r
+               }\r
+       }\r
+       CHAT_SLOT_ITEM* slot_item = &slot->item[cnt];\r
+       /*\8bó\82«\82ª\96³\82¯\82ê\82Î\8b­\90§\93I\82É\8dì\82é\81B*/\r
+       if(slot_item->used){\r
+               deleteChatSlotFromIndex(slot,cnt);\r
+       }\r
+       //\82±\82Ì\8e\9e\93_\82Å\92Ç\89Á\r
+       slot_item->chat_item = item;\r
+       slot_item->surf = surf;\r
+       /*\83\8d\83P\81[\83V\83\87\83\93\82Å\95ª\8aò*/\r
+       int y;\r
+       if(item->location == CMD_LOC_BOTTOM){\r
+               y = video_height - surf->h;\r
+       }else{\r
+               y = 0;\r
+       }\r
+       int running;\r
+       do{\r
+               running = FALSE;\r
+               for(i=0;i<slot_max;i++){\r
+                       CHAT_SLOT_ITEM* other_slot = &slot->item[i];\r
+                       if(!other_slot->used){\r
+                               continue;\r
+                       }\r
+                       const CHAT_ITEM* other_item = other_slot->chat_item;\r
+                       int other_y = other_slot->y;\r
+                       /*\96³\8e\8b\82·\82é\8fð\8c\8f*/\r
+                       if(other_y + other_slot->surf->h <= y){\r
+                               continue;\r
+                       }\r
+                       if(y + surf->h <= other_y){\r
+                               continue;\r
+                       }\r
+                       if(other_item->location != item->location){\r
+                               continue;\r
+                       }\r
+                       int start = MAX(other_item->vstart,item->vstart);\r
+                       int end = MIN(other_item->vend,item->vend);\r
+                       int obj_x_t1 = getX(start,slot_item,video_width);\r
+                       int obj_x_t2 = getX(end,slot_item,video_width);\r
+                       int o_x_t1 = getX(start,other_slot,video_width);\r
+                       int o_x_t2 = getX(end,other_slot,video_width);\r
+                       //\93\96\82½\82è\94»\92è\r
+                       if ((obj_x_t1 <= o_x_t1 + other_slot->surf->w && o_x_t1 <= obj_x_t1 + surf->w)\r
+                || (obj_x_t2 <= o_x_t2 + other_slot->surf->w && o_x_t2 <= obj_x_t2 + surf->w)){\r
+                               if(item->location == CMD_LOC_BOTTOM){\r
+                                       y = other_y - surf->h - 1;\r
+                               }else{\r
+                                       y = other_y + other_slot->surf->h + 1;\r
+                               }\r
+                               running = TRUE;\r
+                               break;\r
+                       }\r
+               }\r
+       }while(running);\r
+       /*\82»\82à\82»\82à\89æ\96Ê\93à\82É\96³\82¯\82ê\82Î\96³\88Ó\96¡\81B*/\r
+       if(y < 0 || y+surf->h > video_height){//\94Í\88Í\82ð\92´\82¦\82Ä\82é\82Ì\82Å\81A\83\89\83\93\83_\83\80\82É\94z\92u\81B\r
+               y = ((rnd() & 0xffff) * (video_height - surf->h)) / 0xffff;\r
+       }\r
+       //\92Ç\89Á\r
+       slot_item->used = TRUE;\r
+       slot_item->y = y;\r
+}\r
+/*\r
+ * \83C\83e\83\8c\81[\83^\82ð\83\8a\83Z\83b\83g\82·\82é\81B\r
+ */\r
+void resetChatSlotIterator(CHAT_SLOT* slot){\r
+       slot->iterator_index = 0;\r
+}\r
+/*\r
+ * \83C\83e\83\8c\81[\83^\82ð\93¾\82é\r
+ */\r
+CHAT_SLOT_ITEM* getChatSlotErased(CHAT_SLOT* slot,int now_vpos){\r
+       int *i = &slot->iterator_index;\r
+       int max_item = slot->max_item;\r
+       CHAT_ITEM* item;\r
+       CHAT_SLOT_ITEM* slot_item;\r
+       for(;*i<max_item;(*i)++){\r
+               slot_item = &slot->item[*i];\r
+               if(!slot_item->used){\r
+                       continue;\r
+               }\r
+               item = slot_item->chat_item;\r
+               if(item==NULL)continue;\r
+               if(now_vpos < item->vstart || now_vpos > item->vend){\r
+                       return slot_item;\r
+               }\r
+       }\r
+       return NULL;\r
+}\r
diff --git a/vhook/chat/chat_slot.h b/vhook/chat/chat_slot.h
new file mode 100644 (file)
index 0000000..6693bdd
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef CHAT_SLOT_H_\r
+#define CHAT_SLOT_H_\r
+\r
+#include "../struct_define.h"\r
+#include "chat.h"\r
+#include <SDL/SDL.h>\r
+\r
+struct CHAT_SLOT_ITEM{\r
+       int used;\r
+       CHAT_ITEM* chat_item;\r
+       SDL_Surface* surf;\r
+       int y;\r
+       //\83\8a\83t\83@\83\8c\83\93\83X\r
+       CHAT_SLOT* slot;\r
+};\r
+\r
+struct CHAT_SLOT{\r
+       int max_item;\r
+       int iterator_index;\r
+       CHAT_SLOT_ITEM* item;\r
+       //\83\8a\83t\83@\83\8c\83\93\83X\r
+       CHAT* chat;\r
+};\r
+#include "../main.h"\r
+//\8f\89\8aú\89»\r
+int initChatSlot(FILE* log,CHAT_SLOT* slot,int max_slot,CHAT* chat);\r
+void closeChatSlot(CHAT_SLOT* slot);\r
+//\92Ç\89Á\81A\8dí\8f\9c\r
+void addChatSlot(DATA* data,CHAT_SLOT* slot,CHAT_ITEM* item,int video_width,int video_height);\r
+void deleteChatSlot(CHAT_SLOT* slot,CHAT_SLOT_ITEM* item);\r
+void deleteChatSlotFromIndex(CHAT_SLOT* slot,int index);\r
+\r
+//\83C\83e\83\8c\81[\83^\r
+void resetChatSlotIterator(CHAT_SLOT* slot);\r
+CHAT_SLOT_ITEM* getChatSlotErased(CHAT_SLOT* slot,int now_vpos);\r
+#endif /*CHAT_SLOT_H_*/\r
diff --git a/vhook/chat/process_chat.c b/vhook/chat/process_chat.c
new file mode 100644 (file)
index 0000000..32fbfe2
--- /dev/null
@@ -0,0 +1,71 @@
+#include <SDL/SDL.h>\r
+#include "chat.h"\r
+#include "chat_slot.h"\r
+#include "process_chat.h"\r
+#include "../main.h"\r
+#include "../mydef.h"\r
+\r
+//\82±\82Ì\83\\81[\83X\93à\82Å\82µ\82©\8eg\82í\82È\82¢\83\81\83\\83b\83h\r
+void drawComment(SDL_Surface* surf,CHAT_SLOT* slot,int now_vpos);\r
+\r
+/**\r
+ * \83R\83\81\83\93\83g\82ð\95`\89æ\82·\82é\81B\r
+ */\r
+int chat_process(DATA* data,SDL_Surface* surf,const int now_vpos){\r
+       CHAT* chat = &data->chat;\r
+       CHAT_SLOT* slot = &data->slot;\r
+       FILE* log = data->log;\r
+       /*\8c©\82¹\82È\82¢\82à\82Ì\82ð\8dí\8f\9c*/\r
+       CHAT_SLOT_ITEM* slot_item;\r
+       CHAT_ITEM* chat_item;\r
+       resetChatSlotIterator(slot);\r
+       while((slot_item = getChatSlotErased(slot,now_vpos)) != NULL){\r
+               chat_item = slot_item->chat_item;\r
+               fprintf(log,"[process-chat/process]<vpos:%6d>com%4d<color:%2d loc:%2d size:%2d %6d-%6d(%6d)> erased. \n",now_vpos,chat_item->no,chat_item->color,chat_item->location,chat_item->size,chat_item->vstart,chat_item->vend,chat_item->vpos);\r
+               fflush(log);\r
+               deleteChatSlot(slot,slot_item);\r
+       }\r
+       /*\8c©\82¹\82é\82à\82Ì\82ð\83Z\83b\83g*/\r
+       resetChatIterator(chat);\r
+       while((chat_item = getChatShowed(chat,now_vpos)) != NULL){\r
+               fprintf(log,"[process-chat/process]<vpos:%6d>com%4d<color:%2d loc:%2d size:%2d %6d-%6d(%6d)> added. \n",now_vpos,chat_item->no,chat_item->color,chat_item->location,chat_item->size,chat_item->vstart,chat_item->vend,chat_item->vpos);\r
+               fflush(log);\r
+               addChatSlot(data,slot,chat_item,surf->w,surf->h);\r
+       }\r
+       drawComment(surf,slot,now_vpos);\r
+       return TRUE;\r
+}\r
+\r
+/*\r
+ * \83\8c\83C\83\84\8f\87\82É\82»\82Á\82Ä\95`\89æ\82·\82é\r
+ */\r
+\r
+void drawComment(SDL_Surface* surf,CHAT_SLOT* slot,int now_vpos){\r
+       int i;\r
+       SDL_Rect rect;\r
+       int max_item = slot->max_item;\r
+       CHAT_SLOT_ITEM* item;\r
+       for(i=0;i<max_item;i++){\r
+               item = &slot->item[i];\r
+               if(item->used){\r
+                       rect.x = getX(now_vpos,item,surf->w);\r
+                       rect.y = item->y;\r
+                       SDL_BlitSurface(item->surf,NULL,surf,&rect);\r
+               }\r
+       }\r
+}\r
+\r
+/*\r
+ * \88Ê\92u\82ð\8b\81\82ß\82é\r
+ */\r
+int getX(int now_vpos,const CHAT_SLOT_ITEM* item,int video_width){\r
+       int text_width = item->surf->w;\r
+       int width = video_width;\r
+       if(item->chat_item->location != CMD_LOC_DEF){\r
+               return (width - text_width) >>1;\r
+       }else{\r
+               int tmp = now_vpos - item->chat_item->vpos + TEXT_AHEAD_SEC;\r
+               return width - ((tmp * (width + text_width)) / TEXT_SHOW_SEC);\r
+       }\r
+       return -1;\r
+}\r
diff --git a/vhook/chat/process_chat.h b/vhook/chat/process_chat.h
new file mode 100644 (file)
index 0000000..dd48e27
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef PROCESS_CHAT_H_\r
+#define PROCESS_CHAT_H_\r
+#include <SDL/SDL.h>\r
+#include "chat.h"\r
+#include "chat_slot.h"\r
+#include "../main.h"\r
+int chat_process(DATA* data,SDL_Surface* surf,const int now_vpos);\r
+int getX(int now_vpos,const CHAT_SLOT_ITEM* item,int video_width);\r
+\r
+#endif /*PROCESS_CHAT_H_*/\r
diff --git a/vhook/comment/com_surface.c b/vhook/comment/com_surface.c
new file mode 100644 (file)
index 0000000..8841821
--- /dev/null
@@ -0,0 +1,153 @@
+#include <SDL/SDL.h>\r
+#include <SDL/SDL_ttf.h>\r
+#include <SDL/SDL_rotozoom.h>\r
+#include "com_surface.h"\r
+#include "surf_util.h"\r
+#include "../chat/chat.h"\r
+#include "../chat/chat_slot.h"\r
+#include "../nicodef.h"\r
+#include "../mydef.h"\r
+#include "../main.h"\r
+#include "shadow.h"\r
+\r
+\r
+SDL_Surface* drawText(DATA* data,int size,int color,Uint16* str);\r
+\r
+SDL_Surface* makeCommentSurface(DATA* data,const CHAT_ITEM* item,int video_width,int video_height){\r
+       Uint16* index = item->str;\r
+       Uint16* last = item->str;\r
+       SDL_Surface* ret = NULL;\r
+       int color = item->color;\r
+       int size = item->size;\r
+\r
+       /*\r
+        * \89e\82Í\92u\82¢\82Ä\82¨\82¢\82Ä\81A\82Æ\82è\82 \82¦\82¸\95\8e\9a\82Ì\95`\89æ\r
+        */\r
+       while(*index != '\0'){\r
+               if(*index == '\n'){\r
+                       *index = '\0';//\82±\82±\82Å\88ê\92U\90Ø\82é\r
+                       if(ret == null){//\8c\8b\8bÇ\89ü\8ds\82Í\96³\82¢\r
+                               ret = drawText(data,size,color,last);\r
+                       }else{/*\89ü\8ds\82 \82è*/\r
+                               ret = connectSurface(ret,drawText(data,size,color,last));\r
+                       }\r
+                       *index = '\n';//\82±\82±\82Å\88ê\92U\90Ø\82é\r
+                       last = index+1;\r
+               }\r
+               index++;\r
+       }\r
+       if(ret == null){//\8c\8b\8bÇ\89ü\8ds\82Í\96³\82¢\r
+               ret = drawText(data,size,color,item->str);\r
+       }else{/*\89ü\8ds\82 \82è*/\r
+               ret = connectSurface(ret,drawText(data,size,color,last));\r
+       }\r
+       \r
+       if(ret->w == 0 || ret->h == 0){\r
+               fprintf(data->log,"[comsurface/make]comment %04d has no char.\n",item->no);\r
+               fflush(data->log);\r
+               return ret;\r
+       }\r
+       \r
+        /*\r
+         * \89e\8f\88\97\9d\r
+         */\r
+         int shadow = data->shadow_kind;\r
+         if(shadow >= SHADOW_MAX){\r
+               shadow = SHADOW_DEFAULT;\r
+         }\r
+         ret = (*ShadowFunc[shadow])(ret,item->color == CMD_COLOR_BLACK,data->fontsize_fix);\r
+\r
+       /*\r
+        * \83A\83\8b\83t\83@\92l\82Ì\90Ý\92è\r
+        */\r
+        if(!data->opaque_comment){\r
+               float alpha_t = (((float)(item->no)/(item->chat->max_no)) * 0.4) + 0.6;\r
+               fprintf(data->log,"[comsurface/make]comment %04d set alpha:%5.2f%%.\n",item->no,alpha_t*100);\r
+               setAlpha(ret,alpha_t);\r
+        }\r
+\r
+       /*\r
+        * \83X\83P\81[\83\8b\90Ý\92è\r
+        */\r
+\r
+       double zoomx = 1.0f;\r
+       //double zoomy = 1.0f;\r
+       //\8fk\8f¬\r
+       \r
+       if(data->fontsize_fix){\r
+               zoomx = (0.5f * (double)video_width) / (double)NICO_WIDTH;\r
+               //zoomy = (0.5f * (double)video_height) / (double)NICO_HEIGHT;\r
+       }\r
+\r
+       /*\83X\83P\81[\83\8b\82Ì\92²\90®*/\r
+       //if(((double)ret->h * zoomy) > ((double)video_height/3.0f)){\r
+       if(((double)ret->h * zoomx) > ((double)video_height/3.0f)){\r
+               zoomx *= 0.5f;\r
+               //zoomy *= 0.5f;\r
+       }\r
+       if(item->location != CMD_LOC_DEF && (ret->w * zoomx) > (double)video_width){\r
+               double scale = ((double)video_width) / (ret->w * zoomx);\r
+               zoomx *= scale;\r
+               //zoomy *= scale;\r
+       }\r
+       //\89æ\96Ê\83T\83C\83Y\82É\8d\87\82í\82¹\82Ä\95Ï\8dX\r
+       //if(zoomx != 1.0f || zoomy != 1.0f){\r
+       if(zoomx != 1.0f){\r
+               //fprintf(data->log,"[comsurface/make]comment %04d resized.(%5.2f%%,%5.2f%%)\n",item->no,zoomx*100,zoomy*100);\r
+               fprintf(data->log,"[comsurface/make]comment %04d resized.(%5.2f%%)\n",item->no,zoomx*100);\r
+               fflush(data->log);\r
+               SDL_Surface* tmp = ret;\r
+               ret = zoomSurface(tmp,zoomx,zoomx,SMOOTHING_ON);\r
+               SDL_FreeSurface(tmp);\r
+       }\r
+\r
+       return ret;\r
+}\r
+/**\r
+ * \95\8e\9a\82ð\95`\89æ\r
+ */\r
+\r
+SDL_Surface* drawText(DATA* data,int size,int color,Uint16* str){\r
+       if(str[0] == '\0'){\r
+               return SDL_CreateRGBSurface(    SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,\r
+                                                                               0,COMMENT_FONT_SIZE[size],32,\r
+                                                                                       #if SDL_BYTEORDER == SDL_BIG_ENDIAN\r
+                                                                                           0xff000000,\r
+                                                                                           0x00ff0000,\r
+                                                                                           0x0000ff00,\r
+                                                                                           0x000000ff\r
+                                                                                       #else\r
+                                                                                           0x000000ff,\r
+                                                                                           0x0000ff00,\r
+                                                                                           0x00ff0000,\r
+                                                                                           0xff000000\r
+                                                                                       #endif\r
+                                                                       );\r
+       }\r
+       /*\r
+       SDL_Surface* fmt = SDL_CreateRGBSurface(        SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,\r
+                                                                                               0,\r
+                                                                                               0,\r
+                                                                                               32,\r
+                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN\r
+                                                                                                   0xff000000,\r
+                                                                                                   0x00ff0000,\r
+                                                                                                   0x0000ff00,\r
+                                                                                                   0x000000ff\r
+                                                                                               #else\r
+                                                                                                   0x000000ff,\r
+                                                                                                   0x0000ff00,\r
+                                                                                                   0x00ff0000,\r
+                                                                                                   0xff000000\r
+                                                                                               #endif\r
+                                                                                       );\r
+\r
+       SDL_Surface* tmp = TTF_RenderUNICODE_Blended(data->font[size],str,COMMENT_COLOR[color]);\r
+       SDL_SetAlpha(tmp,SDL_SRCALPHA | SDL_RLEACCEL,0xff);\r
+       SDL_Surface* surf = SDL_ConvertSurface(tmp,fmt->format,SDL_SRCALPHA | SDL_HWSURFACE);\r
+       SDL_FreeSurface(tmp);\r
+       SDL_FreeSurface(fmt);\r
+       */\r
+       SDL_Surface* surf = TTF_RenderUNICODE_Blended(data->font[size],str,COMMENT_COLOR[color]);\r
+       return surf;\r
+}\r
diff --git a/vhook/comment/com_surface.h b/vhook/comment/com_surface.h
new file mode 100644 (file)
index 0000000..52c2759
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef COM_SURFACE_H_\r
+#define COM_SURFACE_H_\r
+#include <SDL/SDL.h>\r
+#include "../chat/chat.h"\r
+#include "../chat/chat_slot.h"\r
+#include "../main.h"\r
+\r
+SDL_Surface* makeCommentSurface(DATA* data,const CHAT_ITEM* item,int video_width,int video_height);\r
+\r
+\r
+#endif /*COM_SURFACE_H_*/\r
diff --git a/vhook/comment/shadow.c b/vhook/comment/shadow.c
new file mode 100644 (file)
index 0000000..ae54544
--- /dev/null
@@ -0,0 +1,269 @@
+#include <SDL/SDL.h>\r
+#include "surf_util.h"\r
+#include "shadow.h"\r
+\r
+/*\89e\82È\82µ*/\r
+SDL_Surface* noShadow(SDL_Surface* surf,int is_black,int is_fix_size){\r
+       return surf;\r
+}\r
+/*\89E\89º*/\r
+#define SHADOW_SIZE 3\r
+\r
+SDL_Surface* likeNicoNico(SDL_Surface* surf,int is_black,int is_fix_size){\r
+       /*\83X\83\89\83C\83h\95\9d\82Ì\8am\92è*/\r
+       int slide = SHADOW_SIZE;\r
+       if(is_fix_size){\r
+               slide <<= 1;\r
+       }\r
+       int w = surf->w;\r
+       int h = surf->h;\r
+       SDL_Surface* shadow = SDL_CreateRGBSurface(             SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,\r
+                                                                                               w+(slide<<1),\r
+                                                                                               h+(slide<<1),\r
+                                                                                               32,\r
+                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN\r
+                                                                                                   0xff000000,\r
+                                                                                                   0x00ff0000,\r
+                                                                                                   0x0000ff00,\r
+                                                                                                   0x000000ff\r
+                                                                                               #else\r
+                                                                                                   0x000000ff,\r
+                                                                                                   0x0000ff00,\r
+                                                                                                   0x00ff0000,\r
+                                                                                                   0xff000000\r
+                                                                                               #endif\r
+                                                                                       );\r
+       SDL_Surface* shadow2 = SDL_CreateRGBSurface(    SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,\r
+                                                                                               w+(slide<<1),\r
+                                                                                               h+(slide<<1),\r
+                                                                                               32,\r
+                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN\r
+                                                                                                   0xff000000,\r
+                                                                                                   0x00ff0000,\r
+                                                                                                   0x0000ff00,\r
+                                                                                                   0x000000ff\r
+                                                                                               #else\r
+                                                                                                   0x000000ff,\r
+                                                                                                   0x0000ff00,\r
+                                                                                                   0x00ff0000,\r
+                                                                                                   0xff000000\r
+                                                                                               #endif\r
+                                                                                       );\r
+       SDL_Rect rect = {slide,slide};\r
+       SDL_SetAlpha(surf,0,0xff);\r
+       SDL_BlitSurface(surf,NULL,shadow,&rect);\r
+       SDL_SetAlpha(surf,SDL_SRCALPHA,0xff);\r
+       if(is_black){//\8d\95\82Å\82 \82ê\82Î\81A\8eü\82è\82ð\82µ\82ë\82Å\88Í\82Þ\r
+               setRGB(shadow,0xffffffff);\r
+       }else{\r
+               setRGB(shadow,0);\r
+       }\r
+       SDL_SetAlpha(shadow,0,0xff);\r
+       SDL_BlitSurface(shadow,NULL,shadow2,NULL);\r
+       SDL_SetAlpha(shadow,SDL_SRCALPHA,0xff);\r
+       int x,y,z;\r
+       int nw = shadow->w;\r
+       int nh = shadow->h;\r
+       int *pix;\r
+       int *pix2;\r
+       int pitch = shadow->pitch;\r
+       int bps = shadow->format->BytesPerPixel;\r
+       Uint32 Amask = shadow->format->Amask;\r
+       Uint32 Mask = (shadow->format->Rmask | shadow->format->Gmask | shadow->format->Bmask);\r
+       Uint32 Ashift = shadow->format->Ashift;\r
+       Uint32 Aloss = shadow->format->Aloss;\r
+       SDL_LockSurface(shadow);\r
+       SDL_LockSurface(shadow2);\r
+       //\82±\82±\82Í\8bô\90\94\82É\82·\82é\82±\82Æ\81B\r
+       int zmax = 10;\r
+       if(is_fix_size){\r
+               zmax = 16;\r
+       }\r
+       SDL_Surface* tmp;\r
+       for(z=0;z<zmax;z++){\r
+               char *pixels = (char*)shadow->pixels;\r
+               char *pixels2 = (char*)shadow2->pixels;\r
+               for(y=0;y<nh;y++){\r
+                       pix = (int*)(&pixels[pitch * y]);\r
+                       pix2 = (int*)(&pixels2[pitch * y]);\r
+                       for(x=0;x<nw;x++){\r
+                               int right = (x==nw-1) ? 0 : *(int*)((((char*)pix)+bps));\r
+                               int left = (x==0) ? 0 : *(int*)((((char*)pix)-bps));\r
+                               int up = (y==0) ? 0 : *(int*)((((char*)pix)-pitch));\r
+                               int down = (y==nh-1) ? 0 : *(int*)((((char*)pix)+pitch));\r
+                               int my = *pix2;\r
+                               int new_alpha = (((((my & Amask) >> Ashift) << Aloss) +(((right & Amask) >> Ashift) << Aloss)+(((left & Amask) >> Ashift) << Aloss)+(((up & Amask) >> Ashift) << Aloss)+(((down & Amask) >> Ashift) << Aloss)) / 5) & 0xff;\r
+                               new_alpha = (new_alpha * 18) >> 4;\r
+                               if(new_alpha > 0xff){\r
+                                       new_alpha = 0xff;\r
+                               }\r
+                               *pix2 &= Mask;\r
+                               *pix2 |= ((new_alpha >> Aloss) << Ashift) & Amask;\r
+                               pix = (int*)(((char*)pix)+bps);\r
+                               pix2 = (int*)(((char*)pix2)+bps);\r
+                       }\r
+               }\r
+               tmp = shadow2;\r
+               shadow2 = shadow;\r
+               shadow = tmp;\r
+       }\r
+       SDL_UnlockSurface(shadow);\r
+       SDL_UnlockSurface(shadow2);\r
+       shadowBlitSurface(surf,NULL,shadow,&rect);\r
+       SDL_FreeSurface(surf);\r
+       SDL_FreeSurface(shadow2);\r
+       return shadow;\r
+}\r
+\r
+/*\89E\89º*/\r
+#define SHADOW_SLIDE 2\r
+SDL_Surface* likeNovel(SDL_Surface* surf,int is_black,int is_fix_size){\r
+       /*\83X\83\89\83C\83h\95\9d\82Ì\8am\92è*/\r
+       int slide = SHADOW_SLIDE;\r
+       if(is_fix_size){\r
+               slide <<= 1;\r
+       }\r
+       /*\8d\95\82Ì\97p\88Ó*/\r
+       SDL_Surface* black = SDL_CreateRGBSurface(      SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,\r
+                                                                                               surf->w+slide,\r
+                                                                                               surf->h+slide,\r
+                                                                                               32,\r
+                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN\r
+                                                                                                   0xff000000,\r
+                                                                                                   0x00ff0000,\r
+                                                                                                   0x0000ff00,\r
+                                                                                                   0x000000ff\r
+                                                                                               #else\r
+                                                                                                   0x000000ff,\r
+                                                                                                   0x0000ff00,\r
+                                                                                                   0x00ff0000,\r
+                                                                                                   0xff000000\r
+                                                                                               #endif\r
+                                                                                               );\r
+       SDL_Rect rect = {slide,slide};\r
+       SDL_SetAlpha(surf,0,0xff);//\88ê\89ñalpha\8d\87\90¬\82ð\90Ø\82é\r
+       SDL_BlitSurface(surf,NULL,black,&rect);\r
+       SDL_SetAlpha(surf,SDL_SRCALPHA,0xff);\r
+       if(is_black){//\8d\95\82Å\82 \82ê\82Î\81A\8eü\82è\82ð\82µ\82ë\82Å\88Í\82Þ\r
+               setRGB(black,0xffffffff);\r
+       }else{\r
+               setRGB(black,0);\r
+       }\r
+       setAlpha(black,0.6f);\r
+       shadowBlitSurface(surf,NULL,black,NULL);\r
+       SDL_FreeSurface(surf);\r
+       return black;\r
+}\r
+\r
+//\8eU\82ç\82·\82Ì\82Å\82Í\82È\82­\81A\88Í\82Á\82Ä\82µ\82Ü\82¤\81B\r
+SDL_Surface* likeOld(SDL_Surface* surf,int is_black,int is_fix_size){\r
+       /*\83X\83\89\83C\83h\95\9d\82Ì\8am\92è*/\r
+       int slide = SHADOW_SIZE;\r
+       if(is_fix_size){\r
+               slide <<= 1;\r
+       }\r
+       int w = surf->w;\r
+       int h = surf->h;\r
+       SDL_Surface* shadow = SDL_CreateRGBSurface(             SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,\r
+                                                                                               w+(slide<<1),\r
+                                                                                               h+(slide<<1),\r
+                                                                                               32,\r
+                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN\r
+                                                                                                   0xff000000,\r
+                                                                                                   0x00ff0000,\r
+                                                                                                   0x0000ff00,\r
+                                                                                                   0x000000ff\r
+                                                                                               #else\r
+                                                                                                   0x000000ff,\r
+                                                                                                   0x0000ff00,\r
+                                                                                                   0x00ff0000,\r
+                                                                                                   0xff000000\r
+                                                                                               #endif\r
+                                                                                       );\r
+       SDL_Surface* shadow2 = SDL_CreateRGBSurface(    SDL_SRCALPHA | SDL_HWSURFACE | SDL_HWACCEL,\r
+                                                                                               w+(slide<<1),\r
+                                                                                               h+(slide<<1),\r
+                                                                                               32,\r
+                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN\r
+                                                                                                   0xff000000,\r
+                                                                                                   0x00ff0000,\r
+                                                                                                   0x0000ff00,\r
+                                                                                                   0x000000ff\r
+                                                                                               #else\r
+                                                                                                   0x000000ff,\r
+                                                                                                   0x0000ff00,\r
+                                                                                                   0x00ff0000,\r
+                                                                                                   0xff000000\r
+                                                                                               #endif\r
+                                                                                       );\r
+       SDL_Rect rect = {slide,slide};\r
+       SDL_SetAlpha(surf,0,0xff);\r
+       SDL_BlitSurface(surf,NULL,shadow,&rect);\r
+       SDL_SetAlpha(surf,SDL_SRCALPHA,0xff);\r
+       if(is_black){//\8d\95\82Å\82 \82ê\82Î\81A\8eü\82è\82ð\82µ\82ë\82Å\88Í\82Þ\r
+               setRGB(shadow,0xffffffff);\r
+       }else{\r
+               setRGB(shadow,0);\r
+       }\r
+       SDL_SetAlpha(shadow,0,0xff);\r
+       SDL_BlitSurface(shadow,NULL,shadow2,NULL);\r
+       SDL_SetAlpha(shadow,SDL_SRCALPHA,0xff);\r
+       int x,y,z;\r
+       int nw = shadow->w;\r
+       int nh = shadow->h;\r
+       int *pix;\r
+       int *pix2;\r
+       int pitch = shadow->pitch;\r
+       int bps = shadow->format->BytesPerPixel;\r
+       Uint32 Amask = shadow->format->Amask;\r
+       Uint32 Mask = (shadow->format->Rmask | shadow->format->Gmask | shadow->format->Bmask);\r
+       Uint32 Ashift = shadow->format->Ashift;\r
+       Uint32 Aloss = shadow->format->Aloss;\r
+       SDL_Surface* tmp;\r
+       SDL_LockSurface(shadow);\r
+       SDL_LockSurface(shadow2);\r
+       int zmax = 1;\r
+       if(is_fix_size){\r
+               zmax = 2;\r
+       }\r
+       for(z=0;z<zmax;z++){\r
+               char *pixels = (char*)shadow->pixels;\r
+               char *pixels2 = (char*)shadow2->pixels;\r
+               for(y=0;y<nh;y++){\r
+                       pix = (int*)(&pixels[pitch * y]);\r
+                       pix2 = (int*)(&pixels2[pitch * y]);\r
+                       for(x=0;x<nw;x++){\r
+                               int right = (x==nw-1) ? 0 : *(int*)((((char*)pix)+bps));\r
+                               int left = (x==0) ? 0 : *(int*)((((char*)pix)-bps));\r
+                               int up = (y==0) ? 0 : *(int*)((((char*)pix)-pitch));\r
+                               int down = (y==nh-1) ? 0 : *(int*)((((char*)pix)+pitch));\r
+                               int my = *pix2;\r
+                               //\8eü\82è\82ª\8bó\94\92\82Å\82È\82¢\r
+                               if(((right | left | up | down | my) & Amask) != 0){\r
+                                       *pix2 &= Mask;\r
+                                       *pix2 |= (((0xff/(z+1)) >> Aloss) << Ashift) & Amask;\r
+                               }\r
+                               pix = (int*)(((char*)pix)+bps);\r
+                               pix2 = (int*)(((char*)pix2)+bps);\r
+                       }\r
+               }\r
+               tmp = shadow2;\r
+               shadow2 = shadow;\r
+               shadow = tmp;\r
+       }\r
+       SDL_UnlockSurface(shadow);\r
+       SDL_UnlockSurface(shadow2);\r
+       shadowBlitSurface(surf,NULL,shadow,&rect);\r
+       SDL_FreeSurface(surf);\r
+       SDL_FreeSurface(shadow2);\r
+       return shadow;\r
+}\r
+\r
+\r
+//\92è\8b`\r
+SDL_Surface* (*ShadowFunc[SHADOW_MAX])(SDL_Surface* surf,int is_black,int is_fix_size) = {\r
+       noShadow,\r
+       likeNicoNico,\r
+       likeNovel,\r
+       likeOld\r
+};\r
diff --git a/vhook/comment/shadow.h b/vhook/comment/shadow.h
new file mode 100644 (file)
index 0000000..0359680
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef SHADOW_H_\r
+#define SHADOW_H_\r
+\r
+#define SHADOW_MAX 4\r
+#define SHADOW_DEFAULT 1\r
+SDL_Surface* (*ShadowFunc[SHADOW_MAX])(SDL_Surface* surf,int is_black,int is_fix_size);\r
+\r
+#endif /*SHADOW_H_*/\r
diff --git a/vhook/comment/surf_util.c b/vhook/comment/surf_util.c
new file mode 100644 (file)
index 0000000..f8da9b7
--- /dev/null
@@ -0,0 +1,174 @@
+#include <SDL/SDL.h>\r
+#include "surf_util.h"\r
+#include "../mydef.h"\r
+\r
+SDL_Surface* connectSurface(SDL_Surface* top,SDL_Surface* bottom){\r
+       SDL_Surface* ret = SDL_CreateRGBSurface( SDL_SRCALPHA,\r
+                                                                                       MAX(top->w,bottom->w),\r
+                                                                                       top->h+bottom->h,\r
+                                                                                       32,\r
+                                                                                       #if SDL_BYTEORDER == SDL_BIG_ENDIAN\r
+                                                                                           0xff000000,\r
+                                                                                           0x00ff0000,\r
+                                                                                           0x0000ff00,\r
+                                                                                           0x000000ff\r
+                                                                                       #else\r
+                                                                                           0x000000ff,\r
+                                                                                           0x0000ff00,\r
+                                                                                           0x00ff0000,\r
+                                                                                               0xff000000\r
+                                                                                       #endif\r
+                                                                                       );\r
+       SDL_SetAlpha(top,SDL_SRCALPHA | SDL_RLEACCEL,0xff);\r
+       SDL_SetAlpha(bottom,SDL_SRCALPHA | SDL_RLEACCEL,0xff);\r
+\r
+       SDL_BlitSurface(top,NULL,ret,NULL);\r
+\r
+       SDL_Rect rect2 = {0,top->h};\r
+       SDL_BlitSurface(bottom,NULL,ret,&rect2);\r
+       SDL_FreeSurface(top);\r
+       SDL_FreeSurface(bottom);\r
+       return ret;\r
+}\r
+\r
+void setAlpha(SDL_Surface* surf,double alpha_t){\r
+       int x,y;\r
+       int h = surf->h;\r
+       int w = surf->w;\r
+       Uint32 mask,shift,bytesp,pitch,loss;\r
+       Uint8 alpha;\r
+       Uint8* pixels;\r
+       Uint32* pix;\r
+       SDL_PixelFormat* format = surf->format;\r
+       /*\95Ï\90\94\82Ì\90Ý\92è*/\r
+       mask = format->Amask;\r
+       shift = format->Ashift;\r
+       loss = format->Aloss;\r
+       bytesp = format->BytesPerPixel;\r
+       pitch = surf->pitch;\r
+       pixels = surf->pixels;\r
+       SDL_LockSurface(surf);//\83T\81[\83t\83F\83C\83X\82ð\83\8d\83b\83N\r
+       for(y=0;y<h;y++){\r
+               for(x=0;x<w;x++){\r
+                       pix = (Uint32*)(&pixels[y*pitch + x*bytesp]);\r
+                       alpha = (Uint8)((((*pix) & mask) >> shift) << loss);\r
+                       alpha *= alpha_t;\r
+                       (*pix) &= ~((0xff >> loss) << shift);\r
+                       (*pix) |= (alpha >> loss) << shift;\r
+               }\r
+       }\r
+       SDL_UnlockSurface(surf);//\83A\83\93\83\8d\83b\83N\r
+}\r
+\r
+/**\r
+ * src\82Ì\95s\93§\96¾\93x\82ð\8fã\8f\91\82«\82µ\82Ä\82µ\82Ü\82¤\81B\r
+ * src\82Ì\95û\82ª\95s\93§\96¾\82È\82ç\81A\82»\82ê\82ð\8fã\8f\91\82«\81B\r
+ */\r
+\r
+void overrideAlpha(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect){\r
+       SDL_LockSurface(src);//\83T\81[\83t\83F\83C\83X\82ð\83\8d\83b\83N\r
+       SDL_LockSurface(dst);//\83T\81[\83t\83F\83C\83X\82ð\83\8d\83b\83N\r
+       //\94Í\88Í\82Ì\8am\92è\r
+       int sw = src->w;\r
+       int sh = src->h;\r
+       int sx = 0;\r
+       int sy = 0;\r
+       if(srcrect != NULL){\r
+               sx = srcrect->x;\r
+               sy = srcrect->y;\r
+               if(sx >= sw || sy > sh){\r
+                       return;\r
+               }\r
+               sw = MIN(sw-sx,srcrect->w);\r
+               sh = MIN(sh-sy,srcrect->h);\r
+       }\r
+       int dw = dst->w;\r
+       int dh = dst->h;\r
+       int dx = 0;\r
+       int dy = 0;\r
+       if(dstrect != NULL){\r
+               dx = dstrect->x;\r
+               dy = dstrect->y;\r
+               if(dx >= dw || dy > dh){\r
+                       return;\r
+               }\r
+               dw = MIN(dw-dx,dstrect->w);\r
+               dh = MIN(dh-dy,dstrect->h);\r
+       }\r
+       //\8f¬\82³\82¢\82Ù\82¤\82É\82 \82í\82¹\82é\r
+       if(dw > sw){\r
+               dw = sw;\r
+       }else{\r
+               sw = dw;\r
+       }\r
+       if(dh > sh){\r
+               dh = sh;\r
+       }else{\r
+               sh = dh;\r
+       }\r
+       //\82â\82Á\82Æ\82±\82³\95`\89æ\81B\81B\r
+       int sbytesp = src->format->BytesPerPixel;\r
+       int dbytesp = dst->format->BytesPerPixel;\r
+       int spitch = src->pitch;\r
+       int dpitch = dst->pitch;\r
+       int sAmask = src->format->Amask;\r
+       int dAmask = dst->format->Amask;\r
+       int sAshift = src->format->Ashift;\r
+       int dAshift = dst->format->Ashift;\r
+       int sAloss = src->format->Aloss;\r
+       int dAloss = dst->format->Aloss;\r
+       Uint8* spix = (Uint8*)src->pixels;\r
+       Uint8* dpix = (Uint8*)dst->pixels;\r
+       Uint32* spt;\r
+       Uint32* dpt;\r
+       Uint32 salpha;\r
+       Uint32 dalpha;\r
+       int x,y;\r
+       for(y=0;y<sh;y++){\r
+               for(x=0;x<sw;x++){\r
+                       spt = (Uint32*)(&spix[(sy+y)*spitch+(sx+x)*sbytesp]);\r
+                       dpt = (Uint32*)(&dpix[(dy+y)*dpitch+(dx+x)*dbytesp]);\r
+                       salpha = ((*spt & sAmask)>>sAshift)<<sAloss;\r
+                       dalpha = ((*dpt & dAmask)>>dAshift)<<dAloss;\r
+                       if(salpha > dalpha){\r
+                               *dpt &= ~dAmask;\r
+                               *dpt |= (salpha>>dAloss)<<dAshift;\r
+                       }\r
+               }\r
+       }\r
+       SDL_UnlockSurface(dst);//\83A\83\93\83\8d\83b\83N\r
+       SDL_UnlockSurface(src);//\83A\83\93\83\8d\83b\83N\r
+}\r
+\r
+void inline shadowBlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect){\r
+       SDL_BlitSurface(src,srcrect,dst,dstrect);\r
+       overrideAlpha(src,srcrect,dst,dstrect);\r
+}\r
+\r
+void setRGB(SDL_Surface* surf,Uint32 color){\r
+       int x,y;\r
+       int h = surf->h;\r
+       int w = surf->w;\r
+       int bytesp = surf->format->BytesPerPixel;\r
+       int pitch = surf->pitch;\r
+       Uint32 Amask = surf->format->Amask;\r
+       color &= surf->format->Rmask | surf->format->Gmask | surf->format->Bmask;\r
+       Uint8* pix = (Uint8*)surf->pixels;\r
+       Uint32* pt;\r
+       SDL_LockSurface(surf);//\83T\81[\83t\83F\83C\83X\82ð\83\8d\83b\83N\r
+       for(y=0;y<h;y++){\r
+               for(x=0;x<w;x++){\r
+                       pt = (Uint32*)(&pix[y*pitch + x*bytesp]);\r
+                       *pt &= Amask;\r
+                       *pt |= color;\r
+               }\r
+       }\r
+       SDL_UnlockSurface(surf);//\83T\81[\83t\83F\83C\83X\82ð\83A\83\93\83\8d\83b\83N\r
+}\r
+\r
+void getRGBA(SDL_Surface* surf,int x,int y,char* r,char* g,char* b,char* a){\r
+       int pix_index = y * surf->pitch + x * surf->format->BytesPerPixel;\r
+       char* pix = (char*)surf->pixels;\r
+       SDL_GetRGBA(*(Uint32*)(&pix[pix_index]),surf->format,(Uint8*)r,(Uint8*)g,(Uint8*)b,(Uint8*)a);\r
+}\r
+\r
diff --git a/vhook/comment/surf_util.h b/vhook/comment/surf_util.h
new file mode 100644 (file)
index 0000000..5d81a15
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef SURF_UTIL_H_\r
+#define SURF_UTIL_H_\r
+#include <SDL/SDL.h>\r
+SDL_Surface* connectSurface(SDL_Surface* top,SDL_Surface* bottom);\r
+void setAlpha(SDL_Surface* surf,double alpha_t);\r
+void overrideAlpha(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);\r
+void inline shadowBlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);\r
+void setRGB(SDL_Surface* surf,Uint32 color);\r
+#endif /*SURF_UTIL_H_*/\r
diff --git a/vhook/common/framehook_ext.h b/vhook/common/framehook_ext.h
new file mode 100644 (file)
index 0000000..ca55b5a
--- /dev/null
@@ -0,0 +1,57 @@
+/*\r
+ * \8ag\92£Vhook\83t\83B\83\8b\83^\r
+ * copyright (c) 2008 \83Õ\81i\83v\83T\83C\81j\r
+ *\r
+ * \82³\82«\82ã\82Î\82·\97p\82É\8ag\92£\82³\82ê\82½Vhook\83\89\83C\83u\83\89\83\8a\82ð\r
+ * \83r\83\8b\83h\82·\82é\82½\82ß\82Ì\83w\83b\83_\82Å\82·\81B\r
+ *\r
+ * \82±\82Ì\83t\83@\83C\83\8b\82Í\81u\82³\82«\82ã\82Î\82·\81v\82Ì\88ê\95\94\82Å\82 \82è\81A\r
+ * \82±\82Ì\83\\81[\83X\83R\81[\83h\82ÍGPL\83\89\83C\83Z\83\93\83X\82Å\94z\95z\82³\82ê\82Ü\82·\82Å\82·\81B\r
+ */\r
+#ifndef SACCUBUS_VF_VHEXT_H\r
+#define SACCUBUS_VF_VHEXT_H\r
+/*\r
+ * \83c\81[\83\8b\83{\83b\83N\83X\82Ì\83o\81[\83W\83\87\83\93\r
+ * DLL\82Ì\92\86\82Å\8am\94F\82µ\82Æ\82¢\82½\95û\82ª\82¢\82¢\81B\r
+ */\r
+#define TOOLBOX_VERSION 2\r
+\r
+/*\r
+ * \8cÄ\82Î\82ê\82é\82Æ\82«\82É\88ê\8f\8f\82É\82Â\82¢\82Ä\82­\82étoolbox.\r
+ * \82±\82±\82©\82ç\93®\89æ\82Ì\8fî\95ñ\82È\82ñ\82©\82à\8eæ\93¾\82Å\82«\82é\81B\r
+ */\r
+typedef struct toolbox{\r
+       //\83o\81[\83W\83\87\83\93\r
+       int version;\r
+       double video_length;\r
+} toolbox;\r
+\r
+typedef struct vhext_frame{\r
+       void *data;\r
+       int linesize;\r
+       int w;\r
+       int h;\r
+       double pts;\r
+} vhext_frame;\r
+\r
+\r
+/*\r
+ * \8ag\92£vhook\83\89\83C\83u\83\89\83\8a\97p\8aÖ\90\94\8cQ\92è\8b`\r
+ */\r
+\r
+//configure\97p\r
+typedef int (FrameHookExtConfigure)(void **ctxp,const toolbox *tbox, int argc, char *argv[]);\r
+typedef FrameHookExtConfigure *FrameHookExtConfigureFn;\r
+extern FrameHookExtConfigure ExtConfigure;\r
+\r
+//\83t\83\8c\81[\83\80\97p\r
+typedef void (FrameHookExtProcess)(void *ctx,const toolbox *tbox,vhext_frame *pict);\r
+typedef FrameHookExtProcess *FrameHookExtProcessFn;\r
+extern FrameHookExtProcess ExtProcess;\r
+\r
+//\8fI\97¹\8e\9e\82É\8cÄ\82Ô\r
+typedef void (FrameHookExtRelease)(void *ctx,const toolbox *tbox);\r
+typedef FrameHookExtRelease *FrameHookExtReleaseFn;\r
+extern FrameHookExtRelease ExtRelease;\r
+\r
+#endif /* SACCUBUS_VF_VHEXT_H */\r
diff --git a/vhook/framehook.c b/vhook/framehook.c
new file mode 100644 (file)
index 0000000..a1baa4d
--- /dev/null
@@ -0,0 +1,238 @@
+/*\83t\83\8c\81[\83\80\83t\83b\83N\82Ì\91\8a\8eè\82ð\82·\82é\82½\82ß\90ê\97p*/\r
+\r
+#include <stdlib.h>\r
+#include <stdio.h>\r
+#include <string.h>\r
+#include <SDL/SDL.h>\r
+#include "common/framehook_ext.h"\r
+#include "framehook.h"\r
+#include "main.h"\r
+#include "mydef.h"\r
+#include "nicodef.h"\r
+#include "util.h"\r
+\r
+typedef struct ContextInfo{\r
+       FILE* log;\r
+       DATA data;\r
+} ContextInfo;\r
+\r
+/*\r
+ * \95K\97v\82È\8aÖ\90\94\82Ð\82Æ\82Â\82ß\81B\8dÅ\8f\89\82É\8cÄ\82Î\82ê\82é\82æ\81I\r
+ * \r
+ */\r
+int init_setting(FILE*log,const toolbox *tbox,SETTING* setting,int argc, char *argv[]);\r
+\r
+__declspec(dllexport) int ExtConfigure(void **ctxp,const toolbox *tbox, int argc, char *argv[]){\r
+       int i;\r
+       //\83\8d\83O\r
+       FILE* log = fopen("[log]vhext.txt", "w");\r
+       if(log == NULL){\r
+               puts("[framehook/init]failed to open logfile.\n");\r
+               fflush(log);\r
+               return -1;\r
+       }else{\r
+               fputs("[framehook/init]initializing..\n",log);\r
+               fflush(log);\r
+       }\r
+       //\95K\97v\82È\90Ý\92è\82ª\82 \82é\82©\82Ì\8am\94F\r
+       fprintf(log,"[framehook/init]called with argc = %d\n",argc);\r
+       fflush(log);\r
+       for(i=0;i<argc;i++){\r
+               fprintf(log,"[framehook/init]arg[%2d] = %s\n",i,argv[i]);\r
+               fflush(log);\r
+       }\r
+       //\83Z\83b\83e\83B\83\93\83O\8eæ\93¾\81B\r
+       SETTING setting;\r
+       if(init_setting(log,tbox,&setting,argc,argv)){\r
+               fputs("[framehook/init]initialized settings.\n",log);\r
+               fflush(log);\r
+       }else{\r
+               fputs("[framehook/init]failed to initialize settings.\n",log);\r
+               fflush(log);\r
+               return -2;\r
+       }\r
+       //\83\89\83C\83u\83\89\83\8a\82È\82Ç\82Ì\8f\89\8aú\89»\r
+       if(init(log)){\r
+               fputs("[framehook/init]initialized libs.\n",log);\r
+               fflush(log);\r
+       }else{\r
+               fputs("[framehook/init]failed to initialize libs.\n",log);\r
+               fflush(log);\r
+               return -3;\r
+       }\r
+       /*\83R\83\93\83e\83L\83X\83g\82Ì\90Ý\92è*/\r
+       *ctxp = malloc(sizeof(ContextInfo));\r
+       if(*ctxp == NULL){\r
+               fputs("[framehook/init]initialized to malloc for context.\n",log);\r
+               fflush(log);\r
+       }\r
+       ContextInfo* ci = (ContextInfo*)*ctxp;\r
+       ci->log = log;\r
+       fflush(log);\r
+       if(initData(&ci->data,log,&setting)){\r
+               fputs("[framehook/init]initialized context.\n",log);\r
+               fputs("[framehook/init]initialized.\n",log);\r
+               fflush(log);\r
+               return 0;\r
+       }else{\r
+               fputs("[framehook/init]failed to initialize context.\n",log);\r
+               fflush(log);\r
+               return -4;\r
+       }\r
+}\r
+/*\r
+ * \93à\95\94\82Å\82Ì\82Ý\8cÄ\82Î\82ê\82é\81B\r
+ */\r
+\r
+ /*\r
+       argv[0]:\83v\83\8d\83O\83\89\83\80\r
+       argv[1]:vhook\r
+       argv[2]:\83t\83H\83\93\83g\r
+       argv[3]:\83t\83H\83\93\83g\83C\83\93\83f\83b\83N\83X\r
+       argv[4]:\88ê\89æ\96Ê\r
+       argv[5]:\89e\82Ì\8eí\97Þ\r
+       \88È\8d~\83I\83v\83V\83\87\83\93\r
+       --enable-show-video\81F\95`\89æ\92\86\82É\93®\89æ\82ð\8c©\82¹\82é\81B\r
+       --enable-fontsize-fix\81F\83t\83H\83\93\83g\83T\83C\83Y\82ð\8e©\93®\82Å\92²\90®\82·\82é\81B\r
+*/\r
\r
+int init_setting(FILE*log,const toolbox *tbox,SETTING* setting,int argc, char *argv[]){\r
+       /*video\82Ì\92·\82³*/\r
+       setting->video_length = (tbox->video_length * VPOS_FACTOR);\r
+       /*\88È\8d~\83I\83v\83V\83\87\83\93*/\r
+       \r
+       //\83R\83\81\83\93\83g\82ð\8c©\82¹\82é\82©\94Û\82©\81H\r
+       setting->enable_user_comment = FALSE;\r
+       setting->enable_owner_comment = FALSE;\r
+       setting->data_user_path = NULL;\r
+       setting->data_owner_path = NULL;\r
+       //\88ê\94Ê\93I\82È\90Ý\92è\r
+       setting->font_path = NULL;\r
+       setting->font_index = 0;\r
+       setting->user_slot_max = 30;\r
+       setting->owner_slot_max = 30;\r
+       setting->shadow_kind = 1;//\83f\83t\83H\83\8b\83g\82Í\83j\83R\83j\83R\93®\89æ\95\97\r
+       setting->show_video = FALSE;\r
+       setting->fontsize_fix=FALSE;\r
+       setting->opaque_comment=FALSE;\r
+       int i;\r
+       char* arg;\r
+       for(i=0;i<argc;i++){\r
+               arg = argv[i];\r
+               if(!setting->data_user_path && strncmp(FRAMEHOOK_OPT_DATA_USER,arg,FRAMEHOOK_OPT_DATA_USER_LEN) == 0){\r
+                       char* data_user = arg+FRAMEHOOK_OPT_DATA_USER_LEN;\r
+                       setting->data_user_path = data_user;\r
+                       setting->enable_user_comment = TRUE;\r
+                       fprintf(log,"[framehook/init]User Comment data path:%s\n",setting->data_user_path);\r
+                       fflush(log);\r
+               }else if(!setting->data_owner_path && strncmp(FRAMEHOOK_OPT_DATA_OWNER,arg,FRAMEHOOK_OPT_DATA_OWNER_LEN) == 0){\r
+                       char* data_owner = arg+FRAMEHOOK_OPT_DATA_OWNER_LEN;\r
+                       setting->data_owner_path = data_owner;\r
+                       setting->enable_owner_comment = TRUE;\r
+                       fprintf(log,"[framehook/init]Owner Comment data path:%s\n",setting->data_owner_path);\r
+                       fflush(log);\r
+               }else if(!setting->font_path && strncmp(FRAMEHOOK_OPT_FONT,arg,FRAMEHOOK_OPT_FONT_LEN) == 0){\r
+                       char* font = arg+FRAMEHOOK_OPT_FONT_LEN;\r
+                       setting->font_path = font;\r
+                       fprintf(log,"[framehook/init]Font path:%s\n",setting->font_path);\r
+                       fflush(log);\r
+               }else if(strncmp(FRAMEHOOK_OPT_FONTINDEX,arg,FRAMEHOOK_OPT_FONTINDEX_LEN) == 0){\r
+                       setting->font_index = MAX(0,atoi(arg+FRAMEHOOK_OPT_FONTINDEX_LEN));\r
+                       fprintf(log,"[framehook/init]font index:%d\n",setting->font_index);\r
+                       fflush(log);\r
+               }else if(strncmp(FRAMEHOOK_OPT_SHADOW,arg,FRAMEHOOK_OPT_SHADOW_LEN) == 0){\r
+                       setting->shadow_kind = MAX(0,atoi(arg+FRAMEHOOK_OPT_SHADOW_LEN));\r
+                       fprintf(log,"[framehook/init]shadow kind:%d\n",setting->shadow_kind);\r
+                       fflush(log);\r
+               }else if(strncmp(FRAMEHOOK_OPT_SHOW_USER,arg,FRAMEHOOK_OPT_SHOW_USER_LEN) == 0){\r
+                       setting->user_slot_max = MAX(0,atoi(arg+FRAMEHOOK_OPT_SHOW_USER_LEN));\r
+                       fprintf(log,"[framehook/init]User Comments on screen:%d\n",setting->user_slot_max);\r
+                       fflush(log);\r
+               }else if(strncmp(FRAMEHOOK_OPT_SHOW_OWNER,arg,FRAMEHOOK_OPT_SHOW_OWNER_LEN) == 0){\r
+                       setting->owner_slot_max = MAX(0,atoi(arg+FRAMEHOOK_OPT_SHOW_OWNER_LEN));\r
+                       fprintf(log,"[framehook/init]Owner Comments on screen:%d\n",setting->owner_slot_max);\r
+                       fflush(log);\r
+               }else if(!setting->show_video && strcmp(arg,"--enable-show-video") == 0){\r
+                       fputs("[framehook/init]show video while converting.\n",log);\r
+                       fflush(log);\r
+                       setting->show_video=TRUE;\r
+               }else if(!setting->fontsize_fix && strcmp(arg,"--enable-fix-font-size") == 0){\r
+                       fputs("[framehook/init]fix font size automatically.\n",log);\r
+                       fflush(log);\r
+                       setting->fontsize_fix=TRUE;\r
+               }else if(!setting->opaque_comment && strcmp(arg,"--enable-opaque-comment") == 0){\r
+                       fputs("[framehook/init]enable opaque comment.\n",log);\r
+                       fflush(log);\r
+                       setting->opaque_comment=TRUE;\r
+               }\r
+       }\r
+       //\88ø\90\94\82ð\90³\82µ\82­\93ü\97Í\82µ\82½\82©\94Û\82©\82Ì\83`\83F\83b\83N\r
+       //\82±\82±\82Å\83`\83F\83b\83N\82µ\82Ä\82¢\82é\82Ì\88È\8aO\82Í\81A\83f\83t\83H\83\8b\83g\90Ý\92è\82Å\93¦\82°\82é\81B\r
+       if(!setting->font_path){\r
+               fputs("[framehook/init]please set FONT PATH.\n",log);\r
+               fflush(log);\r
+               return FALSE;\r
+       }\r
+       return TRUE;\r
+}\r
+\r
+/*\r
+ * \95K\97v\82È\8aÖ\90\94\93ñ\82Â\82ß\81B\83t\83\8c\81[\83\80\82²\82Æ\82É\8cÄ\82Î\82ê\82é\82æ\81I\r
+ * \r
+ */\r
+__declspec(dllexport) void ExtProcess(void *ctx,const toolbox *tbox,vhext_frame *pict){\r
+    ContextInfo *ci = (ContextInfo *) ctx;\r
+    FILE* log = ci->log;\r
+\r
+       /* Note:\r
+        * Saccubus 1.22\88È\8d~\82Ì\8ag\92£vhook\83t\83B\83\8b\83^\82Å\82Í\81ARGB24\83t\83H\81[\83}\83b\83g\82Å\82Ì\82Ý\r
+        * \89æ\91\9c\82ª\92ñ\8b\9f\82³\82ê\82Ü\82·\81B\r
+        */\r
+\r
+       //SDL\82Ì\83T\81[\83t\83F\83C\83X\82É\95Ï\8a·\r
+    SDL_Surface* surf = SDL_CreateRGBSurfaceFrom(pict->data,\r
+                                                                                       pict->w,pict->h,24,pict->linesize,\r
+                                                                                               #if SDL_BYTEORDER == SDL_BIG_ENDIAN\r
+                                                                                                   0xff000000,\r
+                                                                                                   0x00ff0000,\r
+                                                                                                   0x0000ff00,\r
+                                                                                               #else\r
+                                                                                                   0x000000ff,\r
+                                                                                                   0x0000ff00,\r
+                                                                                                   0x00ff0000,\r
+                                                                                               #endif\r
+                                                                                                   0x00000000\r
+                                                                                               );\r
+       //\83t\83B\83\8b\83^\r
+       int now_vpos = (pict->pts * VPOS_FACTOR);\r
+       if(!main_process(&ci->data,surf,now_vpos)){\r
+               fputs("[framehook/process]failed to process.\n",log);\r
+               fflush(log);\r
+               exit(1);\r
+       }\r
+       //\83T\81[\83t\83F\83C\83X\8aJ\95ú\r
+       SDL_FreeSurface(surf);\r
+       fflush(log);\r
+}\r
+\r
+/*\r
+ * \95K\97v\82È\8aÖ\90\94\8dÅ\8cã\81B\8fI\82í\82Á\82½\82ç\8cÄ\82Î\82ê\82é\82æ\81I\r
+ * \r
+ */\r
+\r
+__declspec(dllexport) void ExtRelease(void *ctx,const toolbox *tbox){\r
+    ContextInfo *ci;\r
+    ci = (ContextInfo *) ctx;\r
+    FILE* log = ci->log;\r
+    fputs("[framehook/close]closing...\n",log);\r
+    if (ctx) {\r
+        closeData(&ci->data);\r
+           fputs("[framehook/close]closed.\n",log);\r
+        fclose(log);\r
+           //\83R\83\93\83e\83L\83X\83g\91S\91Ì\r
+        free(ctx);\r
+    }\r
+    //\83\89\83C\83u\83\89\83\8a\82Ì\8fI\97¹\r
+    close();\r
+}\r
+\r
diff --git a/vhook/framehook.h b/vhook/framehook.h
new file mode 100644 (file)
index 0000000..2b2dcf3
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef FRAMEHOOK_H_\r
+#define FRAMEHOOK_H_\r
+\r
+/*Framehook\82É\93n\82³\82ê\82é\83I\83v\83V\83\87\83\93\97p\82Ì\92è\8b`*/\r
+\r
+#define FRAMEHOOK_OPT_DATA_USER                "--data-user:"\r
+#define FRAMEHOOK_OPT_DATA_USER_LEN    strlen(FRAMEHOOK_OPT_DATA_USER)\r
+\r
+#define FRAMEHOOK_OPT_DATA_OWNER               "--data-owner:"\r
+#define FRAMEHOOK_OPT_DATA_OWNER_LEN   strlen(FRAMEHOOK_OPT_DATA_OWNER)\r
+\r
+#define FRAMEHOOK_OPT_FONT             "--font:"\r
+#define FRAMEHOOK_OPT_FONT_LEN strlen(FRAMEHOOK_OPT_FONT)\r
+\r
+#define FRAMEHOOK_OPT_FONTINDEX                "--font-index:"\r
+#define FRAMEHOOK_OPT_FONTINDEX_LEN    strlen(FRAMEHOOK_OPT_FONTINDEX)\r
+\r
+#define FRAMEHOOK_OPT_FONTSIZE         "--enable-fix-font-size"\r
+#define FRAMEHOOK_OPT_FONTSIZE_LEN     strlen(FRAMEHOOK_OPT_FONTSIZE)\r
+\r
+#define FRAMEHOOK_OPT_SHADOW           "--shadow:"\r
+#define FRAMEHOOK_OPT_SHADOW_LEN       strlen(FRAMEHOOK_OPT_SHADOW)\r
+\r
+#define FRAMEHOOK_OPT_SHOW_USER                "--show-user:"\r
+#define FRAMEHOOK_OPT_SHOW_USER_LEN    strlen(FRAMEHOOK_OPT_SHOW_USER)\r
+\r
+#define FRAMEHOOK_OPT_SHOW_OWNER               "--show-owner:"\r
+#define FRAMEHOOK_OPT_SHOW_OWNER_LEN   strlen(FRAMEHOOK_OPT_SHOW_OWNER)\r
+\r
+#define FRAMEHOOK_OPT_SHOW_VIDEO               "--enable-show-video"\r
+#define FRAMEHOOK_OPT_SHOW_VIDEO_LEN   strlen(FRAMEHOOK_OPT_SHOW_VIDEO)\r
+\r
+#define FRAMEHOOK_OPT_OPAQUE_COMMENT           "--enable-opaque-comment"\r
+#define FRAMEHOOK_OPT_OPAQUE_COMMENT_LEN       strlen(FRAMEHOOK_OPT_OPAQUE_COMMENT)\r
+\r
+#endif /*FRAMEHOOK_H_*/\r
diff --git a/vhook/header.h b/vhook/header.h
new file mode 100644 (file)
index 0000000..21ed7ee
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef HEADER_H_\r
+#define HEADER_H_\r
+\r
+\r
+\r
+#endif /*HEADER_H_*/\r
diff --git a/vhook/main.c b/vhook/main.c
new file mode 100644 (file)
index 0000000..e5b60ea
--- /dev/null
@@ -0,0 +1,164 @@
+\r
+#include <SDL/SDL.h>\r
+#include <SDL/SDL_ttf.h>\r
+#include <stdio.h>\r
+#include "main.h"\r
+#include "mydef.h"\r
+#include "nicodef.h"\r
+#include "process.h"\r
+/**\r
+ * \83\89\83C\83u\83\89\83\8a\8f\89\8aú\89»\r
+ */\r
+int init(FILE* log){\r
+       fputs("[main/init]initializing libs...\n",log);\r
+       //SDL\r
+       if(SDL_Init(SDL_INIT_VIDEO)>=0){\r
+               fputs("[main/init]initialized SDL.\n",log);\r
+       }else{\r
+               fputs("[main/init]failed to initialize SDL.\n",log);\r
+           return FALSE;\r
+       }\r
+       //SDL_ttf\r
+       if(TTF_Init() >= 0){\r
+               fputs("[main/init]initialized SDL_ttf.\n",log);\r
+       }else{\r
+               fputs("[main/init]failed to initialize SDL_ttf.\n",log);\r
+           return FALSE;\r
+       }\r
+       fputs("[main/init]initialized libs.\n",log);\r
+       return TRUE;\r
+}\r
+/*\r
+ * \83f\81[\83^\82Ì\8f\89\8aú\89»\r
+ */\r
+int initData(DATA* data,FILE* log,const SETTING* setting){\r
+       int i;\r
+       data->enable_user_comment = setting->enable_user_comment;\r
+       data->enable_owner_comment = setting->enable_owner_comment;\r
+       data->log = log;\r
+       data->fontsize_fix = setting->fontsize_fix;\r
+       data->show_video = setting->show_video;\r
+       data->opaque_comment = setting->opaque_comment;\r
+       data->shadow_kind = setting->shadow_kind;\r
+       data->process_first_called=FALSE;\r
+       data->video_length = setting->video_length;\r
+       fputs("[main/init]initializing context...\n",log);\r
+       //\83t\83H\83\93\83g\r
+       TTF_Font** font = data->font;\r
+       const char* font_path = setting->font_path;\r
+       const int font_index = setting->font_index;\r
+       for(i=0;i<CMD_FONT_MAX;i++){\r
+               int fontsize = COMMENT_FONT_SIZE[i];\r
+               if(setting->fontsize_fix){\r
+                       fontsize <<= 1;\r
+               }\r
+               font[i] = TTF_OpenFontIndex(font_path,fontsize,font_index);\r
+               if(font[i] == NULL){\r
+                   fprintf(log,"[main/init]failed to load font:%s index:[%d].\n",font_path,font_index);\r
+                   //0\82Å\82à\8e\8e\82µ\82Ä\82Ý\82é\81B\r
+                   fputs("[main/init]retrying to open font at index:0...",log);\r
+                   font[i] = TTF_OpenFontIndex(font_path,fontsize,0);\r
+                   if(font[i] == NULL){\r
+                           fputs("failed.\n",log);\r
+                           return FALSE;\r
+                   }else{\r
+                           fputs("success.\n",log);\r
+                   }\r
+               }\r
+               TTF_SetFontStyle(font[i],TTF_STYLE_BOLD);\r
+       }\r
+       fputs("[main/init]initialized font.\n",log);\r
+       /*\r
+        * \83\86\81[\83U\83R\83\81\83\93\83g\r
+        */\r
+       if(data->enable_user_comment){\r
+               fputs("[main/init]User Comment is enabled.\n",log);\r
+               //\83R\83\81\83\93\83g\83f\81[\83^\r
+               if(initChat(log,&data->chat,setting->data_user_path,&data->slot,data->video_length)){\r
+                       fputs("[main/init]initialized comment.\n",log);\r
+               }else{\r
+                       fputs("[main/init]failed to initialize comment.",log);\r
+                       return FALSE;\r
+               }\r
+               //\83R\83\81\83\93\83g\83X\83\8d\83b\83g\r
+               if(initChatSlot(log,&data->slot,setting->user_slot_max,&data->chat)){\r
+                       fputs("[main/init]initialized comment slot.\n",log);\r
+               }else{\r
+                       fputs("[main/init]failed to initialize comment slot.",log);\r
+                       return FALSE;\r
+               }\r
+       }\r
+       /*\r
+        * \83I\81[\83i\83R\83\81\83\93\83g\r
+        */\r
+       if(data->enable_owner_comment){\r
+               fputs("[main/init]Owner Comment is enabled.\n",log);\r
+       }\r
+       \r
+       //\8fI\82í\82è\81B\r
+       fputs("[main/init]initialized context.\n",log);\r
+       return TRUE;\r
+}\r
+/*\r
+ * \89f\91\9c\82Ì\95Ï\8a·\r
+ */\r
+int main_process(DATA* data,SDL_Surface* surf,const int now_vpos){\r
+       FILE* log = data->log;\r
+       if(!data->process_first_called){\r
+               fprintf(log,"[main/process]screen size is %dx%d.\n",surf->w,surf->h);\r
+               fflush(log);\r
+       }\r
+       /*\83t\83B\83\8b\83^\82ð\82©\82¯\82é*/\r
+       if(process(data,surf,now_vpos)){\r
+       }\r
+       fflush(log);\r
+       /*\95Ï\8a·\82µ\82½\89æ\91\9c\82ð\8c©\82¹\82é\81B*/\r
+       if(data->show_video){\r
+               if(!data->process_first_called){\r
+                       data->screen = SDL_SetVideoMode(surf->w, surf->h, 24, SDL_HWSURFACE | SDL_DOUBLEBUF);\r
+                       if(data->screen == NULL){\r
+                               fputs("[main/process]failed to initialize screen.\n",log);\r
+                               fflush(log);\r
+                               return FALSE;\r
+                       }\r
+               }\r
+               SDL_BlitSurface(surf,NULL,data->screen,NULL);\r
+               SDL_Flip(data->screen);\r
+               SDL_Event event;\r
+               while(SDL_PollEvent(&event)){}\r
+       }\r
+       //\88ê\89ñ\96Ú\88È\8d~\82ÍTRUE\82É\82È\82é\81B\r
+       data->process_first_called=TRUE;\r
+       fflush(log);\r
+       return TRUE;\r
+}\r
+/*\r
+ * \83f\81[\83^\82Ì\83N\83\8d\81[\83Y\r
+ */\r
+int closeData(DATA* data){\r
+       int i;\r
+       //\83\86\81[\83U\83R\83\81\83\93\83g\82ª\97L\8cø\82È\82ç\8aJ\95ú\r
+       if(data->enable_user_comment){\r
+               closeChat(&data->chat);\r
+               closeChatSlot(&data->slot);\r
+       }\r
+       //\83I\81[\83i\83R\83\81\83\93\83g\82ª\97L\8cø\82È\82ç\8aJ\95ú\r
+       if(data->enable_owner_comment){\r
+       }\r
+    //\83t\83H\83\93\83g\8aJ\95ú\r
+       for(i=0;i<CMD_FONT_MAX;i++){\r
+               TTF_CloseFont(data->font[i]);\r
+       }\r
+       return TRUE;\r
+}\r
+\r
+/*\r
+ * \83\89\83C\83u\83\89\83\8a\83V\83\83\83b\83g\83_\83E\83\93\r
+ */\r
+int close(){\r
+    //SDL\82ð\83V\83\83\83b\83g\83_\83E\83\93\r
+    SDL_Quit();\r
+       //\93¯\82\82­TTF\82ð\83V\83\83\83b\83g\83_\83E\83\93\r
+    TTF_Quit();\r
+       return TRUE;\r
+}\r
diff --git a/vhook/main.h b/vhook/main.h
new file mode 100644 (file)
index 0000000..edd0efc
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef MAIN_H_\r
+#define MAIN_H_\r
+#include <SDL/SDL.h>\r
+#include <SDL/SDL_ttf.h>\r
+#include "nicodef.h"\r
+#include "struct_define.h"\r
+#include "chat/chat.h"\r
+#include "chat/chat_slot.h"\r
+\r
+struct DATA{\r
+       FILE* log;\r
+       TTF_Font* font[CMD_FONT_MAX];\r
+       SDL_Surface* screen;\r
+       /*\82»\82ê\82¼\82ê\82Ì\83R\83\81\83\93\83g\82É\89\9e\82\82½\83f\81[\83^*/\r
+       //\83\86\81[\83U\83R\83\81\83\93\83g\r
+       int enable_user_comment;\r
+       CHAT chat;\r
+       CHAT_SLOT slot;\r
+       //\93\8a\8de\8eÒ\83R\83\81\83\93\83g\r
+       int enable_owner_comment;\r
+       \r
+       //\88ê\94Ê\93I\82È\83f\81[\83^\r
+       int shadow_kind;\r
+       int show_video;\r
+       int fontsize_fix;\r
+       int opaque_comment;\r
+       int process_first_called;\r
+       int video_length;\r
+};\r
+\r
+typedef struct SETTING{\r
+       const char* data_user_path;\r
+       const char* data_owner_path;\r
+       const char* font_path;\r
+       int video_length;\r
+       int font_index;\r
+       int user_slot_max;\r
+       int owner_slot_max;\r
+       int shadow_kind;\r
+       /*TRUE OR FALSE*/\r
+       int enable_user_comment;\r
+       int enable_owner_comment;\r
+       int show_video;\r
+       int fontsize_fix;\r
+       int opaque_comment;\r
+}SETTING;\r
+\r
+int init(FILE* log);\r
+int initData(DATA* data,FILE* log,const SETTING* setting);\r
+int main_process(DATA* data,SDL_Surface* surf,const int now_vpos);\r
+int closeData(DATA* data);\r
+int close();\r
+\r
+#endif /*MAIN_H_*/\r
diff --git a/vhook/mydef.h b/vhook/mydef.h
new file mode 100644 (file)
index 0000000..ffd0e29
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef MYDEF_H_\r
+#define MYDEF_H_\r
+\r
+/*\92Ç\89ÁDefine*/\r
+\r
+#define        MAX(a,b)        (((a)>(b))?(a):(b))\r
+#define        MIN(a,b)        (((a)<(b))?(a):(b))\r
+\r
+#define INTEGER_MAX INT32_MAX\r
+#define INTEGER_MIN INT32_MIN\r
+\r
+#define false (1!=1)\r
+#define FALSE false\r
+\r
+#define true (1==1)\r
+#define TRUE true\r
+\r
+#define null NULL\r
+\r
+#endif /*MYDEF_H_*/\r
diff --git a/vhook/nbproject/Makefile-Debug.mk b/vhook/nbproject/Makefile-Debug.mk
new file mode 100644 (file)
index 0000000..ad0a0aa
--- /dev/null
@@ -0,0 +1,127 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc-sjlj.exe
+CCC=g++.exe
+CXX=g++.exe
+FC=
+
+# Macros
+PLATFORM=MinGW-Windows
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/Debug/${PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/comment/com_surface.o \
+       ${OBJECTDIR}/chat/process_chat.o \
+       ${OBJECTDIR}/main.o \
+       ${OBJECTDIR}/framehook.o \
+       ${OBJECTDIR}/comment/surf_util.o \
+       ${OBJECTDIR}/chat/chat.o \
+       ${OBJECTDIR}/comment/shadow.o \
+       ${OBJECTDIR}/chat/chat_slot.o \
+       ${OBJECTDIR}/process.o \
+       ${OBJECTDIR}/util.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-lSDL_gfx -lSDLmain -lSDL.dll -lSDL_ttf
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-Debug.mk dist/Debug/${PLATFORM}/nicovideodbg.dll
+
+dist/Debug/${PLATFORM}/nicovideodbg.dll: ${OBJECTFILES}
+       ${MKDIR} -p dist/Debug/${PLATFORM}
+       ${LINK.c} -shared -o dist/Debug/${PLATFORM}/nicovideodbg.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/comment/com_surface.o: comment/com_surface.c 
+       ${MKDIR} -p ${OBJECTDIR}/comment
+       ${RM} $@.d
+       $(COMPILE.c) -g -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/comment/com_surface.o comment/com_surface.c
+
+${OBJECTDIR}/chat/process_chat.o: chat/process_chat.c 
+       ${MKDIR} -p ${OBJECTDIR}/chat
+       ${RM} $@.d
+       $(COMPILE.c) -g -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/chat/process_chat.o chat/process_chat.c
+
+${OBJECTDIR}/main.o: main.c 
+       ${MKDIR} -p ${OBJECTDIR}
+       ${RM} $@.d
+       $(COMPILE.c) -g -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/main.o main.c
+
+${OBJECTDIR}/framehook.o: framehook.c 
+       ${MKDIR} -p ${OBJECTDIR}
+       ${RM} $@.d
+       $(COMPILE.c) -g -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/framehook.o framehook.c
+
+${OBJECTDIR}/comment/surf_util.o: comment/surf_util.c 
+       ${MKDIR} -p ${OBJECTDIR}/comment
+       ${RM} $@.d
+       $(COMPILE.c) -g -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/comment/surf_util.o comment/surf_util.c
+
+${OBJECTDIR}/chat/chat.o: chat/chat.c 
+       ${MKDIR} -p ${OBJECTDIR}/chat
+       ${RM} $@.d
+       $(COMPILE.c) -g -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/chat/chat.o chat/chat.c
+
+${OBJECTDIR}/comment/shadow.o: comment/shadow.c 
+       ${MKDIR} -p ${OBJECTDIR}/comment
+       ${RM} $@.d
+       $(COMPILE.c) -g -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/comment/shadow.o comment/shadow.c
+
+${OBJECTDIR}/chat/chat_slot.o: chat/chat_slot.c 
+       ${MKDIR} -p ${OBJECTDIR}/chat
+       ${RM} $@.d
+       $(COMPILE.c) -g -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/chat/chat_slot.o chat/chat_slot.c
+
+${OBJECTDIR}/process.o: process.c 
+       ${MKDIR} -p ${OBJECTDIR}
+       ${RM} $@.d
+       $(COMPILE.c) -g -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/process.o process.c
+
+${OBJECTDIR}/util.o: util.c 
+       ${MKDIR} -p ${OBJECTDIR}
+       ${RM} $@.d
+       $(COMPILE.c) -g -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/util.o util.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/Debug
+       ${RM} dist/Debug/${PLATFORM}/nicovideodbg.dll
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/vhook/nbproject/Makefile-Release.mk b/vhook/nbproject/Makefile-Release.mk
new file mode 100644 (file)
index 0000000..e226430
--- /dev/null
@@ -0,0 +1,127 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+CC=gcc-sjlj.exe
+CCC=g++.exe
+CXX=g++.exe
+FC=
+
+# Macros
+PLATFORM=MinGW-Windows
+
+# Include project Makefile
+include Makefile
+
+# Object Directory
+OBJECTDIR=build/Release/${PLATFORM}
+
+# Object Files
+OBJECTFILES= \
+       ${OBJECTDIR}/comment/com_surface.o \
+       ${OBJECTDIR}/chat/process_chat.o \
+       ${OBJECTDIR}/main.o \
+       ${OBJECTDIR}/framehook.o \
+       ${OBJECTDIR}/comment/surf_util.o \
+       ${OBJECTDIR}/chat/chat.o \
+       ${OBJECTDIR}/comment/shadow.o \
+       ${OBJECTDIR}/chat/chat_slot.o \
+       ${OBJECTDIR}/process.o \
+       ${OBJECTDIR}/util.o
+
+# C Compiler Flags
+CFLAGS=
+
+# CC Compiler Flags
+CCFLAGS=
+CXXFLAGS=
+
+# Fortran Compiler Flags
+FFLAGS=
+
+# Link Libraries and Options
+LDLIBSOPTIONS=-lSDL_gfx -lSDLmain -lSDL.dll -lSDL_ttf
+
+# Build Targets
+.build-conf: ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-Release.mk dist/Release/${PLATFORM}/nicovideo.dll
+
+dist/Release/${PLATFORM}/nicovideo.dll: ${OBJECTFILES}
+       ${MKDIR} -p dist/Release/${PLATFORM}
+       ${LINK.c} -shared -o dist/Release/${PLATFORM}/nicovideo.dll -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS} 
+
+${OBJECTDIR}/comment/com_surface.o: comment/com_surface.c 
+       ${MKDIR} -p ${OBJECTDIR}/comment
+       ${RM} $@.d
+       $(COMPILE.c) -O3 -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/comment/com_surface.o comment/com_surface.c
+
+${OBJECTDIR}/chat/process_chat.o: chat/process_chat.c 
+       ${MKDIR} -p ${OBJECTDIR}/chat
+       ${RM} $@.d
+       $(COMPILE.c) -O3 -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/chat/process_chat.o chat/process_chat.c
+
+${OBJECTDIR}/main.o: main.c 
+       ${MKDIR} -p ${OBJECTDIR}
+       ${RM} $@.d
+       $(COMPILE.c) -O3 -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/main.o main.c
+
+${OBJECTDIR}/framehook.o: framehook.c 
+       ${MKDIR} -p ${OBJECTDIR}
+       ${RM} $@.d
+       $(COMPILE.c) -O3 -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/framehook.o framehook.c
+
+${OBJECTDIR}/comment/surf_util.o: comment/surf_util.c 
+       ${MKDIR} -p ${OBJECTDIR}/comment
+       ${RM} $@.d
+       $(COMPILE.c) -O3 -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/comment/surf_util.o comment/surf_util.c
+
+${OBJECTDIR}/chat/chat.o: chat/chat.c 
+       ${MKDIR} -p ${OBJECTDIR}/chat
+       ${RM} $@.d
+       $(COMPILE.c) -O3 -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/chat/chat.o chat/chat.c
+
+${OBJECTDIR}/comment/shadow.o: comment/shadow.c 
+       ${MKDIR} -p ${OBJECTDIR}/comment
+       ${RM} $@.d
+       $(COMPILE.c) -O3 -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/comment/shadow.o comment/shadow.c
+
+${OBJECTDIR}/chat/chat_slot.o: chat/chat_slot.c 
+       ${MKDIR} -p ${OBJECTDIR}/chat
+       ${RM} $@.d
+       $(COMPILE.c) -O3 -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/chat/chat_slot.o chat/chat_slot.c
+
+${OBJECTDIR}/process.o: process.c 
+       ${MKDIR} -p ${OBJECTDIR}
+       ${RM} $@.d
+       $(COMPILE.c) -O3 -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/process.o process.c
+
+${OBJECTDIR}/util.o: util.c 
+       ${MKDIR} -p ${OBJECTDIR}
+       ${RM} $@.d
+       $(COMPILE.c) -O3 -I/f/mingw/include -fPIC  -MMD -MP -MF $@.d -o ${OBJECTDIR}/util.o util.c
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/Release
+       ${RM} dist/Release/${PLATFORM}/nicovideo.dll
+
+# Subprojects
+.clean-subprojects:
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+include .dep.inc
diff --git a/vhook/nbproject/Makefile-impl.mk b/vhook/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..6ff28b1
--- /dev/null
@@ -0,0 +1,123 @@
+# 
+# Generated Makefile - do not edit! 
+# 
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=vhook
+
+# Active Configuration
+DEFAULTCONF=Debug
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=Debug Release 
+
+
+# build
+.build-impl: .build-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre .validate-impl .depcheck-impl
+       @#echo "=> Running $@... Configuration=$(CONF)"
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+
+# clobber 
+.clobber-impl: .clobber-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
+       done
+
+# all 
+.all-impl: .all-pre .depcheck-impl
+       @#echo "=> Running $@..."
+       for CONF in ${ALLCONFS}; \
+       do \
+           ${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
+       done
+
+# dependency checking support
+.depcheck-impl:
+       @echo "# This code depends on make tool being used" >.dep.inc
+       @if [ -n "${MAKE_VERSION}" ]; then \
+           echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+           echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+           echo "include \$${DEPFILES}" >>.dep.inc; \
+           echo "endif" >>.dep.inc; \
+       else \
+           echo ".KEEP_STATE:" >>.dep.inc; \
+           echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+       fi
+
+# configuration validation
+.validate-impl:
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           echo ""; \
+           echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
+           echo "See 'make help' for details."; \
+           echo "Current directory: " `pwd`; \
+           echo ""; \
+       fi
+       @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
+       then \
+           exit 1; \
+       fi
+
+
+# help
+.help-impl: .help-pre
+       @echo "This makefile supports the following configurations:"
+       @echo "    ${ALLCONFS}"
+       @echo ""
+       @echo "and the following targets:"
+       @echo "    build  (default target)"
+       @echo "    clean"
+       @echo "    clobber"
+       @echo "    all"
+       @echo "    help"
+       @echo ""
+       @echo "Makefile Usage:"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] build"
+       @echo "    make [CONF=<CONFIGURATION>] [SUB=no] clean"
+       @echo "    make [SUB=no] clobber"
+       @echo "    make [SUB=no] all"
+       @echo "    make help"
+       @echo ""
+       @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
+       @echo "    also clean subprojects."
+       @echo "Target 'clobber' will remove all built files from all configurations and,"
+       @echo "    unless 'SUB=no', also from subprojects."
+       @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
+       @echo "    also build subprojects."
+       @echo "Target 'help' prints this message."
+       @echo ""
+
diff --git a/vhook/nbproject/Package-Debug.bash b/vhook/nbproject/Package-Debug.bash
new file mode 100644 (file)
index 0000000..4b200b8
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+PLATFORM=MinGW-Windows
+TMPDIR=build/Debug/${PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=dist/Debug/${PLATFORM}/nicovideodbg.dll
+OUTPUT_BASENAME=nicovideodbg.dll
+PACKAGE_TOP_DIR=libvhook.dll/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p dist/Debug/${PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libvhook.dll/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f dist/Debug/${PLATFORM}/package/libvhook.dll.tar
+cd ${TMPDIR}
+tar -vcf ../../../../dist/Debug/${PLATFORM}/package/libvhook.dll.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/vhook/nbproject/Package-Release.bash b/vhook/nbproject/Package-Release.bash
new file mode 100644 (file)
index 0000000..f37e301
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+PLATFORM=MinGW-Windows
+TMPDIR=build/Release/${PLATFORM}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=dist/Release/${PLATFORM}/nicovideo.dll
+OUTPUT_BASENAME=nicovideo.dll
+PACKAGE_TOP_DIR=libvhook.dll/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p dist/Release/${PLATFORM}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/libvhook.dll/lib
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f dist/Release/${PLATFORM}/package/libvhook.dll.tar
+cd ${TMPDIR}
+tar -vcf ../../../../dist/Release/${PLATFORM}/package/libvhook.dll.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/vhook/nbproject/configurations.xml b/vhook/nbproject/configurations.xml
new file mode 100644 (file)
index 0000000..1776037
--- /dev/null
@@ -0,0 +1,257 @@
+<?xml version="1.0" encoding="EUC-JP"?>\r
+<configurationDescriptor version="51">\r
+  <logicalFolder name="root" displayName="root" projectFiles="true">\r
+    <logicalFolder name="SourceFiles" displayName="¥½¡¼¥¹¥Õ¥¡¥¤¥ë" projectFiles="true">\r
+      <logicalFolder name="chat" displayName="chat" projectFiles="true">\r
+        <itemPath>chat/chat.c</itemPath>\r
+        <itemPath>chat/chat_slot.c</itemPath>\r
+        <itemPath>chat/process_chat.c</itemPath>\r
+      </logicalFolder>\r
+      <logicalFolder name="comment" displayName="comment" projectFiles="true">\r
+        <itemPath>comment/com_surface.c</itemPath>\r
+        <itemPath>comment/shadow.c</itemPath>\r
+        <itemPath>comment/surf_util.c</itemPath>\r
+      </logicalFolder>\r
+      <logicalFolder name="common" displayName="common" projectFiles="true">\r
+      </logicalFolder>\r
+      <itemPath>framehook.c</itemPath>\r
+      <itemPath>main.c</itemPath>\r
+      <itemPath>process.c</itemPath>\r
+      <itemPath>util.c</itemPath>\r
+    </logicalFolder>\r
+    <logicalFolder name="HeaderFiles" displayName="¥Ø¥Ã¥À¡¼¥Õ¥¡¥¤¥ë" projectFiles="true">\r
+      <logicalFolder name="chat" displayName="chat" projectFiles="true">\r
+        <itemPath>chat/chat.h</itemPath>\r
+        <itemPath>chat/chat_slot.h</itemPath>\r
+        <itemPath>chat/process_chat.h</itemPath>\r
+      </logicalFolder>\r
+      <logicalFolder name="comment" displayName="comment" projectFiles="true">\r
+        <itemPath>comment/com_surface.h</itemPath>\r
+        <itemPath>comment/shadow.h</itemPath>\r
+        <itemPath>comment/surf_util.h</itemPath>\r
+      </logicalFolder>\r
+      <logicalFolder name="common" displayName="common" projectFiles="true">\r
+        <itemPath>common/framehook_ext.h</itemPath>\r
+      </logicalFolder>\r
+      <itemPath>framehook.h</itemPath>\r
+      <itemPath>header.h</itemPath>\r
+      <itemPath>main.h</itemPath>\r
+      <itemPath>mydef.h</itemPath>\r
+      <itemPath>nicodef.h</itemPath>\r
+      <itemPath>process.h</itemPath>\r
+      <itemPath>struct_define.h</itemPath>\r
+      <itemPath>util.h</itemPath>\r
+    </logicalFolder>\r
+    <logicalFolder name="ResourceFiles" displayName="¥ê¥½¡¼¥¹¥Õ¥¡¥¤¥ë" projectFiles="true">\r
+    </logicalFolder>\r
+    <logicalFolder name="ExternalFiles" displayName="½ÅÍפʥե¡¥¤¥ë" projectFiles="false">\r
+      <itemPath>Makefile</itemPath>\r
+    </logicalFolder>\r
+  </logicalFolder>\r
+  <projectmakefile>Makefile</projectmakefile>\r
+  <confs>\r
+    <conf name="Debug" type="2">\r
+      <toolsSet>\r
+        <developmentServer>localhost</developmentServer>\r
+        <compilerSet>MinGW|MinGW</compilerSet>\r
+        <platform>3</platform>\r
+      </toolsSet>\r
+      <compileType>\r
+        <cCompilerTool>\r
+          <includeDirectories>\r
+            <directoryPath>f:/mingw/include</directoryPath>\r
+          </includeDirectories>\r
+        </cCompilerTool>\r
+        <linkerTool>\r
+          <output>dist/Debug/${PLATFORM}/nicovideodbg.dll</output>\r
+          <linkerLibItems>\r
+            <linkerLibLibItem>SDL_gfx</linkerLibLibItem>\r
+            <linkerLibLibItem>SDLmain</linkerLibLibItem>\r
+            <linkerLibLibItem>SDL.dll</linkerLibLibItem>\r
+            <linkerLibLibItem>SDL_ttf</linkerLibLibItem>\r
+          </linkerLibItems>\r
+        </linkerTool>\r
+      </compileType>\r
+      <item path="chat/chat.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="chat/chat.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="chat/chat_slot.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="chat/chat_slot.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="chat/process_chat.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="chat/process_chat.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="comment/com_surface.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="comment/com_surface.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="comment/shadow.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="comment/shadow.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="comment/surf_util.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="comment/surf_util.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="common/framehook_ext.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="framehook.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="framehook.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="header.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="main.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="main.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="mydef.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="nicodef.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="process.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="process.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="struct_define.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="util.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="util.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+    </conf>\r
+    <conf name="Release" type="2">\r
+      <toolsSet>\r
+        <developmentServer>localhost</developmentServer>\r
+        <compilerSet>MinGW|MinGW</compilerSet>\r
+        <platform>3</platform>\r
+      </toolsSet>\r
+      <compileType>\r
+        <cCompilerTool>\r
+          <developmentMode>6</developmentMode>\r
+          <includeDirectories>\r
+            <directoryPath>f:/mingw/include</directoryPath>\r
+          </includeDirectories>\r
+        </cCompilerTool>\r
+        <ccCompilerTool>\r
+          <developmentMode>5</developmentMode>\r
+        </ccCompilerTool>\r
+        <fortranCompilerTool>\r
+          <developmentMode>5</developmentMode>\r
+        </fortranCompilerTool>\r
+        <linkerTool>\r
+          <output>dist/Release/${PLATFORM}/nicovideo.dll</output>\r
+          <linkerLibItems>\r
+            <linkerLibLibItem>SDL_gfx</linkerLibLibItem>\r
+            <linkerLibLibItem>SDLmain</linkerLibLibItem>\r
+            <linkerLibLibItem>SDL.dll</linkerLibLibItem>\r
+            <linkerLibLibItem>SDL_ttf</linkerLibLibItem>\r
+          </linkerLibItems>\r
+        </linkerTool>\r
+      </compileType>\r
+      <item path="chat/chat.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="chat/chat.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="chat/chat_slot.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="chat/chat_slot.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="chat/process_chat.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="chat/process_chat.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="comment/com_surface.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="comment/com_surface.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="comment/shadow.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="comment/shadow.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="comment/surf_util.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="comment/surf_util.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="common/framehook_ext.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="framehook.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="framehook.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="header.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="main.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="main.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="mydef.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="nicodef.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="process.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="process.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="struct_define.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+      <item path="util.c">\r
+        <itemTool>0</itemTool>\r
+      </item>\r
+      <item path="util.h">\r
+        <itemTool>3</itemTool>\r
+      </item>\r
+    </conf>\r
+  </confs>\r
+</configurationDescriptor>\r
diff --git a/vhook/nbproject/project.properties b/vhook/nbproject/project.properties
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/vhook/nbproject/project.xml b/vhook/nbproject/project.xml
new file mode 100644 (file)
index 0000000..1054771
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project xmlns="http://www.netbeans.org/ns/project/1">\r
+    <type>org.netbeans.modules.cnd.makeproject</type>\r
+    <configuration>\r
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">\r
+            <name>vhook</name>\r
+            <make-project-type>0</make-project-type>\r
+            <c-extensions>c</c-extensions>\r
+            <cpp-extensions/>\r
+            <header-extensions>h</header-extensions>\r
+            <sourceEncoding>windows-31j</sourceEncoding>\r
+            <make-dep-projects/>\r
+        </data>\r
+    </configuration>\r
+</project>\r
diff --git a/vhook/nicodef.h b/vhook/nicodef.h
new file mode 100644 (file)
index 0000000..2d8fe37
--- /dev/null
@@ -0,0 +1,71 @@
+#ifndef NICODEF_H_\r
+#define NICODEF_H_\r
+#include <SDL/SDL_ttf.h>\r
+\r
+//\92è\8b`\r
+#define NICO_WIDTH             512\r
+#define NICO_HEIGHT    384\r
+\r
+\r
+#define VPOS_FACTOR            100     //\91½\95ª\8cW\90\94\82Ì\88Ó\96¡\82Å\82Í\81E\81E\81E\82â\82Í\82è1/100\82Å\8bL\98^\82µ\82Ä\82é\82Á\82Û\82¢\r
+#define TEXT_AHEAD_SEC (1 * VPOS_FACTOR)\r
+#define TEXT_SHOW_SEC  (4 * VPOS_FACTOR)\r
+#define TEXT_HEIGHT            22\r
+\r
+#define CMD_LOC_DEF            (0)\r
+#define CMD_LOC_TOP            (1)\r
+#define CMD_LOC_BOTTOM (2)\r
+\r
+#define CMD_FONT_MAX   3\r
+#define CMD_FONT_DEF   0\r
+#define CMD_FONT_BIG   1\r
+#define CMD_FONT_SMALL 2\r
+\r
+static const int COMMENT_FONT_SIZE[CMD_FONT_MAX] = {\r
+       24,//DEF\r
+       39,//BIG\r
+       15,//SMALL\r
+};\r
+\r
+#define CMD_COLOR_MAX                          17\r
+#define CMD_COLOR_DEF                          0\r
+#define CMD_COLOR_RED                          1\r
+#define CMD_COLOR_ORANGE                       2\r
+#define CMD_COLOR_YELLOW                       3\r
+#define CMD_COLOR_PINK                         4\r
+#define CMD_COLOR_BLUE                         5\r
+#define CMD_COLOR_PURPLE                       6\r
+#define CMD_COLOR_CYAN                         7\r
+#define CMD_COLOR_GREEN                        8\r
+#define CMD_COLOR_NICOWHITE            9\r
+#define CMD_COLOR_MARINEBLUE           10\r
+#define CMD_COLOR_MADYELLOW            11\r
+#define CMD_COLOR_PASSIONORANGE        12\r
+#define CMD_COLOR_NOBLEVIOLET          13\r
+#define CMD_COLOR_ELEMENTALGREEN       14\r
+#define CMD_COLOR_TRUERED                      15\r
+#define CMD_COLOR_BLACK                        16\r
+\r
+static const SDL_Color COMMENT_COLOR[CMD_COLOR_MAX] = {\r
+       {0xff,0xff,0xff,0x00},//DEF\r
+       {0xff,0x00,0x00,0x00},//RED\r
+       {0xff,0xC0,0x00,0x00},//ORANGE\r
+       {0xff,0xff,0x00,0x00},//YELLOW\r
+       {0xff,0x80,0x80,0x00},//PINK\r
+       {0x00,0x00,0xff,0x00},//BLUE\r
+       {0xc0,0x00,0xff,0x00},//PURPLE\r
+       {0x00,0xff,0xff,0x00},//CYAN\r
+       {0x00,0xff,0x00,0x00},//GREEN\r
+       /*\83v\83\8c\83~\83A\90ê\97p*/\r
+       {0xCC,0xCC,0x99,0x00},//NICOWHITE\r
+       {0x33,0xff,0xFC,0x00},//MARINEBLUE\r
+       {0x99,0x99,0x00,0x00},//MADYELLOW\r
+       {0xFF,0x66,0x00,0x00},//PASSIONORANGE\r
+       {0x66,0x33,0xCC,0x00},//NOBLEVIOLET\r
+       {0x00,0xCC,0x66,0x00},//ELEMENTALGREEN\r
+       {0xCC,0x00,0x33,0x00},//TRUERED\r
+       {0x00,0x00,0x00,0x00},//BLACK\r
+\r
+};\r
+\r
+#endif /*NICODEF_H_*/\r
diff --git a/vhook/process.c b/vhook/process.c
new file mode 100644 (file)
index 0000000..008c774
--- /dev/null
@@ -0,0 +1,21 @@
+#include "mydef.h"\r
+#include "process.h"\r
+#include "chat/process_chat.h"\r
+#include "chat/chat.h"\r
+#include "chat/chat_slot.h"\r
+\r
+//\83v\83\8d\83Z\83X\r
+int process(DATA* data,SDL_Surface* surf,const int now_vpos){\r
+       //\83\86\81[\83U\83R\83\81\83\93\83g\r
+       if(data->enable_user_comment){\r
+               if(!chat_process(data,surf,now_vpos)){\r
+                       fputs("[process/process]failed to process comment.\n",data->log);\r
+                       return FALSE;\r
+               }\r
+       }\r
+       //\83I\81[\83i\83R\83\81\83\93\83g\r
+       if(data->enable_owner_comment){\r
+       }\r
+       return TRUE;\r
+}\r
+\r
diff --git a/vhook/process.h b/vhook/process.h
new file mode 100644 (file)
index 0000000..afad601
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef PROCESS_H_\r
+#define PROCESS_H_\r
+#include <SDL/SDL.h>\r
+#include "main.h"\r
+int process(DATA* data,SDL_Surface* surf,const int now_vpos);\r
+\r
+#endif /*PROCESS_H_*/\r
diff --git a/vhook/struct_define.h b/vhook/struct_define.h
new file mode 100644 (file)
index 0000000..65b2715
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef STRUCT_DEFINE_H_\r
+#define STRUCT_DEFINE_H_\r
+\r
+typedef struct DATA DATA;\r
+typedef struct CHAT CHAT;\r
+typedef struct CHAT_ITEM CHAT_ITEM;\r
+typedef struct CHAT_SLOT CHAT_SLOT;\r
+typedef struct CHAT_SLOT_ITEM CHAT_SLOT_ITEM;\r
+typedef struct CHAT_SET CHAT_SET;\r
+\r
+#endif /*STRUCT_DEFINE_H_*/\r
diff --git a/vhook/util.c b/vhook/util.c
new file mode 100644 (file)
index 0000000..3b273b3
--- /dev/null
@@ -0,0 +1,14 @@
+#include "mydef.h"\r
+#include "util.h"\r
+\r
+#include <stdlib.h>\r
+/*\97\90\90\94*/\r
+int rnd(){\r
+       static int Seed = 23573;\r
+       int result;\r
+       Seed *= 214013;\r
+       Seed += 2531011; // ->\8e\9f\82É\8cÄ\82Ñ\8fo\82³\82ê\82½\82Æ\82«\82Ìseed\82É\8eg\82¤\r
+       result = Seed;\r
+       result = result >> 0x10;\r
+       return result;\r
+}\r
diff --git a/vhook/util.h b/vhook/util.h
new file mode 100644 (file)
index 0000000..2d1007b
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef UTIL_H_\r
+#define UTIL_H_\r
+\r
+int rnd();\r
+\r
+#endif /*UTIL_H_*/\r