Only allow using video-recording with regular-application, since it's not usable with SystemApplication. Added _appletIsRegularApplication() for this.

This commit is contained in:
yellows8 2018-10-23 16:23:14 -04:00
parent b130d96445
commit bcddc1ea35
2 changed files with 9 additions and 5 deletions

View File

@ -64,7 +64,7 @@ Result appletIsGamePlayRecordingSupported(bool *flag);
Result appletSetGamePlayRecordingState(bool state); 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. /// 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+. /// Video recording is only fully available system-side with 4.0.0+.
/// Only usable when running under a title which supports video recording. /// Only usable when running under a title which supports video recording.
Result appletInitializeGamePlayRecording(void); Result appletInitializeGamePlayRecording(void);

View File

@ -271,6 +271,10 @@ static bool _appletIsApplication(void) {
return __nx_applet_type == AppletType_Application || __nx_applet_type == AppletType_SystemApplication; return __nx_applet_type == AppletType_Application || __nx_applet_type == AppletType_SystemApplication;
} }
static bool _appletIsRegularApplication(void) {
return __nx_applet_type == AppletType_Application;
}
void appletExit(void) void appletExit(void)
{ {
if (atomicDecrement64(&g_refCnt) == 0) if (atomicDecrement64(&g_refCnt) == 0)
@ -737,7 +741,7 @@ Result appletIsGamePlayRecordingSupported(bool *flag) {
if (flag) *flag = 0; if (flag) *flag = 0;
if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication()) if (!serviceIsActive(&g_appletSrv) || !_appletIsRegularApplication())
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
if (!kernelAbove300()) if (!kernelAbove300())
@ -776,7 +780,7 @@ static Result _appletInitializeGamePlayRecording(TransferMemory *tmem) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);
if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication()) if (!serviceIsActive(&g_appletSrv) || !_appletIsRegularApplication())
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
if (!kernelAbove300()) if (!kernelAbove300())
@ -817,7 +821,7 @@ Result appletSetGamePlayRecordingState(bool state) {
IpcCommand c; IpcCommand c;
ipcInitialize(&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); return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
if (!kernelAbove300()) if (!kernelAbove300())
@ -859,7 +863,7 @@ Result appletInitializeGamePlayRecording(void) {
g_appletRecordingInitialized = 0; 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. //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); return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
if (!kernelAbove300()) if (!kernelAbove300())
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);