libctru v2.5.0
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
frd.h File Reference

Friend Services. More...

#include <3ds/mii.h>

Go to the source code of this file.

Data Structures

struct  FriendKey
 Friend key data. More...
 
struct  GameKey
 Game key data. More...
 
struct  Profile
 Base profile data. More...
 
struct  FriendProfile
 Friend profile data. More...
 
struct  Presence
 Base presence data. More...
 
struct  MyPresence
 Current user's presence data. More...
 
struct  FriendPresence
 Friend presence data. More...
 
struct  FriendMii
 Friend Mii data. More...
 
struct  FriendPlayingGame
 Friend playing game structure. More...
 
struct  FriendInfo
 Friend info structure. More...
 
struct  NotificationEvent
 Friend Notification Event structure. More...
 
struct  GameAuthenticationData
 Game Authentication Data structure. More...
 
struct  ServiceLocatorData
 Service Locator Data strcture. More...
 
struct  ApproachContext
 Encrypted inner Approach Context structure. More...
 
struct  EncryptedApproachContext
 Encrypted Approach Context structure. More...
 
struct  DecryptedApproachContext
 Decrypted Approach Context structure. More...
 

Macros

#define FRIEND_COMMENT_LEN   16+1
 16-character NULL-terminated UTF-16 comment
 
#define FRIEND_GAME_MODE_DESCRIPTION_LEN   127+1
 127-character NULL-terminated UTF-16 game mode description
 
#define NASC_INGAMESN_LEN   11+1
 11-character NULL-terminated UTF-16 in-game nickname
 
#define NASC_KEYHASH_LEN   8+1
 8-character NULL-terminated ASCII NASC keyhash value
 
#define NASC_SVC_LEN   4+1
 4-character NULL-terminated ASCII NASC svc value
 
#define FRIEND_LIST_SIZE   100
 100 (maximum number of friends)
 
#define NFS_TYPESTR_LEN   2+1
 2-character NULL-terminated ASCII NFS (Nintendo Friend Server) type string
 

Typedefs

typedef u16 FriendComment[FRIEND_COMMENT_LEN]
 
typedef u16 FriendGameModeDescription[FRIEND_GAME_MODE_DESCRIPTION_LEN]
 
typedef u16 ScrambledFriendCode[6]
 
typedef char NfsTypeStr[NFS_TYPESTR_LEN]
 

Enumerations

enum  CharacterSet {
  CHARSET_JPN_USA_EUR = 0 ,
  CHARSET_CHN ,
  CHARSET_KOR ,
  CHARSET_TWN
}
 Enum for character set. More...
 
enum  NASCResult {
  NASC_SUCCESS = 001 ,
  NASC_SERVER_UNDER_MAINTENANCE = 101 ,
  NASC_DEVICE_BANNED = 102 ,
  NASC_INVALID_PRODUCT_CODE = 107 ,
  NASC_INVALID_REQUEST_PARAM = 109 ,
  NASC_SERVER_NO_LONGER_AVAILABLE = 110 ,
  NASC_INVALID_SVC = 112 ,
  NASC_INVALID_FPD_VERSION = 119 ,
  NASC_INVALID_TITLE_VERSION = 120 ,
  NASC_INVALID_DEVICE_CERTIFICATE = 121 ,
  NASC_INVALID_PID_HMAC = 122 ,
  NASC_BANNED_ROM_ID = 123 ,
  NASC_INVALID_GAME_ID = 125 ,
  NASC_INVALID_KEY_HASH = 127
}
 Enum for NASC Result.
 
enum  NASCEnvironment {
  NASC_PRODUCTION = 0 ,
  NASC_TESTING ,
  NASC_DEVELOPMENT
}
 Enum for NASC Server Environment.
 
enum  FriendNotificationTypes {
  USER_WENT_ONLINE = 1 ,
  USER_WENT_OFFLINE ,
  FRIEND_WENT_ONLINE ,
  FRIEND_UPDATED_PRESENCE ,
  FRIEND_UPDATED_MII ,
  FRIEND_UPDATED_PROFILE ,
  FRIEND_WENT_OFFLINE ,
  FRIEND_REGISTERED_USER ,
  FRIEND_SENT_JOINABLE_INVITATION ,
  FRIEND_CHANGED_GAME_MODE_DESCRIPTION = 145 ,
  FRIEND_CHANGED_FAVORITE_GAME = 146 ,
  FRIEND_CHANGED_COMMENT = 147 ,
  FRIEND_CHANGED_ANY_PRESENCE = 148 ,
  FRIEND_SENT_ANY_INVITATION = 149
}
 Enum for notification event types. More...
 
