mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
.
This commit is contained in:
parent
01d1e803af
commit
84b0cee362
@ -1159,18 +1159,17 @@ bool Krkrtextrenderdll()
|
||||
if (GetProcAddress(module, "V2Link") == 0)
|
||||
return false;
|
||||
|
||||
bool b1 = [module]()
|
||||
auto [minAddress, maxAddress] = Util::QueryModuleLimits(module);
|
||||
bool b1 = [=]()
|
||||
{
|
||||
auto [minAddress, maxAddress] = Util::QueryModuleLimits(module);
|
||||
BYTE bytes[] = {
|
||||
0x81, 0xEC, 0xFC, 0x00, 0x00, 0x00};
|
||||
auto addr = MemDbg::findBytes(bytes, sizeof(bytes), minAddress, maxAddress);
|
||||
if (addr == 0)
|
||||
if (!addr)
|
||||
return false;
|
||||
addr = MemDbg::findEnclosingAlignedFunction(addr);
|
||||
if (addr == 0)
|
||||
if (!addr)
|
||||
return false;
|
||||
ConsoleOutput("textrender %p", addr);
|
||||
HookParam hp;
|
||||
hp.address = (DWORD)addr;
|
||||
hp.offset = get_stack(2);
|
||||
@ -1178,9 +1177,8 @@ bool Krkrtextrenderdll()
|
||||
|
||||
return NewHook(hp, "krkr_textrender");
|
||||
}();
|
||||
bool b2 = [module]()
|
||||
bool b2 = [=]()
|
||||
{
|
||||
auto [minAddress, maxAddress] = Util::QueryModuleLimits(module);
|
||||
BYTE bytes[] = {
|
||||
0xFF, XX,
|
||||
0x88, XX, XX, XX,
|
||||
@ -1194,9 +1192,8 @@ bool Krkrtextrenderdll()
|
||||
0xB0, 0x01,
|
||||
0xC3};
|
||||
auto addr = MemDbg::findBytes(bytes, sizeof(bytes), minAddress, maxAddress);
|
||||
if (addr == 0)
|
||||
if (!addr)
|
||||
return false;
|
||||
ConsoleOutput("textrender %p", addr);
|
||||
HookParam hp;
|
||||
hp.address = addr - 0xb;
|
||||
hp.offset = get_reg(regs::eax);
|
||||
@ -1204,52 +1201,39 @@ bool Krkrtextrenderdll()
|
||||
hp.filter_fun = KiriKiriZ_msvcFilter;
|
||||
return NewHook(hp, "krkr_textrender");
|
||||
}();
|
||||
return b1 || b2;
|
||||
}
|
||||
void KiriKiriZ3Filter(TextBuffer *buffer, HookParam *)
|
||||
{
|
||||
auto text = reinterpret_cast<LPWSTR>(buffer->buff);
|
||||
|
||||
CharFilter(buffer, L'\x000A');
|
||||
if (cpp_wcsnstr(text, L"%", buffer->size / sizeof(wchar_t)))
|
||||
auto b3 = [=]()
|
||||
{
|
||||
StringFilterBetween(buffer, L"%", 1, L"%", 1);
|
||||
}
|
||||
}
|
||||
|
||||
bool InsertKiriKiriZHook3()
|
||||
{
|
||||
|
||||
/*
|
||||
* Sample games:
|
||||
* https://vndb.org/r109253
|
||||
*/
|
||||
const BYTE bytes[] = {
|
||||
0x66, 0x83, 0x3F, 0x00, // cmp word ptr [edi],00 << hook here
|
||||
0x75, 0x06, // jne Imouto_no_Seiiki.exe+195C1
|
||||
0x33, 0xDB, // xor ebx,ebx
|
||||
0x89, 0x1E, // mov [esi],ebx
|
||||
0xEB, 0x1B // jmp Imouto_no_Seiiki.exe+195DC
|
||||
auto [minAddress, maxAddress] = Util::QueryModuleLimits(module, 0, PAGE_READONLY);
|
||||
char tjs[] = "tTJSVariant::tTJSVariant(const tjs_char *)";
|
||||
auto addr = MemDbg::findBytes(tjs, sizeof(tjs), minAddress, maxAddress);
|
||||
if (!addr)
|
||||
return false;
|
||||
addr = MemDbg::findPushAddress(addr, minAddress, maxAddress);
|
||||
if (!addr)
|
||||
return false;
|
||||
addr = MemDbg::findEnclosingAlignedFunction(addr);
|
||||
if (!addr)
|
||||
return false;
|
||||
HookParam hp;
|
||||
hp.address = addr;
|
||||
hp.offset = get_stack(2);
|
||||
hp.type = CODEC_UTF16 | USING_STRING | DATA_INDIRECT;
|
||||
hp.text_fun = [](hook_stack *stack, HookParam *hp, TextBuffer *buffer, uintptr_t *split)
|
||||
{
|
||||
auto text = *(wchar_t **)stack->stack[2];
|
||||
if (hp->user_value == stack->retaddr)
|
||||
return;
|
||||
if (text[0] == L'%')
|
||||
{
|
||||
hp->user_value = stack->retaddr;
|
||||
return;
|
||||
}
|
||||
buffer->from(text);
|
||||
};
|
||||
return NewHook(hp, "krkr_textrender");
|
||||
};
|
||||
|
||||
ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR);
|
||||
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range);
|
||||
if (!addr)
|
||||
{
|
||||
ConsoleOutput("KiriKiriZ3: pattern not found");
|
||||
return false;
|
||||
}
|
||||
|
||||
HookParam hp;
|
||||
hp.address = addr;
|
||||
hp.offset = get_reg(regs::edi);
|
||||
hp.split = get_reg(regs::edx);
|
||||
hp.type = NO_CONTEXT | CODEC_UTF16 | USING_STRING | USING_SPLIT;
|
||||
hp.filter_fun = KiriKiriZ3Filter;
|
||||
ConsoleOutput("INSERT KiriKiriZ3");
|
||||
return NewHook(hp, "KiriKiriZ3");
|
||||
return b1 || b2 || b3();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@ -1298,8 +1282,7 @@ namespace
|
||||
bool InsertKiriKiriZHook()
|
||||
{
|
||||
auto ok = Krkrtextrenderdll();
|
||||
ok = InsertKiriKiriZHook3() || ok;
|
||||
ok = kagparser() || ok;
|
||||
ok = kagparser();
|
||||
return InsertKiriKiriZHook2() || InsertKiriKiriZHook1() || ok;
|
||||
}
|
||||
namespace
|
||||
|
@ -543,7 +543,15 @@ namespace
|
||||
return buffer->clear();
|
||||
last = s;
|
||||
}
|
||||
|
||||
void F010052300F612000(TextBuffer *buffer, HookParam *hp)
|
||||
{
|
||||
auto s = buffer->strA();
|
||||
s = std::regex_replace(s, std::regex(R"(#r(.*?)\|(.*?)#)"), "$1");
|
||||
s = std::regex_replace(s, std::regex(R"(@r(.*?)@\d)"), "$1");
|
||||
strReplace(s, R"(\c)", "");
|
||||
strReplace(s, R"(\n)", "");
|
||||
buffer->from(s);
|
||||
}
|
||||
auto _ = []()
|
||||
{
|
||||
emfunctionhooks = {
|
||||
@ -679,6 +687,10 @@ namespace
|
||||
{0x801AE35A, {CODEC_UTF8, 7, 0, PCSG01011, 0, "PCSG01011"}},
|
||||
// 真紅の焔 真田忍法帳
|
||||
{0x80025064, {CODEC_UTF8, 0, 0, 0, PCSG00833, "PCSG01158"}},
|
||||
// 月影の鎖 ~狂爛モラトリアム~
|
||||
{0x8007AA94, {0, 1, 0, 0, F010052300F612000, "PCSG00991"}},
|
||||
// 月影の鎖 ~錯乱パラノイア~
|
||||
{0x8000E8E0, {0, 0, 0, 0, F010052300F612000, "PCSG00794"}},
|
||||
|
||||
};
|
||||
return 1;
|
||||
|
@ -1036,14 +1036,28 @@ namespace
|
||||
buffer->size -= 1;
|
||||
}
|
||||
}
|
||||
void F0100FD4016528000(TextBuffer *buffer, HookParam *hp)
|
||||
{
|
||||
auto s = buffer->strA();
|
||||
static std::string last;
|
||||
if (endWith(last, s))
|
||||
{
|
||||
buffer->clear();
|
||||
last = s;
|
||||
return;
|
||||
}
|
||||
last = s;
|
||||
s = std::regex_replace(s, std::regex(R"(@v\d+)"), "");
|
||||
s = std::regex_replace(s, std::regex(R"(@t\d+)"), "");
|
||||
s = std::regex_replace(s, std::regex(R"(@\w+)"), "");
|
||||
buffer->from(s);
|
||||
}
|
||||
void F01001BB01E8E2000(TextBuffer *buffer, HookParam *hp)
|
||||
{
|
||||
|
||||
auto s = buffer->strW();
|
||||
s = std::regex_replace(s, std::wregex(L"<[^>]*>"), L"");
|
||||
buffer->from(s);
|
||||
}
|
||||
|
||||
void F0100B0C016164000(TextBuffer *buffer, HookParam *hp)
|
||||
{
|
||||
|
||||
@ -1090,7 +1104,8 @@ namespace
|
||||
void F0100CB700D438000(TextBuffer *buffer, HookParam *hp)
|
||||
{
|
||||
auto s = buffer->strA();
|
||||
s = std::regex_replace(s, std::regex(R"(<RUBY><RB>(.*?)<\/RB><RT>(.*?)<\/RT><\/RUBY>)"), "$1");
|
||||
s = std::regex_replace(s, std::regex(R"(<RUBY><RB>(.*?)<\/RB><RT>(.*?)<\/RT><\/RUBY>)"),
|
||||
"$1");
|
||||
s = std::regex_replace(s, std::regex("<[^>]*>"), "");
|
||||
static std::string last;
|
||||
if (last == s)
|
||||
@ -3553,6 +3568,8 @@ namespace
|
||||
{0x80020958, {0, 0, 0, 0, F0100D8B019FC0000<false>, 0x0100D8B019FC0000ull, "1.0.0"}},
|
||||
// FANTASIAN Neo Dimension
|
||||
{0x81719ea0, {CODEC_UTF16, 0, 0, ReadTextAndLenDW<0>, F01001BB01E8E2000, 0x01001BB01E8E2000ull, "1.0.0"}},
|
||||
// アイキス3cute
|
||||
{0x804C18C4, {CODEC_UTF8, 1, 0, 0, F0100FD4016528000, 0x0100FD4016528000ull, nullptr}}, // 1.0.0 && 1.0.2
|
||||
|
||||
};
|
||||
return 1;
|
||||
|
@ -700,6 +700,11 @@ namespace ppsspp
|
||||
auto s = buffer->strA();
|
||||
buffer->from(s.substr(1, s.size() - 2));
|
||||
}
|
||||
void ULJM06032(TextBuffer *buffer, HookParam *hp)
|
||||
{
|
||||
StringFilter(buffer, "@n", 2);
|
||||
StringFilter(buffer, "\x81\x90", 2); // $
|
||||
}
|
||||
void ULJM05456(TextBuffer *buffer, HookParam *hp)
|
||||
{
|
||||
static std::string last;
|
||||
@ -1003,6 +1008,8 @@ namespace ppsspp
|
||||
// Confidential Money ~300日で3000万ドル稼ぐ方法~
|
||||
{0x881BD00, {CODEC_UTF16, 1, 0, ULJM06143, 0, "ULJM06143"}},
|
||||
{0x882555C, {CODEC_UTF16, 2, 0, ULJM06143_1, 0, "ULJM06143"}},
|
||||
// アルカナ・ファミリア 幽霊船の魔術師
|
||||
{0x881A214, {0, 0, 0, 0, ULJM06032, "ULJM06032"}},
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user