From 5c7632e91932dce0f7e9cac43f06ae7b8ae8b68b Mon Sep 17 00:00:00 2001 From: Blu3train Date: Sat, 14 Oct 2023 01:54:50 +0200 Subject: [PATCH] Triangle Pix engine hook --- texthook/engine/engine.cc | 36 ++++++++++++++++++++++++++++++++++++ texthook/engine/engine.h | 1 + texthook/engine/match32.cc | 4 ++++ 3 files changed, 41 insertions(+) diff --git a/texthook/engine/engine.cc b/texthook/engine/engine.cc index c2c7abc..6936408 100644 --- a/texthook/engine/engine.cc +++ b/texthook/engine/engine.cc @@ -21728,6 +21728,42 @@ bool InsertNamcoPS2Hook() } #endif // 0 +bool InsertTrianglePixHook() +{ + //by Blu3train + /* + * Sample games: + * https://vndb.org/v38070 + * https://vndb.org/v42090 + * https://vndb.org/v41025 + */ + const BYTE bytes[] = { + 0x50, // push eax << hook here + 0xE8, XX4, // call FinalIgnition.exe+4DE10 + 0x8B, 0x83, XX4, // mov eax,[ebx+0000DCA0] + 0x8D, 0x8D, XX4, // lea ecx,[ebp-0000022C] + 0x83, 0x7D, 0x44, 0x10, // cmp dword ptr [ebp+44],10 + 0xFF, 0x75, 0x40 // push [ebp+40] + }; + + ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR); + ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range); + if (!addr) { + ConsoleOutput("vnreng:TrianglePix: pattern not found"); + return false; + } + + HookParam hp = {}; + hp.address = addr; + hp.offset = pusha_eax_off -4; + hp.index = 0; + hp.type = USING_UTF8 | USING_STRING | NO_CONTEXT; + hp.filter_fun = NewLineCharToSpaceFilter; + ConsoleOutput("vnreng: INSERT TrianglePix"); + NewHook(hp, "TrianglePix"); + return true; +} + } // namespace Engine // EOF diff --git a/texthook/engine/engine.h b/texthook/engine/engine.h index 5e167b2..3f7ef77 100644 --- a/texthook/engine/engine.h +++ b/texthook/engine/engine.h @@ -156,6 +156,7 @@ bool InsertWillPlusHook(); // WillPlus: Rio.arc bool InsertWolfHook(); // Wolf: Data.wolf bool InsertYukaSystem2Hook(); // YukaSystem2: *.ykc bool InsertYurisHook(); // YU-RIS: *.ypf +bool InsertTrianglePixHook(); // Triangle Pix: pix.bin void InsertBrunsHook(); // Bruns: bruns.exe void InsertIronGameSystemHook();// IroneGameSystem: igs_sample.exe diff --git a/texthook/engine/match32.cc b/texthook/engine/match32.cc index fffc4c7..5104477 100644 --- a/texthook/engine/match32.cc +++ b/texthook/engine/match32.cc @@ -370,6 +370,10 @@ bool DetermineEngineByFile3() bool DetermineEngineByFile4() { + if (Util::CheckFile(L"pix.bin")) { + if (InsertTrianglePixHook()) + return true; + } if (Util::CheckFile(L"EAGLS.dll")) { // jichi 3/24/2014: E.A.G.L.S //ConsoleOutput("vnreng: IGNORE EAGLS"); InsertEaglsHook();