Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quadrupled helpers in plugins_ex.h for libhook #1583

Open
BonusPlay opened this issue Jan 5, 2023 · 0 comments
Open

Quadrupled helpers in plugins_ex.h for libhook #1583

BonusPlay opened this issue Jan 5, 2023 · 0 comments

Comments

@BonusPlay
Copy link
Contributor

Currently, we have 4 helpers for each kind of hook:

template<typename Params = PluginResult>
[[nodiscard]]
std::unique_ptr<libhook::CpuidHook> createCpuidHook(hook_cb_t cb);

template<typename Params = PluginResult>
[[nodiscard]]
std::unique_ptr<libhook::CpuidHook> createCpuidHook(hook_cb_t cb, int ttl);

template<typename Params = PluginResult, typename Callback>
[[nodiscard]]
std::unique_ptr<libhook::CpuidHook> createCpuidHook(Callback cb);

template<typename Params = PluginResult, typename Callback>
[[nodiscard]]
std::unique_ptr<libhook::CpuidHook> createCpuidHook(Callback cb, int ttl);

With a bit of constexpr magic we can reduce that down to 1 helper per hook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant