diff --git a/Code/hooks/include/DInputHook.hpp b/Code/hooks/include/DInputHook.hpp index 2823bfd..f68f8eb 100644 --- a/Code/hooks/include/DInputHook.hpp +++ b/Code/hooks/include/DInputHook.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include namespace TiltedPhoques @@ -21,6 +22,8 @@ namespace TiltedPhoques void Update() const noexcept; + Signal OnKeyPress; + private: DInputHook() noexcept; diff --git a/Code/hooks/src/DInputHook.cpp b/Code/hooks/src/DInputHook.cpp index acda073..83dbe94 100644 --- a/Code/hooks/src/DInputHook.cpp +++ b/Code/hooks/src/DInputHook.cpp @@ -98,9 +98,14 @@ namespace TiltedPhoques { for (DWORD i = 0; i < *outDataLen; ++i) { - if (input.IsToggleKey(outData[i].dwOfs) && outData[i].dwData & 0x80) + if (outData[i].dwData & 0x80) { - DInputHook::Get().SetEnabled(true); + if (input.IsToggleKey(outData[i].dwOfs)) + { + input.SetEnabled(true); + } + + input.OnKeyPress.Emit(outData[i].dwOfs); } } } @@ -183,7 +188,6 @@ namespace TiltedPhoques DInputHook::DInputHook() noexcept { - SetToggleKeys({ DIK_F2, DIK_RCONTROL }); } void DInputHook::SetToggleKeys(std::initializer_list aKeys) noexcept