DxLib engine hook

This commit is contained in:
Blu3train 2023-06-02 14:23:03 +02:00
parent f3fbe04409
commit 9a716c4f9e
3 changed files with 53 additions and 0 deletions

View File

@ -21728,6 +21728,54 @@ bool InsertNamcoPS2Hook()
}
#endif // 0
bool DxLibFilter(LPVOID data, DWORD *size, HookParam *, BYTE)
{
auto text = reinterpret_cast<LPSTR>(data);
auto len = reinterpret_cast<size_t *>(size);
StringCharReplacer(text, len, "%N", 2, ' ');
StringFilter(text, len, "%K", 2);
StringFilter(text, len, "%P", 2);
return true;
}
bool InsertDxLibHook()
{
//by Blu3train
/*
* Sample games:
* https://vndb.org/v7849
* https://vndb.org/v10231
*/
const BYTE bytes[] = {
0xF7, 0xC6, XX4, // test esi,00000003 << hook here
0x75, XX, // jne BookofShadows.exe+15FE54
0x8B, 0xD9, // mov ebx,ecx
0xC1, 0xE9, 0x02, // shr ecx,02
0x75, XX, // jne BookofShadows.exe+15FEAE
0xEB, XX // jmp BookofShadows.exe+15FE76
};
ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR);
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range);
if (!addr) {
ConsoleOutput("vnreng:DxLib: pattern not found");
return false;
}
HookParam hp = {};
hp.address = addr;
//hp.offset = pusha_edx_off -4;
hp.offset = pusha_esi_off -4;
hp.index = 0;
hp.type = USING_STRING;
hp.filter_fun = DxLibFilter;
ConsoleOutput("vnreng: INSERT DxLib");
NewHook(hp, "DxLib");
return true;
}
} // namespace Engine
// EOF

View File

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

View File

@ -370,6 +370,10 @@ bool DetermineEngineByFile3()
bool DetermineEngineByFile4()
{
if (Util::CheckFile(L"*.bcx")) {
if (InsertDxLibHook())
return true;
}
if (Util::CheckFile(L"EAGLS.dll")) { // jichi 3/24/2014: E.A.G.L.S
//ConsoleOutput("vnreng: IGNORE EAGLS");
InsertEaglsHook();