feat: added hooks to the api
This commit is contained in:
@@ -6,7 +6,8 @@ extern "C"
|
||||
{
|
||||
typedef bool (*native_hook_t)(fxn::NativeContext* context, bool& call_original);
|
||||
|
||||
__declspec(dllexport) void* fxn_native_invoker_get_handler(std::uint64_t hash);
|
||||
__declspec(dllexport) void fxn_schedule_native(fxn::NativeContext* context, bool wait);
|
||||
__declspec(dllexport) void fxn_register_native_hook(std::uint64_t hash, native_hook_t hook);
|
||||
__declspec(dllexport) void* fxn_native_invoker_get_handler(std::uint64_t hash);
|
||||
__declspec(dllexport) void fxn_schedule_native(fxn::NativeContext* context, bool wait);
|
||||
__declspec(dllexport) size_t fxn_register_native_hook(std::uint64_t hash, native_hook_t hook);
|
||||
__declspec(dllexport) void fxn_unregister_native_hook(std::uint64_t hash, size_t index);
|
||||
}
|
||||
@@ -17,13 +17,17 @@ extern "C"
|
||||
manager.Schedule(context, wait);
|
||||
}
|
||||
|
||||
__declspec(dllexport) void fxn_register_native_hook(std::uint64_t hash, native_hook_t hook)
|
||||
__declspec(dllexport) size_t fxn_register_native_hook(std::uint64_t hash, native_hook_t hook)
|
||||
{
|
||||
static auto& manager = fxn::FxnManager::GetInstance();
|
||||
|
||||
manager.RegisterNativeHook(hash, [hook](fxn::NativeContext* context, bool& call_original)
|
||||
{
|
||||
return hook(context, call_original);
|
||||
});
|
||||
return manager.RegisterNativeHook(hash, hook);
|
||||
}
|
||||
|
||||
__declspec(dllexport) void fxn_unregister_native_hook(std::uint64_t hash, size_t index)
|
||||
{
|
||||
static auto& manager = fxn::FxnManager::GetInstance();
|
||||
|
||||
manager.UnregisterNativeHook(hash, index);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user