1 /*---------------------------------------------------------------------------*
2   Project:  MP DS download play library
3   File:     mpdl.h
4 
5   Copyright 2006 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   $Log: mpdl.h,v $
14   Revision 1.9.2.1  2008/08/06 04:38:40  okubata_ryoma
15   Merged with rev 1.10.
16 
17   Revision 1.9  2007/10/11 06:39:16  yosizaki
18   Support for custom-banner.
19 
20   Revision 1.8  2007/04/27 03:44:00  yosizaki
21   Added MPDLRegistrationList declaration.
22 
23   Revision 1.7  2007/02/16 06:28:35  yosizaki
24   Changed type of the playerbits (from int to u32)
25 
26   Revision 1.6  2006/08/25 02:05:03  yosizaki
27   Added some functions.
28 
29   Revision 1.5  2006/08/23 08:55:37  yosizaki
30   Added some functions.
31 
32   Revision 1.4  2006/08/14 14:41:55  yasu
33   Support for PADDING warnings.
34 
35   Revision 1.3  2006/07/07 03:12:49  yosizaki
36   Added MPDLEnableFlag.
37 
38   Revision 1.2  2006/07/05 07:52:27  yosizaki
39   Changed type of some members in MPDLConfig.
40 
41   Revision 1.1  2006/07/03 23:47:37  yosizaki
42   Initial upload.
43 
44   $NoKeywords: $
45  *---------------------------------------------------------------------------*/
46 
47 #ifndef REVOLUTION_MPDL_H__
48 #define REVOLUTION_MPDL_H__
49 
50 #include <revolution/types.h>
51 #include <revolution/mp.h>
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 /*===========================================================================*/
57 /* Constants */
58 
59 #define MPDL_PLAYER_NAME_MAX         10      /* 10 or fewer characters in UTF16-LE */
60 #define MPDL_DOWNLOAD_PARAMETER_SIZE 32
61 
62 extern const char *MPDLRegistrationList;
63 
64 
65 /*===========================================================================*/
66 /* Declarations */
67 
68 typedef struct MPDLPlayerInfo
69 {
70     int     aid;
71     int     color;
72     u16     name_length;
73     u16     name[MPDL_PLAYER_NAME_MAX];
74     u8      mac[6];
75     int     progress;
76 }
77 MPDLPlayerInfo;
78 
79 #pragma warn_padding off
80 typedef struct MPDLConfig
81 {
82     void*       (*alloc)(u32 size);
83     void        (*free) (void* ptr);
84     OSPriority  threadPriority;
85     u32         ggid;
86     u32         tgid;
87     u32         channel;
88 
89     u8          serverColor;
90 
91     // 3-byte padding
92 
93     const u16  *serverName;
94     const u16  *programTitle;
95     const u16  *programComment;
96     u32         programMaxEntry;
97     const u8   *programImage;
98     const void *bannerCharacter;
99     const void *bannerPalette;
100     u8          userParam[MPDL_DOWNLOAD_PARAMETER_SIZE];
101 
102     void       *internalWork1;
103     void       *internalWork2;
104     BOOL        entry_flag;
105     BOOL        mb_flag;
106     u32         bitmap;
107     MPConfig    mpConfig[1];
108 }
109 MPDLConfig;
110 #pragma warn_padding reset
111 
112 
113 /*===========================================================================*/
114 /* Functions */
115 
116 /*---------------------------------------------------------------------------*
117   Name        : MPDLStartup
118   Description : Initializes and starts MP communications for downloading
119   Arguments   : config  - Download settings
120   Returns     : s32     - Returns the result of the processing. Returns a negative value if processing failed.
121  *---------------------------------------------------------------------------*/
122 s32     MPDLStartup( MPDLConfig* config );
123 
124 /*---------------------------------------------------------------------------*
125   Name        : MPDLCleanup
126   Description : Terminates MP communications for downloading.
127   Arguments   : None.
128   Returns     : s32     - Returns the result of the processing. Returns a negative value if processing failed.
129  *---------------------------------------------------------------------------*/
130 s32     MPDLCleanup( void );
131 
132 /*---------------------------------------------------------------------------*
133   Name        : MPDLIsAvailable
134   Description : Determines whether the MPDL library process has started and if the library is available.
135   Arguments   : None.
136   Returns     : BOOL    - TRUE if the MPDLStartup function has already been called.
137  *---------------------------------------------------------------------------*/
138 BOOL    MPDLIsAvailable( void );
139 
140 /*---------------------------------------------------------------------------*
141   Name        : MPDLStartDownload
142   Description : Closes download entries and starts the download process.
143   Arguments   : None.
144   Returns     : int     - Bitmap representing current entry player status at the close of download entry.
145 
146  *---------------------------------------------------------------------------*/
147 u32     MPDLStartDownload( void );
148 
149 /*---------------------------------------------------------------------------*
150   Name        : MPDLGetPlayerInfo
151   Description : Gets current entry or already downloaded player information.
152   Arguments   : aid     - Player AID (the Wii acting as parent is 0)
153                 dst     - Structure that stores player information
154   Returns     : BOOL - If the AID is valid, store the information and return TRUE. If not, return FALSE.
155 
156  *---------------------------------------------------------------------------*/
157 BOOL    MPDLGetPlayerInfo( int aid, MPDLPlayerInfo* dst );
158 
159 /*---------------------------------------------------------------------------*
160   Name        : MPDLGetEntryBitmap
161   Description : Gets the player status for current entry player status as a bitmap.
162   Arguments   : None.
163   Returns     : int     - Bitmap representing current entry player status.
164  *---------------------------------------------------------------------------*/
165 u32     MPDLGetEntryBitmap( void );
166 
167 /*---------------------------------------------------------------------------*
168   Name        : MPDLGetBootableBitmap
169   Description : Gets download complete player status as a bitmap.
170   Arguments   : None.
171   Returns     : u32     - Bitmap representing players who have finished downloading.
172  *---------------------------------------------------------------------------*/
173 u32     MPDLGetBootableBitmap( void );
174 
175 /*---------------------------------------------------------------------------*
176   Name        : MPDLGetBootedBitmap
177   Description : Gets a bitmap showing the status of players who have finished restarting.
178   Arguments   : None.
179   Returns     : int     - Bitmap representing players who have finished restarting.
180  *---------------------------------------------------------------------------*/
181 u32     MPDLGetBootedBitmap( void );
182 
183 /*---------------------------------------------------------------------------*
184   Name        : MPDLGetBootStopper
185   Description : Gets the state of booting permissions for the players who have have finished downloading.
186   Arguments   : None.
187   Returns     : AID bitmap of players who are not allowed to start.
188  *---------------------------------------------------------------------------*/
189 u32     MPDLGetBootStopper( void );
190 
191 /*---------------------------------------------------------------------------*
192   Name        : MPDLSetBootStopper
193   Description : Changes permissions for players to restart if they have finished downloading.
194   Arguments   : bitmap  - AID bitmap of players who are not allowed to start.
195   Returns     : None.
196  *---------------------------------------------------------------------------*/
197 void    MPDLSetBootStopper( u16 bitmap );
198 
199 /* internal functions -------------------------------------------------------*/
200 
201 /*---------------------------------------------------------------------------*
202   Name        : MPDLEnableFlag
203   Description : Controls the communication beacon flag.
204   Arguments   : entry - Controls entry flag (always true under normal conditions)
205                 mb - Controls MB flag (always true under normal conditions)
206   Returns     : None.
207  *---------------------------------------------------------------------------*/
208 void    MPDLEnableFlag( BOOL entry, BOOL mb );
209 
210 
211 /*===========================================================================*/
212 #ifdef __cplusplus
213 }
214 #endif
215 #endif  /* REVOLUTION_MP_H__ */
216 
217 /*---------------------------------------------------------------------------*
218   End of file
219  *---------------------------------------------------------------------------*/
220