Merge remote-tracking branch 'Blu3train/Ages7EngineHooks'

This commit is contained in:
Chenx221 2024-09-05 11:30:36 +08:00
commit ce5c14efdb
3 changed files with 66 additions and 0 deletions

View File

@ -21728,6 +21728,66 @@ bool InsertNamcoPS2Hook()
} }
#endif // 0 #endif // 0
bool Ages7Filter(LPVOID data, DWORD *size, HookParam *, BYTE)
{
auto text = reinterpret_cast<LPWSTR>(data);
auto len = reinterpret_cast<size_t *>(size);
WideCharFilter(text, len, L'\x3000'); //IDSP
WideCharFilter(text, len, L'\x0001');
WideCharFilter(text, len, L'\x0002');
WideCharFilter(text, len, L'\x0003');
WideCharReplacer(text, len, 0x000A, L' ');
return true;
}
bool InsertAges7Hook()
{
//by Blu3train
/*
* Sample games:
* https://vndb.org/v93
* https://vndb.org/v92
* https://vndb.org/r38978
*/
const BYTE bytes[] = {
0x55, // 55 | push ebp |
0x8B, 0xEC, // 8BEC | mov ebp,esp |
0x6A, 0xFF, // 6A FF | push -01 |
0x68, XX4, // 68 XX4 | push exe+1FF8E2 |
0x64, 0xA1, 0x00, 0x00, 0x00, 0x00, //64 A1 00000000| mov eax,fs:[00000000] |
0x50, // 50 | push eax |
0x83, 0xEC, XX, // 83 EC 34 | sub esp,34 |
0x53, // 53 | push ebx |
0x56, // 56 | push esi |
0x57, // 57 | push edi |
0xA1, XX4, // A1 XX4 | mov eax,[exe+260014] |
0x33, 0xC5, // 33 C5 | xor eax,ebp |
0x50, // 50 | push eax |
0x8D, 0x45, 0xF4, // 8D 45 F4 | lea eax,[ebp-0C] |
0x64, 0xA3, 0x00, 0x00, 0x00, 0x00, //64 A3 00000000| mov fs:[00000000],eax |
0x8B, 0xF9, // 8B F9 | mov edi,ecx |
0x83, 0x7D, 0x0C, 0x00 // 83 7D 0C 00 | cmp dword ptr [ebp+0C],00 |
};
bool ok = false;
auto addrs = Util::SearchMemory(bytes, sizeof(bytes), PAGE_EXECUTE, processStartAddress, processStopAddress);
for(auto addr : addrs){
HookParam hp = {};
hp.address = addr;
hp.offset = 0xC;
hp.type = USING_UNICODE | USING_STRING | USING_SPLIT;
hp.split = 0x4;
hp.filter_fun = Ages7Filter;
NewHook(hp, "Ages7");
ok = true;
}
if (!ok)
ConsoleOutput("vnreng: Ages7: pattern not found");
return ok;
}
} // namespace Engine } // namespace Engine
// EOF // EOF

View File

@ -166,6 +166,8 @@ 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 InsertAges7Hook(); // AGES 7.0: Ages3ResT.dll
// CIRCUS: avdata/ // CIRCUS: avdata/
bool InsertCircusHook1(); bool InsertCircusHook1();
bool InsertCircusHook2(); bool InsertCircusHook2();

View File

@ -370,6 +370,10 @@ bool DetermineEngineByFile3()
bool DetermineEngineByFile4() bool DetermineEngineByFile4()
{ {
if (Util::CheckFile(L"Ages3ResT.dll")) {
if (InsertAges7Hook())
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
//ConsoleOutput("vnreng: IGNORE EAGLS"); //ConsoleOutput("vnreng: IGNORE EAGLS");
InsertEaglsHook(); InsertEaglsHook();