enum  FriendNotificationMask {
  MASK_USER_WENT_ONLINE = BIT(USER_WENT_ONLINE - 1) ,
  MASK_USER_WENT_OFFLINE = BIT(USER_WENT_OFFLINE - 1) ,
  MASK_FRIEND_WENT_ONLINE = BIT(FRIEND_WENT_ONLINE - 1) ,
  MASK_FRIEND_UPDATED_PRESENCE = BIT(FRIEND_UPDATED_PRESENCE - 1) ,
  MASK_FRIEND_UPDATED_MII = BIT(FRIEND_UPDATED_MII - 1) ,
  MASK_FRIEND_UPDATED_PROFILE = BIT(FRIEND_UPDATED_PROFILE - 1) ,
  MASK_FRIEND_WENT_OFFLINE = BIT(FRIEND_WENT_OFFLINE - 1) ,
  MASK_FRIEND_REGISTERED_USER = BIT(FRIEND_REGISTERED_USER - 1) ,
  MASK_FRIEND_SENT_JOINABLE_INVITATION = BIT(FRIEND_SENT_JOINABLE_INVITATION - 1)
}
 Enum for notification event mask.
 
enum  RelationshipType {
  RELATIONSHIP_INCOMPLETE = 0 ,
  RELATIONSHIP_COMPLETE ,
  RELATIONSHIP_NOT_FOUND ,
  RELATIONSHIP_DELETED ,
  RELATIONSHIP_LOCAL
}
 Enum for friend relationship type. More...
 
enum  FriendAttributes {
  FRIEND_ATTRIBUTE_EVER_REGISTERED = BIT(0) ,
  FRIEND_ATTRIBUTE_REGISTRATION_COMPLETE = BIT(1)
}
 Enum for friend attributes according to relationship type. More...
 
enum  NatMappingType {
  NAT_MAPPING_UNKNOWN = 0 ,
  NAT_MAPPING_ENDPOINT_INDEPENDENT ,
  NAT_MAPPING_ENDPOINT_DEPENDENT
}
 Enum for NAT mapping type.
 
enum  NatFilteringType {
  NAT_FILTERING_UNKNOWN = 0 ,
  NAT_FILTERING_PORT_INDEPENDENT ,
  NAT_FILTERING_PORT_DEPENDENT
}
 Enum for NAT filtering type.
 

Functions

Result frdInit (bool forceUser)
 Initializes friend services.
 
void frdExit (void)
 Exits friend services.
 
HandlefrdGetSessionHandle (void)
 Get the friend user/admin service handle.
 
Result FRD_HasLoggedIn (bool *state)
 Gets the login status of the current user.
 
Result FRD_IsOnline (bool *state)
 Gets the online status of the current user.
 
Result FRD_Login (Handle event)
 Log in to Nintendo's friend server.
 
Result FRD_Logout (void)
 Logs out of Nintendo's friend server.
 
Result FRD_GetMyFriendKey (FriendKey *key)
 Gets the current user's friend key.
 
Result FRD_GetMyPreference (bool *isPublicMode, bool *isShowGameName, bool *isShowPlayedGame)
 Gets the current user's privacy information.
 
Result FRD_GetMyProfile (Profile *profile)
 Gets the current user's profile information.
 
Result FRD_GetMyPresence (MyPresence *presence)
 Gets the current user's presence information.
 
Result FRD_GetMyScreenName (MiiScreenName *name)
 Gets the current user's screen name.
 
Result FRD_GetMyMii (FriendMii *mii)
 Gets the current user's Mii data.
 
Result FRD_GetMyLocalAccountId (u8 *localAccountId)
 Gets the ID of the current local account.
 
Result FRD_GetMyPlayingGame (GameKey *playingGame)
 Gets the current user's playing game.
 
Result FRD_GetMyFavoriteGame (GameKey *favoriteGame)
 Gets the current user's favourite game.
 
Result FRD_GetMyNcPrincipalId (u32 *ncPrincipalId)
 Gets the NcPrincipalId for the current user.
 
Result FRD_GetMyComment (FriendComment *comment)
 Gets the current user's comment on their friend profile.
 
Result FRD_GetMyPassword (char *password, u32 bufsize)
 Gets the current friend account's NEX password.
 
Result FRD_GetFriendKeyList (FriendKey *friendKeyList, u32 *num, u32 offset, u32 size)
 Gets the current user's friend key list.
 
Result FRD_GetFriendPresence (FriendPresence *friendPresences, const FriendKey *friendKeyList, u32 count)
 Gets friend presence data for the current user's friends.
 
Result FRD_GetMiiScreenName (MiiScreenName *screenNames, u32 screenNamesLen, u8 *characterSets, u32 characterSetsLen, const FriendKey *friendKeyList, u32 count, bool maskNonAscii, bool profanityFlag)
 Gets screen names for the current user's friends.
 
Result FRD_GetFriendMii (FriendMii *miiList, const FriendKey *friendKeyList, u32 count)
 Gets the current user's friends' Mii data.
 
Result FRD_GetFriendProfile (Profile *profiles, const FriendKey *friendKeyList, u32 count)
 Get the current user's friends' profile data.
 
Result FRD_GetFriendRelationship (u8 *relationships, const FriendKey *friendKeyList, u32 count)
 Get the relationship type for the current user's friends.
 
Result FRD_GetFriendAttributeFlags (u32 *attributes, const FriendKey *friendKeyList, u32 count)
 Get attributes for the current user's friends.
 
Result FRD_GetFriendPlayingGame (FriendPlayingGame *playingGames, const FriendKey *friendKeyList, u32 count)
 Get the current user's friends' playing game.
 
