From 145943d3a627f1bcb6b4cf0f03e67875890cc513 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sat, 30 Dec 2023 17:32:38 +0100 Subject: [PATCH] InputSystem: fix controller hold keys not working Should've been !keyInfo.m_bKeyDown. --- r5dev/engine/sys_mainwind.cpp | 6 +++--- r5dev/engine/sys_mainwind.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/r5dev/engine/sys_mainwind.cpp b/r5dev/engine/sys_mainwind.cpp index b08353e2..8fb7d3ce 100644 --- a/r5dev/engine/sys_mainwind.cpp +++ b/r5dev/engine/sys_mainwind.cpp @@ -121,12 +121,12 @@ void CGame::GetWindowRect(int* const x, int* const y, int* const w, int* const h //----------------------------------------------------------------------------- // Purpose: dispatch key event //----------------------------------------------------------------------------- -void CGame::DispatchKeyEvent(const uint64_t msTime, const ButtonCode_t buttonCode) const +void CGame::DispatchKeyEvent(const uint64_t currentTick, const ButtonCode_t buttonCode) const { - const float duration = buttonCode == KEY_XBUTTON_BACK ? 1.0f : 0.2f; + const float delay = buttonCode == KEY_XBUTTON_BACK ? 1.0f : 0.2f; KeyInfo_t& keyInfo = g_pKeyInfo[buttonCode]; - if (keyInfo.m_bKeyDown && ((msTime - keyInfo.m_nEventTick) * 0.001f) >= duration) + if (!keyInfo.m_bKeyDown && ((currentTick - keyInfo.m_nEventTick) * 0.001f) >= delay) { KeyEvent_t keyEvent; diff --git a/r5dev/engine/sys_mainwind.h b/r5dev/engine/sys_mainwind.h index a4451beb..76745149 100644 --- a/r5dev/engine/sys_mainwind.h +++ b/r5dev/engine/sys_mainwind.h @@ -34,7 +34,7 @@ public: inline float GetTVRefreshRate() const // Avoid stutter on TV's running on broadcast frame rates. { return ((float)m_iDesktopRefreshRate == 59.0f || (float)m_iDesktopRefreshRate == 60.0f) ? 59.939999f : (float)m_iDesktopRefreshRate; } - void DispatchKeyEvent(const uint64_t msTime, const ButtonCode_t buttonCode) const; + void DispatchKeyEvent(const uint64_t currentTick, const ButtonCode_t buttonCode) const; void DispatchAllStoredGameMessages() const; private: