diff --git a/LunaHook/engine64/yuzusuyu.cpp b/LunaHook/engine64/yuzusuyu.cpp index 58ecd60..cfe7616 100644 --- a/LunaHook/engine64/yuzusuyu.cpp +++ b/LunaHook/engine64/yuzusuyu.cpp @@ -359,6 +359,15 @@ bool F01000200194AE000(void* data, size_t* len, HookParam* hp){ } return write_string_overwrite(data,len,s); } +void T0100EA001A626000(hook_stack* stack, HookParam* hp, uintptr_t* data, uintptr_t* split, size_t* len){ + auto address=emu_arg(stack)[1]; + auto s=utf32_to_utf16((uint32_t*)address,u32strlen((uint32_t*)address)); + s = std::regex_replace(s, std::wregex(L"[\\s]"), L""); + s = std::regex_replace(s, std::wregex(L"#KW"), L""); + s = std::regex_replace(s, std::wregex(L"#C\\(TR,0xff0000ff\\)"), L""); + s = std::regex_replace(s, std::wregex(L"#P\\(.*\\)"), L""); + write_string_new(data,len,s); +} namespace{ auto _=[](){ emfunctionhooks={ @@ -395,6 +404,10 @@ auto _=[](){ {0x80557408 - 0x80004000,{"Majestic Majolical",simpleutf8getter<0>,F01000200194AE000,L"01000200194AE000",L"1.0.0"}},//name {0x8059ee94 - 0x80004000,{"Majestic Majolical",simpleutf8getter<3>,F01000200194AE000,L"01000200194AE000",L"1.0.0"}},//player name {0x80557420 - 0x80004000,{"Majestic Majolical",simpleutf8getter<0>,F01000200194AE000,L"01000200194AE000",L"1.0.0"}},//dialogue + + + {0x8017ad54 - 0x80004000,{"Matsurika no Kei",T0100EA001A626000,0,L"0100EA001A626000",L"1.0.0"}},// text + {0x80174d4c - 0x80004000,{"Matsurika no Kei",T0100EA001A626000,0,L"0100EA001A626000",L"1.0.0"}},// name }; return 1; }(); diff --git a/include/stringutils.cpp b/include/stringutils.cpp index 93e2f49..2ad44ab 100644 --- a/include/stringutils.cpp +++ b/include/stringutils.cpp @@ -151,10 +151,9 @@ inline unsigned int convertUTF32ToUTF16(unsigned int cUTF32, unsigned int& h, un unsigned int ret = ((h << 16) | (l & 0x0000FFFF)); return ret; } -std::wstring utf32_to_utf16(void* data,size_t size){ +std::wstring utf32_to_utf16(uint32_t* u32str,size_t size){ std::wstring u16str; - auto u32str=(uint32_t*)data; - for(auto i=0;i commonparsestring(void* data,size_t length,void* php,DWORD df){ auto hp=(HookParam*)php; if (hp->type & CODEC_UTF16) return std::wstring((wchar_t*)data, length / sizeof(wchar_t)); - else if(hp->type&CODEC_UTF32)return (std::move(utf32_to_utf16(data,length))); + else if(hp->type&CODEC_UTF32)return (std::move(utf32_to_utf16((uint32_t*)data,length/ sizeof(uint32_t)))); else if (auto converted = StringToWideString(std::string((char*)data, length), (hp->type&CODEC_UTF8)?CP_UTF8:(hp->codepage ? hp->codepage :df))) return (converted.value()); else return {}; } \ No newline at end of file diff --git a/include/stringutils.h b/include/stringutils.h index 8c59aec..ff9ac2a 100644 --- a/include/stringutils.h +++ b/include/stringutils.h @@ -22,7 +22,7 @@ bool startWith(const std::wstring& s,const std::wstring &s2); bool endWith(const std::string& s,const std::string& s2); bool endWith(const std::wstring& s,const std::wstring& s2); -std::wstring utf32_to_utf16(void* data,size_t size); +std::wstring utf32_to_utf16(uint32_t* u32str,size_t size); std::string WideStringToString(const std::wstring& text,UINT cp=CP_UTF8); std::wstring StringToWideString(const std::string& text); std::optional StringToWideString(const std::string& text, UINT encoding);