Fixed+enabled appletSetTerminateResult and added it to applet.h.

This commit is contained in:
yellows8 2018-12-18 21:45:13 -05:00
parent d8683ea188
commit ced4f16ee1
2 changed files with 41 additions and 36 deletions

View File

@ -143,6 +143,9 @@ Result appletPopLaunchParameter(AppletStorage *s, AppletLaunchParameterKind kind
Result appletGetDesiredLanguage(u64 *LanguageCode);
/// Only available with AppletType_*Application.
Result appletSetTerminateResult(Result res);
/// Gets whether video recording is supported.
/// See also \ref appletInitializeGamePlayRecording.
Result appletIsGamePlayRecordingSupported(bool *flag);

View File

@ -79,7 +79,6 @@ static Result _appletSetOperationModeChangedNotification(u8 flag);
static Result _appletSetPerformanceModeChangedNotification(u8 flag);
static Result _appletSelfExit(void);
//static Result _appletSetTerminateResult(Result res);
static Result _appletExitProcessAndReturn(void);
@ -307,7 +306,7 @@ void appletExit(void)
}
else {
if (_appletIsApplication()) {
//_appletSetTerminateResult(0);
//appletSetTerminateResult(0);
_appletSelfExit();
}
if (__nx_applet_type == AppletType_LibraryApplet)
@ -828,6 +827,43 @@ Result appletGetDesiredLanguage(u64 *LanguageCode) {
return _appletCmdNoInOut64(&g_appletIFunctions, LanguageCode, 21);
}
Result appletSetTerminateResult(Result res) {
IpcCommand c;
ipcInitialize(&c);
if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication())
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
struct {
u64 magic;
u64 cmd_id;
Result res;
} *raw;
raw = serviceIpcPrepareHeader(&g_appletIFunctions, &c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 22;
raw->res = res;
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) {
IpcCommand c;
ipcInitialize(&c);
@ -1424,40 +1460,6 @@ Result appletSetScreenShotImageOrientation(s32 val) {
return rc;
}
/*static Result _appletSetTerminateResult(Result res) {
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
Result res;
} *raw;
raw = serviceIpcPrepareHeader(&g_appletISelfController, &c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 22;
raw->res = res;
Result rc = serviceIpcDispatch(&g_appletISelfController);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
struct {
u64 magic;
u64 result;
} *resp;
serviceIpcParse(&g_appletISelfController, &r, sizeof(*resp));
resp = r.Raw;
rc = resp->result;
}
return rc;
}*/
Result appletCreateManagedDisplayLayer(u64 *out) {
return _appletCmdNoInOut64(&g_appletISelfController, out, 40);
}