From d79ecccf030b0b27f94c27f8120eb0e375ee6277 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 27 Apr 2024 15:36:28 +0200 Subject: [PATCH] Fix the default button combo --- src/config.cpp | 2 +- src/config.h | 3 ++- src/function_patcher.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index b081a21..b9ed876 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -29,7 +29,7 @@ void InitConfig() { DEBUG_FUNCTION_LINE_ERR("Failed to init config api"); } - gButtonCombo = VPAD_BUTTON_TV; + gButtonCombo = BUTTON_COMBO_CONFIG_DEFAULT; WUPSStorageError storageRes; if ((storageRes = WUPSStorageAPI::GetOrStoreDefault(ENABLED_CONFIG_STRING, gEnabled, ENABLED_CONFIG_DEFAULT)) != WUPS_STORAGE_ERROR_SUCCESS) { diff --git a/src/config.h b/src/config.h index 9546177..a3097fa 100644 --- a/src/config.h +++ b/src/config.h @@ -1,10 +1,11 @@ #pragma once +#include #define ENABLED_CONFIG_DEFAULT true #define FORMAT_CONFIG_DEFAULT IMAGE_OUTPUT_FORMAT_JPEG #define QUALITY_CONFIG_DEFAULT 90 #define SCREEN_CONFIG_DEFAULT IMAGE_SOURCE_TV_AND_DRC -#define BUTTON_COMBO_CONFIG_DEFAULT 0 +#define BUTTON_COMBO_CONFIG_DEFAULT VPAD_BUTTON_TV #define RESERVED_BIT_USAGE_CONFIG_DEFAULT true #define ENABLED_CONFIG_STRING "enabled" diff --git a/src/function_patcher.cpp b/src/function_patcher.cpp index 2a0e8af..e123a48 100644 --- a/src/function_patcher.cpp +++ b/src/function_patcher.cpp @@ -93,7 +93,7 @@ DECL_FUNCTION(int32_t, VPADRead, VPADChan chan, VPADStatus *buffer, uint32_t buf VPADReadError real_error; int32_t result = real_VPADRead(chan, buffer, buffer_size, &real_error); - if (gEnabled) { + if (gEnabled && gButtonCombo != 0) { if (result > 0 && real_error == VPAD_READ_SUCCESS) { uint32_t end = 1; // Fix games like TP HD @@ -130,7 +130,7 @@ static uint32_t sWasHoldForXFrame[4]; DECL_FUNCTION(void, WPADRead, WPADChan chan, WPADStatusProController *data) { real_WPADRead(chan, data); - if (gEnabled && chan >= 0 && chan < 4) { + if (gEnabled && gButtonCombo > 0 && chan >= 0 && chan < 4) { if (data[0].err == 0) { if (data[0].extensionType != 0xFF) { uint32_t curButtonHold = 0;