From d7577b15e943077f8bde2d195d059155b8b02cf2 Mon Sep 17 00:00:00 2001 From: Andrew Hawes <117602754+Andrew1Hawes@users.noreply.github.com> Date: Tue, 6 Jun 2023 09:29:53 +0100 Subject: [PATCH] Skip update warning with any controller --- source/MenuUtils.cpp | 15 +++++++++++++-- source/main.cpp | 4 ++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/source/MenuUtils.cpp b/source/MenuUtils.cpp index 7b4b5d2..3f6c6b6 100644 --- a/source/MenuUtils.cpp +++ b/source/MenuUtils.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -395,9 +396,19 @@ void handleUpdateWarningScreen() { VPADStatus vpad{}; VPADRead(VPAD_CHAN_0, &vpad, 1, nullptr); - if (vpad.trigger & VPAD_BUTTON_A) { + KPADStatus kpad; + uint32_t wiimoteButtonsTriggered = 0; + uint32_t classicButtonsTriggered = 0; + for (int32_t i = 0; i < 4; i++) { + if (KPADRead((KPADChan) i, &kpad, 1) > 0) { + wiimoteButtonsTriggered |= kpad.trigger; + classicButtonsTriggered |= kpad.classic.trigger; + } + } + + if (vpad.trigger & VPAD_BUTTON_A || wiimoteButtonsTriggered & WPAD_BUTTON_A || classicButtonsTriggered & WPAD_CLASSIC_BUTTON_A) { break; - } else if (vpad.trigger & VPAD_BUTTON_B) { + } else if (vpad.trigger & VPAD_BUTTON_B || wiimoteButtonsTriggered & WPAD_BUTTON_B || classicButtonsTriggered & WPAD_CLASSIC_BUTTON_B) { f = fopen(UPDATE_SKIP_PATH, "w"); if (f) { // It's **really** important to have this text on the stack. diff --git a/source/main.cpp b/source/main.cpp index 0348fa8..27a1bb7 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -48,6 +49,9 @@ int32_t main(int32_t argc, char **argv) { OSFatal("AutobootModule: Mocha_InitLibrary failed"); } + KPADInit(); + WPADEnableURCC(1); + VPADStatus vpad{}; // Buffer vpad read. VPADRead(VPAD_CHAN_0, &vpad, 1, nullptr);