mireado
Committed by GitHub

Merge pull request #2 from IJEMIN/master

Pal binary pattern update
...@@ -12378,8 +12378,37 @@ static bool InsertNewPalHook() ...@@ -12378,8 +12378,37 @@ static bool InsertNewPalHook()
12378 NewHook(hp, "Pal"); 12378 NewHook(hp, "Pal");
12379 return true; 12379 return true;
12380 } 12380 }
12381 +// Eguni 2016/11/06
12382 +// Supporting new Pal engine, tested with 恋×シンアイ彼女
12383 +static bool InsertNewPal2Hook()
12384 +{
12385 + const BYTE bytes[] = {
12386 + 0x55, // 0136e220 55 push ebp
12387 + 0x8b,0xec, // 0136e221 8bec mov ebp,esp
12388 + 0x83,0xec, 0x7c, // 0136e226 83ec 7c sub esp,0x7c
12389 + 0xa1, XX4, // 0136e226 a1 788d3b01 mov eax,dword ptr ds:[0x2f008c]
12390 + 0x33,0xc5, // 0136e22b 33c5 xor eax,ebp
12391 + 0x89,0x45, 0xfc, // 0136e22d 8945 fc mov dword ptr ss:[ebp-0x4],eax
12392 + 0xe8 // 0136e230 e8 call 01377800
12393 + };
12394 + ULONG range = min(module_limit_ - module_base_, MAX_REL_ADDR);
12395 + ULONG addr = MemDbg::matchBytes(bytes, sizeof(bytes), module_base_, module_base_ + range);
12396 + if (!addr) {
12397 + ConsoleOutput("vnreng:Pal: pattern not found");
12398 + return false;
12399 + }
12400 +
12401 + HookParam hp = {};
12402 + hp.address = addr;
12403 + //hp.type = NO_CONTEXT|USING_SPLIT|DATA_INDIRECT; // 0x418
12404 + hp.type = RELATIVE_SPLIT; // Use relative address to prevent floating issue
12405 + hp.offset = 4 * 2; // arg2
12406 + ConsoleOutput("vnreng: INSERT Pal");
12407 + NewHook(hp, "Pal");
12408 + return true;
12409 +}
12381 bool InsertPalHook() // use Old Pal first, which does not have ruby 12410 bool InsertPalHook() // use Old Pal first, which does not have ruby
12382 -{ return InsertOldPalHook() || InsertNewPalHook(); } 12411 +{ return InsertOldPalHook() || InsertNewPal2Hook() || InsertNewPalHook(); }
12383 12412
12384 /** jichi 7/6/2014 NeXAS 12413 /** jichi 7/6/2014 NeXAS
12385 * Sample game: BALDRSKYZERO EXTREME 12414 * Sample game: BALDRSKYZERO EXTREME
......