#pragma once #include #include #include namespace fxn { using NativeHandler = void(*)(fxn::NativeContext*); using NativeHash = std::uint64_t; using NativeHook = std::function; class FxnManager { private: struct Impl; Impl* m_Impl; FxnManager(); ~FxnManager(); public: static FxnManager& GetInstance(); static void Destroy(); static void DispatchNative(fxn::NativeContext* context, NativeHash hash); public: const NativeHandler& GetNativeHandler(const NativeHash hash) const; void RegisterNativeHandler(const NativeHash hash, const NativeHandler handler); public: void RegisterNativeHook(const NativeHash hash, const NativeHook& hook); void UnregisterNativeHook(const NativeHash hash); public: bool Invoke(fxn::NativeContext* context); bool Schedule(fxn::NativeContext* context, bool waitForCompletion = true); }; }