From ff2e76daf912b4c928a3e3319c5ac267bad390f0 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Fri, 29 Mar 2024 02:27:38 -0700 Subject: [PATCH] ns: Add version checking for ns:dev commands --- nx/include/switch/services/ns.h | 4 ++-- nx/source/services/ns.c | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/nx/include/switch/services/ns.h b/nx/include/switch/services/ns.h index 6903c8de..5e350043 100644 --- a/nx/include/switch/services/ns.h +++ b/nx/include/switch/services/ns.h @@ -1339,8 +1339,8 @@ Result nsdevGetShellEventInfo(NsShellEventInfo* out); ///< [1.0.0-9.2.0] Result nsdevTerminateApplication(void); Result nsdevPrepareLaunchProgramFromHost(NsLaunchProperties* out, const char* path, size_t path_len); ///< [1.0.0-9.2.0] Result nsdevLaunchApplicationForDevelop(u64* out_pid, u64 application_id, u32 flags); ///< [1.0.0-9.2.0] -Result nsdevLaunchApplicationFromHost(u64* out_pid, const char* path, size_t path_len, u32 flags); ///< [10.0.0+] -Result nsdevLaunchApplicationWithStorageIdForDevelop(u64* out_pid, u64 application_id, u32 flags, u8 app_storage_id, u8 patch_storage_id); +Result nsdevLaunchApplicationFromHost(u64* out_pid, const char* path, size_t path_len, u32 flags); ///< [10.0.0-17.0.1] +Result nsdevLaunchApplicationWithStorageIdForDevelop(u64* out_pid, u64 application_id, u32 flags, u8 app_storage_id, u8 patch_storage_id); ///< [1.0.0-17.0.1] Result nsdevIsSystemMemoryResourceLimitBoosted(bool* out); ///< [6.0.0-8.1.0] Result nsdevGetRunningApplicationProcessIdForDevelop(u64* out_pid); ///< [6.0.0+] Result nsdevSetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop(bool can_be_active); ///< [6.0.0+] diff --git a/nx/source/services/ns.c b/nx/source/services/ns.c index e63cdd7c..fd87c6c6 100644 --- a/nx/source/services/ns.c +++ b/nx/source/services/ns.c @@ -2367,7 +2367,7 @@ Result nsdevLaunchApplicationForDevelop(u64* out_pid, u64 application_id, u32 fl } Result nsdevLaunchApplicationFromHost(u64* out_pid, const char* path, size_t path_len, u32 flags) { - if (hosversionBefore(10,0,0)) + if (hosversionBefore(10,0,0) || hosversionAtLeast(18,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return serviceDispatchInOut(&g_nsdevSrv, 8, flags, *out_pid, @@ -2377,6 +2377,9 @@ Result nsdevLaunchApplicationFromHost(u64* out_pid, const char* path, size_t pat } Result nsdevLaunchApplicationWithStorageIdForDevelop(u64* out_pid, u64 application_id, u32 flags, u8 app_storage_id, u8 patch_storage_id) { + if (hosversionAtLeast(18,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + const struct { u8 app_storage_id; u8 patch_storage_id;