This commit is contained in:
恍兮惚兮 2024-11-17 13:03:03 +08:00
parent f64840f948
commit acddc3158f
11 changed files with 81 additions and 147 deletions

View File

@ -39,9 +39,8 @@ bool InsertAnim2Hook()
// そんな俺に声をかけてきたのは、近所のスーパーで働いている主婦の、@n『@[赤羽:あかばね]@[千晶:ちあき]』さんだ。 // そんな俺に声をかけてきたのは、近所のスーパーで働いている主婦の、@n『@[赤羽:あかばね]@[千晶:ちあき]』さんだ。
myhp.filter_fun = [](TextBuffer *buffer, HookParam *hp) myhp.filter_fun = [](TextBuffer *buffer, HookParam *hp)
{ {
static const std::regex rx("@\\[(.*?):(.*?)\\]", std::regex_constants::icase);
std::string result = buffer->strA(); std::string result = buffer->strA();
result = std::regex_replace(result, rx, "$1"); result = std::regex_replace(result, std::regex("@\\[(.*?):(.*?)\\]", std::regex_constants::icase), "$1");
buffer->from(result); buffer->from(result);
}; };
myhp.newlineseperator = L"@n"; myhp.newlineseperator = L"@n";

View File

@ -1258,9 +1258,8 @@ bool InsertBGIDynamicHook(LPVOID addr, DWORD frame, DWORD stack)
hp.filter_fun = [](TextBuffer *buffer, HookParam *hp) hp.filter_fun = [](TextBuffer *buffer, HookParam *hp)
{ {
// It could be either <R..> or <r..> // It could be either <R..> or <r..>
static const std::regex rx("<r.+?>(.+?)</r>", std::regex_constants::icase);
std::string result = buffer->strA(); std::string result = buffer->strA();
result = std::regex_replace(result, rx, "$1"); result = std::regex_replace(result, std::regex("<r.+?>(.+?)</r>", std::regex_constants::icase), "$1");
buffer->from(result); buffer->from(result);
}; };

View File

@ -1198,8 +1198,7 @@ namespace
hp.filter_fun = [](TextBuffer *buffer, HookParam *hp) hp.filter_fun = [](TextBuffer *buffer, HookParam *hp)
{ {
std::string str = buffer->strA(); std::string str = buffer->strA();
std::regex reg1("\\{(.*?)/(.*?)\\}"); std::string result1 = std::regex_replace(str, std::regex("\\{(.*?)/(.*?)\\}"), "$1");
std::string result1 = std::regex_replace(str, reg1, "$1");
buffer->from(result1); buffer->from(result1);
}; };

View File

@ -238,8 +238,7 @@ bool InsertCatSystem2Hook()
hp.type = USING_STRING | CODEC_UTF8; hp.type = USING_STRING | CODEC_UTF8;
hp.filter_fun = [](TextBuffer *buffer, HookParam *hp) hp.filter_fun = [](TextBuffer *buffer, HookParam *hp)
{ {
static std::regex rx(R"(\[(.+?)/.+\])"); auto _ = std::regex_replace(buffer->strA(), std::regex(R"(\[(.+?)/.+\])"), "$1");
auto _ = std::regex_replace(buffer->strA(), rx, "$1");
buffer->from(_); buffer->from(_);
}; };
hp.newlineseperator = L"\\n"; hp.newlineseperator = L"\\n";
@ -836,8 +835,7 @@ namespace
hp.hook_font = F_GetGlyphOutlineA; hp.hook_font = F_GetGlyphOutlineA;
hp.filter_fun = [](TextBuffer *buffer, HookParam *hp) hp.filter_fun = [](TextBuffer *buffer, HookParam *hp)
{ {
static std::regex rx(R"(\[(.+?)/.+\])"); buffer->from(std::regex_replace(buffer->strA(), std::regex(R"(\[(.+?)/.+\])"), "$1"));
buffer->from(std::regex_replace(buffer->strA(), rx, "$1"));
}; };
static ULONG p; static ULONG p;

View File

