mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-23 04:12:02 +00:00
fs.mitm: Fix HID usage (closes #292)
This commit is contained in:
parent
84c776fa6b
commit
a9a71fbeed
2 changed files with 6 additions and 3 deletions
|
@ -191,6 +191,8 @@ void Utils::InitializeHidThreadFunc(void *args) {
|
||||||
|
|
||||||
g_has_hid_session = true;
|
g_has_hid_session = true;
|
||||||
|
|
||||||
|
hidExit();
|
||||||
|
|
||||||
svcExitThread();
|
svcExitThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +200,7 @@ bool Utils::IsSdInitialized() {
|
||||||
return g_has_initialized;
|
return g_has_initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utils::IsHidInitialized() {
|
bool Utils::IsHidAvailable() {
|
||||||
return g_has_hid_session;
|
return g_has_hid_session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,13 +412,14 @@ bool Utils::HasSdDisableMitMFlag(u64 tid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Utils::GetKeysDown(u64 *keys) {
|
Result Utils::GetKeysDown(u64 *keys) {
|
||||||
if (!Utils::IsHidInitialized()) {
|
if (!Utils::IsHidAvailable() || R_FAILED(hidInitialize())) {
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_InitFail_HID);
|
return MAKERESULT(Module_Libnx, LibnxError_InitFail_HID);
|
||||||
}
|
}
|
||||||
|
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
*keys = hidKeysDown(CONTROLLER_P1_AUTO);
|
*keys = hidKeysDown(CONTROLLER_P1_AUTO);
|
||||||
|
|
||||||
|
hidExit();
|
||||||
return 0x0;
|
return 0x0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ class Utils {
|
||||||
static bool HasSdDisableMitMFlag(u64 tid);
|
static bool HasSdDisableMitMFlag(u64 tid);
|
||||||
|
|
||||||
|
|
||||||
static bool IsHidInitialized();
|
static bool IsHidAvailable();
|
||||||
static void InitializeHidThreadFunc(void *args);
|
static void InitializeHidThreadFunc(void *args);
|
||||||
static Result GetKeysDown(u64 *keys);
|
static Result GetKeysDown(u64 *keys);
|
||||||
static bool HasOverrideButton(u64 tid);
|
static bool HasOverrideButton(u64 tid);
|
||||||
|
|
Loading…
Reference in a new issue