DWC_Init

Syntax

#include <dwc.h>

int DWC_Init(DWCAUTHSERVER authserver,
             const char *gamename,
             u32 gamecode,
             DWCAllocEx alloc,
             DWCFreeEx free);

Arguments

authserver Specifies the authentication server.
gamename Game name (NULL if not using the GameSpy service).
gamecode Normally, the initial code (in half-width alphanumeric capital letters) assigned to each game.
For example, 'RABA' is assigned when the game code is RABA.
alloc Pointer to the DWCAllocEx function used to allocate the memory.
free Pointer to the DWCFreeEx function used to free the memory.

Return Values

0 Function completed successfully.

Description

This function initializes the DWC library. Be absolutely sure to call this function first when using the DWC library.

After initialization of the DWC library, DWC will transition to the error state if the network has been disconnected. Once the DWC library has completed normally during reconnection, the appropriate recovery processing must be performed for the SO library as well.

The authentication server selected here affects the server selected for the following modules:


Authentication server

DWC_AUTHSERVER_DEBUG

DWC_AUTHSERVER_RELEASE

Ranking server

Debug server

Actual server

Data storage server

Debug server

Actual server

Download server

Debug server

Actual server

Note that there is no distinction between the development and product servers for friend management and the matchmaking process. When testing matchmaking during the development of a remastered or localized version, matchmaking will sometimes occur with titles that have already been released even if you specify DWC_AUTHSERVER_DEBUG in the DWC_Init function.

To avoid this, use a matchmaking filter to prevent peer matchmaking with friend specified between the release and development (debugging) versions. (Refer to the DWC_AddMatchKeyString function for more on matchmaking filters.)

Use the DWC_InitFriendsMatch function to set communication groups for each game title to avoid mixed communications with other games when using Nintendo Wi-Fi Connection. The gamecode value sets the range of friend relationships (namespace) in these communication groups.

In gamecode, specify the initial code normally assigned to each game title. When forming friend relationships outside the marketing region, set one of the initial codes to be shared.

Since the memory allocation and deallocation functions used with this function may be used by another thread, be sure to use thread exclusion control. For an example, see the demo.
There is no problem allocating memory from either MEM1 or MEM2.

DWC_Init is a block function.

Revision History

1.4.12
Added a gamecode example.
1.4.10
Moved the process for creating DNS cache to DWC_LoginAsync so that now this function can be called without being connected to the network.
1.4.1
Added a description about network disconnection cases.
1.4.0
Added a section concerning the details of connecting to the network.
1.3.2
Changed operation so that the function returns -1 if it failed to create a DNS cache.
1.1.2
Made changes so that data storage server connection target can be changed.
1.1.0
Added a note that thread-exclusive control of the memory allocation and deallocation functions is required.
1.0.0
Added a description of changes to NWC24 specifications in which gamecode is now passed as an argument.
0.0.8
Changed specifications so that gamename is passed as an argument, and changed specifications so that an allocator is passed as an argument.

CONFIDENTIAL