Result FRD_GetFriendFavoriteGame (GameKey *favoriteGames, const FriendKey *friendKeyList, u32 count)
 Get the current user's friends' favourite games.
 
Result FRD_GetFriendInfo (FriendInfo *infos, const FriendKey *friendKeyList, u32 count, bool maskNonAscii, bool profanityFlag)
 Get info about the current user's friends.
 
Result FRD_IsInFriendList (u64 friendCode, bool *isFromList)
 Gets whether a friend code is included in the current user's friend list.
 
Result FRD_UnscrambleLocalFriendCode (u64 *unscrambled, ScrambledFriendCode *scrambled, u32 count)
 Unscrambles a scrambled friend code.
 
Result FRD_UpdateGameModeDescription (FriendGameModeDescription *desc)
 Updates the game mode description string.
 
Result FRD_UpdateMyPresence (Presence *presence, FriendGameModeDescription *desc)
 Updates the current user's presence data and game mode description.
 
Result FRD_SendInvitation (const FriendKey *friendKeyList, u32 count)
 Sends an invitation to the current user's friends.
 
Result FRD_AttachToEventNotification (Handle event)
 Registers the event handle that will be signaled to inform the session of various status changes.
 
Result FRD_SetNotificationMask (FriendNotificationMask mask)
 Sets the notification mask for the event notification system.
 
Result FRD_GetEventNotification (NotificationEvent *event, u32 count, u32 *recievedNotifCount)
 Get Latest Event Notification.
 
Result FRD_GetLastResponseResult ()
 Get the result of the last internal operation.
 
Result FRD_PrincipalIdToFriendCode (u32 principalId, u64 *friendCode)
 Returns the friend code using the given principal ID.
 
Result FRD_FriendCodeToPrincipalId (u64 friendCode, u32 *principalId)
 Returns the principal ID using the given friend code.
 
Result FRD_IsValidFriendCode (u64 friendCode, bool *isValid)
 Checks if the friend code is valid.
 
Result FRD_ResultToErrorCode (u32 *errorCode, Result res)
 Get a support error code (XXX-YYYY) for the given result code.
 
Result FRD_RequestGameAuthentication (u32 serverId, u16 *ingamesn, u32 ingamesnSize, u8 majorSdkVersion, u8 minorSdkVersion, Handle completionEvent)
 Requests game server authentication.
 
Result FRD_GetGameAuthenticationData (GameAuthenticationData *data)
 Get game server authentication data requested using FRD_RequestGameAuthentication.
 
Result FRD_RequestServiceLocator (u32 serverId, char *keyhash, char *svc, u8 majorSdkVersion, u8 minorSdkVersion, Handle completionEvent)
 Request service locator info for a given NEX server.
 
Result FRD_GetServiceLocatorData (ServiceLocatorData *data)
 Get service locator data requested using FRD_RequestServiceLocator.
 
Result FRD_DetectNatProperties (Handle completionEvent)
 Starts an internal task to determine the NAT properties of the current internet connection.
 
Result FRD_GetNatProperties (u32 *natMappingType, u32 *natFilteringType)
 Returns NAT properties for the current internet connection.
 
Result FRD_GetServerTimeDifference (u64 *diff)
 Returns the difference (in nanoseconds) between server time and device time.
 
Result FRD_AllowHalfAwake (bool allow)
 Configures the current session to allow or disallow running the friends service in sleep mode (half-awake mode).
 
Result FRD_GetServerTypes (u8 *nascEnvironment, u8 *nfsType, u8 *nfsNo)
 Gets the server environment configuration for the current user.
 
Result FRD_GetFriendComment (FriendComment *comments, u32 commentsLen, const FriendKey *friendKeyList, u32 count)
 Gets the comment (personal) message of the current user's friends.
 
Result FRD_SetClientSdkVersion (u32 sdkVer)
 Sets the Friend API to use a specific SDK version.
 
Result FRD_GetMyApproachContext (EncryptedApproachContext *ctx)
 Gets the current user's encrypted approach context.
 
Result FRD_AddFriendWithApproach (u8 *unkbuf, u32 unkbufSize, EncryptedApproachContext *ctx, Handle completionEvent)
 Adds a friend using their encrypted approach context.
 
Result FRD_DecryptApproachContext (DecryptedApproachContext *decryptedContext, EncryptedApproachContext *encryptedContext, bool maskNonAscii, u8 characterSet)
 Decrypts an encrypted approach context.
 
Result FRD_GetExtendedNatProperties (u32 *natMappingType, u32 *natFilteringType, u32 *natMappingPortIncrement)
 Gets extended NAT properties.
 
Result FRDA_CreateLocalAccount (u8 localAccountId, u8 nascEnvironment, u8 nfsType, u8 nfsNo)
 Creates a new local friends account.
 
Result FRDA_DeleteLocalAccount (u8 localAccountId)
 Deletes a local friends account.
 
Result FRDA_LoadLocalAccount (u8 localAccountId)
 Loads a local friends account.
 
Result FRDA_UnloadLocalAccount ()
 Unloads the currently active local account.
 
