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::claimHook
, see its docs for more info.
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,std::stringconst&displayName,tulip::hook::HandlerMetadataconst&handlerMetadata,tulip::hook::HookMetadataconst&hookMetadata)
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
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,DetourTypedetour,std::stringconst&displayName,tulip::hook::TulipConventionconvention,tulip::hook::HookMetadataconst&hookMetadata)
No description provided
Public member functions14
geode::Hookoperator=()
No description provided
geode::Mod*getOwner()const
Get the owner of this hook.
Pointer to the owner's Mod handle.
boolisEnabled()const
Get whether the hook is enabled or not.
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.
Auto enable
voidsetAutoEnable(boolautoEnable)
Set whether the hook should be auto enabled or not.
autoEnable
Auto enable
uintptr_tgetAddress()const
Get the address of the function hooked.
Address
std::string_viewgetDisplayName()const
Get the display name of the function hooked.
Display name
matjson::ValuegetRuntimeInfo()const
Get info about the hook as JSON
ℹ For IPC
tulip::hook::HookMetadatagetHookMetadata()const
Get the metadata of the hook.
Hook metadata
voidsetHookMetadata(tulip::hook::HookMetadataconst&metadata)
Set the metadata of the hook.
metadata
Hook metadata
int32_tgetPriority()const
Get the priority of the hook.
Priority