This commit is contained in:
2025-05-29 23:59:05 +08:00
parent 35a220de3f
commit 4a669d86b7
12 changed files with 5901 additions and 655 deletions

View File

@@ -1,6 +1,7 @@
#ifndef BD364AE6_AD96_4DEA_9D6B_B237BC1E2C6A
#define BD364AE6_AD96_4DEA_9D6B_B237BC1E2C6A
#include <cstdint>
#include <gh_datasegment.h>
template <size_t addr> inline constexpr void checkMappedMemory() {
@@ -8,8 +9,9 @@ template <size_t addr> inline constexpr void checkMappedMemory() {
static_assert(addr < GH_DATA_END, "Address outside upper bound");
}
uint8_t *gh_map_dbg_mem(size_t addr);
void gh_init_dbg_loader();
#define GH_MEM(addr) (checkMappedMemory<addr>(), *memoryMapSafe(addr))
#define GH_MEM(addr) (checkMappedMemory<addr>(), *gh_map_dbg_mem(addr))
#endif /* BD364AE6_AD96_4DEA_9D6B_B237BC1E2C6A */

View File

@@ -4,11 +4,13 @@
#define EDBE48FC_B879_4985_9274_B7ACF24AD024
#include "base.h"
#if RE_DBG_INJECTED
#include "dbg_mem.h"
#else
#include "static_mem.h"
#endif
#include <gh_types.h>
#endif /* EDBE48FC_B879_4985_9274_B7ACF24AD024 */

View File

@@ -13,7 +13,7 @@ template <typename T, typename... Args>
T gh_stub_impl_cdecl(void *ptr_, Args... args) {
#if RE_DBG_INJECTED
using Callable = __cdecl T (*)(Args...);
static Callable *fn = (Callable *)gh_stub_impl_ptr(ptr_);
static Callable fn = (Callable)gh_stub_impl_ptr(ptr_);
return fn(args...);
#else
throw GHStubException("Function not implemented");
@@ -24,7 +24,7 @@ template <typename T, typename... Args>
T gh_stub_impl_stdcall(void *ptr_, Args... args) {
#if RE_DBG_INJECTED
using Callable = __stdcall T (*)(Args...);
static Callable *fn = (Callable *)gh_stub_impl_ptr(ptr_);
static Callable fn = (Callable)gh_stub_impl_ptr(ptr_);
return fn(args...);
#else
throw GHStubException("Function not implemented");