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