1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - MB - demos - cloneboot
3   File:     main.c
4 
5   Copyright 2005-2009 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date:: 2009-08-31#$
14   $Rev: 11030 $
15   $Author: tominaga_masafumi $
16 *---------------------------------------------------------------------------*/
17 
18 #ifdef SDK_TWL
19 #include <twl.h>
20 #else
21 #include <nitro.h>
22 #endif
23 
24 #include "common.h"
25 
26 /*
27  * Sample application that implements clone booting.
28  *
29  * Because the MB library samples use multiboot functionality, multiple development units with the same communications environment (wired or wireless) are required.
30  *
31  * The mb_child_NITRO.srl and mb_child_TWL.srl sample programs in the $TwlSDK/bin/ARM9-TS/ROM directory provide the same functionality as that found in a retail unit that is operating as a multiboot child. Load these binaries on some other units in the same manner as loading a normal sample program, and run them together with this sample.
32  *
33  *
34  *
35  *
36  *
37  */
38 
39 /*
40  * This demo uses the WH library for wireless communications, but does not perform wireless shutdown processing; this lack is particularly noticeable on the child side.
41  *
42  * For details on WH library wireless shutdown processing, see the comments at the top of the WH library source code or the wm/dataShare-Model demo.
43  *
44  *
45  */
46 
47 /******************************************************************************/
48 
49 
50 
51 //============================================================================
52 //   Function definitions
53 //============================================================================
54 
55 /*---------------------------------------------------------------------------*
56   Name:         NitroMain / TwlMain
57 
58   Description:  Main routine
59 
60   Arguments:    None.
61 
62   Returns:      None.
63  *---------------------------------------------------------------------------*/
64 #ifdef SDK_TWL
TwlMain(void)65 void TwlMain(void)
66 #else
67 void NitroMain(void)
68 #endif
69 {
70     /*
71      * This sample uses the multiboot-Model sample demo unchanged and simply divides processing by determining whether this is a DS Download Play child program.
72      *
73      *
74      *
75      * The following are primary differences between the parent and child environments when clone booting.
76      *  1. A child does not have card access
77      *  2. You must include 8 KB or less of code specific to the parent
78      *  3. Parents and children use different wireless communications procedures
79      *
80      *
81      * 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.
82      * 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.
83      *
84      *
85      *
86      */
87     if (!MB_IsMultiBootChild())
88     {
89         ParentMain();
90     }
91     else
92     {
93         ChildMain();
94     }
95 
96     /* Control should not arrive here */
97 }
98