From 10b0825be055cd9bca4685995d662b5c57a8014b Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 26 Dec 2021 20:52:06 +0100 Subject: [PATCH] Fix gamepad reading --- source/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/main.cpp b/source/main.cpp index d23f849..007a7a4 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -76,7 +76,10 @@ int main(int argc, char **argv) { VPADStatus vpad_data; VPADRead(VPAD_CHAN_0, &vpad_data, 1, &err); - uint32_t btn = vpad_data.hold | vpad_data.trigger; + uint32_t btn = 0; + if(err == VPAD_READ_SUCCESS) { + btn = vpad_data.hold | vpad_data.trigger; + } std::string environment_path = "fs:/vol/external01/wiiu/environments/default"; if ((btn & VPAD_BUTTON_X) == VPAD_BUTTON_X) {