move Mod::hook to source aswell

This commit is contained in:
HJfod 2024-02-05 23:41:26 +02:00
parent 6cab37d5d2
commit d4acc91d1e
2 changed files with 11 additions and 5 deletions

View file

@ -293,11 +293,7 @@ namespace geode {
void* address, void* detour, std::string const& displayName,
tulip::hook::HandlerMetadata const& handlerMetadata,
tulip::hook::HookMetadata const& hookMetadata
) {
auto hook = Hook::create(address, detour, displayName, handlerMetadata, hookMetadata);
GEODE_UNWRAP_INTO(auto ptr, this->claimHook(std::move(hook)));
return Ok(ptr);
}
);
/**
* Claims an existing hook object, marking this mod as its owner.

View file

@ -141,6 +141,16 @@ bool Mod::getLaunchFlag(std::string_view const name) const {
return m_impl->getLaunchFlag(name);
}
Result<Hook*> Mod::hook(
void* address, void* detour, std::string const& displayName,
tulip::hook::HandlerMetadata const& handlerMetadata,
tulip::hook::HookMetadata const& hookMetadata
) {
auto hook = Hook::create(address, detour, displayName, handlerMetadata, hookMetadata);
GEODE_UNWRAP_INTO(auto ptr, this->claimHook(std::move(hook)));
return Ok(ptr);
}
Result<Hook*> Mod::claimHook(std::shared_ptr<Hook> hook) {
return m_impl->claimHook(hook);
}