|
ReXGlue SDK
|
Hook macros and typed hooks that wrap a recompiled function. More...
#include <atomic>#include <cstring>#include <format>#include <tuple>#include <type_traits>#include <cstddef>#include <string>#include <utility>#include <rex/memory/mapped_ptr.h>#include <rex/platform.h>#include <rex/logging/log_category.h>#include <rex/ppc/context.h>#include <rex/ppc/recompiled_code.h>#include <rex/ppc/call.h>#include <rex/types.h>#include <rex/assert.h>#include <rex/ppc/image.h>#include <rex/utility.h>#include <tracy/Tracy.hpp>Go to the source code of this file.
Classes | |
| struct | rex::ppc::DetourOriginal< R(Args...)> |
| struct | rex::ppc::DetourOriginal< R(PPCContext &, Args...)> |
Namespaces | |
| namespace | rex |
| namespace | rex::ppc |
Macros | |
| #define | REX_HOOK(subroutine, function) |
| #define | REX_HOOK_RAW(name) |
| #define | REX_STUB(subroutine) |
| #define | REX_STUB_LOG(subroutine, msg) |
| #define | REX_STUB_RETURN(subroutine, value) |
| #define | REX_EXPORT(name, function) |
| #define | REX_EXPORT_STUB(name) |
| #define | REX_EXPORT_STUB_RETURN(name, value) |
| #define | REX_IMPORT(symbol, callable, sig) |
| #define | REX_DETOUR(name, Ret, params) |
Functions | |
| template<auto Body> | |
| void | rex::ppc::RunDetour (PPCContext &ctx, u8 *base, const char *name, PPCFunc *host) |
Hook macros and typed hooks that wrap a recompiled function.
| #define REX_DETOUR | ( | name, | |
| Ret, | |||
| params ) |
Defines a typed hook whose body reads the arguments as parameters and calls original(args...) on every path, or original(ctx, args...) when the first parameter is PPCContext& ctx. No detour stays running across a guest SwitchToFiber, since the detour chain is thread local.
| name | The recompiled function symbol. |
| Ret | The return type, written to r3 or f1 for the caller. |
| params | The parameter list in parentheses, with names. |
| #define REX_EXPORT | ( | name, | |
| function ) |
Defines a hook whose symbol a kernel export table links against.
| name | The hook symbol. |
| function | The host function the hook wraps. |
| #define REX_EXPORT_STUB | ( | name | ) |
Defines a stub whose symbol a kernel export table links against.
| name | The hook symbol. |
| #define REX_EXPORT_STUB_RETURN | ( | name, | |
| value ) |
Defines a stub that returns a fixed value and whose symbol a kernel export table links against.
| name | The hook symbol. |
| value | The value returned in r3. |
| #define REX_HOOK | ( | subroutine, | |
| function ) |
Hooks a recompiled function with a native C++ function that takes plain types.
| subroutine | The recompiled function symbol. |
| function | The native function the hook calls. |
| #define REX_HOOK_RAW | ( | name | ) |
Defines a raw hook with access to ctx and base.
| name | The recompiled function symbol. |
| #define REX_IMPORT | ( | symbol, | |
| callable, | |||
| sig ) |
Declares a typed callable import of a recompiled function, with internal linkage so it cannot collide with the generated weak alias on ELF.
| symbol | The exact linker symbol to reference. |
| callable | The name of the typed callable variable. |
| sig | The function signature, such as u32(u32, u32). |
| #define REX_STUB | ( | subroutine | ) |
Defines a stub that logs a warning on the first call and at Dev level on later calls.
| subroutine | The recompiled function symbol. |
| #define REX_STUB_LOG | ( | subroutine, | |
| msg ) |
Defines a stub that logs a message on the first call and at Dev level on later calls.
| subroutine | The recompiled function symbol. |
| msg | The message logged with the stub. |
| #define REX_STUB_RETURN | ( | subroutine, | |
| value ) |
Defines a stub that returns a fixed value in r3 and logs it like REX_STUB.
| subroutine | The recompiled function symbol. |
| value | The value returned in r3. |