mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-11-23 05:45:37 +08:00
bits
1
This commit is contained in:
parent
5a8d299812
commit
42db206882
@ -71,7 +71,7 @@ namespace
|
||||
const char *_id;
|
||||
const char *_version;
|
||||
};
|
||||
std::unordered_map<uintptr_t, emfuncinfo> emfunctionhooks;
|
||||
std::unordered_map<uint64_t, emfuncinfo> 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);
|
||||
|
@ -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;
|
||||
|
@ -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<uintptr_t, uint64_t> 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<sp.minAddress)continue;
|
||||
i+=1;
|
||||
//addresses.push_back(addr.first);
|
||||
|
@ -209,7 +209,7 @@ int HookStrLen(HookParam *hp, BYTE *data)
|
||||
return strnlen((char *)data, TEXT_BUFFER_SIZE);
|
||||
}
|
||||
static std::mutex maplock;
|
||||
void jitaddraddr(uintptr_t em_addr, uintptr_t jitaddr, JITTYPE jittype)
|
||||
void jitaddraddr(uint64_t em_addr, uintptr_t jitaddr, JITTYPE jittype)
|
||||
{
|
||||
std::lock_guard _(maplock);
|
||||
emuaddr2jitaddr[em_addr] = {jittype, jitaddr};
|
||||
@ -248,7 +248,7 @@ void delayinsertadd(HookParam hp, std::string name)
|
||||
delayinserthook[hp.emu_addr] = {name, hp};
|
||||
ConsoleOutput(INSERTING_HOOK, name.c_str(), hp.emu_addr);
|
||||
}
|
||||
void delayinsertNewHook(uintptr_t em_address)
|
||||
void delayinsertNewHook(uint64_t em_address)
|
||||
{
|
||||
if (delayinserthook.find(em_address) == delayinserthook.end())
|
||||
return;
|
||||
|
@ -18,16 +18,16 @@ inline SearchParam spDefault;
|
||||
|
||||
// EOF
|
||||
int HookStrLen(HookParam *, BYTE *data);
|
||||
inline std::unordered_map<uintptr_t, std::pair<JITTYPE, uintptr_t>> emuaddr2jitaddr;
|
||||
inline std::unordered_map<uintptr_t, std::pair<JITTYPE, uintptr_t>> jitaddr2emuaddr;
|
||||
void jitaddraddr(uintptr_t em_addr, uintptr_t jitaddr, JITTYPE);
|
||||
inline std::unordered_map<uint64_t, std::pair<JITTYPE, uintptr_t>> emuaddr2jitaddr;
|
||||
inline std::unordered_map<uintptr_t, std::pair<JITTYPE, uint64_t>> 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<uintptr_t, std::pair<std::string, HookParam>> delayinserthook;
|
||||
inline std::map<uint64_t, std::pair<std::string, HookParam>> 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;
|
Loading…
Reference in New Issue
Block a user