Update buffer.c

Update yuzusuyu.cpp
This commit is contained in:
恍兮惚兮 2024-03-21 21:13:31 +08:00
parent b213f71feb
commit 45e584d8dd

View File

@ -78,7 +78,13 @@ public:
return base+args[idx]; return base+args[idx];
} }
}; };
std::unordered_map<uintptr_t,std::pair<LPCSTR,void*>>emfunctionhooks; struct emfuncinfo{
const char* hookname;
void* hookfunc;
const wchar_t* _id;
const wchar_t* _version;
};
std::unordered_map<uintptr_t,emfuncinfo>emfunctionhooks;
} }
bool yuzusuyu::attach_function() bool yuzusuyu::attach_function()
@ -93,16 +99,18 @@ bool yuzusuyu::attach_function()
auto entrypoint = *argidx(stack,idxEntrypoint); // r9 auto entrypoint = *argidx(stack,idxEntrypoint); // r9
auto em_address = *(uintptr_t*)descriptor; auto em_address = *(uintptr_t*)descriptor;
em_address-=0x80004000; em_address-=0x80004000;
if(emfunctionhooks.find(em_address)!=emfunctionhooks.end() && entrypoint){ if(emfunctionhooks.find(em_address)==emfunctionhooks.end() || !entrypoint)return;
auto op=emfunctionhooks.at(em_address);
DWORD _; auto op=emfunctionhooks.at(em_address);
VirtualProtect((LPVOID)entrypoint,0x10,PAGE_EXECUTE_READWRITE,&_);
HookParam hpinternal;
hpinternal.address=entrypoint; DWORD _;
hpinternal.type=CODEC_UTF16|USING_STRING|NO_CONTEXT; VirtualProtect((LPVOID)entrypoint,0x10,PAGE_EXECUTE_READWRITE,&_);
hpinternal.text_fun=(decltype(hpinternal.text_fun))op.second; HookParam hpinternal;
NewHook(hpinternal,op.first); 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"); return NewHook(hp,"YuzuDoJit");
@ -120,8 +128,8 @@ void _0100978013276000(hook_stack* stack, HookParam* hp, uintptr_t* data, uintpt
} }
auto _=[](){ auto _=[](){
emfunctionhooks={ emfunctionhooks={
{0x8003eeac - 0x80004000,{"Memories Off 1.0.0",_0100978013276000}}, {0x8003eeac - 0x80004000,{"Memories Off",_0100978013276000,L"0100978013276000",L"1.0.0"}},
{0x8003eebc - 0x80004000,{"Memories Off 1.0.1",_0100978013276000}}, {0x8003eebc - 0x80004000,{"Memories Off",_0100978013276000,L"0100978013276000",L"1.0.1"}},
}; };
return 1; return 1;
}(); }();