Support games that use VPADGetButtonProcMode (e.g. Zelda TP HD)

This commit is contained in:
Maschell 2023-01-22 14:52:47 +01:00
parent a466b2f40f
commit 0bd1feb1ff

View File

@ -11,6 +11,8 @@
#include <vpad/input.h> #include <vpad/input.h>
#include <wups.h> #include <wups.h>
extern "C" uint32_t VPADGetButtonProcMode(uint32_t);
DECL_FUNCTION(int32_t, VPADRead, VPADChan chan, VPADStatus *buffer, uint32_t buffer_size, VPADReadError *error) { DECL_FUNCTION(int32_t, VPADRead, VPADChan chan, VPADStatus *buffer, uint32_t buffer_size, VPADReadError *error) {
VPADReadError real_error; VPADReadError real_error;
@ -18,7 +20,13 @@ DECL_FUNCTION(int32_t, VPADRead, VPADChan chan, VPADStatus *buffer, uint32_t buf
if (gEnabled && (gTakeScreenshotTV == SCREENSHOT_STATE_READY || gTakeScreenshotDRC == SCREENSHOT_STATE_READY)) { if (gEnabled && (gTakeScreenshotTV == SCREENSHOT_STATE_READY || gTakeScreenshotDRC == SCREENSHOT_STATE_READY)) {
if (result > 0 && real_error == VPAD_READ_SUCCESS) { if (result > 0 && real_error == VPAD_READ_SUCCESS) {
if (((buffer[0].trigger & 0x000FFFFF) == gButtonCombo)) { uint32_t end = 1;
// Fix games like TP HD
if (VPADGetButtonProcMode(chan) == 1) {
end = result;
}
for (uint32_t i = 0; i < end; i++) {
if (((buffer[i].trigger & 0x000FFFFF) == gButtonCombo)) {
if (!OSIsHomeButtonMenuEnabled()) { if (!OSIsHomeButtonMenuEnabled()) {
DEBUG_FUNCTION_LINE("Screenshots are disabled"); DEBUG_FUNCTION_LINE("Screenshots are disabled");
} else { } else {
@ -36,6 +44,8 @@ DECL_FUNCTION(int32_t, VPADRead, VPADChan chan, VPADStatus *buffer, uint32_t buf
} }
OSMemoryBarrier(); OSMemoryBarrier();
} }
break;
}
} }
} }
} }