From db6432ce0ae2c07d174e761f1f4ddc4b319f5856 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Tue, 5 Apr 2016 17:37:07 -0400 Subject: [PATCH] Added udsGetNetworkStructApplicationData(). --- libctru/include/3ds/services/uds.h | 8 ++++++++ libctru/source/services/uds.c | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/libctru/include/3ds/services/uds.h b/libctru/include/3ds/services/uds.h index d7cb83b..7fcae7e 100644 --- a/libctru/include/3ds/services/uds.h +++ b/libctru/include/3ds/services/uds.h @@ -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. diff --git a/libctru/source/services/uds.c b/libctru/source/services/uds.c index 253c5e8..1bfddc4 100644 --- a/libctru/source/services/uds.c +++ b/libctru/source/services/uds.c @@ -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();