From 83626923cfc0f8edf615f59b51b34a2d030dcaac Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Fri, 15 Mar 2019 18:34:55 -0700 Subject: [PATCH] loader/ams_mitm: hidKeysHeld, not hidKeysDown (and remove workaround) --- stratosphere/ams_mitm/source/utils.cpp | 7 ++----- stratosphere/loader/source/ldr_hid.cpp | 7 +++++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/stratosphere/ams_mitm/source/utils.cpp b/stratosphere/ams_mitm/source/utils.cpp index 1f19ede35..67250a980 100644 --- a/stratosphere/ams_mitm/source/utils.cpp +++ b/stratosphere/ams_mitm/source/utils.cpp @@ -220,8 +220,6 @@ void Utils::InitializeThreadFunc(void *args) { } g_has_hid_session = true; - - hidExit(); } } @@ -449,14 +447,13 @@ bool Utils::HasSdDisableMitMFlag(u64 tid) { } Result Utils::GetKeysDown(u64 *keys) { - if (!Utils::IsHidAvailable() || R_FAILED(hidInitialize())) { + if (!Utils::IsHidAvailable()) { return MAKERESULT(Module_Libnx, LibnxError_InitFail_HID); } hidScanInput(); - *keys = hidKeysDown(CONTROLLER_P1_AUTO); + *keys = hidKeysHeld(CONTROLLER_P1_AUTO); - hidExit(); return 0x0; } diff --git a/stratosphere/loader/source/ldr_hid.cpp b/stratosphere/loader/source/ldr_hid.cpp index a7ca176f0..091491b31 100644 --- a/stratosphere/loader/source/ldr_hid.cpp +++ b/stratosphere/loader/source/ldr_hid.cpp @@ -21,13 +21,16 @@ #include "ldr_hid.hpp" Result HidManagement::GetKeysDown(u64 *keys) { - if (!ContentManagement::HasCreatedTitle(0x0100000000000013) || R_FAILED(hidInitialize())) { + if (!ContentManagement::HasCreatedTitle(0x0100000000000013)) { + return MAKERESULT(Module_Libnx, LibnxError_InitFail_HID); + } + + if (!serviceIsActive(hidGetSessionService()) && R_FAILED(hidInitialize())) { return MAKERESULT(Module_Libnx, LibnxError_InitFail_HID); } hidScanInput(); *keys = hidKeysDown(CONTROLLER_P1_AUTO); - hidExit(); return 0x0; } \ No newline at end of file