From 104b344324b0e2d4b7e3b697133fefe2f87ac74c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Sun, 17 Nov 2024 22:09:28 +0800 Subject: [PATCH] . --- cpp/LunaHook/LunaHook/engine32/EME.cpp | 78 +++++++++++++++++-- .../LunaHook/engines/ppsspp/specialgames.hpp | 10 +++ cpp/version.cmake | 2 +- 3 files changed, 83 insertions(+), 7 deletions(-) diff --git a/cpp/LunaHook/LunaHook/engine32/EME.cpp b/cpp/LunaHook/LunaHook/engine32/EME.cpp index cf8c4957..ba5dbebf 100644 --- a/cpp/LunaHook/LunaHook/engine32/EME.cpp +++ b/cpp/LunaHook/LunaHook/engine32/EME.cpp @@ -28,11 +28,13 @@ bool InsertEMEHook() HookParam hp; hp.address = addr; hp.offset = get_reg(regs::eax); - hp.type = NO_CONTEXT | DATA_INDIRECT | USING_STRING; - ConsoleOutput("INSERT EmonEngine"); - - // ConsoleOutput("EmonEngine, hook will only work with text speed set to slow or normal!"); - // else ConsoleOutput("Unknown EmonEngine engine"); + hp.type = NO_CONTEXT | DATA_INDIRECT | USING_CHAR; + hp.filter_fun = [](TextBuffer *buffer, HookParam *) + { + auto xx = buffer->strA(); + strReplace(xx, " ", ""); + buffer->from(xx); + }; return NewHook(hp, "EmonEngine"); } namespace @@ -60,17 +62,81 @@ namespace hp.filter_fun = [](TextBuffer *buffer, HookParam *) { auto xx = buffer->strA(); + strReplace(xx, " ", ""); static lru_cache last(10); if (last.touch(xx)) buffer->clear(); + else + buffer->from(xx); }; return NewHook(hp, "takeout"); }; return false; } } +namespace +{ + /* + v8 = (BYTE *)(*(_DWORD *)(this + 64) + v7); + if ( *v8 == 9 ) + { + *v8 = 0; + v9 = *(_DWORD *)(this + 68); + ++*(_WORD *)(this + 74); + *(_WORD *)(this + 72) = 0; + *(_DWORD *)(this + 68) = v9 + 1; + sub_413920(String1, 1); + return 1; + } + else + { + if ( IsDBCSLeadByte(*v8) ) + */ + bool emeengine() + { + BYTE sig[] = { + /* + .text:0042D05C mov cl, [eax] + .text:0042D05E cmp cl, 9 + .text:0042D061 jnz short loc_42D08E + */ + 0x8A, 0x08, + 0x80, 0xF9, 0x09, + 0x75, XX}; + BYTE tgt[] = { + /* + .text:0042D08E push ecx ; TestChar + .text:0042D08F call ds:IsDBCSLeadByte + */ + 0x51, + 0xFF, 0x15, XX4}; + auto __IsDBCSLeadByte = Util::FindImportEntry(processStartAddress, (DWORD)IsDBCSLeadByte); + if (!__IsDBCSLeadByte) + return false; + *(DWORD *)(tgt + 3) = __IsDBCSLeadByte; + for (auto addr : Util::SearchMemory(sig, sizeof(sig), PAGE_EXECUTE_READWRITE, processStartAddress, processStopAddress)) + { + auto off = *(BYTE *)(addr + sizeof(sig) - 1); + auto target = addr + sizeof(sig) + off; + if (memcmp((void *)target, tgt, sizeof(tgt)) != 0) + continue; + HookParam hp; + hp.address = addr; + hp.offset = get_reg(regs::eax); + hp.type = NO_CONTEXT | DATA_INDIRECT | USING_CHAR; + hp.filter_fun = [](TextBuffer *buffer, HookParam *) + { + auto xx = buffer->strA(); + strReplace(xx, " ", ""); + buffer->from(xx); + }; + return NewHook(hp, "EmonEngine2"); + } + return InsertEMEHook(); + } +} bool EME::attach_function() { - return InsertEMEHook() | takeout(); + return emeengine() | takeout(); } \ No newline at end of file diff --git a/cpp/LunaHook/LunaHook/engines/ppsspp/specialgames.hpp b/cpp/LunaHook/LunaHook/engines/ppsspp/specialgames.hpp index e0b7fc92..c092192d 100644 --- a/cpp/LunaHook/LunaHook/engines/ppsspp/specialgames.hpp +++ b/cpp/LunaHook/LunaHook/engines/ppsspp/specialgames.hpp @@ -248,6 +248,13 @@ namespace ppsspp { StringCharReplacer(buffer, "\\n", 2, '\n'); } + void ULJM06129(TextBuffer *buffer, HookParam *hp) + { + auto s = buffer->strA(); + s = std::regex_replace(s, std::regex(R"(#\w+?\[\d\])"), ""); + strReplace(s, "#n", ""); + buffer->from(s); + } void FNPJH50247(TextBuffer *buffer, HookParam *hp) { static lru_cache cache(3); @@ -402,6 +409,9 @@ namespace ppsspp {0x8955CE0, {0, 0, 0, ULJM05810, 0, "ULJM05810"}}, // Fate/EXTRA {0x88B87F0, {0, 6, 0, 0, FNPJH50247, "NPJH50247"}}, + // 十鬼の絆 + {0x891AAAC, {0, 0, 0, 0, ULJM06129, "ULJM06129"}}, // text + {0x886E094, {0, 0, 0, 0, ULJM06129, "ULJM06129"}}, // name+text }; } \ No newline at end of file diff --git a/cpp/version.cmake b/cpp/version.cmake index 3a6c519a..3da5bbeb 100644 --- a/cpp/version.cmake +++ b/cpp/version.cmake @@ -1,7 +1,7 @@ set(VERSION_MAJOR 6) set(VERSION_MINOR 3) -set(VERSION_PATCH 2) +set(VERSION_PATCH 3) set(VERSION_REVISION 0) add_definitions(-DVERSION_MAJOR=${VERSION_MAJOR}) add_definitions(-DVERSION_MINOR=${VERSION_MINOR})