From 42db206882657bd110aa333bc34c9182668e172a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Wed, 30 Oct 2024 15:02:19 +0800 Subject: [PATCH] bits 1 --- LunaHook/engine64/yuzu.cpp | 4 ++-- LunaHook/engines/emujitarg.hpp | 2 +- LunaHook/hookfinder.cc | 7 ++++--- LunaHook/main.cc | 4 ++-- LunaHook/main.h | 10 +++++----- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/LunaHook/engine64/yuzu.cpp b/LunaHook/engine64/yuzu.cpp index d5d588b..81e7584 100644 --- a/LunaHook/engine64/yuzu.cpp +++ b/LunaHook/engine64/yuzu.cpp @@ -71,7 +71,7 @@ namespace const char *_id; const char *_version; }; - std::unordered_map emfunctionhooks; + std::unordered_map emfunctionhooks; struct GameInfo { @@ -169,7 +169,7 @@ bool yuzu::attach_function() { auto descriptor = *argidx(stack, idxDescriptor + 1); // r8 auto entrypoint = *argidx(stack, idxEntrypoint + 1); // r9 - auto em_address = *(uintptr_t *)descriptor; + auto em_address = *(uint64_t *)descriptor; if (!entrypoint) return; jitaddraddr(em_address, entrypoint, JITTYPE::YUZU); diff --git a/LunaHook/engines/emujitarg.hpp b/LunaHook/engines/emujitarg.hpp index 0f892f3..43adaf7 100644 --- a/LunaHook/engines/emujitarg.hpp +++ b/LunaHook/engines/emujitarg.hpp @@ -24,7 +24,7 @@ namespace YUZU bool is64; public: - emu_arg(hook_stack *stack_, uintptr_t em_addr = 0) : stack(stack_), is64(em_addr == 0 || em_addr > 0x80004000) {}; + emu_arg(hook_stack *stack_, uint64_t em_addr = 0) : stack(stack_), is64(em_addr == 0 || em_addr > 0x80004000) {}; uintptr_t operator[](int idx) { auto base = stack->r13; diff --git a/LunaHook/hookfinder.cc b/LunaHook/hookfinder.cc index dc753e2..e5be877 100644 --- a/LunaHook/hookfinder.cc +++ b/LunaHook/hookfinder.cc @@ -124,7 +124,7 @@ bool IsBadReadPtr(void *data) } return cacheEntry == BAD_PAGE; } -void DoSend(int i, uintptr_t address, char *str, uintptr_t padding, JITTYPE jittype = JITTYPE::PC, uintptr_t em_addr = 0) +void DoSend(int i, uintptr_t address, char *str, uintptr_t padding, JITTYPE jittype = JITTYPE::PC, uint64_t em_addr = 0) { str += padding; if (IsBadReadPtr(str) || IsBadReadPtr(str + MAX_STRING_SIZE)) @@ -189,7 +189,7 @@ void Send(char **stack, uintptr_t address) DoSend(i, address, stack[i], sp.padding); } } -void SafeSendJitVeh(hook_stack *stack, uintptr_t address, uintptr_t em_addr, JITTYPE jittype, uintptr_t padding) +void SafeSendJitVeh(hook_stack *stack, uintptr_t address, uint64_t em_addr, JITTYPE jittype, uintptr_t padding) { __try { @@ -225,7 +225,7 @@ void SafeSendJitVeh(hook_stack *stack, uintptr_t address, uintptr_t em_addr, JIT } } std::unordered_map addresscalledtime; -bool SendJitVeh(PCONTEXT context, uintptr_t address, uintptr_t em_addr, JITTYPE jittype, uintptr_t padding) +bool SendJitVeh(PCONTEXT context, uintptr_t address, uint64_t em_addr, JITTYPE jittype, uintptr_t padding) { if (safeautoleaveveh) return true; @@ -473,6 +473,7 @@ void SearchForHooks(SearchParam spUser) ConsoleOutput("%p %p",minemaddr,maxemaddr); ConsoleOutput("%p %p",sp.minAddress,sp.maxAddress); for(auto addr:jitaddr2emuaddr){ + //ConsoleOutput("%llx => %p", addr.second.second ,addr.first); if(addr.second.second>sp.maxAddress||addr.second.second> emuaddr2jitaddr; -inline std::unordered_map> jitaddr2emuaddr; -void jitaddraddr(uintptr_t em_addr, uintptr_t jitaddr, JITTYPE); +inline std::unordered_map> emuaddr2jitaddr; +inline std::unordered_map> jitaddr2emuaddr; +void jitaddraddr(uint64_t em_addr, uintptr_t jitaddr, JITTYPE); void context_get(hook_stack *, PCONTEXT); void context_set(hook_stack *, PCONTEXT); -inline std::map> delayinserthook; +inline std::map> delayinserthook; void delayinsertadd(HookParam, std::string); -void delayinsertNewHook(uintptr_t); +void delayinsertNewHook(uint64_t); inline bool safeautoleaveveh = false; inline bool dont_detach = false; inline bool host_connected = false; \ No newline at end of file