mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-27 15:44:12 +08:00
.
This commit is contained in:
parent
d896f14d92
commit
104b344324
@ -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<std::string> 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();
|
||||
}
|
@ -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<std::string> 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
|
||||
};
|
||||
|
||||
}
|
@ -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})
|
||||
|
Loading…
x
Reference in New Issue
Block a user