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