From ccea53c837db2f80237725623996900fafb1df0c Mon Sep 17 00:00:00 2001 From: yellows8 Date: Tue, 29 Oct 2019 12:09:10 -0400 Subject: [PATCH] ns: Updated param names for nssuRequestSendSystemUpdate/nssuControlRequestReceiveSystemUpdate and improved docs. --- nx/include/switch/services/ns.h | 14 ++++++++------ nx/source/services/ns.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/nx/include/switch/services/ns.h b/nx/include/switch/services/ns.h index 5003ef68..5a11dff9 100644 --- a/nx/include/switch/services/ns.h +++ b/nx/include/switch/services/ns.h @@ -311,13 +311,14 @@ Result nssuDestroySystemUpdateTask(void); /** * @brief RequestSendSystemUpdate + * @note The system will use the input addr/port with bind(). addr/port are little-endian. * @note Only available on [4.0.0+]. * @param[out] a \ref AsyncResult - * @param[in] inval0 Unknown input value. - * @param[in] inval1 Unknown input value. qlaunch uses value 0xD904 (55556). + * @param[in] addr IPv4 address. qlaunch uses a local-WLAN addr, however this can be any addr. + * @param[in] port Socket port. qlaunch uses value 55556. * @param[in] info \ref NsSystemDeliveryInfo */ -Result nssuRequestSendSystemUpdate(AsyncResult *a, u32 inval0, u16 inval1, NsSystemDeliveryInfo *info); +Result nssuRequestSendSystemUpdate(AsyncResult *a, u32 addr, u16 port, NsSystemDeliveryInfo *info); /** * @brief GetSendSystemUpdateProgress @@ -471,14 +472,15 @@ Result nssuControlHasReceived(NsSystemUpdateControl *c, bool* out); /** * @brief RequestReceiveSystemUpdate + * @note The system will use the input addr/port with connect(). addr/port are little-endian. * @note Only available on [4.0.0+]. * @param c \ref NsSystemUpdateControl * @param[out] a \ref AsyncResult - * @param[in] inval0 Unknown input value. - * @param[in] inval1 Unknown input value. qlaunch uses value 0xD904 (55556). + * @param[in] addr IPv4 address. qlaunch uses a local-WLAN addr, however this can be any addr. + * @param[in] port Socket port. qlaunch uses value 55556. * @param[in] info \ref NsSystemDeliveryInfo */ -Result nssuControlRequestReceiveSystemUpdate(NsSystemUpdateControl *c, AsyncResult *a, u32 inval0, u16 inval1, NsSystemDeliveryInfo *info); +Result nssuControlRequestReceiveSystemUpdate(NsSystemUpdateControl *c, AsyncResult *a, u32 addr, u16 port, NsSystemDeliveryInfo *info); /** * @brief GetReceiveProgress diff --git a/nx/source/services/ns.c b/nx/source/services/ns.c index 6ee153ca..5aaf162e 100644 --- a/nx/source/services/ns.c +++ b/nx/source/services/ns.c @@ -118,11 +118,11 @@ static Result _nsCmdNoInOutSystemUpdateProgress(Service* srv, NsSystemUpdateProg return serviceDispatchOut(srv, cmd_id, *out); } -static Result _nsCmdRequestSendReceiveSystemUpdate(Service* srv, AsyncResult *a, u32 inval0, u16 inval1, NsSystemDeliveryInfo *info, u32 cmd_id) { +static Result _nsCmdRequestSendReceiveSystemUpdate(Service* srv, AsyncResult *a, u32 addr, u16 port, NsSystemDeliveryInfo *info, u32 cmd_id) { const struct { - u16 inval0; - u32 inval1; - } in = { inval1, inval0 }; + u16 port; + u32 addr; + } in = { port, addr }; memset(a, 0, sizeof(*a)); Handle event = INVALID_HANDLE; @@ -434,11 +434,11 @@ Result nssuDestroySystemUpdateTask(void) { return _nsCmdNoIO(&g_nssuSrv, 16); } -Result nssuRequestSendSystemUpdate(AsyncResult *a, u32 inval0, u16 inval1, NsSystemDeliveryInfo *info) { +Result nssuRequestSendSystemUpdate(AsyncResult *a, u32 addr, u16 port, NsSystemDeliveryInfo *info) { if (hosversionBefore(4,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); - return _nsCmdRequestSendReceiveSystemUpdate(&g_nssuSrv, a, inval0, inval1, info, 17); + return _nsCmdRequestSendReceiveSystemUpdate(&g_nssuSrv, a, addr, port, info, 17); } Result nssuGetSendSystemUpdateProgress(NsSystemUpdateProgress *out) { @@ -614,13 +614,13 @@ Result nssuControlHasReceived(NsSystemUpdateControl *c, bool* out) { return _nsCmdNoInOutBool(&c->s, out, 15); } -Result nssuControlRequestReceiveSystemUpdate(NsSystemUpdateControl *c, AsyncResult *a, u32 inval0, u16 inval1, NsSystemDeliveryInfo *info) { +Result nssuControlRequestReceiveSystemUpdate(NsSystemUpdateControl *c, AsyncResult *a, u32 addr, u16 port, NsSystemDeliveryInfo *info) { if (!serviceIsActive(&c->s)) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); if (hosversionBefore(4,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); - return _nsCmdRequestSendReceiveSystemUpdate(&c->s, a, inval0, inval1, info, 16); + return _nsCmdRequestSendReceiveSystemUpdate(&c->s, a, addr, port, info, 16); } Result nssuControlGetReceiveProgress(NsSystemUpdateControl *c, NsSystemUpdateProgress *out) {