Skip to content

Commit e09a49a

Browse files
ZeroSkill1fincs
authored andcommitted
Fixes for Mii struct and FRD_GetFriendKeyList
1 parent b5cba1e commit e09a49a

File tree

4 files changed

+16
-24
lines changed

4 files changed

+16
-24
lines changed

libctru/include/3ds/mii.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,11 @@ typedef struct
170170

171171
u16 author_name[10]; ///< Name of Mii's author (Encoded using UTF16)
172172
} CTR_PACKED MiiData;
173+
174+
/// Mii CFLStoreData (CTR Face Library Store Data) structure
175+
typedef struct
176+
{
177+
MiiData miiData; ///< Common shared Mii data structure.
178+
u8 pad[2]; ///< Padding (usually left as zeros)
179+
u16 crc16; ///< CRC16 over the previous 0x5E of data
180+
} CFLStoreData;

libctru/include/3ds/services/act.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,6 @@ typedef struct
150150

151151
#pragma pack(push, 1)
152152

153-
/// Mii CFLStoreData (CTR Face Library Store Data) structure
154-
typedef struct
155-
{
156-
MiiData miiData;
157-
u8 pad[2];
158-
u16 crc16;
159-
} CFLStoreData;
160-
161153
/// Birth date structure
162154
typedef struct
163155
{

libctru/include/3ds/services/frd.h

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,23 +92,15 @@ typedef struct
9292
u8 pad;
9393
} FriendPresence;
9494

95-
/// Friend Mii data
96-
typedef struct
97-
{
98-
bool profanityFlag; ///< Whether or not the Mii contains profanity.
99-
u8 characterSet; ///< The character set for text data.
100-
bool dirtyFlag; ///< Whether or not the Mii is marked as "dirty" (needs to be uploaded to the server).
101-
u8 pad;
102-
MiiData mii; ///< The actual Mii data.
103-
} FriendMii;
104-
10595
/// Friend playing game structure
10696
typedef struct
10797
{
10898
GameKey game; ///< Game key of the game.
10999
FriendGameModeDescription gameModeDescription;
110100
} FriendPlayingGame;
111101

102+
typedef CFLStoreData FriendMii;
103+
112104
/// Friend info structure
113105
typedef struct
114106
{
@@ -420,9 +412,9 @@ Result FRD_GetMyPassword(char *password, u32 bufsize);
420412
* @param friendKeyList Pointer to write the friend key list to.
421413
* @param num Stores the number of friend keys obtained.
422414
* @param offset The index of the friend key to start with.
423-
* @param size Size of the friend key list. (FRIEND_LIST_SIZE)
415+
* @param count Number of friend keys to retrieve. Max: FRIEND_LIST_SIZE
424416
*/
425-
Result FRD_GetFriendKeyList(FriendKey *friendKeyList, u32 *num, u32 offset, u32 size);
417+
Result FRD_GetFriendKeyList(FriendKey *friendKeyList, u32 *num, u32 offset, u32 count);
426418

427419
/**
428420
* @brief Gets friend presence data for the current user's friends.

libctru/source/services/frd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ Result FRD_GetMyPassword(char *password, u32 bufsize)
285285
return (Result)cmdbuf[1];
286286
}
287287

288-
Result FRD_GetFriendKeyList(FriendKey *friendKeyList, u32 *num, u32 offset, u32 size)
288+
Result FRD_GetFriendKeyList(FriendKey *friendKeyList, u32 *num, u32 offset, u32 count)
289289
{
290290
Result ret = 0;
291291
u32 *cmdbuf = getThreadCommandBuffer();
@@ -296,9 +296,9 @@ Result FRD_GetFriendKeyList(FriendKey *friendKeyList, u32 *num, u32 offset, u32
296296

297297
cmdbuf[0] = IPC_MakeHeader(0x11,2,0); // 0x110080
298298
cmdbuf[1] = offset;
299-
cmdbuf[2] = size;
299+
cmdbuf[2] = count;
300300

301-
staticbufs[0] = IPC_Desc_StaticBuffer(size, 0);
301+
staticbufs[0] = IPC_Desc_StaticBuffer(count * sizeof(FriendKey), 0);
302302
staticbufs[1] = (u32)friendKeyList;
303303

304304
ret = svcSendSyncRequest(frdHandle);
@@ -1253,4 +1253,4 @@ Result FRDA_IncrementMoveCount()
12531253
return (Result)cmdbuf[1];
12541254
}
12551255

1256-
#undef MIN
1256+
#undef MIN

0 commit comments

Comments
 (0)