mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-12-27 13:44:11 +08:00
964868b2d2
1 1 Update texthook.cc 1 Update hookfinder.cc yuzu/ppsspp hook search Update hookfinder.cc Update hookfinder.cc 1 1 1
52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
#pragma once
|
|
#ifdef _WIN64
|
|
namespace YUZU
|
|
{
|
|
class emu_arg{
|
|
hook_stack* stack;
|
|
public:
|
|
emu_arg(hook_stack* stack_):stack(stack_){};
|
|
uintptr_t operator [](int idx){
|
|
auto base=stack->r13;
|
|
auto args=(uintptr_t*)stack->r15;
|
|
return base+args[idx];
|
|
}
|
|
};
|
|
}
|
|
#endif
|
|
namespace PPSSPP{
|
|
inline DWORD x86_baseaddr;
|
|
class emu_addr{
|
|
hook_stack* stack;
|
|
DWORD addr;
|
|
public:
|
|
emu_addr(hook_stack* stack_,DWORD addr_):stack(stack_),addr(addr_){};
|
|
operator uintptr_t(){
|
|
#ifndef _WIN64
|
|
auto base=x86_baseaddr;
|
|
#else
|
|
auto base=stack->rbx;
|
|
#endif
|
|
return base+addr;
|
|
}
|
|
operator DWORD*(){
|
|
return (DWORD*)(uintptr_t)*this;
|
|
}
|
|
};
|
|
class emu_arg{
|
|
hook_stack* stack;
|
|
public:
|
|
|
|
emu_arg(hook_stack* stack_):stack(stack_){};
|
|
uintptr_t operator [](int idx){
|
|
#ifndef _WIN64
|
|
auto args=stack->ebp;
|
|
#else
|
|
auto args=stack->r14;
|
|
#endif
|
|
auto offR = -0x80;
|
|
auto offset = offR + 0x10 + idx * 4;
|
|
return (uintptr_t)emu_addr(stack,*(uint32_t*)(args+offset));
|
|
}
|
|
};
|
|
} |