From 270b7722f8a95b06f78c2952de97c409f7273934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Thu, 15 Feb 2024 14:09:12 +0800 Subject: [PATCH] Update Leaf.cpp --- LunaHook/engine32/Leaf.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/LunaHook/engine32/Leaf.cpp b/LunaHook/engine32/Leaf.cpp index 9eed5a8..10f788b 100644 --- a/LunaHook/engine32/Leaf.cpp +++ b/LunaHook/engine32/Leaf.cpp @@ -581,9 +581,37 @@ bool InsertAquaplus2Hook() hp.filter_fun = AquaplusFilter; return NewHook(hp, "Aquaplus2"); } +bool InsertAquaplus3Hook() +{ + /* + * Sample games: + * Dungeon Travelers 2: The Royal Library & the Monster Seal + */ + const BYTE bytes[] = { + 0xCC, // int 3 + 0x80, 0x3D, XX4, 0x00, // cmp byte ptr [DT2_en.exe+3052EC],00 << hook here + 0x75, 0x67, // jne DT2_en.exe+89DC0 + 0x56, // push esi + 0xBA, XX4 // mov edx,DT2_en.exe+3051E0 + }; + ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR); + ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range); + if (!addr) { + ConsoleOutput("vnreng:Aquaplus3: pattern not found"); + return false; + } + + HookParam hp = {}; + hp.address = addr + 1; + hp.offset = get_reg(regs::eax); + hp.index = 0; + hp.type = CODEC_UTF8 | USING_STRING | NO_CONTEXT; + hp.filter_fun = NewLineCharToSpaceFilterA; + return NewHook(hp, "Aquaplus3"); +} bool InsertAquaplusHooks() -{ return InsertAquaplus1Hook() || InsertAquaplus2Hook();} +{ return InsertAquaplus1Hook() || InsertAquaplus2Hook()||InsertAquaplus3Hook();} namespace{ bool kizuato(){