ns: Added/updated required-sysver checks as needed by [10.0.0+], and added nsdevLaunchApplicationFromHost.

This commit is contained in:
yellows8 2020-04-16 12:38:46 -04:00
parent a272fa75b9
commit 3a22332630
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 41 additions and 8 deletions

View File

@ -435,6 +435,7 @@ Result nsIsApplicationEntityMovable(u64 application_id, NcmStorageId storage_id,
/** /**
* @brief MoveApplicationEntity * @brief MoveApplicationEntity
* @note Only available on [1.0.0-9.2.0].
* @param[in] application_id ApplicationId. * @param[in] application_id ApplicationId.
* @param[in] storage_id \ref NcmStorageId * @param[in] storage_id \ref NcmStorageId
*/ */
@ -737,7 +738,7 @@ Result nsWithdrawApplicationUpdateRequest(u64 application_id);
/** /**
* @brief RequestVerifyAddOnContentsRights * @brief RequestVerifyAddOnContentsRights
* @note Only available on [3.0.0+]. * @note Only available on [3.0.0-9.2.0].
* @param[out] a \ref NsProgressAsyncResult * @param[out] a \ref NsProgressAsyncResult
* @param[in] application_id ApplicationId. * @param[in] application_id ApplicationId.
*/ */
@ -1318,14 +1319,15 @@ void nsdevExit(void);
/// Gets the Service object for ns:dev. /// Gets the Service object for ns:dev.
Service* nsdevGetServiceSession(void); Service* nsdevGetServiceSession(void);
Result nsdevLaunchProgram(u64* out_pid, const NsLaunchProperties* properties, u32 flags); Result nsdevLaunchProgram(u64* out_pid, const NsLaunchProperties* properties, u32 flags); ///< [1.0.0-9.2.0]
Result nsdevTerminateProcess(u64 pid); Result nsdevTerminateProcess(u64 pid);
Result nsdevTerminateProgram(u64 tid); Result nsdevTerminateProgram(u64 tid); ///< [1.0.0-9.2.0]
Result nsdevGetShellEvent(Event* out_event); ///< Autoclear for nsdevShellEvent is always true. Result nsdevGetShellEvent(Event* out_event); ///< Autoclear for nsdevShellEvent is always true. [1.0.0-9.2.0]
Result nsdevGetShellEventInfo(NsShellEventInfo* out); Result nsdevGetShellEventInfo(NsShellEventInfo* out); ///< [1.0.0-9.2.0]
Result nsdevTerminateApplication(void); Result nsdevTerminateApplication(void);
Result nsdevPrepareLaunchProgramFromHost(NsLaunchProperties* out, const char* path, size_t path_len); 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); 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 nsdevLaunchApplicationWithStorageIdForDevelop(u64* out_pid, u64 application_id, u32 flags, u8 app_storage_id, u8 patch_storage_id);
Result nsdevIsSystemMemoryResourceLimitBoosted(bool* out); ///< [6.0.0-8.1.0] Result nsdevIsSystemMemoryResourceLimitBoosted(bool* out); ///< [6.0.0-8.1.0]
Result nsdevGetRunningApplicationProcessIdForDevelop(u64* out_pid); ///< [6.0.0+] Result nsdevGetRunningApplicationProcessIdForDevelop(u64* out_pid); ///< [6.0.0+]

View File

