From ec035d8feaa178240bcfdfccbb97f91ab64c29ec Mon Sep 17 00:00:00 2001 From: Blu3train Date: Fri, 14 Apr 2023 00:56:29 +0200 Subject: [PATCH] Ages 7.0 engine hooks --- texthook/engine/engine.cc | 38 ++++++++++++++++++++++++++++++++++++++ texthook/engine/engine.h | 2 ++ texthook/engine/match32.cc | 4 ++++ 3 files changed, 44 insertions(+) diff --git a/texthook/engine/engine.cc b/texthook/engine/engine.cc index 61d5140..cd7210d 100644 --- a/texthook/engine/engine.cc +++ b/texthook/engine/engine.cc @@ -21728,6 +21728,44 @@ bool InsertNamcoPS2Hook() } #endif // 0 +bool InsertAges7Hook() +{ + //by Blu3train + 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, 0x34, // 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; + NewHook(hp, "Ages7"); + ok = true; + } + if (!ok) + ConsoleOutput("vnreng: Ages7: pattern not found"); + return ok; +} + } // namespace Engine // EOF diff --git a/texthook/engine/engine.h b/texthook/engine/engine.h index e8e401e..eeaa824 100644 --- a/texthook/engine/engine.h +++ b/texthook/engine/engine.h @@ -166,6 +166,8 @@ void InsertStuffScriptHook(); // Stuff: *.mpk bool InsertTinkerBellHook(); // TinkerBell: arc00.dat bool InsertWaffleHook(); // WAFFLE: cg.pak +bool InsertAges7Hook(); // AGES 7.0: Ages3ResT.dll + // CIRCUS: avdata/ bool InsertCircusHook1(); bool InsertCircusHook2(); diff --git a/texthook/engine/match32.cc b/texthook/engine/match32.cc index fffc4c7..556854c 100644 --- a/texthook/engine/match32.cc +++ b/texthook/engine/match32.cc @@ -370,6 +370,10 @@ bool DetermineEngineByFile3() 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 //ConsoleOutput("vnreng: IGNORE EAGLS"); InsertEaglsHook();