mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-24 05:42:40 +02:00
Replaced appletSetMediaPlaybackStateForApplication with appletSetMediaPlaybackState, which now supports non-Application. Added _appletCmdInU8/_appletCmdInBool, the latter is now used by appletSetMediaPlaybackState.
This commit is contained in:
parent
8be5cad7f8
commit
854e3058ba
@ -162,7 +162,8 @@ Result appletSetTerminateResult(Result res);
|
||||
|
||||
/// Set media playback state.
|
||||
/// If state is set to true, screen dimming and auto sleep is disabled.
|
||||
Result appletSetMediaPlaybackStateForApplication(bool state);
|
||||
/// For *Application, this uses cmd SetMediaPlaybackStateForApplication, otherwise cmd SetMediaPlaybackState is used.
|
||||
Result appletSetMediaPlaybackState(bool state);
|
||||
|
||||
/// Gets whether video recording is supported.
|
||||
/// See also \ref appletInitializeGamePlayRecording.
|
||||
|
@ -668,6 +668,44 @@ static Result _appletCmdNoInOut64(Service* srv, u64 *out, u64 cmd_id) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
static Result _appletCmdInU8(Service* srv, u8 inval, u64 cmd_id) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
u8 inval;
|
||||
} *raw;
|
||||
|
||||
raw = serviceIpcPrepareHeader(srv, &c, sizeof(*raw));
|
||||
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = cmd_id;
|
||||
raw->inval = inval;
|
||||
|
||||
Result rc = serviceIpcDispatch(srv);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
} *resp;
|
||||
|
||||
serviceIpcParse(srv, &r, sizeof(*resp));
|
||||
resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static Result _appletCmdInBool(Service* srv, bool inval, u64 cmd_id) {
|
||||
return _appletCmdInU8(srv, inval!=0, cmd_id);
|
||||
}
|
||||
|
||||
static Result _appletCmdInHandle64(Service* srv, Service* srv_out, u64 cmd_id, Handle handle, u64 inval) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
@ -869,41 +907,14 @@ Result appletSetTerminateResult(Result res) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result appletSetMediaPlaybackStateForApplication(bool state) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
||||
if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication())
|
||||
Result appletSetMediaPlaybackState(bool state) {
|
||||
if (!serviceIsActive(&g_appletSrv))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
u8 state;
|
||||
} *raw;
|
||||
if (!_appletIsApplication())
|
||||
return _appletCmdInBool(&g_appletISelfController, state, 61);//SetMediaPlaybackState
|
||||
|
||||
raw = serviceIpcPrepareHeader(&g_appletIFunctions, &c, sizeof(*raw));
|
||||
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = 60;
|
||||
raw->state = state;
|
||||
|
||||
Result rc = serviceIpcDispatch(&g_appletIFunctions);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
} *resp;
|
||||
|
||||
serviceIpcParse(&g_appletIFunctions, &r, sizeof(*resp));
|
||||
resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
}
|
||||
|
||||
return rc;
|
||||
return _appletCmdInBool(&g_appletIFunctions, state, 60);//SetMediaPlaybackStateForApplication
|
||||
}
|
||||
|
||||
Result appletBeginBlockingHomeButton(s64 val) {
|
||||
|
Loading…
Reference in New Issue
Block a user