From 45e584d8dd30b522e45ecc4e20d3b1726036ec3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Thu, 21 Mar 2024 21:13:31 +0800 Subject: [PATCH] yuzu Update buffer.c Update yuzusuyu.cpp --- LunaHook/engine64/yuzusuyu.cpp | 36 +++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/LunaHook/engine64/yuzusuyu.cpp b/LunaHook/engine64/yuzusuyu.cpp index fa6065b..64f3a6e 100644 --- a/LunaHook/engine64/yuzusuyu.cpp +++ b/LunaHook/engine64/yuzusuyu.cpp @@ -78,7 +78,13 @@ public: return base+args[idx]; } }; -std::unordered_map>emfunctionhooks; +struct emfuncinfo{ + const char* hookname; + void* hookfunc; + const wchar_t* _id; + const wchar_t* _version; +}; +std::unordered_mapemfunctionhooks; } bool yuzusuyu::attach_function() @@ -93,17 +99,19 @@ bool yuzusuyu::attach_function() auto entrypoint = *argidx(stack,idxEntrypoint); // r9 auto em_address = *(uintptr_t*)descriptor; em_address-=0x80004000; - if(emfunctionhooks.find(em_address)!=emfunctionhooks.end() && entrypoint){ - auto op=emfunctionhooks.at(em_address); - DWORD _; - VirtualProtect((LPVOID)entrypoint,0x10,PAGE_EXECUTE_READWRITE,&_); - HookParam hpinternal; - hpinternal.address=entrypoint; - hpinternal.type=CODEC_UTF16|USING_STRING|NO_CONTEXT; - hpinternal.text_fun=(decltype(hpinternal.text_fun))op.second; - NewHook(hpinternal,op.first); - } - + if(emfunctionhooks.find(em_address)==emfunctionhooks.end() || !entrypoint)return; + + auto op=emfunctionhooks.at(em_address); + + + DWORD _; + VirtualProtect((LPVOID)entrypoint,0x10,PAGE_EXECUTE_READWRITE,&_); + HookParam hpinternal; + hpinternal.address=entrypoint; + hpinternal.type=CODEC_UTF16|USING_STRING|NO_CONTEXT; + hpinternal.text_fun=(decltype(hpinternal.text_fun))op.hookfunc; + NewHook(hpinternal,op.hookname); + }; return NewHook(hp,"YuzuDoJit"); } @@ -120,8 +128,8 @@ void _0100978013276000(hook_stack* stack, HookParam* hp, uintptr_t* data, uintpt } auto _=[](){ emfunctionhooks={ - {0x8003eeac - 0x80004000,{"Memories Off 1.0.0",_0100978013276000}}, - {0x8003eebc - 0x80004000,{"Memories Off 1.0.1",_0100978013276000}}, + {0x8003eeac - 0x80004000,{"Memories Off",_0100978013276000,L"0100978013276000",L"1.0.0"}}, + {0x8003eebc - 0x80004000,{"Memories Off",_0100978013276000,L"0100978013276000",L"1.0.1"}}, }; return 1; }(); \ No newline at end of file