Difference between revisions of "Friend Services"
DaniElectra (talk | contribs) (Add more FRD commands) |
TimmSkiller (talk | contribs) |
||
(30 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:Services]] | [[Category:Services]] | ||
− | = Friend Service "frd:u" = | + | = Friend User Service "frd:u" = |
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 94: | Line 94: | ||
|- | |- | ||
| 0x001E02C2 | | 0x001E02C2 | ||
− | | [[FRDU: | + | | [[FRDU:UpdateMyPresence|UpdateMyPresence]] |
|- | |- | ||
| 0x001F0042 | | 0x001F0042 | ||
Line 142: | Line 142: | ||
|- | |- | ||
| 0x002E0000 | | 0x002E0000 | ||
− | | [[FRDU: | + | | [[FRDU:GetServerTimeDifference|GetServerTimeDifference]] |
|- | |- | ||
| 0x002F0040 | | 0x002F0040 | ||
Line 169: | Line 169: | ||
|} | |} | ||
− | = "frd:n" = | + | = Friend Network Daemon Service "frd:n" = |
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 176: | Line 176: | ||
|- | |- | ||
| 0x00010000 | | 0x00010000 | ||
− | | GetHandleOfNdmStatusChangedEvent | + | | [[FRDN:GetHandleOfNdmStatusChangedEvent|GetHandleOfNdmStatusChangedEvent]] |
|- | |- | ||
| 0x00020000 | | 0x00020000 | ||
− | | Resume | + | | [[FRDN:Resume|Resume]] |
|- | |- | ||
| 0x00030040 | | 0x00030040 | ||
− | | SuspendAsync | + | | [[FRDN:SuspendAsync|SuspendAsync]] |
|- | |- | ||
| 0x00040000 | | 0x00040000 | ||
− | | QueryStatus | + | | [[FRDN:QueryStatus|QueryStatus]] |
|} | |} | ||
− | = "frd:a" = | + | = Friend Admin Service "frd:a" = |
− | + | Includes all the commands in [[Friend_Services#Friend_User_Service_.22frd:u.22|frd:u]], and, in addition: | |
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 201: | Line 201: | ||
|- | |- | ||
| 0x04020040 | | 0x04020040 | ||
− | | | + | | [[FRDA:DeleteLocalAccount|DeleteLocalAccount]] |
|- | |- | ||
| 0x04030040 | | 0x04030040 | ||
− | | [[FRDA: | + | | [[FRDA:LoadLocalAccount|LoadLocalAccount]] |
|- | |- | ||
| 0x04040000 | | 0x04040000 | ||
− | | | + | | [[FRDA:UnloadLocalAccount|UnloadLocalAccount]] |
|- | |- | ||
| 0x04050000 | | 0x04050000 | ||
− | | | + | | [[FRDA:SaveLocalAccountData|SaveLocalAccountData]] |
|- | |- | ||
| 0x04060042 | | 0x04060042 | ||
Line 216: | Line 216: | ||
|- | |- | ||
| 0x04070D80 | | 0x04070D80 | ||
− | | AddFriendOffline | + | | [[FRDA:AddFriendOffline|AddFriendOffline]] |
|- | |- | ||
| 0x040802C0 | | 0x040802C0 | ||
− | | | + | | [[FRDA:UpdateFriendDisplayName|UpdateFriendDisplayName]] |
|- | |- | ||
| 0x04090100 | | 0x04090100 | ||
Line 225: | Line 225: | ||
|- | |- | ||
| 0x040A0100 | | 0x040A0100 | ||
− | | UpdatePlayingGame | + | | [[FRDA:UpdatePlayingGame|UpdatePlayingGame]] |
|- | |- | ||
| 0x040B00C0 | | 0x040B00C0 | ||
− | | | + | | [[FRDA:UpdatePreference|UpdatePreference]] |
|- | |- | ||
| 0x040C0800 | | 0x040C0800 | ||
Line 234: | Line 234: | ||
|- | |- | ||
| 0x040D0100 | | 0x040D0100 | ||
− | | UpdateFavoriteGame | + | | [[FRDA:UpdateFavoriteGame|UpdateFavoriteGame]] |
|- | |- | ||
| 0x040E0040 | | 0x040E0040 | ||
− | | | + | | [[FRDA:SetNcPrincipalId|SetNcPrincipalId]] |
|- | |- | ||
− | | | + | | 0x040F0240 |
− | | UpdateComment | + | | [[FRDA:UpdateComment|UpdateComment]] |
|- | |- | ||
| 0x04100000 | | 0x04100000 | ||
− | | | + | | Currently unknown. Increments a u32 value in the savegame. |
|} | |} | ||
Line 250: | Line 250: | ||
==Trusted RootCAs== | ==Trusted RootCAs== | ||
No RootCertChain(s) are used. For the nasc site, friends-module uses [[HTTPC:AddDefaultCert]] with the following certIDs: 0x1, 0x2, and 0x3. | No RootCertChain(s) are used. For the nasc site, friends-module uses [[HTTPC:AddDefaultCert]] with the following certIDs: 0x1, 0x2, and 0x3. | ||
+ | |||
+ | = Types = | ||
+ | |||
+ | == FriendKey == | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x4 | ||
+ | | Principal ID | ||
+ | |- | ||
+ | | 0x4 | ||
+ | | 0x4 | ||
+ | | padding | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x8 | ||
+ | | Friend Code | ||
+ | |} | ||
+ | |||
+ | == GameKey == | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | u64, Title ID | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x2 | ||
+ | | u16, Title Version | ||
+ | |- | ||
+ | | 0xA | ||
+ | | 0x6 | ||
+ | | Unused padding. | ||
+ | |} | ||
+ | |||
+ | ==Presence== | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x4 | ||
+ | | u32 JoinAvailabilityFlag | ||
+ | |- | ||
+ | | 0x4 | ||
+ | | 0x4 | ||
+ | | u32 MatchmakeSystemType | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x4 | ||
+ | | u32 JoinGameID | ||
+ | |- | ||
+ | | 0xC | ||
+ | | 0x4 | ||
+ | | u32 JoinGameMode | ||
+ | |- | ||
+ | | 0x10 | ||
+ | | 0x4 | ||
+ | | u32 OwnerPrincipalID | ||
+ | |- | ||
+ | | 0x14 | ||
+ | | 0x4 | ||
+ | | u32 JoinGroupID | ||
+ | |- | ||
+ | | 0x18 | ||
+ | | 0x14 | ||
+ | | u8 ApplicationArg[20] | ||
+ | |} | ||
+ | |||
+ | ==Mii Data== | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x1 | ||
+ | | bool, ProfanityFlag | ||
+ | |- | ||
+ | | 0x1 | ||
+ | | 0x1 | ||
+ | | [[Mii#Mii_format|Mii character set]] | ||
+ | |- | ||
+ | | 0x2 | ||
+ | | 0x1 | ||
+ | | bool, DirtyFlag | ||
+ | |- | ||
+ | | 0x3 | ||
+ | | 0x1 | ||
+ | | padding | ||
+ | |- | ||
+ | | 0x4 | ||
+ | | 0x5C | ||
+ | | [[Mii#Mii_format|Mii data]] | ||
+ | |} | ||
+ | |||
+ | ==Profile== | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x1 | ||
+ | | u8, Region | ||
+ | |- | ||
+ | | 0x1 | ||
+ | | 0x1 | ||
+ | | u8, Country | ||
+ | |- | ||
+ | | 0x2 | ||
+ | | 0x1 | ||
+ | | u8, Area | ||
+ | |- | ||
+ | | 0x3 | ||
+ | | 0x1 | ||
+ | | u8, Language | ||
+ | |- | ||
+ | | 0x4 | ||
+ | | 0x1 | ||
+ | | u8, Platform, always 2 (PLATFORM_CTR) | ||
+ | |- | ||
+ | | 0x5 | ||
+ | | 0x3 | ||
+ | | padding | ||
+ | |} | ||
+ | |||
+ | ==FriendProfile== | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | [[Friend_Services#Profile|Profile]] | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x10 | ||
+ | | [[Friend_Services#GameKey|GameKey]] of favorite game | ||
+ | |- | ||
+ | | 0x18 | ||
+ | | 0x4 | ||
+ | | u32, NcPrincipalID | ||
+ | |- | ||
+ | | 0x1C | ||
+ | | 0x22 | ||
+ | | 16-Character UTF-16 Personal Message (16 characters + null termination) | ||
+ | |- | ||
+ | | 0x3E | ||
+ | | 0x2 | ||
+ | | padding | ||
+ | |- | ||
+ | | 0x40 | ||
+ | | 0x8 | ||
+ | | NEX Timestamp when this friend was last seen online | ||
+ | |} | ||
+ | |||
+ | ==FriendInfo== | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x10 | ||
+ | | [[Friend_Services#FriendKey|FriendKey]] of this friend | ||
+ | |- | ||
+ | | 0x10 | ||
+ | | 0x8 | ||
+ | | NEX Timestamp when this friend was added to the friends list | ||
+ | |- | ||
+ | | 0x18 | ||
+ | | 0x1 | ||
+ | | The [[Friend_Services#Relationship_Types|relationship]] with this friend | ||
+ | |- | ||
+ | | 0x19 | ||
+ | | 0x7 | ||
+ | | padding | ||
+ | |- | ||
+ | | 0x20 | ||
+ | | 0x48 | ||
+ | | [[Friend_Services#FriendProfile|FriendProfile]] of this friend | ||
+ | |- | ||
+ | | 0x68 | ||
+ | | 0x16 | ||
+ | | 10-Character UTF-16 Screen Name (10 characters + null termination) | ||
+ | |- | ||
+ | | 0x7E | ||
+ | | 0x1 | ||
+ | | u8, [[Mii#Mii_format|Mii character set]] | ||
+ | |- | ||
+ | | 0x7F | ||
+ | | 0x1 | ||
+ | | padding | ||
+ | |- | ||
+ | | 0x80 | ||
+ | | 0x60 | ||
+ | | This friend's [[Friend_Services#Mii_Data|Mii]] | ||
+ | |} | ||
+ | |||
+ | |||
+ | |||
+ | ==GameAuthenticationData== | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset !! Size !! Description | ||
+ | |- | ||
+ | | 0x0 || 0x4 || [[Friend_Services#NASC_Result|NASC Login Result]] | ||
+ | |- | ||
+ | | 0x4 || 0x4 || HTTP Status Code | ||
+ | |- | ||
+ | | 0x8 || 0x20 || Server Address (string) | ||
+ | |- | ||
+ | | 0x28 || 0x2 || Server Port | ||
+ | |- | ||
+ | | 0x2A || 0x6 || padding | ||
+ | |- | ||
+ | | 0x30 || 0x100 || Token for game server authentication (string) | ||
+ | |- | ||
+ | | 0x130 || 0x8 || NEX Timestamp for server time | ||
+ | |} | ||
+ | |||
+ | ==ServiceLocatorData== | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset !! Size !! Description | ||
+ | |- | ||
+ | | 0x0 || 0x4 || [[Friend_Services#NASC_Result|NASC SVCLOC Result]] | ||
+ | |- | ||
+ | | 0x4 || 0x4 || HTTP Status Code | ||
+ | |- | ||
+ | | 0x8 || 0x80 || Service Host (string) | ||
+ | |- | ||
+ | | 0x88 || 0x100 || Service Token (string) | ||
+ | |- | ||
+ | | 0x188 || 0x1 || <code>statusdata</code> from NASC response | ||
+ | |- | ||
+ | | 0x189 || 0x7 || padding | ||
+ | |- | ||
+ | | 0x190 || 0x8 || NEX Timestamp for server time | ||
+ | |} | ||
+ | |||
+ | =Approach Contexts= | ||
+ | The approach context (in the form of an [[Friend_Services#Encrypted_ApproachContext_Payload|encrypted payload]]) of the console can be retrieved using [[FRDU:GetMyApproachContext]]. | ||
+ | |||
+ | [[Friend_Services#Encrypted_ApproachContext_Payload|Encrypted payloads]] can be decrypted using [[FRDU:DecryptApproachContext]]. | ||
+ | |||
+ | It is possible to add a friend using an [[Friend_Services#Encrypted_ApproachContext_Payload|encrypted payload]] using [[FRDU:AddFriendWithApproach]]. | ||
+ | |||
+ | ==ApproachContext== | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset !! Size !! Description | ||
+ | |- | ||
+ | | 0x0 || 0x48 || [[Friend_Services#Friend_Profile|Friend Profile]] of the console that created this approach context | ||
+ | |- | ||
+ | | 0x48 || 0x1 || bool, Has Mii | ||
+ | |- | ||
+ | | 0x49 || 0x1 || bool, Profanity Flag | ||
+ | |- | ||
+ | | 0x4A || 0x1 || u8, [[Mii#Mii_format|Mii Character Set]] | ||
+ | |- | ||
+ | | 0x4B || 0x70 || [[Friend_Services#Mii_Data|Friend Mii Data]] wrapped using [[APT:Wrap]] (Unwrapped size: 0x60) | ||
+ | |- | ||
+ | | 0xBB || 0x16 || 10-Character UTF-16 Screen Name (10 characters + null termination) | ||
+ | |- | ||
+ | | 0xD1 || 0x10F || unused | ||
+ | |} | ||
+ | |||
+ | ==Encrypted ApproachContext Payload== | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset !! Size !! Description | ||
+ | |- | ||
+ | | 0x0 || 0x1 || (u8) unknown, initialized to 1 internally, set to 1 when the PS encryption command succeeds, otherwise 0. Must be 1 when decrypting, otherwise error 0xE0E0C4E9 is returned | ||
+ | |- | ||
+ | | 0x1 || 0x1 || (u8) unknown, always set to 0 | ||
+ | |- | ||
+ | | 0x2 || 0x1 || (u8) unknown, initialized to 2 internally, always set to either 1 when the PS encryption command succeeds, or otherwise 0. Must be 1 when decrypting, otherwise error 0xE0E0C4E9 is returned | ||
+ | |- | ||
+ | | 0x3 || 0x1 || (u8) unknown, always set to 0 | ||
+ | |- | ||
+ | | 0x4 || 0x4 || u32, Principal ID (part of nonce) | ||
+ | |- | ||
+ | | 0x8 || 0x8 || u64, Friend Code (part of nonce) | ||
+ | |- | ||
+ | | 0x10 || 0x1E0 || [[Friend_Services#ApproachContext|ApproachContext]] | ||
+ | |- | ||
+ | | 0x1F0 || 0x10 || AES-CCM MAC over the encrypted payload at 0x10 thru 0x1F0 | ||
+ | |} | ||
+ | |||
+ | ==Decrypted ApproachContext Payload== | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset !! Size !! Description | ||
+ | |- | ||
+ | | 0x0 || 0x1 || (u8) unknown, initialized to 1 internally, set to 1 when the PS encryption command succeeds, otherwise 0. Must be 1 when decrypting, otherwise error 0xE0E0C4E9 is returned | ||
+ | |- | ||
+ | | 0x1 || 0x1 || (u8) unknown, always set to 0 | ||
+ | |- | ||
+ | | 0x2 || 0x1 || (u8) unknown, initialized to 2 internally, always set to either 1 when the PS encryption command succeeds, or otherwise 0. Must be 1 when decrypting, otherwise error 0xE0E0C4E9 is returned | ||
+ | |- | ||
+ | | 0x3 || 0x1 || (u8) unknown, always set to 0 | ||
+ | |- | ||
+ | | 0x4 || 0x1 || bool, Has Mii | ||
+ | |- | ||
+ | | 0x5 || 0x1 || bool, Profanity Flag | ||
+ | |- | ||
+ | | 0x6 || 0x1 || u8, [[Mii#Mii_format|Mii Character Set]] | ||
+ | |- | ||
+ | | 0x7 || 0x1 || padding | ||
+ | |- | ||
+ | | 0x8 || 0x10 || [[Friend_Services#FriendKey|FriendKey]] of the console that created this approach context | ||
+ | |- | ||
+ | | 0x18 || 0x48 || [[Friend_Services#FriendProfile|FriendProfile]] of the console that created this approach context | ||
+ | |- | ||
+ | | 0x60 || 0x60 || [[Friend_Services#Mii_Data|Friend Mii Data]] of the console that created this approach context | ||
+ | |- | ||
+ | | 0xC0 || 0x16 || 10-Character UTF-16 Screen Name (10 characters + null termination) | ||
+ | |- | ||
+ | | 0xD6 || 0x12A || unused | ||
+ | |} | ||
+ | |||
+ | = Notification Events = | ||
+ | The friends module exposes a "Notification Events" system that allows client sessions to be notified of various related events. | ||
+ | |||
+ | A client sets its per-session notification event signaling handle using [[FRDU:AttachToEventNotification]]. | ||
+ | |||
+ | The client can then customize for which [[Friend_Services#Notification_Event_Types|Notification Event Types]] it shall receive notifications using [[FRDU:SetNotificationMask]]. | ||
+ | |||
+ | Once the handle has been signaled by the friends module, the client can use [[FRDU:GetEventNotification]] to receive the notifications. | ||
+ | |||
+ | ==Notification Event Types== | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Value | ||
+ | ! Description | ||
+ | |- | ||
+ | | 1 | ||
+ | | The console went online. | ||
+ | |- | ||
+ | | 2 | ||
+ | | The console went offline. | ||
+ | |- | ||
+ | | 3 | ||
+ | | A friend is now present (went online). | ||
+ | |- | ||
+ | | 5 | ||
+ | | A friend changed their Mii. | ||
+ | |- | ||
+ | | 6 | ||
+ | | A friend changed their [[Friend_Services#Profile|Profile]]. | ||
+ | |- | ||
+ | | 7 | ||
+ | | A friend is no longer present (went offline). | ||
+ | |- | ||
+ | | 8 | ||
+ | | A friend has added you back as a friend (if you had added them before as a "provisionally registered" friend). | ||
+ | |- | ||
+ | | 9 | ||
+ | | A friend sent you a <b>joinable</b> game invitation(?) (only signaled when the console's JoinGameID matches that of the friend). | ||
+ | |- | ||
+ | | 146 | ||
+ | | A friend changed their favorite game. | ||
+ | |- | ||
+ | | 147 | ||
+ | | A friend changed their personal message. | ||
+ | |- | ||
+ | | 149 | ||
+ | | A friend sent you an invitation. (signaled regardless of whether or not the console's JoinGameID matches that of the friend) | ||
+ | |} | ||
+ | |||
+ | ==EventNotification== | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x1 | ||
+ | | u8, [[Friend_Services#Notification_Event_Types|Event Type]] | ||
+ | |- | ||
+ | | 0x1 | ||
+ | | 0x7 | ||
+ | | padding | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x10 | ||
+ | | [[Friend_Services#FriendKey|FriendKey]] of the friend who caused this notification to be sent | ||
+ | |} | ||
+ | |||
+ | = Relationship Types = | ||
+ | Every valid entry in the internal friends list contains a relationship field. | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Value | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0 | ||
+ | | The target has been added locally and on the server, but is only "provisionally registered." The target has not added you as a friend. | ||
+ | |- | ||
+ | | 1 | ||
+ | | The target has been added locally and on the server and is fully registered: the target has also added you as a friend. | ||
+ | |- | ||
+ | | 2 | ||
+ | | No relationship between you and the target has been found: neither you nor the target have added each other. | ||
+ | |- | ||
+ | | 3 | ||
+ | | The relationship has been deleted: the target has deleted your friend card. | ||
+ | |- | ||
+ | | 4 | ||
+ | | The target has been added locally: you were not online when you added the target. (presumably only happens when the "Local" method of adding a friend is used. When the system connects to the internet, a background task runs to register this relationship on the friends server.) | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | =Attribute Flags= | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Flag | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x1 | ||
+ | | Unknown (something like "target ever registered you"?), set when relationship type is 1, 3 or 4 | ||
+ | |- | ||
+ | | 0x2 | ||
+ | | Unknown, set only when relationship type is 1 | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | =NASC Result= | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Value !! Description | ||
+ | |- | ||
+ | | 001 || Success. | ||
+ | |- | ||
+ | | 101 || Game server is under maintenance. | ||
+ | |- | ||
+ | | 102 || Device is banned. | ||
+ | |- | ||
+ | | 107 || Invalid product code. | ||
+ | |- | ||
+ | | 109 || Invalid/missing request parameter. | ||
+ | |- | ||
+ | | 110 || Game server is no longer available. | ||
+ | |- | ||
+ | | 112 || Invalid SVC. | ||
+ | |- | ||
+ | | 119 || Invalid FPD version. | ||
+ | |- | ||
+ | | 120 || Invalid title version. | ||
+ | |- | ||
+ | | 121 || Invalid device certificate. | ||
+ | |- | ||
+ | | 122 || Invalid PID HMAC. | ||
+ | |- | ||
+ | | 123 || ROM ID is banned. | ||
+ | |- | ||
+ | | 125 || Invalid Game ID. | ||
+ | |- | ||
+ | | 127 || Invalid key hash. | ||
+ | |} | ||
+ | |||
= Server Types = | = Server Types = |
Latest revision as of 21:34, 17 December 2024
Friend User Service "frd:u"[edit]
Friend Network Daemon Service "frd:n"[edit]
Command Header | Description |
---|---|
0x00010000 | GetHandleOfNdmStatusChangedEvent |
0x00020000 | Resume |
0x00030040 | SuspendAsync |
0x00040000 | QueryStatus |
Friend Admin Service "frd:a"[edit]
Includes all the commands in frd:u, and, in addition:
Command Header | Description |
---|---|
0x04010100 | CreateLocalAccount |
0x04020040 | DeleteLocalAccount |
0x04030040 | LoadLocalAccount |
0x04040000 | UnloadLocalAccount |
0x04050000 | SaveLocalAccountData |
0x04060042 | AddFriendOnline |
0x04070D80 | AddFriendOffline |
0x040802C0 | UpdateFriendDisplayName |
0x04090100 | RemoveFriend |
0x040A0100 | UpdatePlayingGame |
0x040B00C0 | UpdatePreference |
0x040C0800 | UpdateMii |
0x040D0100 | UpdateFavoriteGame |
0x040E0040 | SetNcPrincipalId |
0x040F0240 | UpdateComment |
0x04100000 | Currently unknown. Increments a u32 value in the savegame. |
HTTPS Requests[edit]
Trusted RootCAs[edit]
No RootCertChain(s) are used. For the nasc site, friends-module uses HTTPC:AddDefaultCert with the following certIDs: 0x1, 0x2, and 0x3.
Types[edit]
FriendKey[edit]
Offset | Size | Description |
---|---|---|
0x0 | 0x4 | Principal ID |
0x4 | 0x4 | padding |
0x8 | 0x8 | Friend Code |
GameKey[edit]
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | u64, Title ID |
0x8 | 0x2 | u16, Title Version |
0xA | 0x6 | Unused padding. |
Presence[edit]
Offset | Size | Description |
---|---|---|
0x0 | 0x4 | u32 JoinAvailabilityFlag |
0x4 | 0x4 | u32 MatchmakeSystemType |
0x8 | 0x4 | u32 JoinGameID |
0xC | 0x4 | u32 JoinGameMode |
0x10 | 0x4 | u32 OwnerPrincipalID |
0x14 | 0x4 | u32 JoinGroupID |
0x18 | 0x14 | u8 ApplicationArg[20] |
Mii Data[edit]
Offset | Size | Description |
---|---|---|
0x0 | 0x1 | bool, ProfanityFlag |
0x1 | 0x1 | Mii character set |
0x2 | 0x1 | bool, DirtyFlag |
0x3 | 0x1 | padding |
0x4 | 0x5C | Mii data |
Profile[edit]
Offset | Size | Description |
---|---|---|
0x0 | 0x1 | u8, Region |
0x1 | 0x1 | u8, Country |
0x2 | 0x1 | u8, Area |
0x3 | 0x1 | u8, Language |
0x4 | 0x1 | u8, Platform, always 2 (PLATFORM_CTR) |
0x5 | 0x3 | padding |
FriendProfile[edit]
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Profile |
0x8 | 0x10 | GameKey of favorite game |
0x18 | 0x4 | u32, NcPrincipalID |
0x1C | 0x22 | 16-Character UTF-16 Personal Message (16 characters + null termination) |
0x3E | 0x2 | padding |
0x40 | 0x8 | NEX Timestamp when this friend was last seen online |
FriendInfo[edit]
Offset | Size | Description |
---|---|---|
0x0 | 0x10 | FriendKey of this friend |
0x10 | 0x8 | NEX Timestamp when this friend was added to the friends list |
0x18 | 0x1 | The relationship with this friend |
0x19 | 0x7 | padding |
0x20 | 0x48 | FriendProfile of this friend |
0x68 | 0x16 | 10-Character UTF-16 Screen Name (10 characters + null termination) |
0x7E | 0x1 | u8, Mii character set |
0x7F | 0x1 | padding |
0x80 | 0x60 | This friend's Mii |
GameAuthenticationData[edit]
Offset | Size | Description |
---|---|---|
0x0 | 0x4 | NASC Login Result |
0x4 | 0x4 | HTTP Status Code |
0x8 | 0x20 | Server Address (string) |
0x28 | 0x2 | Server Port |
0x2A | 0x6 | padding |
0x30 | 0x100 | Token for game server authentication (string) |
0x130 | 0x8 | NEX Timestamp for server time |
ServiceLocatorData[edit]
Offset | Size | Description |
---|---|---|
0x0 | 0x4 | NASC SVCLOC Result |
0x4 | 0x4 | HTTP Status Code |
0x8 | 0x80 | Service Host (string) |
0x88 | 0x100 | Service Token (string) |
0x188 | 0x1 | statusdata from NASC response
|
0x189 | 0x7 | padding |
0x190 | 0x8 | NEX Timestamp for server time |
Approach Contexts[edit]
The approach context (in the form of an encrypted payload) of the console can be retrieved using FRDU:GetMyApproachContext.
Encrypted payloads can be decrypted using FRDU:DecryptApproachContext.
It is possible to add a friend using an encrypted payload using FRDU:AddFriendWithApproach.
ApproachContext[edit]
Offset | Size | Description |
---|---|---|
0x0 | 0x48 | Friend Profile of the console that created this approach context |
0x48 | 0x1 | bool, Has Mii |
0x49 | 0x1 | bool, Profanity Flag |
0x4A | 0x1 | u8, Mii Character Set |
0x4B | 0x70 | Friend Mii Data wrapped using APT:Wrap (Unwrapped size: 0x60) |
0xBB | 0x16 | 10-Character UTF-16 Screen Name (10 characters + null termination) |
0xD1 | 0x10F | unused |
Encrypted ApproachContext Payload[edit]
Offset | Size | Description |
---|---|---|
0x0 | 0x1 | (u8) unknown, initialized to 1 internally, set to 1 when the PS encryption command succeeds, otherwise 0. Must be 1 when decrypting, otherwise error 0xE0E0C4E9 is returned |
0x1 | 0x1 | (u8) unknown, always set to 0 |
0x2 | 0x1 | (u8) unknown, initialized to 2 internally, always set to either 1 when the PS encryption command succeeds, or otherwise 0. Must be 1 when decrypting, otherwise error 0xE0E0C4E9 is returned |
0x3 | 0x1 | (u8) unknown, always set to 0 |
0x4 | 0x4 | u32, Principal ID (part of nonce) |
0x8 | 0x8 | u64, Friend Code (part of nonce) |
0x10 | 0x1E0 | ApproachContext |
0x1F0 | 0x10 | AES-CCM MAC over the encrypted payload at 0x10 thru 0x1F0 |
Decrypted ApproachContext Payload[edit]
Offset | Size | Description |
---|---|---|
0x0 | 0x1 | (u8) unknown, initialized to 1 internally, set to 1 when the PS encryption command succeeds, otherwise 0. Must be 1 when decrypting, otherwise error 0xE0E0C4E9 is returned |
0x1 | 0x1 | (u8) unknown, always set to 0 |
0x2 | 0x1 | (u8) unknown, initialized to 2 internally, always set to either 1 when the PS encryption command succeeds, or otherwise 0. Must be 1 when decrypting, otherwise error 0xE0E0C4E9 is returned |
0x3 | 0x1 | (u8) unknown, always set to 0 |
0x4 | 0x1 | bool, Has Mii |
0x5 | 0x1 | bool, Profanity Flag |
0x6 | 0x1 | u8, Mii Character Set |
0x7 | 0x1 | padding |
0x8 | 0x10 | FriendKey of the console that created this approach context |
0x18 | 0x48 | FriendProfile of the console that created this approach context |
0x60 | 0x60 | Friend Mii Data of the console that created this approach context |
0xC0 | 0x16 | 10-Character UTF-16 Screen Name (10 characters + null termination) |
0xD6 | 0x12A | unused |
Notification Events[edit]
The friends module exposes a "Notification Events" system that allows client sessions to be notified of various related events.
A client sets its per-session notification event signaling handle using FRDU:AttachToEventNotification.
The client can then customize for which Notification Event Types it shall receive notifications using FRDU:SetNotificationMask.
Once the handle has been signaled by the friends module, the client can use FRDU:GetEventNotification to receive the notifications.
Notification Event Types[edit]
Value | Description |
---|---|
1 | The console went online. |
2 | The console went offline. |
3 | A friend is now present (went online). |
5 | A friend changed their Mii. |
6 | A friend changed their Profile. |
7 | A friend is no longer present (went offline). |
8 | A friend has added you back as a friend (if you had added them before as a "provisionally registered" friend). |
9 | A friend sent you a joinable game invitation(?) (only signaled when the console's JoinGameID matches that of the friend). |
146 | A friend changed their favorite game. |
147 | A friend changed their personal message. |
149 | A friend sent you an invitation. (signaled regardless of whether or not the console's JoinGameID matches that of the friend) |
EventNotification[edit]
Offset | Size | Description |
---|---|---|
0x0 | 0x1 | u8, Event Type |
0x1 | 0x7 | padding |
0x8 | 0x10 | FriendKey of the friend who caused this notification to be sent |
Relationship Types[edit]
Every valid entry in the internal friends list contains a relationship field.
Value | Description |
---|---|
0 | The target has been added locally and on the server, but is only "provisionally registered." The target has not added you as a friend. |
1 | The target has been added locally and on the server and is fully registered: the target has also added you as a friend. |
2 | No relationship between you and the target has been found: neither you nor the target have added each other. |
3 | The relationship has been deleted: the target has deleted your friend card. |
4 | The target has been added locally: you were not online when you added the target. (presumably only happens when the "Local" method of adding a friend is used. When the system connects to the internet, a background task runs to register this relationship on the friends server.) |
Attribute Flags[edit]
Flag | Description |
---|---|
0x1 | Unknown (something like "target ever registered you"?), set when relationship type is 1, 3 or 4 |
0x2 | Unknown, set only when relationship type is 1 |
NASC Result[edit]
Value | Description |
---|---|
001 | Success. |
101 | Game server is under maintenance. |
102 | Device is banned. |
107 | Invalid product code. |
109 | Invalid/missing request parameter. |
110 | Game server is no longer available. |
112 | Invalid SVC. |
119 | Invalid FPD version. |
120 | Invalid title version. |
121 | Invalid device certificate. |
122 | Invalid PID HMAC. |
123 | ROM ID is banned. |
125 | Invalid Game ID. |
127 | Invalid key hash. |
Server Types[edit]
The server type is stored internally as a combination of two values, the first value represents the server type letter and the second value is the number that follows it. For example, the production server type is "L1", so the first value is 0 and the second value is 1.
Official servers only support the letters L, C, S, D, I, T, J or U.
Value | Server Type Letter |
---|---|
0 | L |
1 | C |
2 | S |
3 | D |
4 | I |
5 | T |
6 | U (fallback to default value) |
7 | J |
8 | X |
9 | A |
10 | B |
11 | C |
12 | D |
13 | E |
14 | F |
15 | G |
16 | H |
17 | I |
18 | J |
19 | K |
20 | L |
21 | M |
22 | N |
23 | O |
24 | P |
25 | Q |
>=26 | U |