Result FRDA_Save ()
 Saves all data of the friends module.
 
Result FRDA_AddFriendOnline (Handle event, u32 principalId)
 Adds a friend online ("Internet" option).
 
Result FRDA_AddFriendOffline (FriendKey *friendKey, FriendMii *mii, FriendProfile *friendProfile, MiiScreenName *screenName, bool profanityFlag, u8 characterSet)
 Adds a friend offline ("Local" option).
 
Result FRDA_UpdateMiiScreenName (FriendKey *friendKey, MiiScreenName *screenName, u8 characterSet)
 Updates a friend's display name.
 
Result FRDA_RemoveFriend (u32 principalId, u64 localFriendCode)
 Remove a friend.
 
Result FRDA_UpdatePlayingGame (GameKey *playingGame)
 Updates the game being played by the current user.
 
Result FRDA_UpdatePreference (bool isPublicMode, bool isShowGameMode, bool isShowPlayedMode)
 Updates the current user's friend list preferences.
 
Result FRDA_UpdateMii (FriendMii *mii, MiiScreenName *screenName, bool profanityFlag, u8 characterSet)
 Updates the current user's Mii.
 
Result FRDA_UpdateFavoriteGame (GameKey *favoriteGame)
 Updates the current user's favorite game.
 
Result FRDA_SetNcPrincipalId (u32 ncPrincipalId)
 Sets the NcPrincipalId of the current user.
 
Result FRDA_UpdateComment (FriendComment *comment)
 Updates the current user's comment (personal message).
 
Result FRDA_IncrementMoveCount ()
 Increments the move count in the current local account's save data.
 

Detailed Description

Friend Services.

Enumeration Type Documentation

◆ CharacterSet

Enum for character set.

Enumerator
CHARSET_JPN_USA_EUR 

Character set for JPN, USA, and EUR(+AUS).

CHARSET_CHN 

Character set for CHN.

CHARSET_KOR 

Character set for KOR.

CHARSET_TWN 

Character set for TWN.

◆ FriendAttributes

Enum for friend attributes according to relationship type.

Enumerator
FRIEND_ATTRIBUTE_EVER_REGISTERED 

Whether or not the current user has ever been in a friend relationship with the friend. This is set when the relationship type is either incomplete, complete, local, or deleted.

FRIEND_ATTRIBUTE_REGISTRATION_COMPLETE 

Whether or not the current user has been fully registered by this friend. Set only when the relationship type is complete.

◆ FriendNotificationTypes

Enum for notification event types.

Enumerator
USER_WENT_ONLINE 

Self went online.

USER_WENT_OFFLINE 

Self went offline.

FRIEND_WENT_ONLINE 

Friend Went Online.

FRIEND_UPDATED_PRESENCE 

Friend Presence changed (with matching GameJoinID)

FRIEND_UPDATED_MII 

Friend Mii changed.

FRIEND_UPDATED_PROFILE 

Friend Profile changed.

FRIEND_WENT_OFFLINE 

Friend went offline.

FRIEND_REGISTERED_USER 

Friend registered self as friend.

FRIEND_SENT_JOINABLE_INVITATION 

Friend sent invitation (with matching GameJoinID)

FRIEND_CHANGED_GAME_MODE_DESCRIPTION 

Friend changed game mode description.

FRIEND_CHANGED_FAVORITE_GAME 

Friend changed favorite game.

FRIEND_CHANGED_COMMENT 

Friend changed comment.

FRIEND_CHANGED_ANY_PRESENCE 

Friend Presence changed (with nonmatching GameJoinID)

FRIEND_SENT_ANY_INVITATION 

Friend sent invitiation (with nonmatching GameJoinID)

◆ RelationshipType

Enum for friend relationship type.

Enumerator
RELATIONSHIP_INCOMPLETE 

Provisionally registered friend.

RELATIONSHIP_COMPLETE 

Fully registered friend.

RELATIONSHIP_NOT_FOUND 

Friend not registered at all.

RELATIONSHIP_DELETED 

Relationship was deleted.

RELATIONSHIP_LOCAL 

Provisionally registered friend (but this relationship has not been sent to the server yet).

Function Documentation

◆ FRD_AddFriendWithApproach()

Result FRD_AddFriendWithApproach ( u8 unkbuf,
u32  unkbufSize,
EncryptedApproachContext ctx,
Handle  completionEvent 
)

Adds a friend using their encrypted approach context.

Parameters
unkbufPointer to unknown (and unused) data.
unkbufSizeSize of unknown (and unused) data. (max: 0x600)
ctxPointer to encrypted approach context data.
completionEventThe event handle to signal when this action is completed.

◆ FRD_AllowHalfAwake()

Result FRD_AllowHalfAwake ( bool  allow)

Configures the current session to allow or disallow running the friends service in sleep mode (half-awake mode).

Parameters
allowWhether or not to enable half-awake mode.

◆ FRD_AttachToEventNotification()

Result FRD_AttachToEventNotification ( Handle  event)

Registers the event handle that will be signaled to inform the session of various status changes.

Parameters
eventThe event handle to register for notification signaling.

