From c51321f30cb4ded0d877678f833034bce906c9fd Mon Sep 17 00:00:00 2001 From: Maschell Date: Mon, 4 Mar 2024 17:46:06 +0100 Subject: [PATCH 1/2] Fix button combo checking in games that use ButtonProcMode 1 --- src/function_patcher.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/function_patcher.cpp b/src/function_patcher.cpp index d0d0b15..5ae099a 100644 --- a/src/function_patcher.cpp +++ b/src/function_patcher.cpp @@ -92,14 +92,14 @@ DECL_FUNCTION(int32_t, VPADRead, VPADChan chan, VPADStatus *buffer, uint32_t buf bool checkFullBuffer = VPADGetButtonProcMode(chan) == 1; if (gChangeAudioModeButtonComboEnabled && checkButtonComboVPAD(buffer, - checkFullBuffer ? buffer_size : 1, + checkFullBuffer ? result : 1, gSwapAudioButtonCombo, sSwapVoicesWasHoldForXFrameGamePad)) { SwapVoices(); } if (gSwapScreenButtonComboEnabled && checkButtonComboVPAD(buffer, - checkFullBuffer ? buffer_size : 1, + checkFullBuffer ? result : 1, gSwapScreenButtonCombo, sSwapScreenWasHoldForXFrameGamePad)) { SwapScreens(); From 5cb883c1fd75c3e4ef6d79801634851da0a647bb Mon Sep 17 00:00:00 2001 From: Maschell Date: Mon, 4 Mar 2024 17:46:30 +0100 Subject: [PATCH 2/2] Make sure to init static variables --- src/function_patcher.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/function_patcher.cpp b/src/function_patcher.cpp index 5ae099a..9bdfd0e 100644 --- a/src/function_patcher.cpp +++ b/src/function_patcher.cpp @@ -80,8 +80,8 @@ void SwapScreens() { void SwapVoices(); extern "C" uint32_t VPADGetButtonProcMode(VPADChan chan); -static uint32_t sSwapScreenWasHoldForXFrameGamePad; -static uint32_t sSwapVoicesWasHoldForXFrameGamePad; +static uint32_t sSwapScreenWasHoldForXFrameGamePad = 0; +static uint32_t sSwapVoicesWasHoldForXFrameGamePad = 0; DECL_FUNCTION(int32_t, VPADRead, VPADChan chan, VPADStatus *buffer, uint32_t buffer_size, VPADReadError *error) { VPADReadError real_error; int32_t result = real_VPADRead(chan, buffer, buffer_size, &real_error);