]> Chaos Git - corbenik/ctrulib.git/commitdiff
Updated udsNodeInfo and udsConnectionStatus. Updated the related code for udsNodeInfo.
authoryellows8 <yellows8@users.noreply.github.com>
Thu, 7 Apr 2016 20:31:26 +0000 (16:31 -0400)
committeryellows8 <yellows8@users.noreply.github.com>
Thu, 7 Apr 2016 20:31:26 +0000 (16:31 -0400)
libctru/include/3ds/services/uds.h
libctru/source/services/uds.c

index c5cac2fb2e4994aab4fa48a6266ce90c8feae5a4..0cba3d554fff38aae3baad73faa504b236b36e1c 100644 (file)
 /// Node info struct.
 typedef struct {
        u64 uds_friendcodeseed;//UDS version of the FriendCodeSeed.
-       u8 usercfg[0x18];//This is the first 0x18-bytes from this config block: https://www.3dbrew.org/wiki/Config_Savegame#0x000A0000_Block
+
+       union {
+               u8 usercfg[0x18];//This is the first 0x18-bytes from this config block: https://www.3dbrew.org/wiki/Config_Savegame#0x000A0000_Block
+
+               struct {
+                       u16 username[10];
+
+                       u16 unk_x1c;//Unknown. Set to 0x0 with the output from udsScanBeacons().
+                       u8 flag;//"u8 flag, unknown. Originates from the u16 bitmask in the beacon node-list header. This flag is normally 0 since that bitmask is normally 0?"
+                       u8 pad_x1f;//?
+               };
+       };
 
        //The rest of this is initialized by NWM-module.
        u16 NetworkNodeID;
@@ -37,8 +48,7 @@ typedef struct {
 
        u8 total_nodes;
        u8 max_nodes;
-       u8 node_bitmask;//"This is a bitmask of NetworkNodeIDs: bit0 for NetworkNodeID 0x1(host), bit1 for NetworkNodeID 0x2(first original client), and so on."
-       u8 unk_x2f;//"Padding maybe? Normally 0. "
+       u16 node_bitmask;//"This is a bitmask of NetworkNodeIDs: bit0 for NetworkNodeID 0x1(host), bit1 for NetworkNodeID 0x2(first original client), and so on."
 } udsConnectionStatus;
 
 /// Network struct stored as big-endian.
index 71909959f5fbdd18f25704c96c14b8354f979bec..0c5e85a7cc79047572bda8a394a2a3c6a341e941 100644 (file)
@@ -148,9 +148,9 @@ Result udsGenerateNodeInfo(udsNodeInfo *nodeinfo, const char *username)
        {
                len = 10;
 
-               memset(nodeinfo->usercfg, 0, len*2);
+               memset(nodeinfo->username, 0, sizeof(nodeinfo->username));
 
-               units = utf8_to_utf16((uint16_t*)nodeinfo->usercfg, (uint8_t*)username, len);
+               units = utf8_to_utf16((uint16_t*)nodeinfo->username, (uint8_t*)username, len);
 
                if(units < 0 || units > len)ret = -2;
        }
@@ -165,7 +165,7 @@ Result udsGetNodeInfoUsername(const udsNodeInfo *nodeinfo, char *username)
        ssize_t units=0;
        size_t len = 10;
 
-       units = utf16_to_utf8((uint8_t*)username, (uint16_t*)nodeinfo->usercfg, len);
+       units = utf16_to_utf8((uint8_t*)username, (uint16_t*)nodeinfo->username, len);
 
        if(units < 0 || units > len)return -2;
        return 0;