2012-01-21 21:57:41 +01:00
# include "menu.hpp"
2012-01-27 20:38:52 +01:00
# include "nand.hpp"
2012-01-21 21:57:41 +01:00
# include "loader/wdvd.h"
# include "network/gcard.h"
# include "DeviceHandler.hpp"
# include <unistd.h>
# include <fstream>
# include <sys/stat.h>
# include "wbfs.h"
# include "gecko.h"
# include "sys.h"
# include "disc.h"
2012-01-27 20:38:52 +01:00
# include "loader/cios.hpp"
# include "loader/alt_ios.h"
2012-02-01 18:52:01 +01:00
# include "GameTDB.hpp"
2012-01-21 21:57:41 +01:00
extern const u8 btnconfig_png [ ] ;
extern const u8 btnconfigs_png [ ] ;
extern const u8 btninfo_png [ ] ;
extern const u8 btninfos_png [ ] ;
extern const u8 btnquit_png [ ] ;
extern const u8 btnquits_png [ ] ;
extern const u8 btnnext_png [ ] ;
extern const u8 btnnexts_png [ ] ;
extern const u8 btnprev_png [ ] ;
extern const u8 btnprevs_png [ ] ;
extern const u8 btnchannel_png [ ] ;
extern const u8 btnchannels_png [ ] ;
extern const u8 btnusb_png [ ] ;
extern const u8 btnusbs_png [ ] ;
2012-01-21 22:15:45 +01:00
extern const u8 btndml_png [ ] ;
extern const u8 btndmls_png [ ] ;
2012-04-08 17:54:34 +02:00
extern const u8 btnemu_png [ ] ;
extern const u8 btnemus_png [ ] ;
2012-01-21 21:57:41 +01:00
extern const u8 btndvd_png [ ] ;
extern const u8 btndvds_png [ ] ;
extern const u8 favoriteson_png [ ] ;
extern const u8 favoritesons_png [ ] ;
extern const u8 favoritesoff_png [ ] ;
extern const u8 favoritesoffs_png [ ] ;
extern const u8 btnhomebrew_png [ ] ;
2012-01-29 13:30:04 +01:00
extern const u8 btnhomebrews_png [ ] ;
2012-01-21 21:57:41 +01:00
static inline int loopNum ( int i , int s )
{
return i < 0 ? ( s - ( - i % s ) ) % s : i % s ;
}
void CMenu : : _hideMain ( bool instant )
{
m_btnMgr . hide ( m_mainBtnNext , instant ) ;
m_btnMgr . hide ( m_mainBtnPrev , instant ) ;
m_btnMgr . hide ( m_mainBtnConfig , instant ) ;
m_btnMgr . hide ( m_mainBtnInfo , instant ) ;
m_btnMgr . hide ( m_mainBtnQuit , instant ) ;
m_btnMgr . hide ( m_mainBtnHomebrew , instant ) ;
m_btnMgr . hide ( m_mainBtnChannel , instant ) ;
m_btnMgr . hide ( m_mainBtnUsb , instant ) ;
2012-01-21 22:15:45 +01:00
m_btnMgr . hide ( m_mainBtnDML , instant ) ;
2012-04-08 17:54:34 +02:00
m_btnMgr . hide ( m_mainBtnEmu , instant ) ;
2012-01-21 21:57:41 +01:00
m_btnMgr . hide ( m_mainBtnDVD , instant ) ;
m_btnMgr . hide ( m_mainBtnInit , instant ) ;
m_btnMgr . hide ( m_mainBtnInit2 , instant ) ;
m_btnMgr . hide ( m_mainLblInit , instant ) ;
m_btnMgr . hide ( m_mainBtnFavoritesOn , instant ) ;
m_btnMgr . hide ( m_mainBtnFavoritesOff , instant ) ;
m_btnMgr . hide ( m_mainLblLetter , instant ) ;
m_btnMgr . hide ( m_mainLblNotice , instant ) ;
2012-07-05 15:15:23 +02:00
for ( u8 i = 0 ; i < ARRAY_SIZE ( m_mainLblUser ) ; + + i )
if ( m_mainLblUser [ i ] ! = ( u16 ) - 1 )
2012-01-21 21:57:41 +01:00
m_btnMgr . hide ( m_mainLblUser [ i ] , instant ) ;
}
static bool show_homebrew = true ;
2012-01-25 02:11:02 +01:00
static bool parental_homebrew = false ;
2012-02-01 23:26:51 +01:00
static bool show_channel = true ;
2012-04-08 17:54:34 +02:00
static bool show_emu = true ;
2012-01-21 21:57:41 +01:00
void CMenu : : _showMain ( void )
{
_hideWaitMessage ( ) ;
# ifdef SHOWMEM
m_btnMgr . show ( m_mem2FreeSize ) ;
# endif
m_vid . set2DViewport ( m_cfg . getInt ( " GENERAL " , " tv_width " , 640 ) , m_cfg . getInt ( " GENERAL " , " tv_height " , 480 ) ,
2012-02-01 23:26:51 +01:00
m_cfg . getInt ( " GENERAL " , " tv_x " , 0 ) , m_cfg . getInt ( " GENERAL " , " tv_y " , 0 ) ) ;
2012-01-21 21:57:41 +01:00
_setBg ( m_gameBg , m_gameBgLQ ) ;
m_btnMgr . show ( m_mainBtnInfo ) ;
m_btnMgr . show ( m_mainBtnConfig ) ;
m_btnMgr . show ( m_mainBtnQuit ) ;
switch ( m_current_view )
{
2012-02-13 18:09:26 +01:00
case COVERFLOW_DML :
if ( show_channel )
m_btnMgr . show ( m_mainBtnChannel ) ;
2012-04-08 17:54:34 +02:00
else if ( show_emu )
m_btnMgr . show ( m_mainBtnEmu ) ;
2012-02-13 18:09:26 +01:00
else if ( show_homebrew )
m_btnMgr . show ( m_mainBtnHomebrew ) ;
2012-04-08 17:54:34 +02:00
else
2012-01-28 09:40:19 +01:00
m_btnMgr . show ( m_mainBtnUsb ) ;
2012-01-21 21:57:41 +01:00
break ;
case COVERFLOW_CHANNEL :
2012-04-08 17:54:34 +02:00
if ( show_emu )
m_btnMgr . show ( m_mainBtnEmu ) ;
else if ( show_homebrew & & ( parental_homebrew | | ! m_locked ) )
2012-01-21 21:57:41 +01:00
m_btnMgr . show ( m_mainBtnHomebrew ) ;
2012-02-13 18:09:26 +01:00
else
2012-01-28 09:40:19 +01:00
m_btnMgr . show ( m_mainBtnUsb ) ;
2012-01-21 22:15:45 +01:00
break ;
2012-02-13 18:09:26 +01:00
case COVERFLOW_HOMEBREW :
2012-01-21 22:15:45 +01:00
m_btnMgr . show ( m_mainBtnUsb ) ;
2012-01-21 21:57:41 +01:00
break ;
2012-04-08 17:54:34 +02:00
case COVERFLOW_EMU :
if ( show_homebrew & & ( parental_homebrew | | ! m_locked ) )
m_btnMgr . show ( m_mainBtnHomebrew ) ;
else
m_btnMgr . show ( m_mainBtnUsb ) ;
break ;
2012-01-21 21:57:41 +01:00
default :
2012-02-13 18:09:26 +01:00
if ( m_show_dml )
m_btnMgr . show ( m_mainBtnDML ) ;
else if ( show_channel )
2012-02-01 21:44:40 +01:00
m_btnMgr . show ( m_mainBtnChannel ) ;
2012-04-08 17:54:34 +02:00
else if ( show_emu )
m_btnMgr . show ( m_mainBtnEmu ) ;
else if ( show_homebrew & & ( parental_homebrew | | ! m_locked ) )
2012-02-01 21:44:40 +01:00
m_btnMgr . show ( m_mainBtnHomebrew ) ;
else
m_btnMgr . show ( m_mainBtnUsb ) ;
2012-01-21 21:57:41 +01:00
break ;
}
2012-07-05 15:15:23 +02:00
for ( u8 i = 0 ; i < ARRAY_SIZE ( m_mainLblUser ) ; + + i )
if ( m_mainLblUser [ i ] ! = ( u16 ) - 1 )
2012-01-21 21:57:41 +01:00
m_btnMgr . show ( m_mainLblUser [ i ] ) ;
2012-06-21 16:53:20 +02:00
if ( m_gameList . empty ( ) )
2012-01-21 21:57:41 +01:00
{
2012-05-03 01:08:11 +02:00
switch ( m_current_view )
{
case COVERFLOW_USB :
case COVERFLOW_DML :
m_btnMgr . setText ( m_mainLblInit , _t ( " main2 " , L " Welcome to WiiFlow. I have not found any games. Click Install to install games, or Select partition to select your partition type. " ) , true ) ;
m_btnMgr . show ( m_mainBtnInit ) ;
m_btnMgr . show ( m_mainBtnInit2 ) ;
m_btnMgr . show ( m_mainLblInit ) ;
2012-06-21 16:53:20 +02:00
break ;
2012-05-03 01:08:11 +02:00
case COVERFLOW_CHANNEL :
if ( ! m_cfg . getBool ( " NAND " , " disable " , true ) )
{
Nand : : Instance ( ) - > Disable_Emu ( ) ;
_hideMain ( ) ;
if ( ! _AutoCreateNand ( ) )
m_cfg . setBool ( " NAND " , " disable " , true ) ;
_loadList ( ) ;
_showMain ( ) ;
_initCF ( ) ;
}
2012-06-21 16:53:20 +02:00
break ;
2012-05-03 01:08:11 +02:00
case COVERFLOW_HOMEBREW :
m_btnMgr . setText ( m_mainLblInit , _t ( " main4 " , L " Welcome to WiiFlow. I have not found any homebrew apps. Select partition to select your partition type. " ) , true ) ;
m_btnMgr . show ( m_mainBtnInit2 ) ;
m_btnMgr . show ( m_mainLblInit ) ;
2012-06-21 16:53:20 +02:00
break ;
2012-05-03 01:08:11 +02:00
case COVERFLOW_EMU :
2012-05-25 16:54:59 +02:00
m_btnMgr . setText ( m_mainLblInit , _t ( " main5 " , L " Welcome to WiiFlow. I have not found any plugins. Select partition to select your partition type. " ) , true ) ;
2012-05-03 01:08:11 +02:00
m_btnMgr . show ( m_mainBtnInit2 ) ;
m_btnMgr . show ( m_mainLblInit ) ;
2012-06-21 16:53:20 +02:00
break ;
2012-05-26 00:05:38 +02:00
}
2012-01-21 21:57:41 +01:00
}
2012-06-21 16:53:20 +02:00
else if ( m_current_view = = COVERFLOW_CHANNEL & & ! m_cfg . getBool ( " NAND " , " disable " , true ) )
Nand : : Instance ( ) - > Enable_Emu ( ) ;
2012-01-21 21:57:41 +01:00
}
int CMenu : : GetCoverStatusAsync ( CMenu * m )
{
u32 disc_check = 0 ;
WDVD_GetCoverStatus ( & disc_check ) ;
m - > m_initialCoverStatusComplete = true ;
return 0 ;
}
void CMenu : : LoadView ( void )
{
_showWaitMessage ( ) ;
_hideMain ( ) ;
m_curGameId = m_cf . getId ( ) ;
_loadList ( ) ;
_showMain ( ) ;
_initCF ( ) ;
_loadCFLayout ( m_cfg . getInt ( _domainFromView ( ) , " last_cf_mode " , 1 ) ) ;
m_cf . applySettings ( ) ;
2012-02-01 23:26:51 +01:00
char * mode = ( m_current_view = = COVERFLOW_CHANNEL & & m_cfg . getBool ( " NAND " , " disable " , true ) )
2012-02-27 17:05:10 +01:00
? ( char * ) " NAND " : ( char * ) DeviceName [ currentPartition ] ;
2012-01-21 21:57:41 +01:00
for ( u8 i = 0 ; strncmp ( ( const char * ) & mode [ i ] , " \0 " , 1 ) ! = 0 ; i + + )
mode [ i ] = toupper ( mode [ i ] ) ;
m_showtimer = 60 ;
2012-02-27 17:05:10 +01:00
char gui_name [ 20 ] ;
2012-05-04 14:30:43 +02:00
snprintf ( gui_name , sizeof ( gui_name ) , " %s [%s] " , _domainFromView ( ) , mode ) ;
2012-02-27 17:05:10 +01:00
m_btnMgr . setText ( m_mainLblNotice , ( string ) gui_name ) ;
2012-01-21 21:57:41 +01:00
m_btnMgr . show ( m_mainLblNotice ) ;
}
2012-07-05 21:57:28 +02:00
void CMenu : : exitHandler ( int ExitTo )
2012-06-21 14:25:47 +02:00
{
gprintf ( " Exit WiiFlow called \n " ) ;
2012-07-10 17:41:34 +02:00
if ( ! m_disable_exit )
2012-06-21 14:25:47 +02:00
{
2012-07-07 15:42:21 +02:00
m_exit = true ;
2012-07-05 21:57:28 +02:00
if ( ExitTo = = 1 ) // HBC
2012-06-21 14:25:47 +02:00
Sys_ExitTo ( EXIT_TO_HBC ) ;
2012-07-05 21:57:28 +02:00
else if ( ExitTo = = 2 ) // System Menu
2012-06-21 14:25:47 +02:00
Sys_ExitTo ( EXIT_TO_MENU ) ;
2012-07-05 21:57:28 +02:00
else if ( ExitTo = = 3 ) // Priiloader
2012-06-21 14:25:47 +02:00
Sys_ExitTo ( EXIT_TO_PRIILOADER ) ;
2012-07-05 21:57:28 +02:00
else if ( ExitTo = = 4 ) //Bootmii, check that the files are there, or ios will hang.
2012-06-21 14:25:47 +02:00
{
struct stat dummy ;
if ( DeviceHandler : : Instance ( ) - > IsInserted ( SD ) & &
stat ( fmt ( " %s:/bootmii/armboot.bin " , DeviceName [ SD ] ) , & dummy ) = = 0 & &
stat ( fmt ( " %s:/bootmii/ppcboot.elf " , DeviceName [ SD ] ) , & dummy ) = = 0 )
{
Sys_ExitTo ( EXIT_TO_BOOTMII ) ;
}
else
Sys_ExitTo ( EXIT_TO_HBC ) ;
}
}
2012-07-05 21:57:28 +02:00
2012-06-21 14:25:47 +02:00
m_reload = ( BTN_B_HELD | | m_disable_exit ) ;
2012-07-07 15:42:21 +02:00
if ( m_exit & & ! m_reload ) //D'oh!
2012-06-21 14:25:47 +02:00
{
// Mark exiting to prevent soundhandler from restarting
extern bool exiting ;
exiting = true ;
}
}
2012-01-21 21:57:41 +01:00
int CMenu : : main ( void )
{
wstringEx curLetter ;
string prevTheme = m_cfg . getString ( " GENERAL " , " theme " , " default " ) ;
bool use_grab = m_cfg . getBool ( " GENERAL " , " use_grab " , false ) ;
show_homebrew = ! m_cfg . getBool ( " HOMEBREW " , " disable " , false ) ;
2012-02-01 23:26:51 +01:00
show_channel = ! m_cfg . getBool ( " GENERAL " , " hidechannel " , false ) ;
2012-04-08 17:54:34 +02:00
show_emu = ! m_cfg . getBool ( " EMULATOR " , " disable " , false ) ;
2012-02-15 18:57:34 +01:00
bool dpad_mode = m_cfg . getBool ( " GENERAL " , " dpad_mode " , false ) ;
2012-03-19 14:14:49 +01:00
bool b_lr_mode = m_cfg . getBool ( " GENERAL " , " b_lr_mode " , false ) ;
2012-01-28 21:09:34 +01:00
parental_homebrew = m_cfg . getBool ( " HOMEBREW " , " parental " , false ) ;
2012-01-21 21:57:41 +01:00
2012-04-08 17:54:34 +02:00
if ( m_Emulator_boot )
m_current_view = COVERFLOW_EMU ;
2012-01-21 21:57:41 +01:00
m_reload = false ;
static u32 disc_check = 0 ;
int done = 0 ;
if ( m_cfg . getBool ( " GENERAL " , " async_network " , false ) | | has_enabled_providers ( ) )
_initAsyncNetwork ( ) ;
2012-05-25 21:48:35 +02:00
SetupInput ( true ) ;
2012-07-05 16:27:05 +02:00
m_music - > Play ( ) ;
2012-02-01 23:26:51 +01:00
GameTDB m_gametdb ;
2012-05-04 14:30:43 +02:00
m_gametdb . OpenFile ( fmt ( " %s/wiitdb.xml " , m_settingsDir . c_str ( ) ) ) ;
2012-02-01 23:26:51 +01:00
m_GameTDBLoaded = false ;
2012-06-21 14:25:47 +02:00
if ( m_gametdb . IsLoaded ( ) )
2012-02-01 23:26:51 +01:00
{
m_GameTDBLoaded = true ;
m_gametdb . CloseFile ( ) ;
}
2012-05-11 16:17:39 +02:00
if ( m_cfg . getBool ( " GENERAL " , " startup_menu " , false ) )
{
m_vid . hideWaitMessage ( ) ;
2012-05-25 16:21:43 +02:00
_Source ( ) ;
2012-05-11 16:17:39 +02:00
}
2012-01-29 05:25:45 +01:00
if ( m_cfg . getBool ( " GENERAL " , " update_cache " , false ) )
2012-01-30 00:11:43 +01:00
{
2012-01-29 05:25:45 +01:00
UpdateCache ( ) ;
2012-01-30 00:11:43 +01:00
m_gameList . Update ( ) ;
}
2012-01-21 21:57:41 +01:00
_loadList ( ) ;
2012-04-09 00:05:37 +02:00
if ( m_Emulator_boot )
{
_loadCFLayout ( m_cfg . getInt ( _domainFromView ( ) , " last_cf_mode " , 1 ) ) ;
m_cf . applySettings ( ) ;
}
2012-01-21 21:57:41 +01:00
_showMain ( ) ;
2012-05-19 14:29:24 +02:00
m_vid . CheckWaitThread ( true ) ;
2012-01-21 21:57:41 +01:00
m_curGameId . clear ( ) ;
_initCF ( ) ;
lwp_t coverStatus = LWP_THREAD_NULL ;
unsigned int stack_size = ( unsigned int ) 32768 ;
SmartBuf coverstatus_stack = smartMem2Alloc ( stack_size ) ;
LWP_CreateThread ( & coverStatus , ( void * ( * ) ( void * ) ) CMenu : : GetCoverStatusAsync , ( void * ) this , coverstatus_stack . get ( ) , stack_size , 40 ) ;
2012-06-21 14:25:47 +02:00
time_t SourceMenuTimeout = 0 ;
while ( true )
2012-01-21 21:57:41 +01:00
{
_mainLoopCommon ( true ) ;
2012-06-21 14:25:47 +02:00
if ( m_initialCoverStatusComplete )
2012-01-21 21:57:41 +01:00
{
LWP_JoinThread ( coverStatus , NULL ) ;
coverStatus = LWP_THREAD_NULL ;
2012-05-13 17:13:33 +02:00
if ( coverstatus_stack . get ( ) )
coverstatus_stack . release ( ) ;
2012-01-21 21:57:41 +01:00
WDVD_GetCoverStatus ( & disc_check ) ;
}
2012-06-21 14:25:47 +02:00
if ( dpad_mode & & ( BTN_UP_PRESSED | | BTN_DOWN_PRESSED | | BTN_LEFT_PRESSED | | BTN_RIGHT_PRESSED ) & & ( m_btnMgr . selected ( m_mainBtnChannel ) | | m_btnMgr . selected ( m_mainBtnUsb ) | | m_btnMgr . selected ( m_mainBtnDML ) | | m_btnMgr . selected ( m_mainBtnHomebrew ) | | m_btnMgr . selected ( m_mainBtnEmu ) ) )
{
u32 lastView = m_current_view ;
if ( BTN_UP_PRESSED )
m_current_view = COVERFLOW_USB ;
else if ( BTN_DOWN_PRESSED & & m_show_dml )
m_current_view = COVERFLOW_DML ;
else if ( BTN_LEFT_PRESSED & & show_emu )
m_current_view = COVERFLOW_EMU ;
else if ( BTN_RIGHT_PRESSED & & show_channel )
m_current_view = COVERFLOW_CHANNEL ;
if ( lastView = = m_current_view )
m_current_view = COVERFLOW_HOMEBREW ;
LoadView ( ) ;
continue ;
}
if ( BTN_HOME_PRESSED )
{
2012-06-21 19:28:46 +02:00
_hideMain ( ) ;
if ( _Home ( ) ) //exit wiiflow
break ;
_showMain ( ) ;
2012-06-21 14:25:47 +02:00
}
else if ( BTN_A_PRESSED )
2012-01-21 21:57:41 +01:00
{
2012-06-21 14:25:47 +02:00
if ( m_btnMgr . selected ( m_mainBtnPrev ) )
m_cf . pageUp ( ) ;
else if ( m_btnMgr . selected ( m_mainBtnNext ) )
m_cf . pageDown ( ) ;
else if ( m_btnMgr . selected ( m_mainBtnQuit ) )
{
2012-06-21 19:28:46 +02:00
_hideMain ( ) ;
if ( _Home ( ) ) //exit wiiflow
break ;
_showMain ( ) ;
2012-06-21 14:25:47 +02:00
}
else if ( m_btnMgr . selected ( m_mainBtnChannel ) | | m_btnMgr . selected ( m_mainBtnUsb ) | | m_btnMgr . selected ( m_mainBtnDML ) | | m_btnMgr . selected ( m_mainBtnHomebrew ) | | m_btnMgr . selected ( m_mainBtnEmu ) )
{
if ( m_current_view = = COVERFLOW_USB )
m_current_view = m_show_dml ? COVERFLOW_DML : ( show_channel ? COVERFLOW_CHANNEL : ( show_emu ? COVERFLOW_EMU : ( ( show_homebrew & & ( parental_homebrew | | ! m_locked ) ) ? COVERFLOW_HOMEBREW : COVERFLOW_USB ) ) ) ;
else if ( m_current_view = = COVERFLOW_DML )
m_current_view = show_channel ? COVERFLOW_CHANNEL : ( ( show_emu ? COVERFLOW_EMU : ( show_homebrew & & ( parental_homebrew | | ! m_locked ) ) ? COVERFLOW_HOMEBREW : COVERFLOW_USB ) ) ;
else if ( m_current_view = = COVERFLOW_CHANNEL )
m_current_view = ( show_emu ? COVERFLOW_EMU : ( show_homebrew & & ( parental_homebrew | | ! m_locked ) ) ? COVERFLOW_HOMEBREW : COVERFLOW_USB ) ;
else if ( m_current_view = = COVERFLOW_EMU )
m_current_view = ( show_homebrew & & ( parental_homebrew | | ! m_locked ) ) ? COVERFLOW_HOMEBREW : COVERFLOW_USB ;
else if ( m_current_view = = COVERFLOW_HOMEBREW )
m_current_view = COVERFLOW_USB ;
LoadView ( ) ;
}
else if ( m_btnMgr . selected ( m_mainBtnInit ) )
2012-01-21 21:57:41 +01:00
{
2012-06-21 14:25:47 +02:00
if ( ! m_locked )
2012-01-21 21:57:41 +01:00
{
2012-06-21 14:25:47 +02:00
_hideMain ( ) ;
_wbfsOp ( CMenu : : WO_ADD_GAME ) ;
if ( prevTheme ! = m_cfg . getString ( " GENERAL " , " theme " ) )
{
m_reload = true ;
break ;
}
_showMain ( ) ;
2012-01-21 21:57:41 +01:00
}
}
2012-06-21 14:25:47 +02:00
else if ( m_btnMgr . selected ( m_mainBtnInit2 ) )
2012-01-21 21:57:41 +01:00
{
2012-06-21 14:25:47 +02:00
_hideMain ( ) ;
_config ( 1 ) ;
if ( prevTheme ! = m_cfg . getString ( " GENERAL " , " theme " ) )
{
m_reload = true ;
break ;
}
_showMain ( ) ;
}
else if ( m_btnMgr . selected ( m_mainBtnConfig ) )
{
_hideMain ( ) ;
_config ( 1 ) ;
if ( prevTheme ! = m_cfg . getString ( " GENERAL " , " theme " ) | | m_reload = = true )
{
m_reload = true ;
break ;
}
_showMain ( ) ;
}
else if ( m_btnMgr . selected ( m_mainBtnInfo ) )
{
_hideMain ( ) ;
_about ( ) ;
if ( m_exit )
break ;
_showMain ( ) ;
}
else if ( m_btnMgr . selected ( m_mainBtnDVD ) )
{
_showWaitMessage ( ) ;
_hideMain ( true ) ;
dir_discHdr hdr ;
memset ( & hdr , 0 , sizeof ( dir_discHdr ) ) ;
memcpy ( & hdr . id , " dvddvd " , 6 ) ;
_launchGame ( & hdr , true ) ;
_showMain ( ) ;
}
else if ( m_btnMgr . selected ( m_mainBtnFavoritesOn ) | | m_btnMgr . selected ( m_mainBtnFavoritesOff ) )
{
m_favorites = ! m_favorites ;
m_cfg . setInt ( " GENERAL " , " favorites " , m_favorites ) ;
m_curGameId = m_cf . getId ( ) ;
_initCF ( ) ;
}
else if ( ! m_cf . empty ( ) & & m_cf . select ( ) )
{
_hideMain ( ) ;
_game ( BTN_B_HELD ) ;
if ( m_exit )
break ;
m_cf . cancel ( ) ;
_showMain ( ) ;
2012-01-21 21:57:41 +01:00
}
}
2012-06-21 14:25:47 +02:00
else if ( BTN_B_PRESSED )
2012-02-15 18:57:34 +01:00
{
2012-06-21 14:25:47 +02:00
//Events to Show Categories
if ( m_btnMgr . selected ( m_mainBtnFavoritesOn ) | | m_btnMgr . selected ( m_mainBtnFavoritesOff ) )
2012-05-22 16:15:34 +02:00
{
2012-06-21 14:25:47 +02:00
// Event handler to show categories for selection
_hideMain ( ) ;
_CategorySettings ( ) ;
_showMain ( ) ;
_initCF ( ) ;
}
//Events to Switch off/on nand emu
else if ( m_btnMgr . selected ( m_mainBtnChannel ) | | m_btnMgr . selected ( m_mainBtnUsb ) | | m_btnMgr . selected ( m_mainBtnDML ) | | m_btnMgr . selected ( m_mainBtnEmu ) | | m_btnMgr . selected ( m_mainBtnHomebrew ) )
{
2012-06-21 17:22:17 +02:00
if ( m_cfg . getBool ( " GENERAL " , " b_on_mode_to_source " , false ) )
{
_hideMain ( ) ;
if ( ! _Source ( ) ) //Different source selected
LoadView ( ) ;
else
_showMain ( ) ;
continue ;
}
else
{
m_cfg . setBool ( " NAND " , " disable " , ! m_cfg . getBool ( " NAND " , " disable " , true ) ) ;
gprintf ( " EmuNand is %s \n " , m_cfg . getBool ( " NAND " , " disable " , true ) ? " Disabled " : " Enabled " ) ;
m_current_view = COVERFLOW_CHANNEL ;
LoadView ( ) ;
}
2012-06-21 14:25:47 +02:00
}
else if ( m_btnMgr . selected ( m_mainBtnNext ) | | m_btnMgr . selected ( m_mainBtnPrev ) )
{
const char * domain = _domainFromView ( ) ;
int sorting = m_cfg . getInt ( domain , " sort " , SORT_ALPHA ) ;
if ( sorting ! = SORT_ALPHA & & sorting ! = SORT_PLAYERS & & sorting ! = SORT_WIFIPLAYERS & & sorting ! = SORT_GAMEID )
{
m_cf . setSorting ( ( Sorting ) SORT_ALPHA ) ;
m_cfg . setInt ( domain , " sort " , SORT_ALPHA ) ;
}
wchar_t c [ 2 ] = { 0 , 0 } ;
m_btnMgr . selected ( m_mainBtnPrev ) ? m_cf . prevLetter ( c ) : m_cf . nextLetter ( c ) ;
m_showtimer = 60 ;
curLetter . clear ( ) ;
curLetter = wstringEx ( c ) ;
if ( sorting = = SORT_ALPHA )
{
m_btnMgr . setText ( m_mainLblLetter , curLetter ) ;
m_btnMgr . show ( m_mainLblLetter ) ;
}
else
{
curLetter = _getNoticeTranslation ( sorting , curLetter ) ;
m_btnMgr . setText ( m_mainLblNotice , curLetter ) ;
m_btnMgr . show ( m_mainLblNotice ) ;
}
}
2012-06-21 15:23:12 +02:00
else if ( enable_wmote_roll & & m_btnMgr . selected ( m_mainBtnQuit ) )
{
_hideMain ( ) ;
if ( ! _Source ( ) ) //Different source selected
LoadView ( ) ;
else
_showMain ( ) ;
continue ;
}
2012-02-15 18:57:34 +01:00
}
2012-06-21 21:06:29 +02:00
else if ( WROLL_LEFT )
m_cf . left ( ) ;
else if ( WROLL_RIGHT )
m_cf . right ( ) ;
2012-06-21 14:25:47 +02:00
if ( ! BTN_B_HELD )
2012-01-21 21:57:41 +01:00
{
2012-06-21 14:25:47 +02:00
SourceMenuTimeout = 0 ;
if ( BTN_UP_REPEAT | | RIGHT_STICK_UP )
m_cf . up ( ) ;
else if ( ( BTN_RIGHT_REPEAT | | RIGHT_STICK_RIGHT ) | | WROLL_RIGHT )
m_cf . right ( ) ;
else if ( BTN_DOWN_REPEAT | | RIGHT_STICK_DOWN )
m_cf . down ( ) ;
else if ( ( BTN_LEFT_REPEAT | | RIGHT_STICK_LEFT ) | | WROLL_LEFT )
m_cf . left ( ) ;
else if ( BTN_1_PRESSED | | BTN_2_PRESSED )
2012-01-21 21:57:41 +01:00
{
2012-06-21 14:25:47 +02:00
if ( ! m_btnMgr . selected ( m_mainBtnQuit ) )
{
const char * domain = _domainFromView ( ) ;
s8 direction = BTN_1_PRESSED ? 1 : - 1 ;
int cfVersion = 1 + loopNum ( ( m_cfg . getInt ( domain , " last_cf_mode " , 1 ) - 1 ) + direction , m_numCFVersions ) ;
_loadCFLayout ( cfVersion ) ;
m_cf . applySettings ( ) ;
m_cfg . setInt ( domain , " last_cf_mode " , cfVersion ) ;
}
}
else if ( BTN_MINUS_PRESSED )
{
if ( b_lr_mode )
2012-07-05 16:27:05 +02:00
m_music - > Previous ( ) ;
2012-06-21 14:25:47 +02:00
else
m_cf . pageUp ( ) ;
}
else if ( BTN_PLUS_PRESSED )
{
if ( b_lr_mode )
2012-07-05 16:27:05 +02:00
m_music - > Next ( ) ;
2012-06-21 14:25:47 +02:00
else
m_cf . pageDown ( ) ;
2012-01-21 21:57:41 +01:00
}
}
2012-06-21 14:25:47 +02:00
else
2012-01-21 21:57:41 +01:00
{
const char * domain = _domainFromView ( ) ;
//Search by Alphabet
2012-06-21 14:25:47 +02:00
if ( BTN_DOWN_PRESSED | | BTN_UP_PRESSED )
2012-01-21 21:57:41 +01:00
{
2012-06-21 14:25:47 +02:00
SourceMenuTimeout = 0 ;
2012-01-21 21:57:41 +01:00
int sorting = m_cfg . getInt ( domain , " sort " , SORT_ALPHA ) ;
2012-06-21 14:25:47 +02:00
if ( sorting ! = SORT_ALPHA & & sorting ! = SORT_PLAYERS & & sorting ! = SORT_WIFIPLAYERS & & sorting ! = SORT_GAMEID )
2012-01-21 21:57:41 +01:00
{
m_cf . setSorting ( ( Sorting ) SORT_ALPHA ) ;
m_cfg . setInt ( domain , " sort " , SORT_ALPHA ) ;
}
wchar_t c [ 2 ] = { 0 , 0 } ;
BTN_UP_PRESSED ? m_cf . prevLetter ( c ) : m_cf . nextLetter ( c ) ;
curLetter . clear ( ) ;
curLetter = wstringEx ( c ) ;
m_showtimer = 60 ;
if ( sorting = = SORT_ALPHA )
{
m_btnMgr . setText ( m_mainLblLetter , curLetter ) ;
m_btnMgr . show ( m_mainLblLetter ) ;
}
else
{
curLetter = _getNoticeTranslation ( sorting , curLetter ) ;
m_btnMgr . setText ( m_mainLblNotice , curLetter ) ;
m_btnMgr . show ( m_mainLblNotice ) ;
}
}
2012-06-21 14:25:47 +02:00
else if ( BTN_LEFT_PRESSED )
2012-01-21 21:57:41 +01:00
{
2012-06-21 14:25:47 +02:00
SourceMenuTimeout = 0 ;
if ( b_lr_mode )
m_cf . pageUp ( ) ;
else
2012-07-05 16:27:05 +02:00
m_music - > Previous ( ) ;
2012-06-21 14:25:47 +02:00
}
else if ( BTN_RIGHT_PRESSED )
{
SourceMenuTimeout = 0 ;
if ( b_lr_mode )
m_cf . pageDown ( ) ;
else
2012-07-05 16:27:05 +02:00
m_music - > Next ( ) ;
2012-06-21 14:25:47 +02:00
}
else if ( BTN_PLUS_PRESSED & & ! m_locked )
{
SourceMenuTimeout = 0 ;
2012-01-21 21:57:41 +01:00
u32 sort = 0 ;
2012-05-01 14:32:14 +02:00
sort = loopNum ( ( m_cfg . getInt ( domain , " sort " , 0 ) ) + 1 , SORT_MAX - 1 ) ;
2012-01-21 21:57:41 +01:00
m_cf . setSorting ( ( Sorting ) sort ) ;
m_cfg . setInt ( domain , " sort " , sort ) ;
wstringEx curSort ;
2012-06-21 14:25:47 +02:00
if ( sort = = SORT_ALPHA )
2012-01-21 21:57:41 +01:00
curSort = m_loc . getWString ( m_curLanguage , " alphabetically " , L " Alphabetically " ) ;
2012-06-21 14:25:47 +02:00
else if ( sort = = SORT_PLAYCOUNT )
2012-01-21 21:57:41 +01:00
curSort = m_loc . getWString ( m_curLanguage , " byplaycount " , L " By Play Count " ) ;
2012-06-21 14:25:47 +02:00
else if ( sort = = SORT_LASTPLAYED )
2012-01-21 21:57:41 +01:00
curSort = m_loc . getWString ( m_curLanguage , " bylastplayed " , L " By Last Played " ) ;
2012-06-21 14:25:47 +02:00
else if ( sort = = SORT_GAMEID )
2012-01-21 21:57:41 +01:00
curSort = m_loc . getWString ( m_curLanguage , " bygameid " , L " By Game I.D. " ) ;
2012-06-21 14:25:47 +02:00
else if ( sort = = SORT_ESRB )
2012-01-21 21:57:41 +01:00
curSort = m_loc . getWString ( m_curLanguage , " byesrb " , L " By ESRB " ) ;
2012-06-21 14:25:47 +02:00
else if ( sort = = SORT_WIFIPLAYERS )
2012-01-21 21:57:41 +01:00
curSort = m_loc . getWString ( m_curLanguage , " bywifiplayers " , L " By Wifi Players " ) ;
2012-06-21 14:25:47 +02:00
else if ( sort = = SORT_PLAYERS )
2012-01-21 21:57:41 +01:00
curSort = m_loc . getWString ( m_curLanguage , " byplayers " , L " By Players " ) ;
2012-06-21 14:25:47 +02:00
else if ( sort = = SORT_CONTROLLERS )
2012-01-21 21:57:41 +01:00
curSort = m_loc . getWString ( m_curLanguage , " bycontrollers " , L " By Controllers " ) ;
m_showtimer = 60 ;
m_btnMgr . setText ( m_mainLblNotice , curSort ) ;
m_btnMgr . show ( m_mainLblNotice ) ;
}
2012-06-21 14:25:47 +02:00
else if ( BTN_MINUS_PRESSED & & ! m_locked )
2012-01-21 21:57:41 +01:00
{
2012-06-21 14:25:47 +02:00
SourceMenuTimeout = 0 ;
2012-01-21 21:57:41 +01:00
bool block = m_current_view = = COVERFLOW_CHANNEL & & m_cfg . getBool ( " NAND " , " disable " , true ) ;
char * partition ;
2012-02-27 17:05:10 +01:00
if ( ! block )
2012-01-21 21:57:41 +01:00
{
_showWaitMessage ( ) ;
_hideMain ( ) ;
2012-01-27 20:38:52 +01:00
Nand : : Instance ( ) - > Disable_Emu ( ) ;
bool isD2XnewerThanV6 = false ;
iosinfo_t * iosInfo = cIOSInfo : : GetInfo ( mainIOS ) ;
if ( iosInfo - > version > 6 )
isD2XnewerThanV6 = true ;
2012-06-21 14:25:47 +02:00
if ( m_current_view = = COVERFLOW_CHANNEL & & m_cfg . getInt ( " NAND " , " emulation " , 0 ) )
2012-03-11 20:47:24 +01:00
Nand : : Instance ( ) - > Enable_Emu ( ) ;
2012-01-21 21:57:41 +01:00
u8 limiter = 0 ;
currentPartition = loopNum ( currentPartition + 1 , ( int ) USB8 ) ;
while ( ! DeviceHandler : : Instance ( ) - > IsInserted ( currentPartition ) | |
2012-04-08 17:54:34 +02:00
( ( m_current_view = = COVERFLOW_CHANNEL | | m_current_view = = COVERFLOW_EMU ) & & ( DeviceHandler : : Instance ( ) - > GetFSType ( currentPartition ) ! = PART_FS_FAT | |
2012-01-27 16:59:19 +01:00
( ! isD2XnewerThanV6 & & DeviceHandler : : Instance ( ) - > PathToDriveType ( m_appDir . c_str ( ) ) = = currentPartition ) | |
( ! isD2XnewerThanV6 & & DeviceHandler : : Instance ( ) - > PathToDriveType ( m_dataDir . c_str ( ) ) = = currentPartition ) ) ) | |
2012-02-27 17:05:10 +01:00
( ( m_current_view = = COVERFLOW_HOMEBREW | | m_current_view = = COVERFLOW_DML ) & & DeviceHandler : : Instance ( ) - > GetFSType ( currentPartition ) = = PART_FS_WBFS ) )
2012-01-21 21:57:41 +01:00
{
currentPartition = loopNum ( currentPartition + 1 , ( int ) USB8 ) ;
if ( limiter > 10 ) break ;
limiter + + ;
}
partition = ( char * ) DeviceName [ currentPartition ] ;
2012-01-27 23:28:47 +01:00
gprintf ( " Setting Emu NAND to Partition: %i \n " , currentPartition ) ;
2012-01-21 21:57:41 +01:00
m_cfg . setInt ( _domainFromView ( ) , " partition " , currentPartition ) ;
}
2012-01-23 18:49:32 +01:00
else
partition = ( char * ) " NAND " ;
2012-01-21 21:57:41 +01:00
for ( u8 i = 0 ; strncmp ( ( const char * ) & partition [ i ] , " \0 " , 1 ) ! = 0 ; i + + )
partition [ i ] = toupper ( partition [ i ] ) ;
gprintf ( " Next item: %s \n " , partition ) ;
m_showtimer = 60 ;
2012-02-27 17:05:10 +01:00
char gui_name [ 20 ] ;
2012-05-04 14:30:43 +02:00
snprintf ( gui_name , sizeof ( gui_name ) , " %s [%s] " , _domainFromView ( ) , partition ) ;
2012-02-27 17:05:10 +01:00
m_btnMgr . setText ( m_mainLblNotice , ( string ) gui_name ) ;
2012-01-21 21:57:41 +01:00
m_btnMgr . show ( m_mainLblNotice ) ;
2012-02-27 17:05:10 +01:00
if ( ! block )
2012-01-21 21:57:41 +01:00
{
_loadList ( ) ;
_showMain ( ) ;
_initCF ( ) ;
}
}
2012-06-21 15:23:12 +02:00
else if ( ! enable_wmote_roll )
2012-01-21 21:57:41 +01:00
{
2012-06-21 14:25:47 +02:00
if ( ! SourceMenuTimeout )
SourceMenuTimeout = time ( 0 ) ;
else if ( time ( 0 ) - SourceMenuTimeout > 1 ) //Source Menu requested
2012-01-21 21:57:41 +01:00
{
2012-06-21 14:25:47 +02:00
SourceMenuTimeout = 0 ;
_hideMain ( ) ;
if ( ! _Source ( ) ) //Different source selected
LoadView ( ) ;
else
_showMain ( ) ;
continue ;
2012-01-21 21:57:41 +01:00
}
}
}
2012-06-21 14:25:47 +02:00
if ( done = = 0 & & m_cat . getBool ( " GENERAL " , " category_on_start " , false ) )
2012-01-21 21:57:41 +01:00
{
done = 1 ; //set done so it doesnt keep doing it
// show categories menu
_hideMain ( ) ;
_CategorySettings ( ) ;
_showMain ( ) ;
m_curGameId = m_cf . getId ( ) ;
_initCF ( ) ;
}
2012-06-21 14:25:47 +02:00
if ( use_grab )
_getGrabStatus ( ) ;
if ( m_showtimer > 0 )
2012-01-21 21:57:41 +01:00
{
2012-06-21 14:25:47 +02:00
if ( - - m_showtimer = = 0 )
2012-01-21 21:57:41 +01:00
{
m_btnMgr . hide ( m_mainLblLetter ) ;
m_btnMgr . hide ( m_mainLblNotice ) ;
}
2012-06-21 14:25:47 +02:00
}
2012-01-21 21:57:41 +01:00
//zones, showing and hiding buttons
2012-06-21 14:25:47 +02:00
if ( ! m_gameList . empty ( ) & & m_show_zone_prev )
2012-01-21 21:57:41 +01:00
m_btnMgr . show ( m_mainBtnPrev ) ;
else
m_btnMgr . hide ( m_mainBtnPrev ) ;
2012-06-21 14:25:47 +02:00
if ( ! m_gameList . empty ( ) & & m_show_zone_next )
2012-01-21 21:57:41 +01:00
m_btnMgr . show ( m_mainBtnNext ) ;
else
m_btnMgr . hide ( m_mainBtnNext ) ;
2012-06-21 14:25:47 +02:00
if ( ! m_gameList . empty ( ) & & m_show_zone_main )
2012-01-21 21:57:41 +01:00
{
m_btnMgr . show ( m_mainLblUser [ 0 ] ) ;
m_btnMgr . show ( m_mainLblUser [ 1 ] ) ;
m_btnMgr . show ( m_mainBtnInfo ) ;
m_btnMgr . show ( m_mainBtnConfig ) ;
m_btnMgr . show ( m_mainBtnQuit ) ;
static bool change = m_favorites ;
m_btnMgr . show ( m_favorites ? m_mainBtnFavoritesOn : m_mainBtnFavoritesOff , change ! = m_favorites ) ;
m_btnMgr . hide ( m_favorites ? m_mainBtnFavoritesOff : m_mainBtnFavoritesOn , change ! = m_favorites ) ;
change = m_favorites ;
}
else
{
m_btnMgr . hide ( m_mainLblUser [ 0 ] ) ;
m_btnMgr . hide ( m_mainLblUser [ 1 ] ) ;
2012-05-26 00:13:43 +02:00
if ( ! m_gameList . empty ( ) )
m_btnMgr . hide ( m_mainBtnConfig ) ;
2012-01-21 21:57:41 +01:00
m_btnMgr . hide ( m_mainBtnInfo ) ;
m_btnMgr . hide ( m_mainBtnQuit ) ;
m_btnMgr . hide ( m_mainBtnFavoritesOn ) ;
m_btnMgr . hide ( m_mainBtnFavoritesOff ) ;
}
2012-06-21 14:25:47 +02:00
if ( ! m_cfg . getBool ( " GENERAL " , " hideviews " , false ) & & ( m_gameList . empty ( ) | | m_show_zone_main2 ) )
2012-02-13 18:09:26 +01:00
{
2012-06-21 14:25:47 +02:00
switch ( m_current_view )
{
case COVERFLOW_DML :
if ( show_channel )
m_btnMgr . show ( m_mainBtnChannel ) ;
else if ( show_emu )
m_btnMgr . show ( m_mainBtnEmu ) ;
else if ( show_homebrew )
m_btnMgr . show ( m_mainBtnHomebrew ) ;
else
m_btnMgr . show ( m_mainBtnUsb ) ;
break ;
case COVERFLOW_CHANNEL :
if ( show_emu )
m_btnMgr . show ( m_mainBtnEmu ) ;
else if ( show_homebrew & & ( parental_homebrew | | ! m_locked ) )
m_btnMgr . show ( m_mainBtnHomebrew ) ;
else
m_btnMgr . show ( m_mainBtnUsb ) ;
break ;
case COVERFLOW_EMU :
if ( show_homebrew & & ( parental_homebrew | | ! m_locked ) )
m_btnMgr . show ( m_mainBtnHomebrew ) ;
else
m_btnMgr . show ( m_mainBtnUsb ) ;
break ;
case COVERFLOW_HOMEBREW :
2012-02-13 18:09:26 +01:00
m_btnMgr . show ( m_mainBtnUsb ) ;
2012-06-21 14:25:47 +02:00
break ;
default :
if ( m_show_dml )
m_btnMgr . show ( m_mainBtnDML ) ;
else if ( show_channel )
m_btnMgr . show ( m_mainBtnChannel ) ;
else if ( show_emu )
m_btnMgr . show ( m_mainBtnEmu ) ;
else if ( show_homebrew & & ( parental_homebrew | | ! m_locked ) )
m_btnMgr . show ( m_mainBtnHomebrew ) ;
else
m_btnMgr . show ( m_mainBtnUsb ) ;
}
2012-01-21 21:57:41 +01:00
m_btnMgr . show ( m_mainLblUser [ 2 ] ) ;
m_btnMgr . show ( m_mainLblUser [ 3 ] ) ;
}
else
{
m_btnMgr . hide ( m_mainBtnHomebrew ) ;
m_btnMgr . hide ( m_mainBtnChannel ) ;
m_btnMgr . hide ( m_mainBtnUsb ) ;
2012-01-21 22:15:45 +01:00
m_btnMgr . hide ( m_mainBtnDML ) ;
2012-04-08 17:54:34 +02:00
m_btnMgr . hide ( m_mainBtnEmu ) ;
2012-01-21 21:57:41 +01:00
m_btnMgr . hide ( m_mainLblUser [ 2 ] ) ;
m_btnMgr . hide ( m_mainLblUser [ 3 ] ) ;
}
2012-06-21 14:25:47 +02:00
if ( ( disc_check & 0x2 ) & & ( m_gameList . empty ( ) | | m_show_zone_main3 ) )
2012-01-21 21:57:41 +01:00
{
m_btnMgr . show ( m_mainBtnDVD ) ;
m_btnMgr . show ( m_mainLblUser [ 4 ] ) ;
m_btnMgr . show ( m_mainLblUser [ 5 ] ) ;
}
else
{
m_btnMgr . hide ( m_mainBtnDVD ) ;
m_btnMgr . hide ( m_mainLblUser [ 4 ] ) ;
m_btnMgr . hide ( m_mainLblUser [ 5 ] ) ;
}
for ( int chan = WPAD_MAX_WIIMOTES - 1 ; chan > = 0 ; chan - - )
2012-05-13 17:13:33 +02:00
{
2012-06-21 14:25:47 +02:00
if ( WPadIR_Valid ( chan ) | | ( m_show_pointer [ chan ] & & ! WPadIR_Valid ( chan ) ) )
2012-01-21 21:57:41 +01:00
m_cf . mouse ( m_vid , chan , m_cursor [ chan ] . x ( ) , m_cursor [ chan ] . y ( ) ) ;
else
2012-05-13 17:13:33 +02:00
m_cf . mouse ( m_vid , chan , - 1 , - 1 ) ;
}
2012-01-21 21:57:41 +01:00
}
2012-06-21 14:25:47 +02:00
2012-01-21 21:57:41 +01:00
gprintf ( " Saving configuration files \n " ) ;
m_cfg . save ( ) ;
m_cat . save ( ) ;
// m_loc.save();
gprintf ( " Wait for dvd \n " ) ;
LWP_JoinThread ( coverStatus , NULL ) ;
coverStatus = LWP_THREAD_NULL ;
2012-05-13 17:13:33 +02:00
if ( coverstatus_stack . get ( ) )
coverstatus_stack . release ( ) ;
2012-07-08 15:35:59 +02:00
if ( ! m_reload )
return 0 ;
2012-05-22 22:08:56 +02:00
cleanup ( ) ;
2012-07-08 15:35:59 +02:00
return 1 ;
2012-01-21 21:57:41 +01:00
}
void CMenu : : _initMainMenu ( CMenu : : SThemeData & theme )
{
STexture texQuit ;
STexture texQuitS ;
STexture texInfo ;
STexture texInfoS ;
STexture texConfig ;
STexture texConfigS ;
2012-01-21 22:15:45 +01:00
STexture texDML ;
STexture texDMLs ;
2012-04-08 17:54:34 +02:00
STexture texEmu ;
STexture texEmus ;
2012-01-21 21:57:41 +01:00
STexture texDVD ;
STexture texDVDs ;
STexture texUsb ;
STexture texUsbs ;
STexture texChannel ;
STexture texChannels ;
STexture texHomebrew ;
STexture texHomebrews ;
STexture texPrev ;
STexture texPrevS ;
STexture texNext ;
STexture texNextS ;
STexture texFavOn ;
STexture texFavOnS ;
STexture texFavOff ;
STexture texFavOffS ;
STexture bgLQ ;
STexture emptyTex ;
m_mainBg = _texture ( theme . texSet , " MAIN/BG " , " texture " , theme . bg ) ;
2012-05-04 14:30:43 +02:00
if ( m_theme . loaded ( ) & & STexture : : TE_OK = = bgLQ . fromPNGFile ( fmt ( " %s/%s " , m_themeDataDir . c_str ( ) , m_theme . getString ( " MAIN/BG " , " texture " ) . c_str ( ) ) , GX_TF_CMPR , ALLOC_MEM2 , 64 , 64 ) )
2012-01-21 21:57:41 +01:00
m_mainBgLQ = bgLQ ;
texQuit . fromPNG ( btnquit_png ) ;
texQuitS . fromPNG ( btnquits_png ) ;
texInfo . fromPNG ( btninfo_png ) ;
texInfoS . fromPNG ( btninfos_png ) ;
texConfig . fromPNG ( btnconfig_png ) ;
texConfigS . fromPNG ( btnconfigs_png ) ;
texDVD . fromPNG ( btndvd_png ) ;
texDVDs . fromPNG ( btndvds_png ) ;
texUsb . fromPNG ( btnusb_png ) ;
texUsbs . fromPNG ( btnusbs_png ) ;
2012-01-21 22:15:45 +01:00
texDML . fromPNG ( btndml_png ) ;
texDMLs . fromPNG ( btndmls_png ) ;
2012-04-08 17:54:34 +02:00
texEmu . fromPNG ( btnemu_png ) ;
texEmus . fromPNG ( btnemus_png ) ;
2012-01-21 21:57:41 +01:00
texChannel . fromPNG ( btnchannel_png ) ;
texChannels . fromPNG ( btnchannels_png ) ;
texHomebrew . fromPNG ( btnhomebrew_png ) ;
2012-01-29 13:30:04 +01:00
texHomebrews . fromPNG ( btnhomebrews_png ) ;
2012-01-21 21:57:41 +01:00
texPrev . fromPNG ( btnprev_png ) ;
texPrevS . fromPNG ( btnprevs_png ) ;
texNext . fromPNG ( btnnext_png ) ;
texNextS . fromPNG ( btnnexts_png ) ;
texFavOn . fromPNG ( favoriteson_png ) ;
texFavOnS . fromPNG ( favoritesons_png ) ;
texFavOff . fromPNG ( favoritesoff_png ) ;
texFavOffS . fromPNG ( favoritesoffs_png ) ;
_addUserLabels ( theme , m_mainLblUser , ARRAY_SIZE ( m_mainLblUser ) , " MAIN " ) ;
2012-02-10 19:45:42 +01:00
m_mainBtnInfo = _addPicButton ( theme , " MAIN/INFO_BTN " , texInfo , texInfoS , 20 , 400 , 48 , 48 ) ;
m_mainBtnConfig = _addPicButton ( theme , " MAIN/CONFIG_BTN " , texConfig , texConfigS , 70 , 400 , 48 , 48 ) ;
m_mainBtnQuit = _addPicButton ( theme , " MAIN/QUIT_BTN " , texQuit , texQuitS , 570 , 400 , 48 , 48 ) ;
m_mainBtnChannel = _addPicButton ( theme , " MAIN/CHANNEL_BTN " , texChannel , texChannels , 520 , 400 , 48 , 48 ) ;
m_mainBtnHomebrew = _addPicButton ( theme , " MAIN/HOMEBREW_BTN " , texHomebrew , texHomebrews , 520 , 400 , 48 , 48 ) ;
m_mainBtnUsb = _addPicButton ( theme , " MAIN/USB_BTN " , texUsb , texUsbs , 520 , 400 , 48 , 48 ) ;
m_mainBtnDML = _addPicButton ( theme , " MAIN/DML_BTN " , texDML , texDMLs , 520 , 400 , 48 , 48 ) ;
2012-04-08 17:54:34 +02:00
m_mainBtnEmu = _addPicButton ( theme , " MAIN/EMU_BTN " , texEmu , texEmus , 520 , 400 , 48 , 48 ) ;
2012-02-10 19:45:42 +01:00
m_mainBtnDVD = _addPicButton ( theme , " MAIN/DVD_BTN " , texDVD , texDVDs , 470 , 400 , 48 , 48 ) ;
2012-01-21 21:57:41 +01:00
m_mainBtnNext = _addPicButton ( theme , " MAIN/NEXT_BTN " , texNext , texNextS , 540 , 146 , 80 , 80 ) ;
m_mainBtnPrev = _addPicButton ( theme , " MAIN/PREV_BTN " , texPrev , texPrevS , 20 , 146 , 80 , 80 ) ;
2012-02-10 19:45:42 +01:00
m_mainBtnInit = _addButton ( theme , " MAIN/BIG_SETTINGS_BTN " , theme . titleFont , L " " , 72 , 180 , 496 , 56 , theme . titleFontColor ) ;
m_mainBtnInit2 = _addButton ( theme , " MAIN/BIG_SETTINGS_BTN2 " , theme . titleFont , L " " , 72 , 290 , 496 , 56 , theme . titleFontColor ) ;
m_mainLblInit = _addLabel ( theme , " MAIN/MESSAGE " , theme . lblFont , L " " , 40 , 40 , 560 , 140 , theme . lblFontColor , FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE ) ;
m_mainBtnFavoritesOn = _addPicButton ( theme , " MAIN/FAVORITES_ON " , texFavOn , texFavOnS , 300 , 400 , 56 , 56 ) ;
m_mainBtnFavoritesOff = _addPicButton ( theme , " MAIN/FAVORITES_OFF " , texFavOff , texFavOffS , 300 , 400 , 56 , 56 ) ;
m_mainLblLetter = _addLabel ( theme , " MAIN/LETTER " , theme . titleFont , L " " , 540 , 40 , 80 , 80 , theme . titleFontColor , FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE , emptyTex ) ;
m_mainLblNotice = _addLabel ( theme , " MAIN/NOTICE " , theme . titleFont , L " " , 340 , 40 , 280 , 80 , theme . titleFontColor , FTGX_JUSTIFY_RIGHT | FTGX_ALIGN_MIDDLE , emptyTex ) ;
2012-01-21 21:57:41 +01:00
# ifdef SHOWMEM
2012-02-10 19:45:42 +01:00
m_mem2FreeSize = _addLabel ( theme , " MEM2 " , theme . titleFont , L " " , 40 , 300 , 480 , 80 , theme . titleFontColor , FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE , emptyTex ) ;
2012-01-21 21:57:41 +01:00
# endif
//
m_mainPrevZone . x = m_theme . getInt ( " MAIN/ZONES " , " prev_x " , - 32 ) ;
m_mainPrevZone . y = m_theme . getInt ( " MAIN/ZONES " , " prev_y " , - 32 ) ;
m_mainPrevZone . w = m_theme . getInt ( " MAIN/ZONES " , " prev_w " , 182 ) ;
m_mainPrevZone . h = m_theme . getInt ( " MAIN/ZONES " , " prev_h " , 382 ) ;
m_mainPrevZone . hide = m_theme . getBool ( " MAIN/ZONES " , " prev_hide " , true ) ;
m_mainNextZone . x = m_theme . getInt ( " MAIN/ZONES " , " next_x " , 490 ) ;
m_mainNextZone . y = m_theme . getInt ( " MAIN/ZONES " , " next_y " , - 32 ) ;
m_mainNextZone . w = m_theme . getInt ( " MAIN/ZONES " , " next_w " , 182 ) ;
m_mainNextZone . h = m_theme . getInt ( " MAIN/ZONES " , " next_h " , 382 ) ;
m_mainNextZone . hide = m_theme . getBool ( " MAIN/ZONES " , " next_hide " , true ) ;
m_mainButtonsZone . x = m_theme . getInt ( " MAIN/ZONES " , " buttons_x " , - 32 ) ;
m_mainButtonsZone . y = m_theme . getInt ( " MAIN/ZONES " , " buttons_y " , 350 ) ;
m_mainButtonsZone . w = m_theme . getInt ( " MAIN/ZONES " , " buttons_w " , 704 ) ;
m_mainButtonsZone . h = m_theme . getInt ( " MAIN/ZONES " , " buttons_h " , 162 ) ;
m_mainButtonsZone . hide = m_theme . getBool ( " MAIN/ZONES " , " buttons_hide " , true ) ;
m_mainButtonsZone2 . x = m_theme . getInt ( " MAIN/ZONES " , " buttons2_x " , - 32 ) ;
m_mainButtonsZone2 . y = m_theme . getInt ( " MAIN/ZONES " , " buttons2_y " , 350 ) ;
m_mainButtonsZone2 . w = m_theme . getInt ( " MAIN/ZONES " , " buttons2_w " , 704 ) ;
m_mainButtonsZone2 . h = m_theme . getInt ( " MAIN/ZONES " , " buttons2_h " , 162 ) ;
m_mainButtonsZone2 . hide = m_theme . getBool ( " MAIN/ZONES " , " buttons2_hide " , true ) ;
m_mainButtonsZone3 . x = m_theme . getInt ( " MAIN/ZONES " , " buttons3_x " , - 32 ) ;
m_mainButtonsZone3 . y = m_theme . getInt ( " MAIN/ZONES " , " buttons3_y " , 350 ) ;
m_mainButtonsZone3 . w = m_theme . getInt ( " MAIN/ZONES " , " buttons3_w " , 704 ) ;
m_mainButtonsZone3 . h = m_theme . getInt ( " MAIN/ZONES " , " buttons3_h " , 162 ) ;
m_mainButtonsZone3 . hide = m_theme . getBool ( " MAIN/ZONES " , " buttons3_hide " , true ) ;
//
_setHideAnim ( m_mainBtnNext , " MAIN/NEXT_BTN " , 0 , 0 , 0.f , 0.f ) ;
_setHideAnim ( m_mainBtnPrev , " MAIN/PREV_BTN " , 0 , 0 , 0.f , 0.f ) ;
_setHideAnim ( m_mainBtnConfig , " MAIN/CONFIG_BTN " , 0 , 40 , 0.f , 0.f ) ;
_setHideAnim ( m_mainBtnInfo , " MAIN/INFO_BTN " , 0 , 40 , 0.f , 0.f ) ;
_setHideAnim ( m_mainBtnQuit , " MAIN/QUIT_BTN " , 0 , 40 , 0.f , 0.f ) ;
_setHideAnim ( m_mainBtnChannel , " MAIN/CHANNEL_BTN " , 0 , 40 , 0.f , 0.f ) ;
_setHideAnim ( m_mainBtnHomebrew , " MAIN/HOMEBREW_BTN " , 0 , 40 , 0.f , 0.f ) ;
_setHideAnim ( m_mainBtnUsb , " MAIN/USB_BTN " , 0 , 40 , 0.f , 0.f ) ;
2012-01-21 22:15:45 +01:00
_setHideAnim ( m_mainBtnDML , " MAIN/DML_BTN " , 0 , 40 , 0.f , 0.f ) ;
2012-04-08 17:54:34 +02:00
_setHideAnim ( m_mainBtnEmu , " MAIN/EMU_BTN " , 0 , 40 , 0.f , 0.f ) ;
2012-01-21 21:57:41 +01:00
_setHideAnim ( m_mainBtnDVD , " MAIN/DVD_BTN " , 0 , 40 , 0.f , 0.f ) ;
_setHideAnim ( m_mainBtnFavoritesOn , " MAIN/FAVORITES_ON " , 0 , 40 , 0.f , 0.f ) ;
_setHideAnim ( m_mainBtnFavoritesOff , " MAIN/FAVORITES_OFF " , 0 , 40 , 0.f , 0.f ) ;
_setHideAnim ( m_mainBtnInit , " MAIN/BIG_SETTINGS_BTN " , 0 , 0 , - 2.f , 0.f ) ;
_setHideAnim ( m_mainBtnInit2 , " MAIN/BIG_SETTINGS_BTN2 " , 0 , 0 , - 2.f , 0.f ) ;
_setHideAnim ( m_mainLblInit , " MAIN/MESSAGE " , 0 , 0 , 0.f , 0.f ) ;
_setHideAnim ( m_mainLblLetter , " MAIN/LETTER " , 0 , 0 , 0.f , 0.f ) ;
_setHideAnim ( m_mainLblNotice , " MAIN/NOTICE " , 0 , 0 , 0.f , 0.f ) ;
# ifdef SHOWMEM
_setHideAnim ( m_mem2FreeSize , " MEM2 " , 0 , 0 , 0.f , 0.f ) ;
# endif
_hideMain ( true ) ;
_textMain ( ) ;
}
void CMenu : : _textMain ( void )
{
m_btnMgr . setText ( m_mainBtnInit , _t ( " main1 " , L " Install Game " ) ) ;
m_btnMgr . setText ( m_mainBtnInit2 , _t ( " main3 " , L " Select Partition " ) ) ;
}
wstringEx CMenu : : _getNoticeTranslation ( int sorting , wstringEx curLetter )
{
if ( sorting = = SORT_PLAYERS )
curLetter + = m_loc . getWString ( m_curLanguage , " players " , L " Players " ) ;
else if ( sorting = = SORT_WIFIPLAYERS )
curLetter + = m_loc . getWString ( m_curLanguage , " wifiplayers " , L " Wifi Players " ) ;
else if ( sorting = = SORT_GAMEID )
{
switch ( curLetter [ 0 ] )
{
case L ' C ' :
{
if ( m_current_view ! = COVERFLOW_CHANNEL )
curLetter = m_loc . getWString ( m_curLanguage , " custom " , L " Custom " ) ;
else
curLetter = m_loc . getWString ( m_curLanguage , " commodore " , L " Commodore 64 " ) ;
break ;
}
case L ' E ' :
{
curLetter = m_loc . getWString ( m_curLanguage , " neogeo " , L " Neo-Geo " ) ;
break ;
}
case L ' F ' :
{
curLetter = m_loc . getWString ( m_curLanguage , " nes " , L " Nintendo " ) ;
break ;
}
case L ' J ' :
{
curLetter = m_loc . getWString ( m_curLanguage , " snes " , L " Super Nintendo " ) ;
break ;
}
case L ' L ' :
{
curLetter = m_loc . getWString ( m_curLanguage , " mastersystem " , L " Sega Master System " ) ;
break ;
}
case L ' M ' :
{
curLetter = m_loc . getWString ( m_curLanguage , " genesis " , L " Sega Genesis " ) ;
break ;
}
case L ' N ' :
{
curLetter = m_loc . getWString ( m_curLanguage , " nintendo64 " , L " Nintendo64 " ) ;
break ;
}
case L ' P ' :
{
curLetter = m_loc . getWString ( m_curLanguage , " turbografx16 " , L " TurboGrafx-16 " ) ;
break ;
}
case L ' Q ' :
{
curLetter = m_loc . getWString ( m_curLanguage , " turbografxcd " , L " TurboGrafx-CD " ) ;
break ;
}
case L ' W ' :
{
curLetter = m_loc . getWString ( m_curLanguage , " wiiware " , L " WiiWare " ) ;
break ;
}
case L ' H ' :
{
curLetter = m_loc . getWString ( m_curLanguage , " wiichannels " , L " Offical Wii Channels " ) ;
break ;
}
case L ' R ' :
case L ' S ' :
{
curLetter = m_loc . getWString ( m_curLanguage , " wii " , L " Wii " ) ;
break ;
}
case L ' D ' :
{
curLetter = m_loc . getWString ( m_curLanguage , " homebrew " , L " Homebrew " ) ;
break ;
}
default :
{
curLetter = m_loc . getWString ( m_curLanguage , " unknown " , L " Unknown " ) ;
break ;
}
}
}
return curLetter ;
}