Added appletIsSystemBufferSharingEnabled, appletGetSystemSharedLayerHandle, and appletGetSystemSharedBufferHandle.

This commit is contained in:
yellows8 2019-07-24 19:45:39 -04:00
parent 974f5b9a1b
commit ed2f4a68f7
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 75 additions and 1 deletions

View File

@ -519,6 +519,27 @@ Result appletSetDesirableKeyboardLayout(u32 layout);
Result appletCreateManagedDisplayLayer(u64 *out);
/**
* @brief Checks whether SystemBufferSharing is enabled, throwing an error otherwise.
* @note Only available with [4.0.0+]. Not usable with AppletType_*Application.
*/
Result appletIsSystemBufferSharingEnabled(void);
/**
* @brief Gets the System SharedBufferHandle and SharedLayerHandle.
* @note Only available with [4.0.0+]. Not usable with AppletType_*Application.
* @param[out] SharedBufferHandle Output System SharedBufferHandle.
* @param[out] SharedLayerHandle Output System SharedLayerHandle.
*/
Result appletGetSystemSharedLayerHandle(u64 *SharedBufferHandle, u64 *SharedLayerHandle);
/**
* @brief Same as \ref appletGetSystemSharedLayerHandle except this just gets the SharedBufferHandle.
* @note Only available with [5.0.0+]. Not usable with AppletType_*Application.
* @param[out] SharedBufferHandle Output System SharedBufferHandle.
*/
Result appletGetSystemSharedBufferHandle(u64 *SharedBufferHandle);
/**
* @brief Sets whether ::AppletNotificationMessage_RequestToDisplay is enabled.
* @note Sets an internal state flag. When the input flag is 0, this will in additional run the same code as \ref appletApproveToDisplay.

View File

@ -2242,7 +2242,6 @@ Result appletSetScreenShotAppletIdentityInfo(AppletIdentityInfo *info) {
struct {
u64 magic;
u64 result;
AppletIdentityInfo info;
} *resp;
serviceIpcParse(&g_appletISelfController, &r, sizeof(*resp));
@ -2290,6 +2289,60 @@ Result appletCreateManagedDisplayLayer(u64 *out) {
return _appletCmdNoInOut64(&g_appletISelfController, out, 40);
}
Result appletIsSystemBufferSharingEnabled(void) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _appletCmdNoIO(&g_appletISelfController, 41);
}
Result appletGetSystemSharedLayerHandle(u64 *SharedBufferHandle, u64 *SharedLayerHandle) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = serviceIpcPrepareHeader(&g_appletISelfController, &c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 42;
Result rc = serviceIpcDispatch(&g_appletISelfController);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
struct {
u64 magic;
u64 result;
u64 SharedBufferHandle;
u64 SharedLayerHandle;
} *resp;
serviceIpcParse(&g_appletISelfController, &r, sizeof(*resp));
resp = r.Raw;
rc = resp->result;
if (R_SUCCEEDED(rc) && SharedBufferHandle) *SharedBufferHandle = resp->SharedBufferHandle;
if (R_SUCCEEDED(rc) && SharedLayerHandle) *SharedLayerHandle = resp->SharedLayerHandle;
}
return rc;
}
Result appletGetSystemSharedBufferHandle(u64 *SharedBufferHandle) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _appletCmdNoInOut64(&g_appletISelfController, SharedBufferHandle, 43);
}
Result appletSetHandlesRequestToDisplay(bool flag) {
return _appletCmdInBool(&g_appletISelfController, flag, 50);
}