1 /* Library header file */ 2 #ifndef HBM_BASE_H_ 3 #define HBM_BASE_H_ 4 5 #ifdef __cplusplus 6 extern "C" 7 { 8 #endif /*__cplusplus */ 9 10 #ifndef HBM_SND_THREAD_STACK_SIZE 11 #define HBM_SND_THREAD_STACK_SIZE 1024*16 12 #endif 13 #define HBM_MEM_SIZE (1024 * 512) 14 #define HBM_SND_GROUP_HOMEBUTTON 0 15 16 //#define USE_FOR_MANUAL 17 18 typedef enum 19 { 20 HBM_SELECT_NULL = -1, 21 HBM_SELECT_HOMEBTN = 0, 22 HBM_SELECT_BTN1, 23 HBM_SELECT_BTN2, 24 HBM_SELECT_BTN3, 25 HBM_SELECT_BTN4, 26 HBM_SELECT_MAX 27 }HBMSelectBtnNum; 28 29 enum 30 { 31 HBMSE_HOME_BUTTON = 0, 32 HBMSE_RETURN_APP, 33 HBMSE_GOTO_MENU, 34 HBMSE_RESET_APP, 35 HBMSE_FOCUS, 36 HBMSE_SELECT, 37 HBMSE_CANCEL, 38 HBMSE_OPEN_CONTROLLER, 39 HBMSE_CLOSE_CONTROLLER, 40 HBMSE_VOLUME_PLUS, 41 HBMSE_VOLUME_MINUS,//10 42 HBMSE_VOLUME_PLUS_LIMIT, 43 HBMSE_VOLUME_MINUS_LIMIT, 44 HBMSE_NOTHING_DONE, 45 HBMSE_VIBE_ON, 46 HBMSE_VIBE_OFF, 47 HBMSE_START_CONNECT_WINDOW, 48 HBMSE_CONNECTED, 49 HBMSE_CONNECTED2, 50 HBMSE_CONNECTED3,//20 51 HBMSE_CONNECTED4, 52 HBMSE_END_CONNECT_WINDOW 53 #ifdef USE_FOR_MANUAL 54 , 55 HBMSE_MANUAL_OPEN, // for manual 56 HBMSE_MANUAL_FOCUS, 57 HBMSE_MANUAL_SELECT, 58 HBMSE_MANUAL_SCROLL, 59 HBMSE_MANUAL_CANCEL, 60 HBMSE_MANUAL_RETURN 61 #endif 62 }; 63 64 // Value of the evt argument of HBMSoundCallback 65 enum 66 { 67 HBMSEV_BEFORE_INIT_SOUND, /* Enter menu and just before initializing sound */ 68 HBMSEV_INIT_SOUND, /* Enter menu and just before playing sound effect */ 69 HBMSEV_BEGIN_EXIT_ANIM, /* Start animation when exiting from menu */ 70 HBMSEV_BEGIN_BLACKOUT, /* Start menu blackout */ 71 HBMSEV_END_MENU, /* Menu close */ 72 HBMSEV_PLAY_SOUND /* Play sound effect */ 73 #ifdef USE_FOR_MANUAL 74 ,HBMSEV_BEGIN_BLACKOUT_TO_MANUAL /* Start menu blackout (when at manual) */ 75 #endif 76 }; 77 78 // Return value of HBMSoundCallback 79 enum 80 { 81 HBMSEV_RET_NONE = 0, /* No sound is played back from the application either outside of HBMSEV_PLAY_SOUND or during HBMSEV_PLAY_SOUND. */ 82 HBMSEV_RET_PLAY_SOUND /* Sound was played back from the application during HBMSEV_PLAY_SOUND. */ 83 }; 84 85 // messageFlag flag 86 enum 87 { 88 HBMMSG_NOSAVE_WIIMENU = 1, 89 HBMMSG_NOSAVE_RESET = 2, 90 HBMMSG_NOSAVE_ALL = -1 91 }; 92 93 /* Wii Controller information */ 94 typedef struct 95 { 96 KPADStatus* kpad; 97 Vec2 pos; 98 u32 use_devtype; 99 }HBMKPadData; 100 101 /* Controller data structure passed to Home Button object */ 102 typedef struct 103 { 104 HBMKPadData wiiCon[WPAD_MAX_CONTROLLERS]; 105 }HBMControllerData; 106 107 /* Sound callback function type declaration */ 108 typedef int (*HBMSoundCallback)(int evt, int num); 109 110 typedef struct 111 { 112 void* layoutBuf; 113 void* spkSeBuf; 114 void* msgBuf; 115 void* configBuf; 116 void* mem; 117 HBMSoundCallback sound_callback; 118 int backFlag; 119 int region; 120 int cursor; 121 int messageFlag; 122 u32 configBufSize; 123 u32 memSize; 124 f32 frameDelta; 125 Vec2 adjust; 126 MEMAllocator* pAllocator; 127 }HBMDataInfo; 128 129 void HBMCreate( const HBMDataInfo* pHBInfo ); 130 void HBMDelete(); 131 void HBMInit( void ); 132 HBMSelectBtnNum HBMCalc( const HBMControllerData* pController ); 133 void HBMDraw( void ); 134 HBMSelectBtnNum HBMGetSelectBtnNum( void ); 135 void HBMSetAdjustFlag( int flag ); 136 void HBMStartBlackOut( void ); 137 int HBMIsReassignedControllers( void ); 138 139 void HBMSetBlackOutColor( u8 red, u8 green, u8 blue ); 140 GXColor HBMGetBlackOutColor( void ); 141 void HBMSetVIBlack ( int flag ); 142 143 #define HBM_WORK_SIZE_SOUND 0x14700 144 #define HBM_MEM_SIZE_SOUND (HBM_WORK_SIZE_SOUND + HBM_SND_THREAD_STACK_SIZE) 145 146 /* Compatibility */ 147 #define HBM_MEM_SIZE_DVD HBM_MEM_SIZE_SOUND 148 #define HBM_MEM_SIZE_MEMORY HBM_MEM_SIZE_SOUND 149 #define HBM_MEM_SIZE_NAND HBM_MEM_SIZE_SOUND 150 #define HBM_MEM2_SIZE_DVD HBM_MEM_SIZE_DVD 151 #define HBM_MEM2_SIZE_MEMORY HBM_MEM_SIZE_MEMORY 152 #define HBM_MEM2_SIZE_NAND HBM_MEM_SIZE_NAND 153 154 void HBMCreateSound( const void* soundData, void* memBuf, u32 memSize ); 155 void HBMDeleteSound(); 156 157 void HBMUpdateSound(); /* Call every frame */ 158 159 #ifdef USE_FOR_MANUAL 160 void HBMPlayManualSound( int id ); 161 void HBMUpdateManualSound( void ); 162 void HBMFadeoutManualSound( f32 gain ); 163 void HBMResetManualSound( void ); 164 #endif 165 166 #ifdef __cplusplus 167 } 168 #endif /*__cplusplus */ 169 170 #endif /* HBM_BASE_H */ 171