DWC_InitForProduction

Syntax

#include <dwc.h>
int DWC_InitForProduction(const char *gameName, 
                          u32 gameCode, 
                          DWCAllocEx alloc, 
                          DWCFreeEx free); 

Arguments

gameName Game name (NULL when not using GameSpy services). Affects the range for possible matchmaking.
gameCode The range for connecting friend relationships. Normally, the game code (in single byte, capital Roman letters) assigned to each game.
For example, 'NTRJ' is assigned when the game code is NTRJ.
alloc Pointer to the DWCAllocEx function used to allocate the memory.
free Pointer to the DWCFreeEx function used to deallocate the memory.

Return Values

DWC_INIT_RESULT_NOERROR Initialization succeeded.
DWC_INIT_RESULT_CREATE_USERID Generated temporary user ID on the Nintendo DS system.
DWC_INIT_RESULT_DESTROY_USERID Generated a temporary user ID because the user ID on the DS system may have been corrupted.
DWC_INIT_RESULT_DESTROY_OTHER_SETTING The Nintendo DS system connection target settings may have been corrupted.
DWC_INIT_RESULT_MEMORY_FULL Failed to allocate work memory. (0x1000 bytes with HYBRIDROM and LIMITEDROM; 0x700 bytes with NITROROM)

Description

Function that initializes the DWC library for the production server.
In addition to setting the authentication server and production server of each module, this function also checks and creates user IDs to save on the Nintendo DS system and sets the allocator.

There are two types of functions for initializing the DWC library, the DWC_InitForDevelopment and DWC_InitForProduction functions. You must call either of these once before calling other functions included in the DWC library.
Note: You can call the DWC_Debug_DWCInitError and DWC_SetReportLevel functions before calling a function to initialize the DWC library.

Display an appropriate message that corresponds to the return value. See the Nintendo Wi-Fi Connection Programming Guidelines for more information on error messages.

The memory allocation and deallocation functions used with this function may be used by another thread, so be sure to use thread exclusion control.

The work memory allocated by this function is deallocated internally by this function.

The Alloc and Free function pointers passed to this function are stored in a static variable in the DWC library.
This function is not intialized to NULL by the library, but if a DWC function is not used after the DWC_CleanupInet or DWC_CleanupInetAsync function completes, then Alloc and Free passed to this function will not be used.

Before calling this function, you must call the OS_Init function.
Note that the OS_InitTick, OS_InitAlarm and the RTC_Init functions are called by the DWC_InitForDevelopment and DWC_InitForProduction functions.

This function waits for a PXI interrupt for synchronization purposes. Do not call it when PXI interrupts are prohibited.



Switching Between Development and Production Servers

The DWC initialization functions affect the following server selections.

DWC Initialization Functions DWC_InitForDevelopment DWC_InitForProduction
Authentication Server Debug Server Actual Server
Ranking Server Debug Server Actual Server
Data Storage Server Debug Server Actual Server
Download Server Debug Server Actual Server

Use the DWC_InitForDevelopment function for development and debugging. (The authentication server for development is used.) Use the DWC_InitForProduction function to switch to the production authentication server to confirm operations when when creating the final ROM. Do not use the DWC_InitForProduction function at the testing stage of development. Also, for the final ROM build, do not allow (1) object codes for the DWC_InitForDevelopment function to be included, or (2) the display of DEBUGDWCx.x.xx... when checking middleware (for the library used) that uses DS_MRC and MasterEditor.

When using the DWC_InitForDevelopment function (which initializes the development server), you cannot connect from a hotspot to the authentication server.

When the build type is FINALROM, use the production authentication server in the Wi-Fi Connection setup utility regardless of which DWC initialization function was used.

Note that there is no distinction between the development and production servers for friend management and matchmaking. When testing matchmaking during the development of a remastered or localized version, matchmaking sometimes occurs with titles that have already been released even if you initialize DWC using the DWC_InitForDevelopment function.

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



Units of Communication and Friend Relationship Range Settings

In Nintendo Wi-Fi Connection, the gameName value specified by this function is used to set a communication group for each game title to avoid interference from other games. Also, the gameCode argument specified by this function is used separately from this to configure a range for friend relationships.

For gameCode, specify the game code that is routinely assigned to each title. If you want the friend relationships to be able to span across market regions, choose one of the game codes and use it as a shared parameter.

Specifying a gameCode value for different markets has the following effect on the exchange of friend information.

Exchange using friend registration keys The friend registration keys will fail the DWC_CheckFriendKey function's validity check.
Exchange using DS Wireless Communications There is no method used to check the validity of friend information, but no friend relationship will be established, even though friend information is added to the friend roster.
For more information, see the DWC_CreateExchangeToken function reference.

Note that if gameName is the same, peer matchmaking with friends unspecified is possible even when specifying a different gameCode value.



Operation Status of the Authentication Server

To check the operation status of each authentication server, see the following links. If the string AuthServerisup appears, the server is operating.

Authentication Server for Production Authentication Server for Development

See Also

DWC_CreateUserData

Revision History

5.4
Added description of the allocated work memory.
5.3
Based on a change to the specifications, the initialization function has been separated into two functions: One for development and one for production. Also added support for requiring the specification of a game name, game code, and allocator.
5.1
Revised the list of functions that must be called before using the DWC_Init function to include only the OS_Init function.

For the revision history prior to version 5.1 PR2, click here.


CONFIDENTIAL