Merge remote-tracking branch 'Blu3train/GameMakerEngineHooks'

This commit is contained in:
Chenx221 2024-09-05 11:49:54 +08:00
commit 755d9d2e1d
3 changed files with 47 additions and 0 deletions

View File

@ -22578,6 +22578,48 @@ bool InsertNamcoPS2Hook()
} }
#endif // 0 #endif // 0
bool GameMakerFilter(LPVOID data, DWORD *size, HookParam *, BYTE)
{
CharFilter(reinterpret_cast<LPSTR>(data), reinterpret_cast<size_t*>(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) bool KaleidoFilter(LPVOID data, DWORD *size, HookParam *, BYTE)
{ {
auto text = reinterpret_cast<LPSTR>(data); auto text = reinterpret_cast<LPSTR>(data);

View File

@ -156,6 +156,7 @@ bool InsertWillPlusHook(); // WillPlus: Rio.arc
bool InsertWolfHook(); // Wolf: Data.wolf bool InsertWolfHook(); // Wolf: Data.wolf
bool InsertYukaSystem2Hook(); // YukaSystem2: *.ykc bool InsertYukaSystem2Hook(); // YukaSystem2: *.ykc
bool InsertYurisHook(); // YU-RIS: *.ypf bool InsertYurisHook(); // YU-RIS: *.ypf
bool InsertGameMakerHook(); // GameMaker: GMResource.dll
void InsertBrunsHook(); // Bruns: bruns.exe void InsertBrunsHook(); // Bruns: bruns.exe
void InsertIronGameSystemHook();// IroneGameSystem: igs_sample.exe void InsertIronGameSystemHook();// IroneGameSystem: igs_sample.exe

View File

@ -372,6 +372,10 @@ bool DetermineEngineByFile3()
bool DetermineEngineByFile4() bool DetermineEngineByFile4()
{ {
if (Util::CheckFile(L"GMResource.dll")) {
if (InsertGameMakerHook())
return true;
}
if (Util::CheckFile(L"windata/script_body.bin")) { if (Util::CheckFile(L"windata/script_body.bin")) {
if (InsertKaleidoHook()) if (InsertKaleidoHook())
return true; return true;