mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
bpc: add 6.0.0 bpcGetPowerButton, update accessible-firmware comments.
This commit is contained in:
parent
cdba7dc808
commit
d42ddeff78
@ -24,4 +24,5 @@ Service* bpcGetServiceSession(void);
|
|||||||
|
|
||||||
Result bpcShutdownSystem(void);
|
Result bpcShutdownSystem(void);
|
||||||
Result bpcRebootSystem(void);
|
Result bpcRebootSystem(void);
|
||||||
Result bpcGetSleepButtonState(BpcSleepButtonState *out); ///< [2.0.0+]
|
Result bpcGetSleepButtonState(BpcSleepButtonState *out); ///< [2.0.0-13.2.1]
|
||||||
|
Result bpcGetPowerButton(bool* out_is_pushed); ///< [6.0.0+]
|
||||||
|
@ -23,6 +23,10 @@ static Result _bpcCmdNoIO(Service *srv, u32 cmd_id) {
|
|||||||
return serviceDispatch(srv, cmd_id);
|
return serviceDispatch(srv, cmd_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Result _bpcCmdOutU8(Service* srv, u32 cmd_id, u8* out) {
|
||||||
|
return serviceDispatchOut(&g_bpcSrv, cmd_id, out);
|
||||||
|
}
|
||||||
|
|
||||||
Result bpcShutdownSystem(void) {
|
Result bpcShutdownSystem(void) {
|
||||||
return _bpcCmdNoIO(&g_bpcSrv, 0);
|
return _bpcCmdNoIO(&g_bpcSrv, 0);
|
||||||
}
|
}
|
||||||
@ -32,13 +36,25 @@ Result bpcRebootSystem(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result bpcGetSleepButtonState(BpcSleepButtonState *out) {
|
Result bpcGetSleepButtonState(BpcSleepButtonState *out) {
|
||||||
if (hosversionBefore(2,0,0))
|
if (!hosversionBetween(2, 14))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
u8 tmp = 0;
|
u8 tmp = 0;
|
||||||
Result rc = serviceDispatchOut(&g_bpcSrv, 6, tmp);
|
Result rc = _bpcCmdOutU8(&g_bpcSrv, 6, &tmp);
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc) && out) *out = tmp;
|
if (R_SUCCEEDED(rc) && out) *out = tmp;
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result bpcGetPowerButton(bool* out_is_pushed) {
|
||||||
|
if (hosversionBefore(6,0,0))
|
||||||
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
|
u8 tmp = 0;
|
||||||
|
Result rc = _bpcCmdOutU8(&g_bpcSrv, 14, &tmp);
|
||||||
|
|
||||||
|
if (out_is_pushed) *out_is_pushed = R_SUCCEEDED(rc) && tmp != 0;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user