From defee076257aacc216205fdc742efabd84a7086a Mon Sep 17 00:00:00 2001 From: leo60228 Date: Sat, 11 May 2019 14:58:46 -0400 Subject: [PATCH 1/3] Allow pressing buttons on all controllers in loader (closes #541) --- stratosphere/loader/source/ldr_hid.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stratosphere/loader/source/ldr_hid.cpp b/stratosphere/loader/source/ldr_hid.cpp index bc103f56c..eb9c58075 100644 --- a/stratosphere/loader/source/ldr_hid.cpp +++ b/stratosphere/loader/source/ldr_hid.cpp @@ -36,7 +36,11 @@ Result HidManagement::GetKeysHeld(u64 *keys) { } hidScanInput(); - *keys = hidKeysHeld(CONTROLLER_P1_AUTO); + *keys = 0; + + for (int controller = 0; controller < 10; controller++) { + *keys |= hidKeysHeld((HidControllerID) controller); + } return ResultSuccess; } From 56d74734519b36f7439866980109a321fa7acbdc Mon Sep 17 00:00:00 2001 From: leo60228 Date: Sun, 12 May 2019 09:04:58 -0400 Subject: [PATCH 2/3] Do same in ams_mitm --- stratosphere/ams_mitm/source/utils.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stratosphere/ams_mitm/source/utils.cpp b/stratosphere/ams_mitm/source/utils.cpp index 70f1a011e..b1e5ca315 100644 --- a/stratosphere/ams_mitm/source/utils.cpp +++ b/stratosphere/ams_mitm/source/utils.cpp @@ -460,7 +460,11 @@ Result Utils::GetKeysHeld(u64 *keys) { } hidScanInput(); - *keys = hidKeysHeld(CONTROLLER_P1_AUTO); + *keys = 0; + + for (int controller = 0; controller < 10; controller++) { + *keys |= hidKeysHeld((HidControllerID) controller); + } return ResultSuccess; } From eab2d056803b38863c0021de8b5d0edace4b3528 Mon Sep 17 00:00:00 2001 From: leo60228 Date: Sun, 12 May 2019 10:43:49 -0400 Subject: [PATCH 3/3] Do same in dmnt and reboot_to_payload --- stratosphere/dmnt/source/dmnt_hid.cpp | 8 ++++++-- troposphere/reboot_to_payload/source/main.c | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/stratosphere/dmnt/source/dmnt_hid.cpp b/stratosphere/dmnt/source/dmnt_hid.cpp index 7e331d2bf..959ffb79e 100644 --- a/stratosphere/dmnt/source/dmnt_hid.cpp +++ b/stratosphere/dmnt/source/dmnt_hid.cpp @@ -26,7 +26,11 @@ Result HidManagement::GetKeysDown(u64 *keys) { std::scoped_lock lk(g_hid_keys_down_lock); hidScanInput(); - *keys = hidKeysHeld(CONTROLLER_P1_AUTO); + *keys = 0; + + for (int controller = 0; controller < 10; controller++) { + *keys |= hidKeysHeld((HidControllerID) controller); + } return ResultSuccess; -} \ No newline at end of file +} diff --git a/troposphere/reboot_to_payload/source/main.c b/troposphere/reboot_to_payload/source/main.c index 89f0e6258..3c6dcf0e1 100644 --- a/troposphere/reboot_to_payload/source/main.c +++ b/troposphere/reboot_to_payload/source/main.c @@ -79,8 +79,12 @@ int main(int argc, char **argv) //Scan all the inputs. This should be done once for each frame hidScanInput(); - //hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame) - u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO); + u64 kDown = 0; + + for (int controller = 0; controller < 10; controller++) { + // hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame) + kDown |= hidKeysDown((HidControllerID) controller); + } if (can_reboot && kDown & KEY_MINUS) { reboot_to_payload();