Cliel2 engine hook

This commit is contained in:
Blu3train 2023-08-06 01:07:47 +02:00
parent d6a01088c6
commit c973196e24
3 changed files with 44 additions and 8 deletions

View File

@ -21735,12 +21735,10 @@ bool CielFilter(LPVOID data, DWORD *size, HookParam *, BYTE)
if (*len == 1) return false; if (*len == 1) return false;
//StringCharReplacer(text, len, "^n", 2, ' ');
return true; return true;
} }
bool InsertCielHook() bool InsertCiel1Hook()
{ {
//by Blu3train //by Blu3train
/* /*
@ -21761,7 +21759,7 @@ bool InsertCielHook()
ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR); ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR);
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range); ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range);
if (!addr) { if (!addr) {
ConsoleOutput("vnreng:Ciel: pattern not found"); ConsoleOutput("vnreng:Ciel1: pattern not found");
return false; return false;
} }
@ -21772,11 +21770,49 @@ bool InsertCielHook()
hp.length_offset = 1; hp.length_offset = 1;
hp.type = DATA_INDIRECT; hp.type = DATA_INDIRECT;
hp.filter_fun = CielFilter; hp.filter_fun = CielFilter;
ConsoleOutput("vnreng: INSERT Ciel"); ConsoleOutput("vnreng: INSERT Ciel1");
NewHook(hp, "Ciel"); NewHook(hp, "Ciel1");
return true; return true;
} }
bool InsertCiel2Hook()
{
//by Blu3train
/*
* Sample games:
* https://vndb.org/r5101
*/
const BYTE bytes[] = {
0x68, XX4, // push after.exe+94518 << hook here
0x50, // push eax
0xE8, XX4, // call after.exe+711F0
0x83, 0xC4, 0x0C, // add esp,0C
0x85, 0xC0, // test eax,eax
0x0F, 0x85, XX4, // jne after.exe+A2E4
0x8B, 0x93, XX4 // mov edx,[ebx+000BE000]
};
ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR);
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range);
if (!addr) {
ConsoleOutput("vnreng:Ciel2: pattern not found");
return false;
}
HookParam hp = {};
hp.address = addr;
hp.offset = pusha_eax_off -4;
hp.index = 0;
hp.length_offset = 1;
hp.type = DATA_INDIRECT;
ConsoleOutput("vnreng: INSERT Ciel2");
NewHook(hp, "Ciel2");
return true;
}
bool InsertCielHooks()
{ return InsertCiel1Hook() || InsertCiel2Hook();}
} // namespace Engine } // namespace Engine
// EOF // EOF

View File

@ -165,7 +165,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 InsertCielHook(); // Ciel: sys/kidoku.dat bool InsertCielHooks(); // Ciel: sys/kidoku.dat
// CIRCUS: avdata/ // CIRCUS: avdata/
bool InsertCircusHook1(); bool InsertCircusHook1();

View File

@ -371,7 +371,7 @@ bool DetermineEngineByFile3()
bool DetermineEngineByFile4() bool DetermineEngineByFile4()
{ {
if (Util::CheckFile(L"sys/kidoku.dat")) { if (Util::CheckFile(L"sys/kidoku.dat")) {
if (InsertCielHook()) if (InsertCielHooks())
return true; return true;
} }
if (Util::CheckFile(L"EAGLS.dll")) { // jichi 3/24/2014: E.A.G.L.S if (Util::CheckFile(L"EAGLS.dll")) { // jichi 3/24/2014: E.A.G.L.S