◆ FRD_DecryptApproachContext()

Result FRD_DecryptApproachContext ( DecryptedApproachContext decryptedContext,
EncryptedApproachContext encryptedContext,
bool  maskNonAscii,
u8  characterSet 
)

Decrypts an encrypted approach context.

Parameters
decryptedContextPointer to write the decrypted approach context data to.
encryptedContextPointer to input encrypted approach context.
maskNonAsciiWhether or not to replace all non-ASCII characters with question marks ('?') if the given character set doesn't match that of the corresponding friend's Mii data.
characterSetThe character set to use for text conversions.

◆ FRD_DetectNatProperties()

Result FRD_DetectNatProperties ( Handle  completionEvent)

Starts an internal task to determine the NAT properties of the current internet connection.

Parameters
completionEventThe event handle to signal once the task has completed.

◆ FRD_FriendCodeToPrincipalId()

Result FRD_FriendCodeToPrincipalId ( u64  friendCode,
u32 principalId 
)

Returns the principal ID using the given friend code.

Parameters
friendCodeThe friend code being used.
principalIdPointer to write the principal ID to.

◆ FRD_GetEventNotification()

Result FRD_GetEventNotification ( NotificationEvent event,
u32  count,
u32 recievedNotifCount 
)

Get Latest Event Notification.

Parameters
eventPointer to write recieved notification event struct to.
countNumber of events
recievedNotifCountNumber of notification reccieved.

◆ FRD_GetExtendedNatProperties()

Result FRD_GetExtendedNatProperties ( u32 natMappingType,
u32 natFilteringType,
u32 natMappingPortIncrement 
)

Gets extended NAT properties.

This is the same as FRD_GetNatProperties, with this version also returning the NAT Mapping Port Increment.

Parameters
natMappingTypePointer to write the NAT mapping type of the connection to.
natFilteringTypePointer to write the NAT filtering type of the connection to.
natMappingPortIncrementPointer to write the NAT mapping port increment to.

◆ FRD_GetFriendAttributeFlags()

Result FRD_GetFriendAttributeFlags ( u32 attributes,
const FriendKey friendKeyList,
u32  count 
)

Get attributes for the current user's friends.

Parameters
attributesPointer to output the attributes to.
friendKeyListPointer to input friend keys to query attributes for.
countNumber of input friend keys.

◆ FRD_GetFriendComment()

Result FRD_GetFriendComment ( FriendComment *  comments,
u32  commentsLen,
const FriendKey friendKeyList,
u32  count 
)

Gets the comment (personal) message of the current user's friends.

Parameters
commentsPointer to write the friend comment data to.
commentsLenNumber of UTF-16 characters screenNames can hold. (max: 0xC00)
friendKeyListPointer to input friend keys.
countNumber of input friend keys.

◆ FRD_GetFriendFavoriteGame()

Result FRD_GetFriendFavoriteGame ( GameKey favoriteGames,
const FriendKey friendKeyList,
u32  count 
)

Get the current user's friends' favourite games.

Parameters
favoriteGamesPointer to write game key data to.
friendKeyListPointer to friend keys.
countNumber of friend keys.

◆ FRD_GetFriendInfo()

Result FRD_GetFriendInfo ( FriendInfo infos,
const FriendKey friendKeyList,
u32  count,
bool  maskNonAscii,
bool  profanityFlag 
)

Get info about the current user's friends.

Parameters
infosPointer to output friend info data to.
friendKeyListPointer to input friend keys.
countNumber of input friend keys.
maskNonAsciiWhether or not to replace all non-ASCII characters with question marks ('?') if the given character set doesn't match that of the corresponding friend's Mii data.
profanityFlagSetting this to true replaces the screen names with all question marks ('?') if profanityFlag is also set in the corresponding friend's Mii data.

◆ FRD_GetFriendKeyList()

Result FRD_GetFriendKeyList ( FriendKey friendKeyList,
u32 num,
u32  offset,
u32  size 
)

Gets the current user's friend key list.

Parameters
friendKeyListPointer to write the friend key list to.
numStores the number of friend keys obtained.
offsetThe index of the friend key to start with.
sizeSize of the friend key list. (FRIEND_LIST_SIZE)

◆ FRD_GetFriendMii()

Result FRD_GetFriendMii ( FriendMii miiList,
const FriendKey friendKeyList,
u32  count 
)

Gets the current user's friends' Mii data.

Parameters
miiListPointer to write Mii data to.
friendKeyListPointer to input friend keys.
countNumber of input friend keys.

◆ FRD_GetFriendPlayingGame()

Result FRD_GetFriendPlayingGame ( FriendPlayingGame playingGames,
const FriendKey friendKeyList,
u32  count 
)

Get the current user's friends' playing game.

Parameters
playingGamesPointer to write playing game data to.
friendKeyListPointer to friend keys.
countNumber of input friend keys.

◆ FRD_GetFriendPresence()

Result FRD_GetFriendPresence ( FriendPresence friendPresences,
const FriendKey friendKeyList,
u32  count 
)

Gets friend presence data for the current user's friends.

