mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-05 10:52:15 +02:00
Do not store events as global variables
This commit is contained in:
parent
9d536520b3
commit
a812549802
@ -2351,7 +2351,6 @@ bool appletMainLoop(void) {
|
|||||||
|
|
||||||
appletCallHook(AppletHookType_OnPerformanceMode);
|
appletCallHook(AppletHookType_OnPerformanceMode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -13,10 +13,6 @@
|
|||||||
static Service g_hidsysSrv;
|
static Service g_hidsysSrv;
|
||||||
static u64 g_hidsysRefCnt;
|
static u64 g_hidsysRefCnt;
|
||||||
|
|
||||||
static Event g_hidsysHomeEvent = {0};
|
|
||||||
static Event g_hidsysCaptureEvent = {0};
|
|
||||||
static Event g_hidSysSleepEvent = {0};
|
|
||||||
|
|
||||||
static u64 g_hidsysAppletResourceUserId = 0;
|
static u64 g_hidsysAppletResourceUserId = 0;
|
||||||
|
|
||||||
Result hidsysInitialize(void) {
|
Result hidsysInitialize(void) {
|
||||||
@ -38,10 +34,6 @@ Result hidsysInitialize(void) {
|
|||||||
|
|
||||||
void hidsysExit(void) {
|
void hidsysExit(void) {
|
||||||
if (atomicDecrement64(&g_hidsysRefCnt) == 0) {
|
if (atomicDecrement64(&g_hidsysRefCnt) == 0) {
|
||||||
eventClose(&g_hidsysHomeEvent);
|
|
||||||
eventClose(&g_hidsysCaptureEvent);
|
|
||||||
eventClose(&g_hidSysSleepEvent);
|
|
||||||
|
|
||||||
serviceClose(&g_hidsysSrv);
|
serviceClose(&g_hidsysSrv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,40 +158,16 @@ static Result _hidsysGetEvent(Event* event_out, u64 cmd_id, bool autoclear) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result hidsysAcquireHomeButtonEventHandle(Event* event_out) {
|
Result hidsysAcquireHomeButtonEventHandle(Event* event_out) {
|
||||||
if (eventActive(&g_hidsysHomeEvent))
|
return _hidsysGetEvent(event_out, 101, false);
|
||||||
{
|
|
||||||
*event_out = g_hidsysHomeEvent;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Result rc = _hidsysGetEvent(&g_hidsysHomeEvent, 101, false);
|
|
||||||
if (R_SUCCEEDED(rc))
|
|
||||||
*event_out = g_hidsysHomeEvent;
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//These functions don't seem to work in the overlaydisp applet context
|
//These functions don't seem to work in the overlaydisp applet context
|
||||||
Result hidsysAcquireCaptureButtonEventHandle(Event* event_out) {
|
Result hidsysAcquireCaptureButtonEventHandle(Event* event_out) {
|
||||||
if (eventActive(&g_hidsysCaptureEvent))
|
return _hidsysGetEvent(event_out, 141, false);
|
||||||
{
|
|
||||||
*event_out = g_hidsysCaptureEvent;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Result rc = _hidsysGetEvent(&g_hidsysCaptureEvent, 141, false);
|
|
||||||
if (R_SUCCEEDED(rc))
|
|
||||||
*event_out = g_hidsysCaptureEvent;
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result hidsysAcquireSleepButtonEventHandle(Event* event_out) {
|
Result hidsysAcquireSleepButtonEventHandle(Event* event_out) {
|
||||||
if (eventActive(&g_hidSysSleepEvent))
|
return _hidsysGetEvent(event_out, 121, false);
|
||||||
{
|
|
||||||
*event_out = g_hidSysSleepEvent;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Result rc = _hidsysGetEvent(&g_hidSysSleepEvent, 121, false);
|
|
||||||
if (R_SUCCEEDED(rc))
|
|
||||||
*event_out = g_hidSysSleepEvent;
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result hidsysActivateHomeButton(void) {
|
Result hidsysActivateHomeButton(void) {
|
||||||
|
Loading…
Reference in New Issue
Block a user