mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-24 13:52:53 +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.
|
/// Set media playback state.
|
||||||
/// If state is set to true, screen dimming and auto sleep is disabled.
|
/// 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.
|
/// Gets whether video recording is supported.
|
||||||
/// See also \ref appletInitializeGamePlayRecording.
|
/// See also \ref appletInitializeGamePlayRecording.
|
||||||
|
@ -668,6 +668,44 @@ static Result _appletCmdNoInOut64(Service* srv, u64 *out, u64 cmd_id) {
|
|||||||
return rc;
|
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) {
|
static Result _appletCmdInHandle64(Service* srv, Service* srv_out, u64 cmd_id, Handle handle, u64 inval) {
|
||||||
IpcCommand c;
|
IpcCommand c;
|
||||||
ipcInitialize(&c);
|
ipcInitialize(&c);
|
||||||
@ -869,41 +907,14 @@ Result appletSetTerminateResult(Result res) {
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result appletSetMediaPlaybackStateForApplication(bool state) {
|
Result appletSetMediaPlaybackState(bool state) {
|
||||||
IpcCommand c;
|
if (!serviceIsActive(&g_appletSrv))
|
||||||
ipcInitialize(&c);
|
|
||||||
|
|
||||||
if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication())
|
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||||
|
|
||||||
struct {
|
if (!_appletIsApplication())
|
||||||
u64 magic;
|
return _appletCmdInBool(&g_appletISelfController, state, 61);//SetMediaPlaybackState
|
||||||
u64 cmd_id;
|
|
||||||
u8 state;
|
|
||||||
} *raw;
|
|
||||||
|
|
||||||
raw = serviceIpcPrepareHeader(&g_appletIFunctions, &c, sizeof(*raw));
|
return _appletCmdInBool(&g_appletIFunctions, state, 60);//SetMediaPlaybackStateForApplication
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result appletBeginBlockingHomeButton(s64 val) {
|
Result appletBeginBlockingHomeButton(s64 val) {
|
||||||
|
Loading…
Reference in New Issue
Block a user