@ -189,8 +189,7 @@ namespace
return buffer->clear(); return buffer->clear();
std::string str = buffer->strA(); std::string str = buffer->strA();
std::regex reg1("\\{(.*?)/(.*?)\\}"); std::string result1 = std::regex_replace(str, std::regex("\\{(.*?)/(.*?)\\}"), "$1");
std::string result1 = std::regex_replace(str, reg1, "$1");
buffer->from(result1); buffer->from(result1);
}; };
succ |= NewHook(hp, "debonosu"); succ |= NewHook(hp, "debonosu");

View File

@ -393,8 +393,7 @@ namespace
void hook2(hook_stack *stack, HookParam *hp, TextBuffer *buffer, uintptr_t *split) void hook2(hook_stack *stack, HookParam *hp, TextBuffer *buffer, uintptr_t *split)
{ {
strReplace(save, "\\k", ""); strReplace(save, "\\k", "");
static std::regex rx("<R(.+?)\\|.+>"); save = std::regex_replace(save, std::regex("<R(.+?)\\|.+>"), "$1");
save = std::regex_replace(save, rx, "$1");
buffer->from(save); buffer->from(save);
} }
void hook2a(hook_stack *s, TextBuffer buffer) void hook2a(hook_stack *s, TextBuffer buffer)

View File

@ -517,9 +517,8 @@ namespace
}; };
hp.filter_fun = [](TextBuffer *buffer, HookParam *hp) hp.filter_fun = [](TextBuffer *buffer, HookParam *hp)
{ {
static const std::regex rx("#\\{(.*?)\\}(.*?)#", std::regex_constants::icase);
std::string result = buffer->strA(); std::string result = buffer->strA();
result = std::regex_replace(result, rx, "$2"); result = std::regex_replace(result, std::regex("#\\{(.*?)\\}(.*?)#", std::regex_constants::icase), "$2");
strReplace(result, u8" \n", ""); strReplace(result, u8" \n", "");
strReplace(result, u8"\n", ""); strReplace(result, u8"\n", "");
buffer->from(result); buffer->from(result);

View File

@ -147,12 +147,9 @@ namespace
std::string rubyRemove(std::string text) std::string rubyRemove(std::string text)
{ {
std::regex rx("<r(.*?)>(.*?)</r>"); text = std::regex_replace(text, std::regex("<r(.*?)>(.*?)</r>"), "$2");
text = std::regex_replace(text, rx, "$2"); text = std::regex_replace(text, std::regex("<c(.*?)>(.*?)</c>"), "$2");
std::regex rx2("<c(.*?)>(.*?)</c>"); text = std::regex_replace(text, std::regex("<s(.*?)>(.*?)</s>"), "$2");
text = std::regex_replace(text, rx2, "$2");
std::regex rx3("<s(.*?)>(.*?)</s>");
text = std::regex_replace(text, rx3, "$2");
return text; return text;
} }
} }

View File

