diff --git a/texthook/engine/engine.cc b/texthook/engine/engine.cc index ec8d9ae..550a481 100644 --- a/texthook/engine/engine.cc +++ b/texthook/engine/engine.cc @@ -22578,6 +22578,48 @@ bool InsertNamcoPS2Hook() } #endif // 0 +bool GameMakerFilter(LPVOID data, DWORD *size, HookParam *, BYTE) +{ + CharFilter(reinterpret_cast(data), reinterpret_cast(size), '#'); + return true; +} + +bool InsertGameMakerHook() +{ + //by Blu3train + /* + * Sample games: + * VA-11 Hall A + */ + const BYTE bytes[] = { + 0x85, 0xF6, // test esi,esi + 0x74, XX, // je "VA-11 Hall A.exe"+D5014 + 0x85, 0xC0, // test eax,eax + 0x74, XX, // je "VA-11 Hall A.exe"+D5014 + 0x50, // push eax + 0x56 // push esi << hook here + }; + enum { addr_offset = sizeof(bytes) - 1 }; + + ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR); + ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range); + if (!addr) { + ConsoleOutput("vnreng:GameMaker: pattern not found"); + return false; + } + + HookParam hp = {}; + hp.address = addr + addr_offset; + hp.offset = pusha_eax_off -4; + hp.index = 0; + hp.type = USING_STRING | NO_CONTEXT; + hp.filter_fun = GameMakerFilter; + ConsoleOutput("vnreng: INSERT GameMaker"); + NewHook(hp, "GameMaker"); + ConsoleOutput("vnreng:GameMaker: use regex filter .+\\]"); + return true; +} + bool KaleidoFilter(LPVOID data, DWORD *size, HookParam *, BYTE) { auto text = reinterpret_cast(data); diff --git a/texthook/engine/engine.h b/texthook/engine/engine.h index add6002..b9b8f3d 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 InsertGameMakerHook(); // GameMaker: GMResource.dll void InsertBrunsHook(); // Bruns: bruns.exe void InsertIronGameSystemHook();// IroneGameSystem: igs_sample.exe diff --git a/texthook/engine/match32.cc b/texthook/engine/match32.cc index 1240f49..50a0d1d 100644 --- a/texthook/engine/match32.cc +++ b/texthook/engine/match32.cc @@ -372,6 +372,10 @@ bool DetermineEngineByFile3() bool DetermineEngineByFile4() { + if (Util::CheckFile(L"GMResource.dll")) { + if (InsertGameMakerHook()) + return true; + } if (Util::CheckFile(L"windata/script_body.bin")) { if (InsertKaleidoHook()) return true;