From acd81566fa0ec733f62736f9324e792195deede6 Mon Sep 17 00:00:00 2001 From: Hamzah Al-washali Date: Tue, 20 May 2025 16:31:25 +0300 Subject: [PATCH] Holds are now fixed! 1. a new variable is introduced "lastDownId". 2. This variable is used to track the last pressed button. In case of "holds" the button HAS to be the last one pressed, this is the case on all the official games. 3. This will fix the syndrome "just hold R2 / L2 to get the full hold score". --- .../source/plugins/TLAC/Input/Bindings/Binding.cpp | 14 ++++++++++++-- .../source/plugins/TLAC/Input/Bindings/Binding.h | 3 +++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/source-code/source/plugins/TLAC/Input/Bindings/Binding.cpp b/source-code/source/plugins/TLAC/Input/Bindings/Binding.cpp index 9d24e90e..8babddd2 100644 --- a/source-code/source/plugins/TLAC/Input/Bindings/Binding.cpp +++ b/source-code/source/plugins/TLAC/Input/Bindings/Binding.cpp @@ -19,10 +19,14 @@ namespace TLAC::Input bool Binding::AnyDown() { + int i = 0; for (const auto& binding : InputBindings) { - if (binding->IsDown()) + // If an old input is still held down, don't register it, only a new input is allowed. + if (binding->IsDown() && this->lastDownId == i) return true; + + i++; } return false; @@ -30,10 +34,16 @@ namespace TLAC::Input bool Binding::AnyTapped() { + int i = 0; for (const auto& binding : InputBindings) { - if (binding->IsTapped()) + if (binding->IsTapped()) { + // This saves the last button id to a variable, so that it's known as the last input registered (see AnyDown()). + this->lastDownId = i; return true; + } + + i++; } return false; diff --git a/source-code/source/plugins/TLAC/Input/Bindings/Binding.h b/source-code/source/plugins/TLAC/Input/Bindings/Binding.h index 359c9930..a536f5d0 100644 --- a/source-code/source/plugins/TLAC/Input/Bindings/Binding.h +++ b/source-code/source/plugins/TLAC/Input/Bindings/Binding.h @@ -6,6 +6,9 @@ namespace TLAC::Input { class Binding { + // Used in down & tapped events + int lastDownId = -1; + public: std::vector InputBindings;