Merge remote-tracking branch 'Blu3train/SakanaGLEngineHook'

This commit is contained in:
Chenx221 2024-09-05 12:20:23 +08:00
commit dfae7f65c1
3 changed files with 41 additions and 0 deletions

View File

@ -23758,6 +23758,42 @@ bool InsertNamcoPS2Hook()
} }
#endif // 0 #endif // 0
bool InsertSakanaGLHook() {
//by Blu3train
/*
* Sample games:
* https://vndb.org/v46148
*/
const BYTE bytes[] = {
0x89, XX, // mov [ecx],eax <- hook here
0x33, XX, // xor ecx,ecx
0x85, XX // test ebx,ebx
};
HMODULE module = GetModuleHandleW(L"sakanagl.dll");
auto [minAddress, maxAddress] = Util::QueryModuleLimits(module);
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), minAddress, maxAddress);
if (!addr) {
ConsoleOutput("vnreng:SakanaGL: pattern not found");
return false;
}
HookParam hp = {};
hp.address = addr;
hp.offset = pusha_edx_off -4;
hp.index = 0;
hp.text_fun = [](DWORD esp_base, HookParam*, BYTE, DWORD *data, DWORD*, DWORD *len)
{
if ( regof(edi,esp_base) != 2)
return;
*len = strlen((char*)*data);
};
hp.type = USING_UTF8 | USING_STRING;
ConsoleOutput("vnreng: INSERT SakanaGL");
NewHook(hp, "SakanaGL");
return true;
}
bool InsertDebonosuWorksHook() { bool InsertDebonosuWorksHook() {
//by Blu3train //by Blu3train
/* /*

View File

@ -156,6 +156,7 @@ bool InsertWillPlusHook(); // WillPlus: Rio.arc
bool InsertWolfHook(); // Wolf: Data.wolf bool InsertWolfHook(); // Wolf: Data.wolf
bool InsertYukaSystemHooks(); // YukaSystem2: *.ykc bool InsertYukaSystemHooks(); // YukaSystem2: *.ykc
bool InsertYurisHook(); // YU-RIS: *.ypf bool InsertYurisHook(); // YU-RIS: *.ypf
bool InsertSakanaGLHook(); // SakanaGL: sakanagl.dll
bool InsertDebonosuWorksHook(); // DebonosuWorks: resource string bool InsertDebonosuWorksHook(); // DebonosuWorks: resource string
bool InsertLucaSystemHook(); // LucaSystem: *.iga bool InsertLucaSystemHook(); // LucaSystem: *.iga
bool InsertKogadoHook(); // Kogado: *.pak bool InsertKogadoHook(); // Kogado: *.pak

View File

@ -380,6 +380,10 @@ bool DetermineEngineByFile3()
bool DetermineEngineByFile4() bool DetermineEngineByFile4()
{ {
if (Util::CheckFile(L"sakanagl.dll")) {
if (InsertSakanaGLHook())
return true;
}
if (Util::SearchResourceString(L"でぼの巣製作所")) { if (Util::SearchResourceString(L"でぼの巣製作所")) {
if (InsertDebonosuWorksHook()) if (InsertDebonosuWorksHook())
return true; return true;