# MB_Init

## C Specification

      #include <nitro/mb.h>

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

## 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 `MB_Init`, but before calling `MB_StartParent`, use `MB_SetParentCommParam` to set the maximum number of connected children.

## 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` | 4-byte identifier for the Game Group ID (GGID).

`tgid`

TGID value. 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.
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 initialization completes correctly.

## See Also

`MBUserInfo, MB_StartParent, MB_StartParentFromIdle, MB_SetParentCommParam, MB_End, OS_GetVBlankCount`

## Revision History

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.