Merge remote-tracking branch 'Blu3train/A98sysHook'

This commit is contained in:
Chenx221 2024-09-05 11:53:03 +08:00
commit 5a1b218d35
3 changed files with 39 additions and 0 deletions

View File

@ -22994,6 +22994,40 @@ bool InsertNamcoPS2Hook()
} }
#endif // 0 #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;
}
bool CodeXFilter(LPVOID data, DWORD *size, HookParam *, BYTE) bool CodeXFilter(LPVOID data, DWORD *size, HookParam *, BYTE)
{ {
auto text = reinterpret_cast<LPSTR>(data); auto text = reinterpret_cast<LPSTR>(data);

View File

@ -168,6 +168,7 @@ void InsertRealliveHook(); // RealLive: RealLive*.exe
void InsertStuffScriptHook(); // Stuff: *.mpk void InsertStuffScriptHook(); // Stuff: *.mpk
bool InsertTinkerBellHook(); // TinkerBell: arc00.dat bool InsertTinkerBellHook(); // TinkerBell: arc00.dat
bool InsertWaffleHook(); // WAFFLE: cg.pak bool InsertWaffleHook(); // WAFFLE: cg.pak
bool InsertA98sysHook(); // A98sys: A98SYS.PAK
bool InsertKaleidoHook(); // Kaleido ADV Workshop: windata/script_body.bin bool InsertKaleidoHook(); // Kaleido ADV Workshop: windata/script_body.bin
bool InsertRpgmXPHook(); // Rpgm XP: *.rgssad bool InsertRpgmXPHook(); // Rpgm XP: *.rgssad
bool InsertMinoriHooks(); // Minori: *.paz bool InsertMinoriHooks(); // Minori: *.paz

View File

@ -372,6 +372,10 @@ bool DetermineEngineByFile3()
bool DetermineEngineByFile4() bool DetermineEngineByFile4()
{ {
if (Util::CheckFile(L"A98SYS.PAK")) {
if (InsertA98sysHook())
return true;
}
if (Util::CheckFile(L"*.xfl")) { if (Util::CheckFile(L"*.xfl")) {
if (InsertCodeXHook()) if (InsertCodeXHook())
return true; return true;