Parameters
friendPresencesPointer to write the friend presence data to.
friendKeyListThe friend keys of the friends to get presence data for.
countThe number of input friend keys.

◆ FRD_GetFriendProfile()

Result FRD_GetFriendProfile ( Profile profiles,
const FriendKey friendKeyList,
u32  count 
)

Get the current user's friends' profile data.

Parameters
profilePointer to write profile data to.
friendKeyListPointer to input friend keys.
countNumber of input friend keys.

◆ FRD_GetFriendRelationship()

Result FRD_GetFriendRelationship ( u8 relationships,
const FriendKey friendKeyList,
u32  count 
)

Get the relationship type for the current user's friends.

Parameters
relationshipsPointer to output relationship types to.
friendKeyListPointer to input friend keys to query relationship types for.
countNumber of input friend keys.

◆ FRD_GetGameAuthenticationData()

Result FRD_GetGameAuthenticationData ( GameAuthenticationData data)

Get game server authentication data requested using FRD_RequestGameAuthentication.

Parameters
dataPointer to write game server authentication data to.

◆ FRD_GetMiiScreenName()

Result FRD_GetMiiScreenName ( MiiScreenName *  screenNames,
u32  screenNamesLen,
u8 characterSets,
u32  characterSetsLen,
const FriendKey friendKeyList,
u32  count,
bool  maskNonAscii,
bool  profanityFlag 
)

Gets screen names for the current user's friends.

Parameters
screenNamesPointer to write the UTF-16 screen names to.
screenNamesLenNumber of UTF-16 characters screenNames can hold. (max: 0x800)
characterSetsPointer to write the character sets for the screen names to.
characterSetsLenSize of buffer to output character sets to.
friendKeyListThe friend keys for the friends to get screen names for.
countThe number of input friend keys.
maskNonAsciiWhether or not to replace all non-ASCII characters with question marks ('?') if the given character set doesn't match that of the corresponding friend's Mii data.
profanityFlagSetting this to true replaces the screen names with all question marks ('?') if profanityFlag is also set in the corresponding friend's Mii data.

◆ FRD_GetMyApproachContext()

Result FRD_GetMyApproachContext ( EncryptedApproachContext ctx)

Gets the current user's encrypted approach context.

Parameters
ctxPointer to write the encrypted approach context data to.

◆ FRD_GetMyComment()

Result FRD_GetMyComment ( FriendComment *  comment)

Gets the current user's comment on their friend profile.

Parameters
commentPointer to write the current user's comment to.
max_sizeMax size of the comment.

◆ FRD_GetMyFavoriteGame()

Result FRD_GetMyFavoriteGame ( GameKey favoriteGame)

Gets the current user's favourite game.

Parameters
titleIdPointer to write the title ID of current user's favourite game to.

◆ FRD_GetMyFriendKey()

Result FRD_GetMyFriendKey ( FriendKey key)

Gets the current user's friend key.

Parameters
keyPointer to write the current user's friend key to.

◆ FRD_GetMyLocalAccountId()

Result FRD_GetMyLocalAccountId ( u8 localAccountId)

Gets the ID of the current local account.

Parameters
localAccountIdPointer to write the current local account ID to.\

◆ FRD_GetMyMii()

Result FRD_GetMyMii ( FriendMii mii)

Gets the current user's Mii data.

Parameters
miiPointer to write the current user's mii data to.

◆ FRD_GetMyNcPrincipalId()

Result FRD_GetMyNcPrincipalId ( u32 ncPrincipalId)

Gets the NcPrincipalId for the current user.

Parameters
ncPrincipalIdPointer to output the NcPrincipalId to.

◆ FRD_GetMyPassword()

Result FRD_GetMyPassword ( char *  password,
u32  bufsize 
)

Gets the current friend account's NEX password.

Parameters
passwordPointer to write the NEX password to.
max_sizeMax size of the output buffer. Must not exceed 0x800.

◆ FRD_GetMyPlayingGame()

Result FRD_GetMyPlayingGame ( GameKey playingGame)

Gets the current user's playing game.

Parameters
titleIdPointer to write the current user's playing game to.

◆ FRD_GetMyPreference()

Result FRD_GetMyPreference ( bool *  isPublicMode,
bool *  isShowGameName,
bool *  isShowPlayedGame 
)

Gets the current user's privacy information.

Parameters
isPublicModeDetermines whether friends are notified of the current user's online status.
isShowGameNameDetermines whether friends are notified of the application that the current user is running.
isShowPlayedGameDetermiens whether to display the current user's game history.

◆ FRD_GetMyPresence()

Result FRD_GetMyPresence ( MyPresence presence)

Gets the current user's presence information.

Parameters
presencePointer to write the current user's presence information to.

◆ FRD_GetMyProfile()

Result FRD_GetMyProfile ( Profile profile)

Gets the current user's profile information.

Parameters
profilePointer to write the current user's profile information to.

◆ FRD_GetMyScreenName()

Result FRD_GetMyScreenName ( MiiScreenName *  name)

Gets the current user's screen name.

Parameters
namePointer to write the current user's screen name to.
max_sizeMax size of the screen name.

