mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
Added appletGetDisplayVersion.
This commit is contained in:
parent
da4c060278
commit
2262259984
@ -208,6 +208,13 @@ Result appletGetDesiredLanguage(u64 *LanguageCode);
|
||||
/// Only available with AppletType_*Application.
|
||||
Result appletSetTerminateResult(Result res);
|
||||
|
||||
/**
|
||||
* @brief Gets the DisplayVersion for the current host title control.nacp.
|
||||
* @note Only available with AppletType_*Application.
|
||||
* @param[out] displayVersion Output DisplayVersion string, must be at least 0x10-bytes. This is always NUL-terminated.
|
||||
*/
|
||||
Result appletGetDisplayVersion(char *displayVersion);
|
||||
|
||||
/// Set media playback state.
|
||||
/// If state is set to true, screen dimming and auto sleep is disabled.
|
||||
/// For *Application, this uses cmd SetMediaPlaybackStateForApplication, otherwise cmd SetMediaPlaybackState is used.
|
||||
|
@ -1319,6 +1319,49 @@ Result appletSetTerminateResult(Result res) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result appletGetDisplayVersion(char *displayVersion) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
||||
if (displayVersion) memset(displayVersion, 0, 0x10);
|
||||
|
||||
if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication())
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
} *raw;
|
||||
|
||||
raw = serviceIpcPrepareHeader(&g_appletIFunctions, &c, sizeof(*raw));
|
||||
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = 23;
|
||||
|
||||
Result rc = serviceIpcDispatch(&g_appletIFunctions);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
char displayVersion[0x10];
|
||||
} *resp;
|
||||
|
||||
serviceIpcParse(&g_appletIFunctions, &r, sizeof(*resp));
|
||||
resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
|
||||
if (R_SUCCEEDED(rc) && displayVersion) {
|
||||
strncpy(displayVersion, resp->displayVersion, 0x10);
|
||||
displayVersion[0xf] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result appletSetMediaPlaybackState(bool state) {
|
||||
if (!serviceIsActive(&g_appletSrv))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
|
Loading…
Reference in New Issue
Block a user