From c4bc7b24a0106ae4761ca8d7b440749b07ccbd4a Mon Sep 17 00:00:00 2001 From: yellows8 Date: Tue, 3 Dec 2019 23:31:01 -0500 Subject: [PATCH] Added type Uuid and use it where needed. Renamed the c field in NcmPlaceHolderId to uuid. Removed PACKED from WebWifiPageArg/WebWifiReturnValue. --- nx/include/switch/applets/web.h | 8 ++++---- nx/include/switch/services/applet.h | 2 +- nx/include/switch/services/ncm_types.h | 2 +- nx/include/switch/types.h | 2 ++ nx/source/applets/web.c | 2 +- nx/source/services/applet.c | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/nx/include/switch/applets/web.h b/nx/include/switch/applets/web.h index c8ea9a0c..e93f5ba8 100644 --- a/nx/include/switch/applets/web.h +++ b/nx/include/switch/applets/web.h @@ -47,15 +47,15 @@ typedef struct { u32 unk_x0; ///< Official sw sets this to 0 with appletStorageWrite, separately from the rest of the config struct. char conntest_url[0x100]; ///< Connection-test URL. char initial_url[0x400]; ///< Initial URL navigated to by the applet. - u128 uuid; ///< NIFM Network UUID. Only used by the applet when conntest_url is set. + Uuid uuid; ///< NIFM Network UUID. Only used by the applet when conntest_url is set. u32 rev; ///< Input value for nifm cmd SetRequirementByRevision. Only used by the applet when conntest_url is set. -} PACKED WebWifiPageArg; +} WebWifiPageArg; /// Struct for the WebWifi applet output storage. typedef struct { u32 unk_x0; ///< Unknown. Result res; ///< Result -} PACKED WebWifiReturnValue; +} WebWifiReturnValue; /// Config for WebWifi. typedef struct { @@ -243,7 +243,7 @@ typedef enum { * @param uuid NIFM Network UUID, for nifm cmd SetNetworkProfileId. Value 0 can be used. Only used by the applet when conntest_url is set. * @param rev Input value for nifm cmd SetRequirementByRevision. Value 0 can be used. Only used by the applet when conntest_url is set. */ -void webWifiCreate(WebWifiConfig* config, const char* conntest_url, const char* initial_url, u128 uuid, u32 rev); +void webWifiCreate(WebWifiConfig* config, const char* conntest_url, const char* initial_url, Uuid uuid, u32 rev); /** * @brief Launches WifiWebAuthApplet with the specified config and waits for it to exit. diff --git a/nx/include/switch/services/applet.h b/nx/include/switch/services/applet.h index 4c332a71..e34086b1 100644 --- a/nx/include/switch/services/applet.h +++ b/nx/include/switch/services/applet.h @@ -1347,7 +1347,7 @@ void appletNotifyRunning(bool *out); * @note Only available with AppletType_*Application on [2.0.0+]. * @param[out] out Output PseudoDeviceId. */ -Result appletGetPseudoDeviceId(u128 *out); +Result appletGetPseudoDeviceId(Uuid *out); /// Set media playback state. /// If state is set to true, screen dimming and auto sleep is disabled. diff --git a/nx/include/switch/services/ncm_types.h b/nx/include/switch/services/ncm_types.h index 26e57049..db12897c 100644 --- a/nx/include/switch/services/ncm_types.h +++ b/nx/include/switch/services/ncm_types.h @@ -65,7 +65,7 @@ typedef struct { /// PlaceHolderId typedef struct { - alignas(8) u8 c[0x10]; ///< Id + alignas(8) Uuid uuid; ///< UUID } NcmPlaceHolderId; /// ContentMetaKey diff --git a/nx/include/switch/types.h b/nx/include/switch/types.h index d28e9b9e..12138829 100644 --- a/nx/include/switch/types.h +++ b/nx/include/switch/types.h @@ -48,6 +48,8 @@ typedef u32 Result; ///< Function error code result type. typedef void (*ThreadFunc)(void *); ///< Thread entrypoint function. typedef void (*VoidFn)(void); ///< Function without arguments nor return value. +typedef struct { u8 uuid[0x10]; } Uuid; ///< Unique identifier. + /// Creates a bitmask from a bit number. #ifndef BIT #define BIT(n) (1U<<(n)) diff --git a/nx/source/applets/web.c b/nx/source/applets/web.c index 3dac6f92..20cc17c4 100644 --- a/nx/source/applets/web.c +++ b/nx/source/applets/web.c @@ -52,7 +52,7 @@ static Result _webShow(AppletHolder *holder, AppletId id, u32 version, void* arg return rc; } -void webWifiCreate(WebWifiConfig* config, const char* conntest_url, const char* initial_url, u128 uuid, u32 rev) { +void webWifiCreate(WebWifiConfig* config, const char* conntest_url, const char* initial_url, Uuid uuid, u32 rev) { memset(config, 0, sizeof(*config)); if (conntest_url) strncpy(config->arg.conntest_url, conntest_url, sizeof(config->arg.conntest_url)-1); diff --git a/nx/source/services/applet.c b/nx/source/services/applet.c index 6b1f175d..0536fc94 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -2005,7 +2005,7 @@ void appletNotifyRunning(bool *out) { if (R_FAILED(rc)) fatalThrow(MAKERESULT(Module_Libnx, LibnxError_BadAppletNotifyRunning)); } -Result appletGetPseudoDeviceId(u128 *out) { +Result appletGetPseudoDeviceId(Uuid *out) { if (!serviceIsActive(&g_appletSrv) || !_appletIsApplication()) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); if (hosversionBefore(2,0,0))