◆ FRD_GetNatProperties()

Result FRD_GetNatProperties ( u32 natMappingType,
u32 natFilteringType 
)

Returns NAT properties for the current internet connection.

Parameters
natMappingTypePointer to write the NAT mapping type of the connection to.
natFilteringTypePointer to write the NAT filtering type of the connection to.

◆ FRD_GetServerTimeDifference()

Result FRD_GetServerTimeDifference ( u64 diff)

Returns the difference (in nanoseconds) between server time and device time.

This difference is calculated every time the system logs into friend services.

Parameters
diffMsThe pointer to write the time difference (in nanoseconds) to.

◆ FRD_GetServerTypes()

Result FRD_GetServerTypes ( u8 nascEnvironment,
u8 nfsType,
u8 nfsNo 
)

Gets the server environment configuration for the current user.

Parameters
nascEnvironmentPointer to write the NASC server environment type to.
nfsTypePointer to write the NFS (Nintendo Friend Server) type to.
nfsNoPointer to write the NFS (Nintendo Friend Server) number to.

◆ FRD_GetServiceLocatorData()

Result FRD_GetServiceLocatorData ( ServiceLocatorData data)

Get service locator data requested using FRD_RequestServiceLocator.

Parameters
dataPointer to write the service locator data to.

◆ FRD_HasLoggedIn()

Result FRD_HasLoggedIn ( bool *  state)

Gets the login status of the current user.

Parameters
statePointer to write the current user's login status to.

◆ FRD_IsInFriendList()

Result FRD_IsInFriendList ( u64  friendCode,
bool *  isFromList 
)

Gets whether a friend code is included in the current user's friend list.

Parameters
friendCodeThe friend code to check for.
isFromListPointer to write whether or not the given friend code was found in the current user's friends list.

◆ FRD_IsOnline()

Result FRD_IsOnline ( bool *  state)

Gets the online status of the current user.

Parameters
statePointer to write the current user's online status to.

◆ FRD_IsValidFriendCode()

Result FRD_IsValidFriendCode ( u64  friendCode,
bool *  isValid 
)

Checks if the friend code is valid.

Parameters
friendCodeThe friend code being used.
isValidPointer to write the validity of the friend code to.

◆ FRD_Login()

Result FRD_Login ( Handle  event)

Log in to Nintendo's friend server.

Parameters
eventEvent to signal when Login is done.

◆ FRD_PrincipalIdToFriendCode()

Result FRD_PrincipalIdToFriendCode ( u32  principalId,
u64 friendCode 
)

Returns the friend code using the given principal ID.

Parameters
principalIdThe principal ID being used.
friendCodePointer to write the friend code to.

◆ FRD_RequestGameAuthentication()

Result FRD_RequestGameAuthentication ( u32  serverId,
u16 ingamesn,
u32  ingamesnSize,
u8  majorSdkVersion,
u8  minorSdkVersion,
Handle  completionEvent 
)

Requests game server authentication.

Parameters
serverIdThe ID of the NEX server to request authentication for.
ingamesnThe UTF-16 nickname to use in game.
ingamesnSizeBuffer size of the input ingamesn buffer. (max: FRIEND_INGAMESN_LEN * 2)
majorSdkVersionThe major SDK version.
minorSdkVersionThe minor SDK version.
completionEventThe event handle to signal once the operation has completed.

◆ FRD_RequestServiceLocator()

Result FRD_RequestServiceLocator ( u32  serverId,
char *  keyhash,
char *  svc,
u8  majorSdkVersion,
u8  minorSdkVersion,
Handle  completionEvent 
)

Request service locator info for a given NEX server.

Parameters
keyhashThe keyhash value to use for the NASC request.
svcThe svc value to use for the NASC request.
majorSdkVersionThe major SDK version.
minorSdkVersionThe minor SDK version.
completionEventThe event handle to signal once the operation has completed.
serverId

◆ FRD_ResultToErrorCode()

Result FRD_ResultToErrorCode ( u32 errorCode,
Result  res 
)

Get a support error code (XXX-YYYY) for the given result code.

Parameters
errorCodePointer to write the support error code to.
resThe result code to convert.

◆ FRD_SendInvitation()

Result FRD_SendInvitation ( const FriendKey friendKeyList,
u32  count 
)

Sends an invitation to the current user's friends.

Parameters
friendKeyListThe friend keys to send an invitation to.
countThe number of input friend keys.

◆ FRD_SetClientSdkVersion()

Result FRD_SetClientSdkVersion ( u32  sdkVer)

Sets the Friend API to use a specific SDK version.

Parameters
sdkVerThe SDK version needed to be used.

◆ FRD_SetNotificationMask()

Result FRD_SetNotificationMask ( FriendNotificationMask  mask)

Sets the notification mask for the event notification system.

Parameters
maskThe notifications to subscribe to for the event notification system.

◆ FRD_UnscrambleLocalFriendCode()

Result FRD_UnscrambleLocalFriendCode ( u64 unscrambled,
ScrambledFriendCode *  scrambled,
u32  count 
)

Unscrambles a scrambled friend code.

