MB_Init

C Specification

#include <nitro/mb.h>

int MB_Init(void *work, const MBUserInfo *user, u32 ggid, u32 tgid, u32 dma);

Arguments

work Pointer to memory allocated for the internal state management of the MB library.
This size must equal or exceed the byte size in MB_SYSTEM_BUF_SIZE. (If you can ensure that MB_StartParentFromIdle is called after MB_Init, you can reduce the size by WM_SYSTEM_BUF_SIZE bytes.) The allocated memory is used internally until MB_End is called.
user Pointer to the structure in which user data is saved.
The content specified by this pointer is referenced only in the MB_Init function.
ggid Specifies a 4-byte game group ID.
tgid A 16-bit value from 0x0000 to 0xFFFF that indicates the TGID value. When MB_TGID_AUTO is assigned to this value, the TGID will be automatically obtained by internally calling WM_GetNextTgid. At the initial program launch (IPL), the display information is not updated when the tgid, ggid, and MAC address are the same (a single parent is assumed). After a parent terminates, the user information displayed in the child IPL may not be updated if the user name was updated and restarted as an MB parent.
When not specifying MB_TGID_AUTO, use OS_GetVBlankCount or RTC like a random number generator to set a different value whenever a restart occurs.
dma The DMA channel allocated for MB internal processing.
The DMA channel is used internally until the MB_End function is called.

Return Values

Returns MB_SUCCESS if the initialization completes successfully.

Description

This function initializes the multi-boot (MB) library. The MB_Init function must be called once before any MB function is called. However, if you call MB_Init more than once, nothing happens. After calling this function, but before calling MB_StartParent, use MB_SetParentCommParam to set the maximum number of connected children.

See Also

MBUserInfo, MB_StartParent, MB_StartParentFromIdle, MB_SetParentCommParam, MB_End, OS_GetVBlankCount

Revision History

04/11/2005 Expanded the type of the tgid argument to u32 and added description for MB_TGID_AUTO.
11/24/2004 Changed name: MB_StartParentEx to MB_StartParentFromIdle.
10/18/2004 Added a description of MB_StartParentEx and several links.
10/05/2004 Corrected an error in the description of internal operation.
09/30/2004 Added argument.
08/09/2004 Initial version.