diff --git a/texthook/engine/engine.cc b/texthook/engine/engine.cc index c2c7abc..8a7edf4 100644 --- a/texthook/engine/engine.cc +++ b/texthook/engine/engine.cc @@ -21728,6 +21728,40 @@ bool InsertNamcoPS2Hook() } #endif // 0 +bool InsertA98sysHook() +{ + //by Blu3train + /* + * Sample games: + * https://vndb.org/v2477 + */ + const BYTE bytes[] = { + 0x56, // push esi << hook here + 0xE8, XX4, // call HEARTWORK.EXE+134F0 + 0x83, 0xC4, 0x38, // add esp,38 + 0x5F, // pop edi + 0x5D, // pop ebp + 0x5B, // pop ebx + 0xE8, XX4 // call HEARTWORK.EXE+1AF80 + }; + + ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR); + ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range); + if (!addr) { + ConsoleOutput("vnreng:A98sys: pattern not found"); + return false; + } + + HookParam hp = {}; + hp.address = addr; + hp.offset = pusha_ecx_off -4; + hp.index = 0; + hp.type = USING_STRING; + ConsoleOutput("vnreng: INSERT A98sys"); + NewHook(hp, "A98sys"); + return true; +} + } // namespace Engine // EOF diff --git a/texthook/engine/engine.h b/texthook/engine/engine.h index 5e167b2..7bc07fb 100644 --- a/texthook/engine/engine.h +++ b/texthook/engine/engine.h @@ -165,6 +165,7 @@ void InsertRealliveHook(); // RealLive: RealLive*.exe void InsertStuffScriptHook(); // Stuff: *.mpk bool InsertTinkerBellHook(); // TinkerBell: arc00.dat bool InsertWaffleHook(); // WAFFLE: cg.pak +bool InsertA98sysHook(); // A98sys: A98SYS.PAK // CIRCUS: avdata/ bool InsertCircusHook1(); diff --git a/texthook/engine/match32.cc b/texthook/engine/match32.cc index fffc4c7..9dc2d7e 100644 --- a/texthook/engine/match32.cc +++ b/texthook/engine/match32.cc @@ -370,6 +370,10 @@ bool DetermineEngineByFile3() bool DetermineEngineByFile4() { + if (Util::CheckFile(L"A98SYS.PAK")) { + if (InsertA98sysHook()) + return true; + } if (Util::CheckFile(L"EAGLS.dll")) { // jichi 3/24/2014: E.A.G.L.S //ConsoleOutput("vnreng: IGNORE EAGLS"); InsertEaglsHook();