@ -729,6 +729,9 @@ Result nsIsApplicationEntityMovable(u64 application_id, NcmStorageId storage_id,
} }
Result nsMoveApplicationEntity(u64 application_id, NcmStorageId storage_id) { Result nsMoveApplicationEntity(u64 application_id, NcmStorageId storage_id) {
if (hosversionAtLeast(10,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsManCmdInU8U64NoOut(storage_id, application_id, 9); return _nsManCmdInU8U64NoOut(storage_id, application_id, 9);
} }
@ -1226,7 +1229,7 @@ static Result _nsRequestVerifyApplication(NsProgressAsyncResult *a, u64 applicat
} }
Result nsRequestVerifyAddOnContentsRights(NsProgressAsyncResult *a, u64 application_id) { Result nsRequestVerifyAddOnContentsRights(NsProgressAsyncResult *a, u64 application_id) {
if (hosversionBefore(3,0,0)) if (!hosversionBetween(3,10))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
Service srv={0}; Service srv={0};
@ -2262,6 +2265,9 @@ Service* nsdevGetServiceSession(void) {
} }
Result nsdevLaunchProgram(u64* out_pid, const NsLaunchProperties* properties, u32 flags) { Result nsdevLaunchProgram(u64* out_pid, const NsLaunchProperties* properties, u32 flags) {
if (hosversionAtLeast(10,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct { const struct {
u32 flags; u32 flags;
u32 pad; u32 pad;
@ -2276,14 +2282,23 @@ Result nsdevTerminateProcess(u64 pid) {
} }
Result nsdevTerminateProgram(u64 tid) { Result nsdevTerminateProgram(u64 tid) {
if (hosversionAtLeast(10,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdInU64(&g_nsdevSrv, tid, 2); return _nsCmdInU64(&g_nsdevSrv, tid, 2);
} }
Result nsdevGetShellEvent(Event* out_event) { Result nsdevGetShellEvent(Event* out_event) {
if (hosversionAtLeast(10,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _nsCmdGetEvent(&g_nsdevSrv, out_event, true, 4); return _nsCmdGetEvent(&g_nsdevSrv, out_event, true, 4);
} }
Result nsdevGetShellEventInfo(NsShellEventInfo* out) { Result nsdevGetShellEventInfo(NsShellEventInfo* out) {
if (hosversionAtLeast(10,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
struct { struct {
u32 event; u32 event;
u64 process_id; u64 process_id;
@ -2302,6 +2317,9 @@ Result nsdevTerminateApplication(void) {
} }
Result nsdevPrepareLaunchProgramFromHost(NsLaunchProperties* out, const char* path, size_t path_len) { Result nsdevPrepareLaunchProgramFromHost(NsLaunchProperties* out, const char* path, size_t path_len) {
if (hosversionAtLeast(10,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchOut(&g_nsdevSrv, 7, *out, return serviceDispatchOut(&g_nsdevSrv, 7, *out,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In }, .buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In },
.buffers = { { path, path_len } }, .buffers = { { path, path_len } },
@ -2309,6 +2327,9 @@ Result nsdevPrepareLaunchProgramFromHost(NsLaunchProperties* out, const char* pa
} }
Result nsdevLaunchApplicationForDevelop(u64* out_pid, u64 application_id, u32 flags) { Result nsdevLaunchApplicationForDevelop(u64* out_pid, u64 application_id, u32 flags) {
if (hosversionAtLeast(10,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
const struct { const struct {
u32 flags; u32 flags;
u64 application_id; u64 application_id;
@ -2317,6 +2338,16 @@ Result nsdevLaunchApplicationForDevelop(u64* out_pid, u64 application_id, u32 fl
return serviceDispatchInOut(&g_nsdevSrv, 8, in, *out_pid); return serviceDispatchInOut(&g_nsdevSrv, 8, in, *out_pid);
} }
Result nsdevLaunchApplicationFromHost(u64* out_pid, const char* path, size_t path_len, u32 flags) {
if (hosversionBefore(10,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchInOut(&g_nsdevSrv, 8, flags, *out_pid,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In },
.buffers = { { path, path_len } },
);
}
Result nsdevLaunchApplicationWithStorageIdForDevelop(u64* out_pid, u64 application_id, u32 flags, u8 app_storage_id, u8 patch_storage_id) { Result nsdevLaunchApplicationWithStorageIdForDevelop(u64* out_pid, u64 application_id, u32 flags, u8 app_storage_id, u8 patch_storage_id) {
const struct { const struct {
u8 app_storage_id; u8 app_storage_id;