Class Hook

#include <Geode/loader/Hook.hpp>
classHook{ ... }
No description provided
Examples0
Public static methods2
staticstd::shared_ptr<geode::Hook>create(
void*address
,
void*detour
,,,)

Create a hook at an address. By default, the hook is disabled and placed at the end of the detour list; however, this can be controlled using metadata settings. After creating the hook object, we recommend you set its owner by calling [Mod](/classes/geode/Mod)::claimHook, see its docs for more info.

Parameters

address

The address to hook

detour

The detour to run when the hook is hit. The detour's calling convention should be cdecl

displayName

A human-readable name describing the hook, usually the fully qualified name of the function being hooked

handlerMetadata

Metadata for the hook handler

hookMetadata

Metadata for the hook itself
Return value
The created hook, or an error. Make sure to add the created hook to the mod that owns it using mod->claimHook(hook)!
template<class DetourType>staticstd::shared_ptr<geode::Hook>create(
void*address
,,,,)
No description provided
Public member functions14
geode::Hookoperator=()
No description provided
geode::Mod*getOwner()const

Get the owner of this hook.

Return value
Pointer to the owner's Mod handle.
boolisEnabled()const

Get whether the hook is enabled or not.

Return value
True if enabled, false if not.
geode::Result<>enable()
No description provided
geode::Result<>disable()
No description provided
boolgetAutoEnable()const

Get whether the hook should be auto enabled or not.

Return value
Auto enable
voidsetAutoEnable(
boolautoEnable
)

Set whether the hook should be auto enabled or not.

Parameters

autoEnable

Auto enable
_::uintptr_tgetAddress()const

Get the address of the function hooked.

Return value
Address
std::string_viewgetDisplayName()const

Get the display name of the function hooked.

Return value
Display name
matjson::ValuegetRuntimeInfo()const

Get info about the hook as JSON

ℹ For IPC

tulip::hook::HookMetadatagetHookMetadata()const

Get the metadata of the hook.

Return value
Hook metadata
voidsetHookMetadata()

Set the metadata of the hook.

Parameters

metadata

Hook metadata
int32_tgetPriority()const

Get the priority of the hook.

Return value
Priority
voidsetPriority(
int32_tpriority
)

Set the priority of the hook.

Parameters

priority

Priority
Fields0
Protected member functions0
Protected fields0