DWC_InitFriendsMatch

Syntax

#include <dwc.h>

void DWC_InitFriendsMatch(DWCFriendsMatchControl *dwccnt,
                          DWCUserData *userdata,
                          int productID,
                          const char *gameName,
                          const char *secretKey,
                          int sendBufSize,
                          int recvBufSize,
                          DWCFriendData friendList[],
                          int friendListLen);

Arguments

dwccnt Retained for compatibility with past versions. Specify NULL.
userdata Pointer to the DWCUserData type user data object.
productID The product ID assigned by GameSpy.
gameName The game name assigned by GameSpy (C language string).
secretKey The secret key assigned by GameSpy (C language string).
sendBufSize The size of the send buffer used in peer-to-peer communication. If the value is set to 0, 8 KB is used by default.
recvBufSize The size of the receive buffer used in peer-to-peer communication. If the value is set to 0, 8 KB is used by default.
friendList Pointer to a friend roster for which an array with the maximum number of elements was allocated (NULL if unused).
friendListLen The maximum number of elements in the friends list. Max value is 64.

Return Values

None.

Description

Initializes the FriendsMatch library, a set of features used for matchmaking and friend managment.

Call this function before calling the DWC_LoginAsync function.

Specify the pointer to the DWCUserData structure created with DWC_CreateUserData in userdata. Maintain this buffer until DWC_ShutdownFriendsMatch is called.

productID, gameName, and secretKey are assigned to each game title. These communication groups are used to assign GameSpy servers and to configure the ranges for matchmaking and friend relationship creation. If you want to configure the ranges within the same game type or game title based on the market region (for example, so that Japanese and North American game versions cannot communicate), be sure to use a namespace that can be created using the DWC_CreateUserData function.

sendBuffSize and recvBuffSize specify the size of buffers to be used for Reliable send/receive between peers. The buffers are allocated by the DWC library after matchmaking is complete. (For information on Reliable send, see the function DWC_SendReliable.) A buffer of this specified size will then be allocated for each target peer through the memory allocation function passed by DWC_Init. If a 0 is specified here, the default size of 8 kilobytes is allocated.

Unlike the buffer specified by the DWC_SetRecvBuffer function, the buffer whose size is specified here is used internally by the library.

When adjusting this buffer size, consider the size of the data exchanged between peers and the frequency of the data exchange and set it so that the buffer overflow would not occur. In addition, even if an application does not use Reliable communication, a minimum buffer region is required in order to perform Reliable communication when the library establishes peer-to-peer connections. For details, see the Nintendo Wi-Fi Connection Programming Manual for Wii.

When the send/receive buffer size is reduced, it is possible to make adjustments so that the buffer does not overflow by using the DWC_SetSendSplitMax function to reduce the maximum size of the send data.

Specify the friend roster to be managed by the application using friendList and friendListLen. The application should save the friend roster along with save data. The friend roster automatically updates within the library. For details about operations performed on the friend roster, see the description of the DWC_CreateFriendKeyToken function. This function is used to create the friend data that will be stored in the friend roster. Furthermore, because the friend roster uses the passed buffer as-is without making a copy in the library, keep the entity in the application until the DWC_ShutdownFriendsMatch function is called.

Revision History

1.4.1
Deleted the description about DWC_CreateExchangeToken.
1.3.0
Made it so that the first argument is ignored.
1.1.2
The DWCFriendsMatchControl definition has changed from a structure to a pointer variable. Corrected an error regarding DWC_SetMemFunc().

CONFIDENTIAL