1 /*---------------------------------------------------------------------------* 2 Project: TwlSDK - MB - include 3 File: mb_gameinfo.h 4 5 Copyright 2007-2008 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:: 2008-09-18#$ 14 $Rev: 8573 $ 15 $Author: okubata_ryoma $ 16 *---------------------------------------------------------------------------*/ 17 18 #ifndef NITRO_MB_MB_GAMEINFO_H_ 19 #define NITRO_MB_MB_GAMEINFO_H_ 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 #include <nitro/types.h> 26 #include <nitro/mb/mb.h> 27 28 #define MB_USER_VOLAT_DATA_SIZE 8 29 30 31 typedef void (*MBSendVolatCallbackFunc) (u32 ggid); 32 33 /* 34 * Unchangeable parent game information 35 * (This is re-received when seqNo changes. (However, this normally stays fixed.)) 36 */ 37 typedef struct MBGameInfoFixed 38 { 39 MBIconInfo icon; // 544B Icon data 40 MBUserInfo parent; // 22B Parent user information 41 u8 maxPlayerNum; // 1B Maximum number of players 42 u8 pad[1]; 43 u16 gameName[MB_GAME_NAME_LENGTH]; // 96B Game title 44 u16 gameIntroduction[MB_GAME_INTRO_LENGTH]; // 192B Description of game content 45 } 46 MBGameInfoFixed, MbGameInfoFixed; 47 48 49 /* 50 * Volatile parent game information 51 *(This is re-received when seqNo changes) 52 */ 53 typedef struct MBGameInfoVolatile 54 { 55 u8 nowPlayerNum; // 1B: Current number of players 56 u8 pad[1]; 57 u16 nowPlayerFlag; // 2B: Indicates, in bits, the player numbers of all current players. 58 u16 changePlayerFlag; // 2B: Indicates, with a flag, the player information number that was changed in latest change. 59 MBUserInfo member[MB_MEMBER_MAX_NUM]; // 330B: Member information 60 u8 userVolatData[MB_USER_VOLAT_DATA_SIZE]; // 8B: Data the user can set 61 } 62 MBGameInfoVolatile, MbGameInfoVolatile; 63 64 65 /* Beacon attributes */ 66 typedef enum MbBeaconDataAttr 67 { 68 MB_BEACON_DATA_ATTR_FIXED_NORMAL = 0, /* Fixed data for when there is icon data */ 69 MB_BEACON_DATA_ATTR_FIXED_NO_ICON, /* Fixed data for when there is no icon data */ 70 MB_BEACON_DATA_ATTR_VOLAT /* Member information and other volatile data */ 71 } 72 MBBeaconDataAttr, MbBeaconDataAttr; 73 74 /* When dataAttr = FIXED_NORMAL, sends MbGameInfoFixed data from the beginning in chunked MB_BEACON_DATA_SIZE units. 75 When dataAttr = FIXED_NO_ICON, sends data from MBUserInfo starting at the beginning in MB_BEACON_DATA_SIZE units (icon data skipped). 76 When dataAttr = VOLATILED, sends as "Current number of senders x user information" 77 */ 78 79 /* 80 * Parent game information beacon 81 */ 82 typedef struct MBGameInfo 83 { 84 MBGameInfoFixed fixed; // Fixed data 85 MBGameInfoVolatile volat; // Volatile data 86 u16 broadcastedPlayerFlag; // Indicates in bits player information that has been broadcast in volatile data. 87 u8 dataAttr; // Data attributes 88 u8 seqNoFixed; // Fixed region's sequence number 89 u8 seqNoVolat; // Volatile region's sequence number 90 u8 fileNo; // File number 91 u8 pad[2]; 92 u32 ggid; // GGID 93 struct MBGameInfo *nextp; // Pointer to next GameInfo (unidirectional list) 94 } 95 MBGameInfo, MbGameInfo; 96 97 98 enum 99 { 100 MB_SEND_VOLAT_CALLBACK_TIMMING_BEFORE, 101 MB_SEND_VOLAT_CALLBACK_TIMMING_AFTER 102 }; 103 104 void MB_SetSendVolatCallback(MBSendVolatCallbackFunc callback, u32 timming); 105 void MB_SetUserVolatData(u32 ggid, const u8 *userData, u32 size); 106 void *MB_GetUserVolatData(const WMGameInfo *gameInfo); 107 108 109 110 #ifdef __cplusplus 111 } 112 #endif 113 114 115 #endif // NITRO_MB_MB_GAMEINFO_H_ 116