@ -265,8 +265,7 @@ namespace
void FBLJM61131(TextBuffer *buffer, HookParam *hp) void FBLJM61131(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
std::regex pattern("\\[[^\\]]+."); s = std::regex_replace(s, std::regex("\\[[^\\]]+."), "");
s = std::regex_replace(s, pattern, "");
s = std::regex_replace(s, std::regex("\\\\k|\\\\x|%C|%B"), ""); s = std::regex_replace(s, std::regex("\\\\k|\\\\x|%C|%B"), "");
s = std::regex_replace(s, std::regex("\\%\\d+\\#[0-9a-fA-F]*\\;"), ""); s = std::regex_replace(s, std::regex("\\%\\d+\\#[0-9a-fA-F]*\\;"), "");
s = std::regex_replace(s, std::regex("\\n+"), " "); s = std::regex_replace(s, std::regex("\\n+"), " ");

View File

@ -363,8 +363,7 @@ namespace
void F0100F6A00A684000(TextBuffer *buffer, HookParam *hp) void F0100F6A00A684000(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
std::regex regex("(?=@.)"); std::sregex_token_iterator it(s.begin(), s.end(), std::regex("(?=@.)"), -1);
std::sregex_token_iterator it(s.begin(), s.end(), regex, -1);
std::sregex_token_iterator end; std::sregex_token_iterator end;
std::vector<std::string> parts(it, end); std::vector<std::string> parts(it, end);
s = ""; s = "";
@ -424,8 +423,7 @@ namespace
void F01006590155AC000(TextBuffer *buffer, HookParam *hp) void F01006590155AC000(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
std::regex regex("(?=@.)"); std::sregex_token_iterator it(s.begin(), s.end(), std::regex("(?=@.)"), -1);
std::sregex_token_iterator it(s.begin(), s.end(), regex, -1);
std::sregex_token_iterator end; std::sregex_token_iterator end;
std::vector<std::string> parts(it, end); std::vector<std::string> parts(it, end);
@ -468,8 +466,7 @@ namespace
} }
else if (tag == "@v" || tag == "@h") else if (tag == "@v" || tag == "@h")
{ {
std::regex regex("[\\w_-]+"); s += std::regex_replace(content, std::regex("[\\w_-]+"), "");
s += std::regex_replace(content, regex, "");
counter++; counter++;
continue; continue;
} }
@ -486,8 +483,7 @@ namespace
counter++; counter++;
continue; continue;
} }
std::regex regex(u8"[\\d+─]"); s += std::regex_replace(content, std::regex(u8"[\\d+─]"), "");
s += std::regex_replace(content, regex, "");
counter += 3; counter += 3;
continue; continue;
} }
@ -507,8 +503,7 @@ namespace
static bool readString_playerNameFlag = false; static bool readString_playerNameFlag = false;
static std::string readString_playerName = u8"ラピス"; static std::string readString_playerName = u8"ラピス";
std::regex regex("(?=@.)"); std::sregex_token_iterator it(s.begin(), s.end(), std::regex("(?=@.)"), -1);
std::sregex_token_iterator it(s.begin(), s.end(), regex, -1);
std::sregex_token_iterator end; std::sregex_token_iterator end;
std::vector<std::string> parts(it, end); std::vector<std::string> parts(it, end);
@ -572,8 +567,7 @@ namespace
} }
else if (tag == "@v" || tag == "@h") else if (tag == "@v" || tag == "@h")
{ {
std::regex regex("[\\w_-]+"); s += std::regex_replace(content, std::regex("[\\w_-]+"), "");
s += std::regex_replace(content, regex, "");
counter++; counter++;
continue; continue;
} }
@ -590,8 +584,7 @@ namespace
counter++; counter++;
continue; continue;
} }
std::regex regex(u8"[\\d+─]"); s += std::regex_replace(content, std::regex(u8"[\\d+─]"), "");
s += std::regex_replace(content, regex, "");
counter += 3; counter += 3;
continue; continue;
} }
@ -789,8 +782,7 @@ namespace
void F010045C014650000(TextBuffer *buffer, HookParam *hp) void F010045C014650000(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
std::regex pattern("(@(\\/)?[a-zA-Z#](\\(\\d+\\))?|)[*<>]+"); s = std::regex_replace(s, std::regex(R"((@(\/)?[a-zA-Z#](\(\d+\))?|)+|[\*<>]+)"), "");
s = std::regex_replace(s, pattern, "");
buffer->from(s); buffer->from(s);
} }
@ -846,18 +838,15 @@ namespace
void F0100AFA01750C000(TextBuffer *buffer, HookParam *hp) void F0100AFA01750C000(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
std::regex newlineRegex("(\\\\n)+"); s = std::regex_replace(s, std::regex(R"((\\n)+)"), " ");
std::regex specialCharsRegex("\\\\d$|^\\@[a-z]+|#.*?#|\\$"); s = std::regex_replace(s, std::regex(R"(\\d$|^\@[a-z]+|#.*?#|\$)"), "");
s = std::regex_replace(s, newlineRegex, " ");
s = std::regex_replace(s, specialCharsRegex, "");
buffer->from(s); buffer->from(s);
} }
void F0100C1E0102B8000(TextBuffer *buffer, HookParam *hp) void F0100C1E0102B8000(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
s = std::regex_replace(s, std::regex("#N"), "\n"); s = std::regex_replace(s, std::regex("#N"), "\n");
std::regex colorRegex("#Color\\[[\\d]+\\]"); s = std::regex_replace(s, std::regex("#Color\\[[\\d]+\\]"), "");
s = std::regex_replace(s, colorRegex, "");
buffer->from(s); buffer->from(s);
} }
void F0100BD700E648000(TextBuffer *buffer, HookParam *hp) void F0100BD700E648000(TextBuffer *buffer, HookParam *hp)
@ -956,8 +945,7 @@ namespace
void F010055D009F78000(TextBuffer *buffer, HookParam *hp) void F010055D009F78000(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
std::regex pattern3("\\d+"); s = std::regex_replace(s, std::regex("\\d+"), "");
s = std::regex_replace(s, pattern3, "");
static std::string last; static std::string last;
if (last == s) if (last == s)
return buffer->clear(); return buffer->clear();
@ -968,21 +956,16 @@ namespace
void F010080C01AA22000(TextBuffer *buffer, HookParam *hp) void F010080C01AA22000(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
std::regex furiganaRegex("#\\d+R.*?#"); s = std::regex_replace(s, std::regex("#\\d+R.*?#"), "");
s = std::regex_replace(s, furiganaRegex, ""); s = std::regex_replace(s, std::regex("[A-Za-z0-9]"), "");
std::regex lettersNumbersRegex("[A-Za-z0-9]"); s = std::regex_replace(s, std::regex(u8"[().%,_!#©&:?/]"), "");
s = std::regex_replace(s, lettersNumbersRegex, "");
std::regex symbolsRegex(u8"[().%,_!#©&:?/]");
s = std::regex_replace(s, symbolsRegex, "");
buffer->from(s); buffer->from(s);
} }
void F0100CB700D438000(TextBuffer *buffer, HookParam *hp) void F0100CB700D438000(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
std::regex furiganaRegex("<RUBY><RB>(.*?)<\\/RB><RT>(.*?)<\\/RT><\\/RUBY>"); s = std::regex_replace(s, std::regex(R"(<RUBY><RB>(.*?)<\/RB><RT>(.*?)<\/RT><\/RUBY>)"), "$1");
s = std::regex_replace(s, furiganaRegex, "$1"); s = std::regex_replace(s, std::regex("<[^>]*>"), "");
std::regex htmlTagRegex("<[^>]*>");
s = std::regex_replace(s, htmlTagRegex, "");
static std::string last; static std::string last;
if (last == s) if (last == s)
return buffer->clear(); return buffer->clear();
@ -1018,14 +1001,10 @@ namespace
void F010072000BD32000(TextBuffer *buffer, HookParam *hp) void F010072000BD32000(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
std::regex lineBreakRegex("\\[~\\]"); s = std::regex_replace(s, std::regex(R"(\[~\])"), "\n");
s = std::regex_replace(s, lineBreakRegex, "\n"); s = std::regex_replace(s, std::regex(R"(\rom:[\s\S]*$)"), "");
std::regex romRegex("rom:[\\s\\S]*$"); s = std::regex_replace(s, std::regex(R"(\[[\w\d]*\[[\w\d]*\].*?\[\/[\w\d]*\]\])"), "");
s = std::regex_replace(s, romRegex, ""); s = std::regex_replace(s, std::regex(R"(\[.*?\])"), "");
std::regex furiganaRegex("\\[[\\w\\d]*\\[[\\w\\d]*\\].*?\\[\\/\\[\\w\\d]*\\]\\]");
s = std::regex_replace(s, furiganaRegex, "");
std::regex bracketsRegex("\\[.*?\\]");
s = std::regex_replace(s, bracketsRegex, "");
static std::string last; static std::string last;
if (last == s) if (last == s)
return buffer->clear(); return buffer->clear();
@ -1334,12 +1313,8 @@ namespace
void F0100B5500CA0C000(TextBuffer *buffer, HookParam *hp) void F0100B5500CA0C000(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
// std::regex pattern1("\\\\u0000+$"); s = std::regex_replace(s, std::regex("\\\\"), "");
std::regex pattern2("\\\\"); s = std::regex_replace(s, std::regex("\\$"), "");
std::regex pattern3("\\$");
// s = std::regex_replace(s, pattern1, "");
s = std::regex_replace(s, pattern2, "");
s = std::regex_replace(s, pattern3, "");
buffer->from(s); buffer->from(s);
} }
void T0100B5500CA0C000(hook_stack *stack, HookParam *hp, TextBuffer *buffer, uintptr_t *split) void T0100B5500CA0C000(hook_stack *stack, HookParam *hp, TextBuffer *buffer, uintptr_t *split)
@ -1585,11 +1560,9 @@ namespace
void F0100556015CCC000(TextBuffer *buffer, HookParam *hp) void F0100556015CCC000(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
std::regex rubiRegex("\\[[^\\]]+."); s = std::regex_replace(s, std::regex("\\[[^\\]]+."), "");
s = std::regex_replace(s, rubiRegex, "");
s = std::regex_replace(s, std::regex("\\\\k|\\\\x|%C|%B|%p-1;"), ""); s = std::regex_replace(s, std::regex("\\\\k|\\\\x|%C|%B|%p-1;"), "");
std::regex colorRegex("#[0-9a-fA-F]+;([^%#]+)(%r)?"); s = std::regex_replace(s, std::regex("#[0-9a-fA-F]+;([^%#]+)(%r)?"), "$1");
s = std::regex_replace(s, colorRegex, "$1");
static std::set<std::string> dump; static std::set<std::string> dump;
if (dump.find(s) != dump.end()) if (dump.find(s) != dump.end())
return buffer->clear(); return buffer->clear();
@ -1668,14 +1641,10 @@ namespace
void F01001B900C0E2000(TextBuffer *buffer, HookParam *hp) void F01001B900C0E2000(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
std::regex whitespaceRegex("\\s"); s = std::regex_replace(s, std::regex("\\s"), "");
s = std::regex_replace(s, whitespaceRegex, ""); s = std::regex_replace(s, std::regex("#[A-Za-z]+(\\[(\\d*\\.)?\\d+\\])+"), "");
std::regex hashRegex("#[A-Za-z]+(\\[(\\d*\\.)?\\d+\\])+"); s = std::regex_replace(s, std::regex("#[a-z]"), "");
s = std::regex_replace(s, hashRegex, ""); s = std::regex_replace(s, std::regex("[a-z]"), "");
std::regex hashLetterRegex("#[a-z]");
s = std::regex_replace(s, hashLetterRegex, "");
std::regex lowercaseRegex("[a-z]");
s = std::regex_replace(s, lowercaseRegex, "");
buffer->from(s); buffer->from(s);
} }
@ -1950,8 +1919,7 @@ namespace
void F01005E9016BDE000(TextBuffer *buffer, HookParam *hp) void F01005E9016BDE000(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
std::regex patt("/\\/\\/ remove rubi\\n\\ss = s.replace\\(patt, ''\\);/"); s = std::regex_replace(s, std::regex(R"(\[[^\]]+.)"), "");
s = std::regex_replace(s, patt, "");
s = std::regex_replace(s, std::regex("\\\\k|\\\\x|%C|%B|%p-1;"), ""); s = std::regex_replace(s, std::regex("\\\\k|\\\\x|%C|%B|%p-1;"), "");
s = std::regex_replace(s, std::regex("#[0-9a-fA-F]+;([^%#]+)(%r)?"), "$1"); s = std::regex_replace(s, std::regex("#[0-9a-fA-F]+;([^%#]+)(%r)?"), "$1");
s = std::regex_replace(s, std::regex("\\\\n"), " "); s = std::regex_replace(s, std::regex("\\\\n"), " ");
@ -1970,12 +1938,9 @@ namespace
{ {
auto s = buffer->strW(); auto s = buffer->strW();
std::wregex pattern1(L"\\[([^\\]\\/]+)\\/[^\\]]+\\]"); s = std::regex_replace(s, std::wregex(LR"(\[([^\]\/]+)\/[^\]]+\])"), L"$1");
s = std::regex_replace(s, pattern1, L"$1"); s = std::regex_replace(s, std::wregex(L"(\\S*)@"), L"$1");
std::wregex pattern2(L"(\\S*)@"); s = std::regex_replace(s, std::wregex(L"\\$"), L"");
s = std::regex_replace(s, pattern2, L"$1");
std::wregex pattern3(L"\\$");
s = std::regex_replace(s, pattern3, L"");
buffer->from(s); buffer->from(s);
} }
void F01000A400AF2A000(TextBuffer *buffer, HookParam *hp) void F01000A400AF2A000(TextBuffer *buffer, HookParam *hp)

View File

@ -6,10 +6,8 @@ namespace ppsspp
void ULJS00403_filter(TextBuffer *buffer, HookParam *hp) void ULJS00403_filter(TextBuffer *buffer, HookParam *hp)
{ {
std::string result = buffer->strA(); std::string result = buffer->strA();
std::regex newlinePattern(R"((\\n)+)"); result = std::regex_replace(result, std::regex(R"((\\n)+)"), " ");
result = std::regex_replace(result, newlinePattern, " "); result = std::regex_replace(result, std::regex(R"((\\d$|^\@[a-z]+|#.*?#|\$))"), "");
std::regex pattern(R"((\\d$|^\@[a-z]+|#.*?#|\$))");
result = std::regex_replace(result, pattern, "");
buffer->from(result); buffer->from(result);
} }
@ -109,28 +107,18 @@ namespace ppsspp
void ULJM06119_filter(TextBuffer *buffer, HookParam *hp) void ULJM06119_filter(TextBuffer *buffer, HookParam *hp)
{ {
std::string s = buffer->strA(); std::string s = buffer->strA();
s = std::regex_replace(s, std::regex(R"(/\[[^\]]+./g)"), "");
std::regex pattern(R"(/\[[^\]]+./g)"); s = std::regex_replace(s, std::regex(R"(/\\k|\\x|%C|%B)"), "");
s = std::regex_replace(s, pattern, ""); s = std::regex_replace(s, std::regex(R"(/\%\d+\#[0-9a-fA-F]*\;)"), "");
s = std::regex_replace(s, std::regex(R"(/\n+)"), " ");
std::regex tagPattern(R"(/\\k|\\x|%C|%B)");
s = std::regex_replace(s, tagPattern, "");
std::regex colorPattern(R"(/\%\d+\#[0-9a-fA-F]*\;)");
s = std::regex_replace(s, colorPattern, "");
std::regex newlinePattern(R"(/\n+)");
s = std::regex_replace(s, newlinePattern, " ");
buffer->from(s); buffer->from(s);
} }
void ULJM06036_filter(TextBuffer *buffer, HookParam *hp) void ULJM06036_filter(TextBuffer *buffer, HookParam *hp)
{ {
std::wstring result = buffer->strW(); std::wstring result = buffer->strW();
std::wregex pattern(LR"(<R([^\/]+).([^>]+).>)"); result = std::regex_replace(result, std::wregex(LR"(<R([^\/]+).([^>]+).>)"), L"$2");
result = std::regex_replace(result, pattern, L"$2"); result = std::regex_replace(result, std::wregex(LR"(<[A-Z]+>)"), L"");
std::wregex tagPattern(LR"(<[A-Z]+>)");
result = std::regex_replace(result, tagPattern, L"");
buffer->from(result); buffer->from(result);
} }
@ -260,6 +248,20 @@ namespace ppsspp
{ {
StringCharReplacer(buffer, "\\n", 2, '\n'); StringCharReplacer(buffer, "\\n", 2, '\n');
} }
void FNPJH50247(TextBuffer *buffer, HookParam *hp)
{
static lru_cache<std::string> cache(3);
auto s = buffer->strA();
if (cache.touch(s))
buffer->clear();
else
{
s = std::regex_replace(s, std::regex("#C[0-9]{9}"), "");
s = std::regex_replace(s, std::regex("#RUBS(.*?)#RUBE(.*?)#REND"), "$2");
s = std::regex_replace(s, std::regex("#CDEF"), "");
buffer->from(s);
}
}
void ULJM06145(TextBuffer *buffer, HookParam *hp) void ULJM06145(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
@ -296,45 +298,22 @@ namespace ppsspp
void NPJH50619F(TextBuffer *buffer, HookParam *hp) void NPJH50619F(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
std::regex pattern1("[\\r\\n]+"); s = std::regex_replace(s, std::regex("[\\r\\n]+"), "");
std::string replacement1 = ""; s = std::regex_replace(s, std::regex("^(.*?)\\)+"), "");
std::string result1 = std::regex_replace(s, pattern1, replacement1); s = std::regex_replace(s, std::regex("#ECL+"), "");
std::regex pattern2("^(.*?)\\)+"); s = std::regex_replace(s, std::regex("(#.+?\\))+"), "");
std::string replacement2 = ""; buffer->from(s);
std::string result2 = std::regex_replace(result1, pattern2, replacement2);
std::regex pattern3("#ECL+");
std::string replacement3 = "";
std::string result3 = std::regex_replace(result2, pattern3, replacement3);
std::regex pattern4("(#.+?\\))+");
std::string replacement4 = "";
std::string result4 = std::regex_replace(result3, pattern4, replacement4);
buffer->from(result4);
} }
void NPJH50505F(TextBuffer *buffer, HookParam *hp) void NPJH50505F(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
s = std::regex_replace(s, std::regex("#RUBS(#[A-Z0-9]+)*[^#]+"), "");
std::regex pattern2("#RUBS(#[A-Z0-9]+)*[^#]+"); s = std::regex_replace(s, std::regex("#FAMILY"), "$FAMILY");
std::string replacement2 = ""; s = std::regex_replace(s, std::regex("#GIVE"), "$GIVE");
std::string result2 = std::regex_replace(s, pattern2, replacement2); s = std::regex_replace(s, std::regex("(#[A-Z0-9\\-]+)+"), "");
s = std::regex_replace(s, std::regex("\\n+"), "");
std::regex pattern3("#FAMILY"); buffer->from(s);
std::string replacement3 = "$FAMILY";
std::string result3 = std::regex_replace(result2, pattern3, replacement3);
std::regex pattern4("#GIVE");
std::string replacement4 = "$GIVE";
std::string result4 = std::regex_replace(result3, pattern4, replacement4);
std::regex pattern5("(#[A-Z0-9\\-]+)+");
std::string replacement5 = "";
std::string result5 = std::regex_replace(result4, pattern5, replacement5);
std::regex pattern6("\\n+");
std::string replacement6 = " ";
std::string result6 = std::regex_replace(result5, pattern6, replacement6);
buffer->from(result6);
} }
void QNPJH50909(hook_stack *stack, HookParam *hp, TextBuffer *buffer, uintptr_t *split) void QNPJH50909(hook_stack *stack, HookParam *hp, TextBuffer *buffer, uintptr_t *split)
@ -420,7 +399,9 @@ namespace ppsspp
// 源狼 GENROH // 源狼 GENROH
{0x8940DA8, {0, 1, 0, 0, ULJM06145, "ULJM06145"}}, // TEXT {0x8940DA8, {0, 1, 0, 0, ULJM06145, "ULJM06145"}}, // TEXT
// 遙かなる時空の中で4 愛蔵版 // 遙かなる時空の中で4 愛蔵版
{0x8955CE0, {0, 0, 0, ULJM05810, 0, " ULJM05810"}}, {0x8955CE0, {0, 0, 0, ULJM05810, 0, "ULJM05810"}},
// Fate/EXTRA
{0x88B87F0, {0, 6, 0, 0, FNPJH50247, "NPJH50247"}},
}; };
} }