]> Chaos Git - corbenik/ctrulib.git/commitdiff
Added udsGetNetworkStructApplicationData().
authoryellows8 <yellows8@users.noreply.github.com>
Tue, 5 Apr 2016 21:37:07 +0000 (17:37 -0400)
committeryellows8 <yellows8@users.noreply.github.com>
Tue, 5 Apr 2016 21:37:07 +0000 (17:37 -0400)
libctru/include/3ds/services/uds.h
libctru/source/services/uds.c

index d7cb83b6b987b4320f7ffd4d7b58399dcf70becc..7fcae7ede9db2750422b43db5e3d4213a8fb888b 100644 (file)
@@ -184,6 +184,14 @@ Result udsSetApplicationData(u8 *buf, u32 size);
  */
 Result udsGetApplicationData(u8 *buf, u32 size, u32 *actual_size);
 
+/**
+ * @brief This can be used with a NetworkStruct, from udsScanBeacons() mainly, for getting the appdata.
+ * @param buf Appdata buffer.
+ * @param size Max size of the output buffer.
+ * @param actual_size If set, the actual size of the appdata written into the buffer is stored here.
+ */
+Result udsGetNetworkStructApplicationData(udsNetworkStruct *network, u8 *buf, u32 size, u32 *actual_size);
+
 /**
  * @brief Create a bind.
  * @param bindcontext The output bind context.
index 253c5e8f34a942507a0cba8c4a7b338a000af04f..1bfddc4763015246d8cdd67136fcc87f5383ad13 100644 (file)
@@ -662,6 +662,18 @@ Result udsGetApplicationData(u8 *buf, u32 size, u32 *actual_size)
        return ret;
 }
 
+Result udsGetNetworkStructApplicationData(udsNetworkStruct *network, u8 *buf, u32 size, u32 *actual_size)
+{
+       if(network->appdata_size > sizeof(network->appdata))return -1;
+       if(size > network->appdata_size)size = network->appdata_size;
+
+       if(buf)memcpy(buf, network->appdata, size);
+
+       if(actual_size)*actual_size = size;
+
+       return 0;
+}
+
 static Result udsipc_Bind(udsBindContext *bindcontext, u32 input0, u8 input1, u16 NetworkNodeID)//input0 and input1 are unknown.
 {
        u32* cmdbuf=getThreadCommandBuffer();