mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-12-25 20:54:15 +08:00
yuzu
This commit is contained in:
parent
db7beab725
commit
5055412464
@ -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;
|
||||
}();
|
||||
|
@ -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<size/sizeof(uint32_t);i++){
|
||||
for(auto i=0;i<size;i++){
|
||||
unsigned h,l;
|
||||
convertUTF32ToUTF16(u32str[i],h,l);
|
||||
if(h)
|
||||
@ -176,7 +175,7 @@ size_t u32strlen(uint32_t* data){
|
||||
std::optional<std::wstring> 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 {};
|
||||
}
|
@ -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<std::wstring> StringToWideString(const std::string& text, UINT encoding);
|
||||
|
Loading…
x
Reference in New Issue
Block a user