This commit is contained in:
恍兮惚兮 2024-11-17 22:09:28 +08:00
parent d896f14d92
commit 104b344324
3 changed files with 83 additions and 7 deletions

View File

@ -28,11 +28,13 @@ bool InsertEMEHook()
HookParam hp; HookParam hp;
hp.address = addr; hp.address = addr;
hp.offset = get_reg(regs::eax); hp.offset = get_reg(regs::eax);
hp.type = NO_CONTEXT | DATA_INDIRECT | USING_STRING; hp.type = NO_CONTEXT | DATA_INDIRECT | USING_CHAR;
ConsoleOutput("INSERT EmonEngine"); hp.filter_fun = [](TextBuffer *buffer, HookParam *)
{
// ConsoleOutput("EmonEngine, hook will only work with text speed set to slow or normal!"); auto xx = buffer->strA();
// else ConsoleOutput("Unknown EmonEngine engine"); strReplace(xx, " ", "");
buffer->from(xx);
};
return NewHook(hp, "EmonEngine"); return NewHook(hp, "EmonEngine");
} }
namespace namespace
@ -60,17 +62,81 @@ namespace
hp.filter_fun = [](TextBuffer *buffer, HookParam *) hp.filter_fun = [](TextBuffer *buffer, HookParam *)
{ {
auto xx = buffer->strA(); auto xx = buffer->strA();
strReplace(xx, " ", "");
static lru_cache<std::string> last(10); static lru_cache<std::string> last(10);
if (last.touch(xx)) if (last.touch(xx))
buffer->clear(); buffer->clear();
else
buffer->from(xx);
}; };
return NewHook(hp, "takeout"); return NewHook(hp, "takeout");
}; };
return false; 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() bool EME::attach_function()
{ {
return InsertEMEHook() | takeout(); return emeengine() | takeout();
} }

View File

@ -248,6 +248,13 @@ namespace ppsspp
{ {
StringCharReplacer(buffer, "\\n", 2, '\n'); 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) void FNPJH50247(TextBuffer *buffer, HookParam *hp)
{ {
static lru_cache<std::string> cache(3); static lru_cache<std::string> cache(3);
@ -402,6 +409,9 @@ namespace ppsspp
{0x8955CE0, {0, 0, 0, ULJM05810, 0, "ULJM05810"}}, {0x8955CE0, {0, 0, 0, ULJM05810, 0, "ULJM05810"}},
// Fate/EXTRA // Fate/EXTRA
{0x88B87F0, {0, 6, 0, 0, FNPJH50247, "NPJH50247"}}, {0x88B87F0, {0, 6, 0, 0, FNPJH50247, "NPJH50247"}},
// 十鬼の絆
{0x891AAAC, {0, 0, 0, 0, ULJM06129, "ULJM06129"}}, // text
{0x886E094, {0, 0, 0, 0, ULJM06129, "ULJM06129"}}, // name+text
}; };
} }

View File

@ -1,7 +1,7 @@
set(VERSION_MAJOR 6) set(VERSION_MAJOR 6)
set(VERSION_MINOR 3) set(VERSION_MINOR 3)
set(VERSION_PATCH 2) set(VERSION_PATCH 3)
set(VERSION_REVISION 0) set(VERSION_REVISION 0)
add_definitions(-DVERSION_MAJOR=${VERSION_MAJOR}) add_definitions(-DVERSION_MAJOR=${VERSION_MAJOR})
add_definitions(-DVERSION_MINOR=${VERSION_MINOR}) add_definitions(-DVERSION_MINOR=${VERSION_MINOR})