/*---------------------------------------------------------------------------*
  Project:  TwlSDK - MB - demos - cloneboot
  File:     main.c

  Copyright 2005-2008 Nintendo. All rights reserved.

  These coded instructions, statements, and computer programs contain
  proprietary information of Nintendo of America Inc. and/or Nintendo
  Company Ltd., and are protected by Federal copyright law. They may
  not be disclosed to third parties or copied or duplicated in any form,
  in whole or in part, without the prior written consent of Nintendo.

  $Date:: 2009-03-02#$
  $Rev: 10122 $
  $Author: kitase_hirotake $
*---------------------------------------------------------------------------*/

#ifdef SDK_TWL
#include <twl.h>
#else
#include <nitro.h>
#endif

#include "common.h"

/*
 * Sample application that implements clone booting.
 *
 * Because the MB library samples use the multiboot functionality, multiple development units with the same communications environment (wired or wireless) are required.
 * 
 * The mb_child_NITRO.srl and mb_child_TWL.srl programs in the directory $TwlSDK/bin/ARM9-TS/Rom/ are samples providing the same features as the multiboot child in the final commercial unit. Load these binaries into other development units using the same method as for sample programs, and execute them together.
 * 
 * 
 * 
 * 
 *
 */

/******************************************************************************/



//============================================================================
//   Function Definitions
//============================================================================

/*---------------------------------------------------------------------------*
  Name:         NitroMain / TwlMain

  Description:  Main routine.

  Arguments:    None.

  Returns:      None.
 *---------------------------------------------------------------------------*/
#ifdef SDK_TWL
void TwlMain(void)
#else
void NitroMain(void)
#endif
{
    /*
     * This sample uses the multiboot-Model sample demo unchanged and simply divides processing by determining whether this is a DS Download Play child program.
     * 
     * 
     *
     * The following are primary differences between the parent and child environments when clone booting.
     *  1. A child does not have card access
     *  2. You must include 8 KB or less of code specific to the parent
     *  3. Parents and children use different wireless communications procedures
     * 
     *
     * If you heed these points and handle them with wrapper processes that match your application design, you can create an efficient program that keeps most content common between parents and children, supports both single-player and versus play, and conserves CARD-ROM memory usage.
     * Conversely, if there are absolutely no commonalities between the parent and children in DS Download Play, it will probably not be possible to achieve the aforementioned benefits.
     * 
     * 
     * 
     */
    if (!MB_IsMultiBootChild())
    {
        ParentMain();
    }
    else
    {
        ChildMain();
    }

    /* Control should not arrive here */
}
