I_Jemin

Merge remote-tracking branch 'refs/remotes/mireado/master'

...@@ -1424,6 +1424,7 @@ bool InsertKiriKiriZHook1() ...@@ -1424,6 +1424,7 @@ bool InsertKiriKiriZHook1()
1424 return true; 1424 return true;
1425 } 1425 }
1426 1426
1427 +
1427 // jichi 1/30/2015: Add KiriKiriZ2 for サノバウィッ� 1428 // jichi 1/30/2015: Add KiriKiriZ2 for サノバウィッ�
1428 // It inserts to the same location as the old KiriKiriZ, but use a different way to find it. 1429 // It inserts to the same location as the old KiriKiriZ, but use a different way to find it.
1429 bool InsertKiriKiriZHook2() 1430 bool InsertKiriKiriZHook2()
...@@ -1448,7 +1449,7 @@ bool InsertKiriKiriZHook2() ...@@ -1448,7 +1449,7 @@ bool InsertKiriKiriZHook2()
1448 1449
1449 // 012280e0 55 push ebp 1450 // 012280e0 55 push ebp
1450 // 012280e1 8bec mov ebp,esp 1451 // 012280e1 8bec mov ebp,esp
1451 - addr = MemDbg::findEnclosingAlignedFunction(addr, 0x100); // 0x0122812f - 0x 012280dc = 83 1452 + addr = MemDbg::findEnclosingAlignedFunction(addr, 0x100); // 0x0122812f-0x012280e0 = 0x4F
1452 enum : BYTE { push_ebp = 0x55 }; // 011d4c80 /$ 55 push ebp 1453 enum : BYTE { push_ebp = 0x55 }; // 011d4c80 /$ 55 push ebp
1453 if (!addr || *(BYTE *)addr != push_ebp) { 1454 if (!addr || *(BYTE *)addr != push_ebp) {
1454 ConsoleOutput("vnreng:KiriKiriZ2: pattern found but the function offset is invalid"); 1455 ConsoleOutput("vnreng:KiriKiriZ2: pattern found but the function offset is invalid");
...@@ -2001,11 +2002,12 @@ bool InsertBGI1Hook() ...@@ -2001,11 +2002,12 @@ bool InsertBGI1Hook()
2001 bool InsertBGI2Hook() 2002 bool InsertBGI2Hook()
2002 { 2003 {
2003 const BYTE bytes[] = { 2004 const BYTE bytes[] = {
2004 - 0x3c, 0x20, // 011d4d31 |. 3c 20 cmp al,0x20 2005 + // The following code does not exist in newer BGI games after BGI 1.633.0.0 (tayutama2_trial_EX)
2005 - 0x7d, XX, // 011d4d33 |. 7d 75 jge short sekachu.011d4daa ; jichi: 0x75 or 0x58 2006 + //0x3c, 0x20, // 011d4d31 |. 3c 20 cmp al,0x20
2007 + //0x7d, XX, // 011d4d33 |. 7d 75 jge short sekachu.011d4daa ; jichi: 0x75 or 0x58
2006 0x0f,0xbe,0xc0, // 011d4d35 |. 0fbec0 movsx eax,al 2008 0x0f,0xbe,0xc0, // 011d4d35 |. 0fbec0 movsx eax,al
2007 0x83,0xc0, 0xfe, // 011d4d38 |. 83c0 fe add eax,-0x2 ; switch (cases 2..8) 2009 0x83,0xc0, 0xfe, // 011d4d38 |. 83c0 fe add eax,-0x2 ; switch (cases 2..8)
2008 - 0x83,0xf8, 0x06 // 011d4d3b |. 83f8 06 cmp eax,0x6 2010 + 0x83,0xf8//, 0x06 // 011d4d3b |. 83f8 06 cmp eax,0x6
2009 // The following code does not exist in newer BGI games after 蒼の彼方 2011 // The following code does not exist in newer BGI games after 蒼の彼方
2010 //0x77, 0x6a // 011d4d3e |. 77 6a ja short sekachu.011d4daa 2012 //0x77, 0x6a // 011d4d3e |. 77 6a ja short sekachu.011d4daa
2011 }; 2013 };
...@@ -2033,13 +2035,15 @@ bool InsertBGI2Hook() ...@@ -2033,13 +2035,15 @@ bool InsertBGI2Hook()
2033 hp.offset = 4 * 3; 2035 hp.offset = 4 * 3;
2034 break; 2036 break;
2035 // for new BGI2 game since 蒼の彼方 (2014/08), text is in arg2 2037 // for new BGI2 game since 蒼の彼方 (2014/08), text is in arg2
2036 - case 0x01312cd0 - 0x01312d8e: 2038 + case 0x01312cd0 - 0x01312D92:
2037 // For newer BGI2 game since コドモノアソビ (2015/11) 2039 // For newer BGI2 game since コドモノアソビ (2015/11)
2038 - case 0x00A64260 - 0x00A64318: 2040 + case 0x00A64260 - 0x00A6431C:
2039 // For latest BGI2 game since タユタマ2(2016/05) by @mireado 2041 // For latest BGI2 game since タユタマ2(2016/05) by @mireado
2040 - case 0x00E95290 - 0x00E95345: 2042 + case 0x00E95290 - 0x00E95349:
2041 // For latest BGI2 game since 千の刃濤、桃花染の皇姫 体験版 by @mireado 2043 // For latest BGI2 game since 千の刃濤、桃花染の皇姫 体験版 by @mireado
2042 - case 0x00AF5640 - 0x00AF56FB: 2044 + case 0x00AF5640 - 0x00AF56FF:
2045 + // For latest BGI2 game since by BGI 1.633.0.0 @mireado
2046 + case 0x00D8A660 - 0x00D8A73A:
2043 hp.offset = 4 * 2; 2047 hp.offset = 4 * 2;
2044 break; 2048 break;
2045 default: 2049 default:
...@@ -7044,7 +7048,7 @@ bool InsertMalie3Hook() ...@@ -7044,7 +7048,7 @@ bool InsertMalie3Hook()
7044 // jichi 3/15/2015: Remove 0704 in シルヴァリオ ヴェンッ�タ 7048 // jichi 3/15/2015: Remove 0704 in シルヴァリオ ヴェンッ�タ
7045 hp.filter_fun = IllegalWideCharsFilter; // remove illegal control chars such as 0x07,0x01 7049 hp.filter_fun = IllegalWideCharsFilter; // remove illegal control chars such as 0x07,0x01
7046 hp.text_fun = SpecialHookMalie3; 7050 hp.text_fun = SpecialHookMalie3;
7047 - hp.type = NO_CONTEXT|USING_UNICODE; 7051 + hp.type = USING_SPLIT|NO_CONTEXT|USING_UNICODE;
7048 //hp.filter_fun = Malie3Filter; 7052 //hp.filter_fun = Malie3Filter;
7049 ConsoleOutput("vnreng: INSERT Malie3"); 7053 ConsoleOutput("vnreng: INSERT Malie3");
7050 NewHook(hp, "Malie3"); 7054 NewHook(hp, "Malie3");
...@@ -7053,6 +7057,45 @@ bool InsertMalie3Hook() ...@@ -7053,6 +7057,45 @@ bool InsertMalie3Hook()
7053 return true; 7057 return true;
7054 } 7058 }
7055 7059
7060 +bool InsertMalie4Hook()
7061 +{
7062 + // i.e. 50 8B 45 10 D9 9F ?? ?? ?? ?? 0F B7 04 58 50 51 E8 ?? ?? ?? ?? 8B 45 14 83 C4 10
7063 + const BYTE bytes[] = {
7064 + 0x50, // 65904E | 50 | push eax | mireado: pattern starts
7065 + 0x8B,0x45,0x10, // 65904F | 8B 45 10 | mov eax,dword ptr ss:[ebp+10] |
7066 + 0xD9,0x9F,XX4, // 659052 | D9 9F E8 6B 87 00 | fstp dword ptr ds:[edi+876BE8] |
7067 + 0x0F,0xB7,0x04,0x58, // 659058 | 0F B7 04 58 | movzx eax,word ptr ds:[eax+ebx*2] |
7068 + 0x50, // 65905C | 50 | push eax |
7069 + 0x51, // 65905D | 51 | push ecx |
7070 + 0xE8,XX4, // 65905E | E8 DD 1D EA FF | call malie.4FAE40 | mireado: hook here
7071 + 0x8B,0x45,0x14, // 659063 | 8B 45 14 | mov eax,dword ptr ss:[ebp+14] |
7072 + 0x83,0xC4,0x10 // 659066 | 83 C4 10 | add esp,10 |
7073 + };
7074 + enum {addr_offset = 0x65905E - 0x65904E};
7075 + ULONG addr = MemDbg::matchBytes(bytes, sizeof(bytes), module_base_, module_limit_);
7076 + if (!addr) {
7077 + ConsoleOutput("vnreng:Malie4: pattern not found");
7078 + return false;
7079 + }
7080 +
7081 + HookParam hp = {};
7082 + hp.address = addr + addr_offset;
7083 + hp.offset = -8; // pusha_eax_off - 4
7084 + hp.length_offset = 1;
7085 + //hp.split = 0xc; // jichi 12/17/2013: Subcontext removed
7086 + //hp.type = USING_SPLIT|USING_UNICODE|NO_CONTEXT;
7087 + // jichi 12/17/2013: Need extern func for Electro Arms
7088 + // Though the hook parameter is quit similar to Malie, the original extern function does not work
7089 + hp.split = -0x10; // jichi 12/17/2013: This could split the furigana, but will mess up the text
7090 + hp.type = USING_SPLIT|NO_CONTEXT|USING_UNICODE;
7091 + ConsoleOutput("vnreng: INSERT Malie4");
7092 + NewHook(hp, "Malie4");
7093 +
7094 + //GROWL_DWORD2(hp.address, reladdr);
7095 + //RegisterEngineType(ENGINE_MALIE);
7096 + return true;
7097 +}
7098 +
7056 // jichi 3/12/2015: Return guessed Malie engine year 7099 // jichi 3/12/2015: Return guessed Malie engine year
7057 //int GetMalieYear() 7100 //int GetMalieYear()
7058 //{ 7101 //{
...@@ -7084,6 +7127,7 @@ bool InsertMalieHook() ...@@ -7084,6 +7127,7 @@ bool InsertMalieHook()
7084 7127
7085 // The main disadvantage of Malie3 is that it cannot find character name 7128 // The main disadvantage of Malie3 is that it cannot find character name
7086 ok = InsertMalie3Hook() || ok; // jichi 3/7/2014 7129 ok = InsertMalie3Hook() || ok; // jichi 3/7/2014
7130 + ok = InsertMalie4Hook() || ok;
7087 7131
7088 if (ok) { 7132 if (ok) {
7089 ConsoleOutput("vnreng:Malie: disable GDI hooks"); 7133 ConsoleOutput("vnreng:Malie: disable GDI hooks");
...@@ -10305,7 +10349,7 @@ bool InsertUnicornHook() ...@@ -10305,7 +10349,7 @@ bool InsertUnicornHook()
10305 * 株式会社エヴァンジェ 10349 * 株式会社エヴァンジェ
10306 * 株式会社ポニーキャニオン 10350 * 株式会社ポニーキャニオン
10307 * 株式会社大福エンターヂ�ンメン� */ 10351 * 株式会社大福エンターヂ�ンメン� */
10308 -bool InsertArtemisHook() 10352 +bool InsertArtemis1Hook()
10309 { 10353 {
10310 const BYTE bytes[] = { 10354 const BYTE bytes[] = {
10311 0x83,0xc4, 0x0c, // add esp,0xc ; hook here 10355 0x83,0xc4, 0x0c, // add esp,0xc ; hook here
...@@ -10318,7 +10362,7 @@ bool InsertArtemisHook() ...@@ -10318,7 +10362,7 @@ bool InsertArtemisHook()
10318 ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), module_base_, module_base_ + range); 10362 ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), module_base_, module_base_ + range);
10319 //GROWL_DWORD3(reladdr, module_base_, range); 10363 //GROWL_DWORD3(reladdr, module_base_, range);
10320 if (!addr) { 10364 if (!addr) {
10321 - ConsoleOutput("vnreng:Artemis: pattern not exist"); 10365 + ConsoleOutput("vnreng:Artemis1: pattern not exist");
10322 return false; 10366 return false;
10323 } 10367 }
10324 10368
...@@ -10332,12 +10376,45 @@ bool InsertArtemisHook() ...@@ -10332,12 +10376,45 @@ bool InsertArtemisHook()
10332 //hp.address = 0x650a2f; 10376 //hp.address = 0x650a2f;
10333 //GROWL_DWORD(hp.address); 10377 //GROWL_DWORD(hp.address);
10334 10378
10335 - ConsoleOutput("vnreng: INSERT Artemis"); 10379 + ConsoleOutput("vnreng: INSERT Artemis1");
10336 - NewHook(hp, "Artemis"); 10380 + NewHook(hp, "Artemis1");
10337 - //ConsoleOutput("Artemis"); 10381 + //ConsoleOutput("Artemis1");
10382 + return true;
10383 +}
10384 +
10385 +bool InsertArtemis2Hook()
10386 +{
10387 + const BYTE bytes[] = {
10388 + 0x55, 0x8B, 0xEC, 0x83, 0xE4, 0xF8, 0x6A, 0xFF, 0x68, XX4, 0x64, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x50, 0x83, 0xEC, 0x28, 0xA1, XX4, 0x33, 0xC4, 0x89, 0x44, 0x24, 0x20, 0x53, 0x56, 0x57, 0xA1, XX4, 0x33, 0xC4, 0x50, 0x8D, 0x44, 0x24, 0x38, 0x64, 0xA3, 0x00, 0x00, 0x00, 0x00, 0x8B, 0xF1, 0x8B, 0x5D, 0x08, 0x8B, 0x4D, 0x0C
10389 + };
10390 + enum { addr_offset = 0 }; // distance to the beginning of the function, which is 0x55 (push ebp)
10391 + ULONG range = min(module_limit_ - module_base_, MAX_REL_ADDR);
10392 + ULONG addr = MemDbg::matchBytes(bytes, sizeof(bytes), module_base_, module_base_ + range);
10393 + if (!addr) {
10394 + ConsoleOutput("vnreng:Artemis2: pattern not found");
10395 + return false;
10396 + }
10397 + addr += addr_offset;
10398 + enum { push_ebp = 0x55 }; // beginning of the function
10399 + if (*(BYTE *)addr != push_ebp) {
10400 + ConsoleOutput("vnreng:Artemis2: beginning of the function not found");
10401 + return false;
10402 + }
10403 +
10404 + HookParam hp = {};
10405 + hp.address = addr;
10406 + hp.offset = 4;
10407 + hp.type = USING_STRING|NO_CONTEXT;
10408 +
10409 + ConsoleOutput("vnreng: INSERT Artemis2");
10410 + NewHook(hp, "Artemis2");
10411 + //ConsoleOutput("Artemis2");
10338 return true; 10412 return true;
10339 } 10413 }
10340 10414
10415 +bool InsertArtemisHook()
10416 +{ return InsertArtemis1Hook() || InsertArtemis2Hook(); }
10417 +
10341 /** 10418 /**
10342 * jichi 1/2/2014: Taskforce2 Engine 10419 * jichi 1/2/2014: Taskforce2 Engine
10343 * 10420 *
...@@ -12352,7 +12429,7 @@ static bool InsertOldPalHook() // this is used in case the new pattern does not ...@@ -12352,7 +12429,7 @@ static bool InsertOldPalHook() // this is used in case the new pattern does not
12352 NewHook(hp, "Pal"); 12429 NewHook(hp, "Pal");
12353 return true; 12430 return true;
12354 } 12431 }
12355 -static bool InsertNewPalHook() 12432 +static bool InsertNewPal1Hook()
12356 { 12433 {
12357 const BYTE bytes[] = { 12434 const BYTE bytes[] = {
12358 0x55, // 002c6ab0 55 push ebp 12435 0x55, // 002c6ab0 55 push ebp
...@@ -12360,12 +12437,12 @@ static bool InsertNewPalHook() ...@@ -12360,12 +12437,12 @@ static bool InsertNewPalHook()
12360 0x83,0xec, 0x78, // 002c6ab3 83ec 78 sub esp,0x78 12437 0x83,0xec, 0x78, // 002c6ab3 83ec 78 sub esp,0x78
12361 0xa1, XX4, // 002c6ab6 a1 8c002f00 mov eax,dword ptr ds:[0x2f008c] 12438 0xa1, XX4, // 002c6ab6 a1 8c002f00 mov eax,dword ptr ds:[0x2f008c]
12362 0x33,0xc5, // 002c6abb 33c5 xor eax,ebp 12439 0x33,0xc5, // 002c6abb 33c5 xor eax,ebp
12363 - 0x89,0x45, 0xf8 // 002c6abd 8945 f8 mov dword ptr ss:[ebp-0x8],eax 12440 + 0x89,0x45, 0xf8 // 002c6abd 8945 f8 mov dword ptr ss:[ebp-0x8],eax ; mireado : small update
12364 }; 12441 };
12365 ULONG range = min(module_limit_ - module_base_, MAX_REL_ADDR); 12442 ULONG range = min(module_limit_ - module_base_, MAX_REL_ADDR);
12366 ULONG addr = MemDbg::matchBytes(bytes, sizeof(bytes), module_base_, module_base_ + range); 12443 ULONG addr = MemDbg::matchBytes(bytes, sizeof(bytes), module_base_, module_base_ + range);
12367 if (!addr) { 12444 if (!addr) {
12368 - ConsoleOutput("vnreng:Pal: pattern not found"); 12445 + ConsoleOutput("vnreng:Pal1: pattern not found");
12369 return false; 12446 return false;
12370 } 12447 }
12371 12448
...@@ -12374,7 +12451,7 @@ static bool InsertNewPalHook() ...@@ -12374,7 +12451,7 @@ static bool InsertNewPalHook()
12374 //hp.type = NO_CONTEXT|USING_SPLIT|DATA_INDIRECT; // 0x418 12451 //hp.type = NO_CONTEXT|USING_SPLIT|DATA_INDIRECT; // 0x418
12375 hp.type = RELATIVE_SPLIT; // Use relative address to prevent floating issue 12452 hp.type = RELATIVE_SPLIT; // Use relative address to prevent floating issue
12376 hp.offset = 4 * 2; // arg2 12453 hp.offset = 4 * 2; // arg2
12377 - ConsoleOutput("vnreng: INSERT Pal"); 12454 + ConsoleOutput("vnreng: INSERT Pal1");
12378 NewHook(hp, "Pal"); 12455 NewHook(hp, "Pal");
12379 return true; 12456 return true;
12380 } 12457 }
...@@ -12382,33 +12459,33 @@ static bool InsertNewPalHook() ...@@ -12382,33 +12459,33 @@ static bool InsertNewPalHook()
12382 // Supporting new Pal engine, tested with 恋×シンアイ彼女 12459 // Supporting new Pal engine, tested with 恋×シンアイ彼女
12383 static bool InsertNewPal2Hook() 12460 static bool InsertNewPal2Hook()
12384 { 12461 {
12385 - const BYTE bytes[] = { 12462 + const BYTE bytes[] = {
12386 - 0x55, // 0136e220 55 push ebp 12463 + 0x55, // 0124E220 55 push ebp; doesn't works... why?
12387 - 0x8b,0xec, // 0136e221 8bec mov ebp,esp 12464 + 0x8b,0xec, // 0124E221 8bec mov ebp,esp
12388 - 0x83,0xec, 0x7c, // 0136e226 83ec 7c sub esp,0x7c 12465 + 0x83,0xec, 0x7c, // 0124E223 83ec 7c sub esp,0x7C
12389 - 0xa1, XX4, // 0136e226 a1 788d3b01 mov eax,dword ptr ds:[0x2f008c] 12466 + 0xa1, XX4, // 0124E226 a1 788D2901 mov eax,dword ptr ds:[0x2f008c]
12390 - 0x33,0xc5, // 0136e22b 33c5 xor eax,ebp 12467 + 0x33,0xc5, // 0124E22B 33c5 xor eax,ebp
12391 - 0x89,0x45, 0xfc, // 0136e22d 8945 fc mov dword ptr ss:[ebp-0x4],eax 12468 + 0x89,0x45, 0xfc, // 0124E22D 8945 FC mov dword ptr ss:[ebp-0x8],eax ; mireado : small update
12392 - 0xe8 // 0136e230 e8 call 01377800 12469 + 0xe8 // 0136e230 e8 call 01377800
12393 - }; 12470 + };
12394 - ULONG range = min(module_limit_ - module_base_, MAX_REL_ADDR); 12471 + ULONG range = min(module_limit_ - module_base_, MAX_REL_ADDR);
12395 - ULONG addr = MemDbg::matchBytes(bytes, sizeof(bytes), module_base_, module_base_ + range); 12472 + ULONG addr = MemDbg::matchBytes(bytes, sizeof(bytes), module_base_, module_base_ + range);
12396 - if (!addr) { 12473 + if (!addr) {
12397 - ConsoleOutput("vnreng:Pal: pattern not found"); 12474 + ConsoleOutput("vnreng:Pal2: pattern not found");
12398 - return false; 12475 + return false;
12399 - } 12476 + }
12400 - 12477 +
12401 - HookParam hp = {}; 12478 + HookParam hp = {};
12402 - hp.address = addr; 12479 + hp.address = addr;
12403 - //hp.type = NO_CONTEXT|USING_SPLIT|DATA_INDIRECT; // 0x418 12480 + //hp.type = NO_CONTEXT|USING_SPLIT|DATA_INDIRECT; // 0x418
12404 - hp.type = RELATIVE_SPLIT; // Use relative address to prevent floating issue 12481 + hp.type = RELATIVE_SPLIT; // Use relative address to prevent floating issue
12405 - hp.offset = 4 * 2; // arg2 12482 + hp.offset = 4 * 2; // arg2
12406 - ConsoleOutput("vnreng: INSERT Pal"); 12483 + ConsoleOutput("vnreng: INSERT Pal2");
12407 - NewHook(hp, "Pal"); 12484 + NewHook(hp, "Pal");
12408 - return true; 12485 + return true;
12409 } 12486 }
12410 bool InsertPalHook() // use Old Pal first, which does not have ruby 12487 bool InsertPalHook() // use Old Pal first, which does not have ruby
12411 -{ return InsertOldPalHook() || InsertNewPal2Hook() || InsertNewPalHook(); } 12488 +{ return InsertOldPalHook() || InsertNewPal1Hook() || InsertNewPal2Hook(); }
12412 12489
12413 /** jichi 7/6/2014 NeXAS 12490 /** jichi 7/6/2014 NeXAS
12414 * Sample game: BALDRSKYZERO EXTREME 12491 * Sample game: BALDRSKYZERO EXTREME
...@@ -13810,7 +13887,7 @@ void SpecialHook5pb3(DWORD esp_base, HookParam *, BYTE index, DWORD *data, DWORD ...@@ -13810,7 +13887,7 @@ void SpecialHook5pb3(DWORD esp_base, HookParam *, BYTE index, DWORD *data, DWORD
13810 } 13887 }
13811 bool Insert5pbHook3() 13888 bool Insert5pbHook3()
13812 { 13889 {
13813 - const BYTE bytes[] = { // function starts 13890 + const BYTE bytes[] = { // function starts
13814 0x55, // 0025A130 55 PUSH EBP 13891 0x55, // 0025A130 55 PUSH EBP
13815 0x8b,0xec, // 0025A131 8BEC MOV EBP,ESP 13892 0x8b,0xec, // 0025A131 8BEC MOV EBP,ESP
13816 0x56, // 0025A133 56 PUSH ESI 13893 0x56, // 0025A133 56 PUSH ESI
...@@ -13841,7 +13918,6 @@ bool Insert5pbHook3() ...@@ -13841,7 +13918,6 @@ bool Insert5pbHook3()
13841 //DisableGDIHooks(); 13918 //DisableGDIHooks();
13842 return true; 13919 return true;
13843 } 13920 }
13844 -
13845 } // unnamed namespace 13921 } // unnamed namespace
13846 13922
13847 bool Insert5pbHook() 13923 bool Insert5pbHook()
...@@ -14473,6 +14549,60 @@ bool InsertLeafHook() ...@@ -14473,6 +14549,60 @@ bool InsertLeafHook()
14473 return true; 14549 return true;
14474 } 14550 }
14475 14551
14552 +/**
14553 + * mireado 8/01/2016: Add NekoPack hook
14554 + *
14555 + * See: http://sakuradite.com/topic/1470
14556 + * https://arallab.hided.net/board_codetalk/2605967
14557 + *
14558 + * [Pure More] 少女アクティビティ_trial 1.01
14559 + *
14560 + * base: 0x4000000
14561 + * binary pattern :: 558BEC81C4C4FDFFFFB8
14562 + */
14563 +
14564 +bool InsertNekopackHook()
14565 +{
14566 + const BYTE bytes[] = {
14567 + 0x55, // 0069637C /$ 55 PUSH EBP
14568 + 0x8b,0xec, // 0069637D |. 8BEC MOV EBP,ESP
14569 + 0x81,0xc4, 0xC4,0xFD,0xFF,0xFF, // 0069637F |. 81C4 C4FDFFFF ADD ESP,-23C
14570 + 0xb8, XX4, // 00696385 |. B8 A8FF7900 MOV EAX,OFFSET 0079FFA8
14571 + 0x53, // 0069638A |. 53 PUSH EBX
14572 + 0x56, // 0069638B |. 56 PUSH ESI
14573 + 0x57, // 0069638C |. 57 PUSH EDI
14574 + 0x8b,0x5d, 0x08 // 0069638D |. 8B5D 08 MOV EBX,DWORD PTR SS:[ARG.1]
14575 + };
14576 + ULONG range = min(module_limit_ - module_base_, MAX_REL_ADDR);
14577 + ULONG addr = MemDbg::matchBytes(bytes, sizeof(bytes), module_base_, module_base_ + range);
14578 + enum { addr_offset = 0 }; // distance to the beginning of the function, which is 0x55 (push ebp)
14579 + //GROWL(reladdr);
14580 + if (!addr) {
14581 + ConsoleOutput("vnreng:NekoPack: pattern not found");
14582 + return false;
14583 + }
14584 + addr += addr_offset;
14585 + //GROWL(addr);
14586 + enum { push_ebp = 0x55 }; // beginning of the function
14587 + if (*(BYTE *)addr != push_ebp) {
14588 + ConsoleOutput("vnreng:NekoPack: beginning of the function not found");
14589 + return false;
14590 + }
14591 +
14592 + HookParam hp = {};
14593 + hp.address = addr;
14594 + hp.offset = 8;
14595 + hp.type = USING_STRING;
14596 +
14597 + ConsoleOutput("vnreng: INSERT NekoPack");
14598 + NewHook(hp, "NekoPack");
14599 +
14600 + // Disable GDIHook(um.. ?), which is cached and hence missing characters.
14601 + //ConsoleOutput("vnreng:NekoPack: disable GDI hooks");
14602 + //DisableGDIHooks();
14603 + return true;
14604 +}
14605 +
14476 /** jichi 12/27/2014 LunaSoft 14606 /** jichi 12/27/2014 LunaSoft
14477 * Sample game: [141226] [LunaSoft] 悪堕ラビリンス -- /hsn8@46C5EF 14607 * Sample game: [141226] [LunaSoft] 悪堕ラビリンス -- /hsn8@46C5EF
14478 * 14608 *
......
...@@ -120,6 +120,7 @@ bool InsertMBLHook(); // MBL: *.mbl ...@@ -120,6 +120,7 @@ bool InsertMBLHook(); // MBL: *.mbl
120 bool InsertMEDHook(); // MED: *.med 120 bool InsertMEDHook(); // MED: *.med
121 bool InsertMinkHook(); // Mink: *.at2 121 bool InsertMinkHook(); // Mink: *.at2
122 //bool InsertMonoHook(); // Mono (Unity3D): */Mono/mono.dll 122 //bool InsertMonoHook(); // Mono (Unity3D): */Mono/mono.dll
123 +bool InsertNekopackHook(); // Nekopack: *.dat
123 bool InsertNeXASHook(); // NeXAS: Thumbnail.pac 124 bool InsertNeXASHook(); // NeXAS: Thumbnail.pac
124 bool InsertNextonHook(); // NEXTON: aInfo.db 125 bool InsertNextonHook(); // NEXTON: aInfo.db
125 bool InsertNexton1Hook(); 126 bool InsertNexton1Hook();
......
...@@ -121,7 +121,7 @@ bool DetermineEngineByFile1() ...@@ -121,7 +121,7 @@ bool DetermineEngineByFile1()
121 InsertSideBHook(); 121 InsertSideBHook();
122 return true; 122 return true;
123 } 123 }
124 - if (IthFindFile(L"bgi.*") || IthFindFile(L"BHVC.exe") || IthFindFile(L"sysgrp.arc")) { 124 + if (IthFindFile(L"bgi.*") || IthFindFile(L"sysgrp.arc")) {
125 InsertBGIHook(); 125 InsertBGIHook();
126 return true; 126 return true;
127 } 127 }
...@@ -329,6 +329,10 @@ bool DetermineEngineByFile3() ...@@ -329,6 +329,10 @@ bool DetermineEngineByFile3()
329 InsertStuffScriptHook(); 329 InsertStuffScriptHook();
330 return true; 330 return true;
331 } 331 }
332 + if (IthFindFile(L"USRDIR\\*.mpk")) { // jichi 12/2/2014
333 + InsertStuffScriptHook();
334 + return true;
335 + }
332 if (IthCheckFile(L"Execle.exe")) { 336 if (IthCheckFile(L"Execle.exe")) {
333 InsertTriangleHook(); 337 InsertTriangleHook();
334 return true; 338 return true;
...@@ -613,6 +617,9 @@ bool DetermineEngineAtLast() ...@@ -613,6 +617,9 @@ bool DetermineEngineAtLast()
613 if (IthFindFile(L"*.pak") // jichi 12/25/2014: too common 617 if (IthFindFile(L"*.pak") // jichi 12/25/2014: too common
614 && InsertLeafHook()) 618 && InsertLeafHook())
615 return true; 619 return true;
620 + if (IthFindFile(L"*.dat") // mireado 08/22/2016: too common
621 + && InsertNekopackHook())
622 + return true;
616 // jichi 10/31/2014 623 // jichi 10/31/2014
617 // File description: Adobe Flash Player 10.2r153 624 // File description: Adobe Flash Player 10.2r153
618 // Product name: Shockwave Flash 625 // Product name: Shockwave Flash
......