From bcddc1ea35025e96c70d97f24458c18a2c81e698 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Tue, 23 Oct 2018 16:23:14 -0400 Subject: [PATCH] Only allow using video-recording with regular-application, since it's not usable with SystemApplication. Added _appletIsRegularApplication() for this. --- nx/include/switch/services/applet.h | 2 +- nx/source/services/applet.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/nx/include/switch/services/applet.h b/nx/include/switch/services/applet.h index 203dcb12..53f0c6e6 100644 --- a/nx/include/switch/services/applet.h +++ b/nx/include/switch/services/applet.h @@ -64,7 +64,7 @@ Result appletIsGamePlayRecordingSupported(bool *flag); Result appletSetGamePlayRecordingState(bool state); /// Initializes video recording. This allocates a 0x6000000-byte buffer for the TransferMemory, cleanup is handled automatically during app exit in \ref appletExit. -/// Only available with AppletType_*Application on 3.0.0+, hence errors from this can be ignored. +/// Only available with AppletType_Application on 3.0.0+, hence errors from this can be ignored. /// Video recording is only fully available system-side with 4.0.0+. /// Only usable when running under a title which supports video recording. Result appletInitializeGamePlayRecording(void); diff --git a/nx/source/services/applet.c b/nx/source/services/applet.c index dffc4b12..2ad5c86e 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -271,6 +271,10 @@ static bool _appletIsApplication(void) { return __nx_applet_type == AppletType_Application || __nx_applet_type == AppletType_SystemApplication; } +static bool _appletIsRegularApplication(void) { + return __nx_applet_type == AppletType_Application; +} + void appletExit(void) { if (atomicDecrement64(&g_refCnt) == 0) @@ -737,7 +741,7 @@ Result appletIsGamePlayRecordingSupported(bool *flag) { if (flag) *flag = 0; - if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication()) + if (!serviceIsActive(&g_appletSrv) || !_appletIsRegularApplication()) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); if (!kernelAbove300()) @@ -776,7 +780,7 @@ static Result _appletInitializeGamePlayRecording(TransferMemory *tmem) { IpcCommand c; ipcInitialize(&c); - if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication()) + if (!serviceIsActive(&g_appletSrv) || !_appletIsRegularApplication()) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); if (!kernelAbove300()) @@ -817,7 +821,7 @@ Result appletSetGamePlayRecordingState(bool state) { IpcCommand c; ipcInitialize(&c); - if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication() || g_appletRecordingInitialized==0) + if (!serviceIsActive(&g_appletSrv) || !_appletIsRegularApplication() || g_appletRecordingInitialized==0) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); if (!kernelAbove300()) @@ -859,7 +863,7 @@ Result appletInitializeGamePlayRecording(void) { g_appletRecordingInitialized = 0; //These checks are done in the called applet funcs, but do it here too so that tmemCreate() doesn't run when it's not needed. - if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication()) + if (!serviceIsActive(&g_appletSrv) || !_appletIsRegularApplication()) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); if (!kernelAbove300()) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);