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.13 2008/10/30 08:19:04 yosizaki 15 Added MPDLResetEntryBitmap. 16 17 Revision 1.12 2008/10/23 06:58:04 yosizaki 18 Added MPDLStartDownloadEx. 19 20 Revision 1.11 2008/10/08 02:42:56 yosizaki 21 Added entry-filter. 22 23 Revision 1.10 2008/02/01 08:55:34 yosizaki 24 Added MPDLSetBootStopper. 25 26 Revision 1.9 2007/10/11 06:39:16 yosizaki 27 Support for custom-banner. 28 29 Revision 1.8 2007/04/27 03:44:00 yosizaki 30 Added MPDLRegistrationList declaration. 31 32 Revision 1.7 2007/02/16 06:28:35 yosizaki 33 Changed type of the playerbits (from int to u32). 34 35 Revision 1.6 2006/08/25 02:05:03 yosizaki 36 Added some functions. 37 38 Revision 1.5 2006/08/23 08:55:37 yosizaki 39 Added some functions. 40 41 Revision 1.4 2006/08/14 14:41:55 yasu 42 Support for PADDING warnings. 43 44 Revision 1.3 2006/07/07 03:12:49 yosizaki 45 Added MPDLEnableFlag. 46 47 Revision 1.2 2006/07/05 07:52:27 yosizaki 48 Changed type of some members in MPDLConfig. 49 50 Revision 1.1 2006/07/03 23:47:37 yosizaki 51 Initial upload. 52 53 $NoKeywords: $ 54 *---------------------------------------------------------------------------*/ 55 56 #ifndef REVOLUTION_MPDL_H__ 57 #define REVOLUTION_MPDL_H__ 58 59 #include <revolution/types.h> 60 #include <revolution/mp.h> 61 62 #ifdef __cplusplus 63 extern "C" { 64 #endif 65 /*===========================================================================*/ 66 /* Constants */ 67 68 #define MPDL_PLAYER_NAME_MAX 10 /* 10 or fewer characters in UTF16-LE */ 69 #define MPDL_DOWNLOAD_PARAMETER_SIZE 32 70 71 extern const char *MPDLRegistrationList; 72 73 74 /*===========================================================================*/ 75 /* Declarations */ 76 77 typedef struct MPDLPlayerInfo 78 { 79 int aid; 80 int color; 81 u16 name_length; 82 u16 name[MPDL_PLAYER_NAME_MAX]; 83 u8 mac[6]; 84 int progress; 85 } 86 MPDLPlayerInfo; 87 88 #pragma warn_padding off 89 typedef struct MPDLConfig 90 { 91 void* (*alloc)(u32 size); 92 void (*free) (void* ptr); 93 OSPriority threadPriority; 94 u32 ggid; 95 u32 tgid; 96 u32 channel; 97 98 u8 serverColor; 99 100 // 3-byte padding 101 102 const u16 *serverName; 103 const u16 *programTitle; 104 const u16 *programComment; 105 u32 programMaxEntry; 106 const u8 *programImage; 107 const void *bannerCharacter; 108 const void *bannerPalette; 109 u8 userParam[MPDL_DOWNLOAD_PARAMETER_SIZE]; 110 111 void *internalWork1; 112 void *internalWork2; 113 BOOL entry_flag; 114 BOOL mb_flag; 115 u32 bitmap; 116 MPConfig mpConfig[1]; 117 } 118 MPDLConfig; 119 #pragma warn_padding reset 120 121 typedef BOOL (*MPDLEntryFilterCallback)(const MPDLPlayerInfo*); 122 123 124 /*===========================================================================*/ 125 /* Functions */ 126 127 /*---------------------------------------------------------------------------* 128 Name : MPDLStartup 129 Description : Initializes and starts MP communications for downloading 130 Arguments : config - Download settings 131 Returns : s32 - Returns the processing results. Returns a negative value if processing failed. 132 *---------------------------------------------------------------------------*/ 133 s32 MPDLStartup( MPDLConfig* config ); 134 135 /*---------------------------------------------------------------------------* 136 Name : MPDLCleanup 137 Description : Terminates MP communications for downloading. 138 Arguments : None. 139 Returns : s32 - Returns the processing results. Returns a negative value if processing failed. 140 *---------------------------------------------------------------------------*/ 141 s32 MPDLCleanup( void ); 142 143 /*---------------------------------------------------------------------------* 144 Name : MPDLIsAvailable 145 Description : Determines whether the MPDL library process has started and if the library is available. 146 Arguments : None. 147 Returns : BOOL - TRUE if the MPDLStartup function has already been called. 148 *---------------------------------------------------------------------------*/ 149 BOOL MPDLIsAvailable( void ); 150 151 /*---------------------------------------------------------------------------* 152 Name : MPDLStartDownloadEx 153 Description : Closes download entries and starts the download process. 154 Arguments : bitmap - Bitmap of AID for which entry will be closed. 155 Returns : u32 - Bitmap that shows the states of players who were considered to be entries when download entries were closed. 156 157 *---------------------------------------------------------------------------*/ 158 u32 MPDLStartDownloadEx(u32 bitmap); 159 160 /*---------------------------------------------------------------------------* 161 Name : MPDLStartDownload 162 Description : Closes all download entries and starts the download process. 163 Arguments : None. 164 Returns : int - Bitmap that shows the states of players who were considered to be entries when download entries were closed. 165 166 *---------------------------------------------------------------------------*/ 167 u32 MPDLStartDownload( void ); 168 169 /*---------------------------------------------------------------------------* 170 Name : MPDLGetPlayerInfo 171 Description : Gets current entry or downloaded player information. 172 Arguments : aid - Player AID (the parent Wii is 0) 173 dst - Structure that stores player information 174 Returns : BOOL - Returns TRUE and saves data for a valid AID; returns FALSE otherwise. 175 176 *---------------------------------------------------------------------------*/ 177 BOOL MPDLGetPlayerInfo( int aid, MPDLPlayerInfo* dst ); 178 179 /*---------------------------------------------------------------------------* 180 Name : MPDLGetEntryBitmap 181 Description : Gets the current entry player status as a bitmap. 182 Arguments : None. 183 Returns : int - Bitmap representing current entry player status. 184 *---------------------------------------------------------------------------*/ 185 u32 MPDLGetEntryBitmap( void ); 186 187 /*---------------------------------------------------------------------------* 188 Name : MPDLGetBootableBitmap 189 Description : Gets download-completed player status as a bitmap. 190 Arguments : None. 191 Returns : u32 - Bitmap representing players who have completed downloading. 192 *---------------------------------------------------------------------------*/ 193 u32 MPDLGetBootableBitmap( void ); 194 195 /*---------------------------------------------------------------------------* 196 Name : MPDLGetBootedBitmap 197 Description : Gets a bitmap showing the statuses of players who have completed restarting. 198 Arguments : None. 199 Returns : int - Bitmap representing players who have completed restarting. 200 *---------------------------------------------------------------------------*/ 201 u32 MPDLGetBootedBitmap( void ); 202 203 /*---------------------------------------------------------------------------* 204 Name : MPDLGetBootStopper 205 Description : Gets the states of booting permissions for players who have have completed downloading. 206 Arguments : None. 207 Returns : AID bitmap of players who are not allowed to start. 208 *---------------------------------------------------------------------------*/ 209 u32 MPDLGetBootStopper( void ); 210 211 /*---------------------------------------------------------------------------* 212 Name : MPDLSetBootStopper 213 Description : Changes permissions for players to restart if they have completed downloading. 214 Arguments : bitmap - AID bitmap of players who are not allowed to start. 215 Returns : None. 216 *---------------------------------------------------------------------------*/ 217 void MPDLSetBootStopper( u16 bitmap ); 218 219 /*---------------------------------------------------------------------------* 220 Name : MPDLResetEntryBitmap 221 Description : Reaccepts entries for AIDs that are currently in an open state. 222 This is used to start the next download entry for AIDs that completed downloading or were disconnected while downloading. 223 224 Arguments : bitmap - AID bitmap of players whose entries will be re-allowed. 225 AIDs that are currently connected will be ignored. 226 Returns : Bitmap of AIDs that were actually accepted and restarted. 227 *---------------------------------------------------------------------------*/ 228 u32 MPDLResetEntryBitmap(u32 bitmap); 229 230 /*---------------------------------------------------------------------------* 231 Name : MPDLSetEntryFilterCallback 232 Description : Sets an entry permission callback to be invoked for players immediately after they connect. 233 Arguments : func - Entry permission callback (an MPDLEntryFilterCallback type). 234 Specifying NULL will cause entries to always be allowed. 235 Returns : None. 236 *---------------------------------------------------------------------------*/ 237 void MPDLSetEntryFilterCallback(MPDLEntryFilterCallback func); 238 239 240 /* internal functions -------------------------------------------------------*/ 241 242 /*---------------------------------------------------------------------------* 243 Name : MPDLEnableFlag 244 Description : Controls the communication beacon flag. 245 Arguments : entry - Controls entry flag (normally, always true) 246 mb - Controls MB flag (normally, always true) 247 Returns : None. 248 *---------------------------------------------------------------------------*/ 249 void MPDLEnableFlag( BOOL entry, BOOL mb ); 250 251 252 /*===========================================================================*/ 253 #ifdef __cplusplus 254 } 255 #endif 256 #endif /* REVOLUTION_MP_H__ */ 257 258 /*---------------------------------------------------------------------------* 259 End of file 260 *---------------------------------------------------------------------------*/ 261