mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-09 22:56:35 +00:00
dmnt: only initialize HID once
This commit is contained in:
parent
b4b1208222
commit
fbddf090a4
2 changed files with 10 additions and 4 deletions
|
@ -16,17 +16,17 @@
|
||||||
|
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
#include "dmnt_hid.hpp"
|
#include "dmnt_hid.hpp"
|
||||||
|
|
||||||
|
static HosMutex g_hid_keys_down_lock;
|
||||||
|
|
||||||
Result HidManagement::GetKeysDown(u64 *keys) {
|
Result HidManagement::GetKeysDown(u64 *keys) {
|
||||||
if (R_FAILED(hidInitialize())) {
|
std::scoped_lock<HosMutex> lk(g_hid_keys_down_lock);
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_InitFail_HID);
|
|
||||||
}
|
|
||||||
|
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
*keys = hidKeysDown(CONTROLLER_P1_AUTO);
|
*keys = hidKeysDown(CONTROLLER_P1_AUTO);
|
||||||
|
|
||||||
hidExit();
|
|
||||||
return 0x0;
|
return 0x0;
|
||||||
}
|
}
|
|
@ -99,6 +99,11 @@ void __appInit(void) {
|
||||||
fatalSimple(rc);
|
fatalSimple(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rc = hidInitialize();
|
||||||
|
if (R_FAILED(rc)) {
|
||||||
|
fatalSimple(rc);
|
||||||
|
}
|
||||||
|
|
||||||
rc = fsInitialize();
|
rc = fsInitialize();
|
||||||
if (R_FAILED(rc)) {
|
if (R_FAILED(rc)) {
|
||||||
fatalSimple(rc);
|
fatalSimple(rc);
|
||||||
|
@ -116,6 +121,7 @@ void __appExit(void) {
|
||||||
/* Cleanup services. */
|
/* Cleanup services. */
|
||||||
fsdevUnmountAll();
|
fsdevUnmountAll();
|
||||||
fsExit();
|
fsExit();
|
||||||
|
hidExit();
|
||||||
setExit();
|
setExit();
|
||||||
lrExit();
|
lrExit();
|
||||||
nsdevExit();
|
nsdevExit();
|
||||||
|
|
Loading…
Reference in a new issue