System42 engine hook

This commit is contained in:
Blu3train 2023-12-28 11:28:50 +01:00
parent f3fbe04409
commit a82e95b421
3 changed files with 56 additions and 5 deletions

View File

@ -5539,6 +5539,53 @@ bool InsertSystem43Hook()
return ok; return ok;
} }
bool System42Filter(LPVOID data, DWORD *size, HookParam *, BYTE)
{
auto text = reinterpret_cast<LPSTR>(data);
auto len = reinterpret_cast<size_t *>(size);
if (*len == 1)
return false;
if (all_ascii(text, *len)) {
CharReplacer(text, len, '`', ' ');
CharReplacer(text, len, '\x7D', '-');
}
return true;
}
bool InsertSystem42Hook() {
//by Blu3train
/*
* Sample games:
* https://vndb.org/v1427
*/
const BYTE bytes[] = {
0x8B, 0x46, 0x04, // mov eax,[esi+04]
0x57, // push edi
0x52, // push edx
0x50, // push eax
0xE8, XX4 // call Sys42VM.DLL+4B5B0
};
HMODULE module = GetModuleHandleW(L"Sys42VM.dll");
auto [minAddress, maxAddress] = Util::QueryModuleLimits(module);
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), minAddress, maxAddress);
if (!addr)
return false;
HookParam hp = {};
hp.address = addr;
hp.offset = pusha_edx_off -4;
hp.split = pusha_esp_off -4;
hp.type = NO_CONTEXT | USING_STRING | USING_SPLIT;
hp.filter_fun = System42Filter;
ConsoleOutput("vnreng: INSERT System42");
NewHook(hp, "System42");
return true;
}
/******************************************************************************************** /********************************************************************************************
AtelierKaguya hook: AtelierKaguya hook:
Game folder contains message.dat. Used by AtelierKaguya games. Game folder contains message.dat. Used by AtelierKaguya games.

View File

@ -143,6 +143,7 @@ bool InsertSiglusHook(); // SiglusEngine: SiglusEngine.exe
bool InsertSideBHook(); // SideB: Copyright side-B bool InsertSideBHook(); // SideB: Copyright side-B
bool InsertSilkysHook(); // SilkysPlus bool InsertSilkysHook(); // SilkysPlus
bool InsertSyuntadaHook(); // Syuntada: dSoh.dat bool InsertSyuntadaHook(); // Syuntada: dSoh.dat
bool InsertSystem42Hook(); // System42@AliceSoft: AliceStart.ini DLL/Sys42VM.dll
bool InsertSystem43Hook(); // System43@AliceSoft: AliceStart.ini bool InsertSystem43Hook(); // System43@AliceSoft: AliceStart.ini
bool InsertSystemAoiHook(); // SystemAoi: *.vfs bool InsertSystemAoiHook(); // SystemAoi: *.vfs
bool InsertTamamoHook(); // Tamamo bool InsertTamamoHook(); // Tamamo

View File

@ -557,6 +557,14 @@ bool DetermineEngineByProcessName()
bool DetermineEngineOther() bool DetermineEngineOther()
{ {
// jichi 12/26/2013: Add this after alicehook
if (Util::CheckFile(L"AliceStart.ini")) {
if (Util::CheckFile(L"DLL/Sys42VM.dll"))
if (InsertSystem42Hook())
return true;
if (InsertSystem43Hook())
return true;
}
if (InsertAliceHook()) if (InsertAliceHook())
return true; return true;
// jichi 1/19/2015: Disable inserting Lstr for System40 // jichi 1/19/2015: Disable inserting Lstr for System40
@ -565,11 +573,6 @@ bool DetermineEngineOther()
ConsoleOutput("vnreng: IGNORE old System40.ini"); ConsoleOutput("vnreng: IGNORE old System40.ini");
return true; return true;
} }
// jichi 12/26/2013: Add this after alicehook
if (Util::CheckFile(L"AliceStart.ini")) {
InsertSystem43Hook();
return true;
}
// Artikash 7/16/2018: Uses node/libuv: likely v8 - sample game https://vndb.org/v22975 // Artikash 7/16/2018: Uses node/libuv: likely v8 - sample game https://vndb.org/v22975
//if (GetProcAddress(GetModuleHandleW(nullptr), "uv_uptime") || GetModuleHandleW(L"node.dll")) //if (GetProcAddress(GetModuleHandleW(nullptr), "uv_uptime") || GetModuleHandleW(L"node.dll"))