From 2022aa042ea60a303f8de47a329a0710ba55fb8e Mon Sep 17 00:00:00 2001 From: Eguni Date: Wed, 16 Nov 2016 03:24:11 +0900 Subject: [PATCH] Pal binary pattern update --- vnr/vnrhook/src/engine/engine.cc | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/vnr/vnrhook/src/engine/engine.cc b/vnr/vnrhook/src/engine/engine.cc index 4f64822..62fc6ad 100644 --- a/vnr/vnrhook/src/engine/engine.cc +++ b/vnr/vnrhook/src/engine/engine.cc @@ -12378,8 +12378,37 @@ static bool InsertNewPalHook() NewHook(hp, "Pal"); return true; } +// Eguni 2016/11/06 +// Supporting new Pal engine, tested with 恋×シンアイ彼女 +static bool InsertNewPal2Hook() +{ + const BYTE bytes[] = { + 0x55, // 0136e220 55 push ebp + 0x8b,0xec, // 0136e221 8bec mov ebp,esp + 0x83,0xec, 0x7c, // 0136e226 83ec 7c sub esp,0x7c + 0xa1, XX4, // 0136e226 a1 788d3b01 mov eax,dword ptr ds:[0x2f008c] + 0x33,0xc5, // 0136e22b 33c5 xor eax,ebp + 0x89,0x45, 0xfc, // 0136e22d 8945 fc mov dword ptr ss:[ebp-0x4],eax + 0xe8 // 0136e230 e8 call 01377800 + }; + ULONG range = min(module_limit_ - module_base_, MAX_REL_ADDR); + ULONG addr = MemDbg::matchBytes(bytes, sizeof(bytes), module_base_, module_base_ + range); + if (!addr) { + ConsoleOutput("vnreng:Pal: pattern not found"); + return false; + } + + HookParam hp = {}; + hp.address = addr; + //hp.type = NO_CONTEXT|USING_SPLIT|DATA_INDIRECT; // 0x418 + hp.type = RELATIVE_SPLIT; // Use relative address to prevent floating issue + hp.offset = 4 * 2; // arg2 + ConsoleOutput("vnreng: INSERT Pal"); + NewHook(hp, "Pal"); + return true; +} bool InsertPalHook() // use Old Pal first, which does not have ruby -{ return InsertOldPalHook() || InsertNewPalHook(); } +{ return InsertOldPalHook() || InsertNewPal2Hook() || InsertNewPalHook(); } /** jichi 7/6/2014 NeXAS * Sample game: BALDRSKYZERO EXTREME