From ae8687fa19afd4a01927a29e93515709626cc18a Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 26 Apr 2024 10:28:28 +0200 Subject: [PATCH 1/2] Fix checking button combo --- src/main.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c595a2c..ea21c3c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -57,11 +57,16 @@ extern "C" uint32_t start_wrapper(int argc, char **argv) { DEBUG_FUNCTION_LINE_VERBOSE("Hello from payload.elf multiloader"); - VPADReadError err; - VPADStatus vpad_data; - VPADRead(VPAD_CHAN_0, &vpad_data, 1, &err); - - uint32_t btn = vpad_data.hold | vpad_data.trigger; + VPADStatus vpadStatus{}; + VPADReadError vpadError = VPAD_READ_UNINITIALIZED; + int btn = 0; + do { + if (VPADRead(VPAD_CHAN_0, &vpadStatus, 1, &vpadError) > 0 && vpadError == VPAD_READ_SUCCESS) { + btn = vpadStatus.trigger | vpadStatus.hold; + } else { + OSSleepTicks(OSMillisecondsToTicks(1)); + } + } while (vpadError == VPAD_READ_NO_SAMPLES); std::map payloads = get_all_payloads("wiiu/payloads"); From 64c4223a4d7c7c44180159ef4280eec8e4a42ad1 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 26 Apr 2024 10:28:48 +0200 Subject: [PATCH 2/2] Fix Makefile to be compatible with CLion --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 42eefd6..7e28f4b 100644 --- a/Makefile +++ b/Makefile @@ -127,7 +127,7 @@ export OUTPUT := $(CURDIR)/$(TARGET) #--------------------------------------------------------------------------------- $(BUILD): - @[ -d $@ ] || mkdir -p $@ + @$(shell [ ! -d $(BUILD) ] && mkdir -p $(BUILD)) @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile