Skip to content

Commit

Permalink
Fix the default button combo
Browse files Browse the repository at this point in the history
  • Loading branch information
Maschell committed Apr 27, 2024
1 parent 3ffae91 commit d79eccc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/config.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#pragma once
#include <vpad/input.h>

#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"
Expand Down
4 changes: 2 additions & 2 deletions src/function_patcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d79eccc

Please sign in to comment.