Parameters
unscrambledPointer to output the unscrambled friend codes to.
scrambledPointer to the input scrambled friend codes.
countNumber of input scrambled codes.

◆ FRD_UpdateGameModeDescription()

Result FRD_UpdateGameModeDescription ( FriendGameModeDescription *  desc)

Updates the game mode description string.

Parameters
descPointer to the UTF-8 game mode description to use.

◆ FRD_UpdateMyPresence()

Result FRD_UpdateMyPresence ( Presence presence,
FriendGameModeDescription *  desc 
)

Updates the current user's presence data and game mode description.

Parameters
presenceThe new presence data to use.
descThe new game mode description to use.

◆ FRDA_AddFriendOffline()

Result FRDA_AddFriendOffline ( FriendKey friendKey,
FriendMii mii,
FriendProfile friendProfile,
MiiScreenName *  screenName,
bool  profanityFlag,
u8  characterSet 
)

Adds a friend offline ("Local" option).

Parameters
friendKeyPointer to the friend key of the friend to add.
miiPointer to the Mii of the friend to add.
friendProfilePointer to the friend profile of the friend to add.
screenNamePointer to the UTF-16 screen name of the friend to add.
profanityFlagSetting this to true will cause calls that return the screen name to replace it with question marks ('?') when profanityFlag is true in those calls.
characterSetThe character set to use for text data of the friend.

◆ FRDA_AddFriendOnline()

Result FRDA_AddFriendOnline ( Handle  event,
u32  principalId 
)

Adds a friend online ("Internet" option).

Parameters
eventEvent signaled when friend is registered.
principalIdPrincipalId of the friend to add.

◆ FRDA_CreateLocalAccount()

Result FRDA_CreateLocalAccount ( u8  localAccountId,
u8  nascEnvironment,
u8  nfsType,
u8  nfsNo 
)

Creates a new local friends account.

Parameters
localAccountIdThe local account ID to use.
nascEnvironmentThe NASC environment to create this account in.
nfsTypeThe NFS (Nintendo Friend Server) type this account should use.
nfsNoThe NFS (Nintendo Friend Server) number this account should use.

◆ FRDA_DeleteLocalAccount()

Result FRDA_DeleteLocalAccount ( u8  localAccountId)

Deletes a local friends account.

Parameters
localAccountIdThe ID of the local account to delete.

◆ FRDA_LoadLocalAccount()

Result FRDA_LoadLocalAccount ( u8  localAccountId)

Loads a local friends account.

Parameters
localAccountIdThe ID of the local account to load.

◆ FRDA_RemoveFriend()

Result FRDA_RemoveFriend ( u32  principalId,
u64  localFriendCode 
)

Remove a friend.

Parameters
principalIdPrinipalId of the friend code to remove.
localFriendCodeLocalFriendCode of the friend code to remove.

◆ FRDA_SetNcPrincipalId()

Result FRDA_SetNcPrincipalId ( u32  ncPrincipalId)

Sets the NcPrincipalId of the current user.

Parameters
ncPrincipalIdThe new NcPrincipalId.

◆ FRDA_UpdateComment()

Result FRDA_UpdateComment ( FriendComment *  comment)

Updates the current user's comment (personal message).

Parameters
commentPointer to the new comment (personal message).

◆ FRDA_UpdateFavoriteGame()

Result FRDA_UpdateFavoriteGame ( GameKey favoriteGame)

Updates the current user's favorite game.

Parameters
favoriteGamePointer to the game key of the new favorite game.

◆ FRDA_UpdateMii()

Result FRDA_UpdateMii ( FriendMii mii,
MiiScreenName *  screenName,
bool  profanityFlag,
u8  characterSet 
)

Updates the current user's Mii.

Parameters
miiPointer to the new Mii data to use.
screenNamePointer to new screen name associated with the new Mii.
profanityFlagSetting this to true will cause calls that return the screen name to replace it with question marks ('?') when profanityFlag is true in those calls.
characterSetThe character set to use for the screen name.

◆ FRDA_UpdateMiiScreenName()

Result FRDA_UpdateMiiScreenName ( FriendKey friendKey,
MiiScreenName *  screenName,
u8  characterSet 
)

Updates a friend's display name.

Parameters
friendKeyPointer to friend key of the friend to update the screen name of.
screenNamePointer to the new screen name to use.
characterSetThe character set of the new screen name.

◆ FRDA_UpdatePlayingGame()

Result FRDA_UpdatePlayingGame ( GameKey playingGame)

Updates the game being played by the current user.

Parameters
playingGamePointer to game key of the game being played.

◆ FRDA_UpdatePreference()

Result FRDA_UpdatePreference ( bool  isPublicMode,
bool  isShowGameMode,
bool  isShowPlayedMode 
)

Updates the current user's friend list preferences.

Parameters
isPublicModeWhether or not the online status should be public.
isShowGameModeWhether or not the currently played game is shown.
isShowPlayedModeWhether or not the play history is shown.

◆ frdInit()

Result frdInit ( bool  forceUser)

Initializes friend services.

Parameters
forceUserWhether or not to force using the user service frd:u instead of the default (admin service frd:a).