mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-04 09:11:31 -04:00
add docs
This commit is contained in:
parent
45a04cc330
commit
5268bc631b
2 changed files with 30 additions and 4 deletions
|
@ -25,9 +25,11 @@ namespace geode {
|
|||
public:
|
||||
|
||||
/**
|
||||
* Create a hook at an address. The hook is enabled immediately. By
|
||||
* default, the hook is placed at the end of the detour list; however,
|
||||
* this can be controlled using metadata settings.
|
||||
* 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.
|
||||
* @param address The address to hook
|
||||
* @param detour The detour to run when the hook is hit. The detour's
|
||||
* calling convention should be cdecl
|
||||
|
@ -36,7 +38,7 @@ namespace geode {
|
|||
* @param handlerMetadata Metadata for the hook handler
|
||||
* @param hookMetadata Metadata for the hook itself
|
||||
* @returns The created hook, or an error. Make sure to add the created
|
||||
* hook to the mod that owns it using mod->claimHook!
|
||||
* hook to the mod that owns it using mod->claimHook(hook)!
|
||||
*/
|
||||
static std::shared_ptr<Hook> create(
|
||||
void* address,
|
||||
|
|
|
@ -265,8 +265,20 @@ namespace geode {
|
|||
return Ok(ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Claims an existing hook object, marking this mod as its owner.
|
||||
* If the hook has "auto enable" set, this will enable the hook.
|
||||
* @returns Returns a pointer to the hook, or an error if the
|
||||
* hook already has an owner, or was unable to enable the hook.
|
||||
*/
|
||||
Result<Hook*> claimHook(std::shared_ptr<Hook>&& hook);
|
||||
|
||||
/**
|
||||
* Disowns a hook which this mod owns, making this mod no longer its owner.
|
||||
* If the hook has "auto enable" set, this will disable the hook.
|
||||
* @returns Returns an error if this mod doesn't own the hook, or
|
||||
* if disabling the hook failed.
|
||||
*/
|
||||
Result<> disownHook(Hook* hook);
|
||||
|
||||
/**
|
||||
|
@ -288,8 +300,20 @@ namespace geode {
|
|||
return Ok(ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Claims an existing patch object, marking this mod as its owner.
|
||||
* If the patch has "auto enable" set, this will enable the patch.
|
||||
* @returns Returns a pointer to the patch, or an error if the
|
||||
* patch already has an owner, or was unable to enable the patch.
|
||||
*/
|
||||
Result<Patch*> claimPatch(std::shared_ptr<Patch>&& patch);
|
||||
|
||||
/**
|
||||
* Disowns a patch which this mod owns, making this mod no longer its owner.
|
||||
* If the patch has "auto enable" set, this will disable the patch.
|
||||
* @returns Returns an error if this mod doesn't own the patch, or
|
||||
* if disabling the patch failed.
|
||||
*/
|
||||
Result<> disownPatch(Patch* patch);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue