2012-01-21 21:57:41 +01:00
# include <fstream>
# include <sys/stat.h>
# include <dirent.h>
# include <time.h>
# include <wchar.h>
2012-05-11 00:20:18 +02:00
# include <network.h>
# include <errno.h>
2012-01-21 21:57:41 +01:00
2012-08-05 15:48:15 +02:00
# include "menu.hpp"
2012-06-16 19:03:23 +02:00
# include "types.h"
2012-01-21 21:57:41 +01:00
# include "fonts.h"
2012-08-05 15:48:15 +02:00
# include "banner/BannerWindow.hpp"
# include "channel/nand.hpp"
2012-12-27 02:08:16 +01:00
# include "channel/nand_save.hpp"
2012-08-05 15:48:15 +02:00
# include "fileOps/fileOps.h"
# include "gc/gc.hpp"
# include "gui/Gekko.h"
# include "gui/GameTDB.hpp"
# include "loader/alt_ios.h"
# include "loader/cios.h"
# include "loader/fs.h"
2012-08-11 14:27:38 +02:00
# include "loader/nk.h"
2012-01-21 21:57:41 +01:00
# include "loader/playlog.h"
2012-08-05 15:48:15 +02:00
# include "loader/wbfs.h"
# include "music/SoundHandler.hpp"
# include "network/gcard.h"
# include "unzip/U8Archive.h"
2012-01-21 21:57:41 +01:00
// Sounds
extern const u8 click_wav [ ] ;
extern const u32 click_wav_size ;
extern const u8 hover_wav [ ] ;
extern const u32 hover_wav_size ;
extern const u8 camera_wav [ ] ;
extern const u32 camera_wav_size ;
// Pics
extern const u8 btnplus_png [ ] ;
extern const u8 btnpluss_png [ ] ;
extern const u8 btnminus_png [ ] ;
extern const u8 btnminuss_png [ ] ;
2012-07-23 15:41:13 +02:00
extern const u8 background_jpg [ ] ;
extern const u32 background_jpg_size ;
2012-01-21 21:57:41 +01:00
extern const u8 butleft_png [ ] ;
extern const u8 butcenter_png [ ] ;
extern const u8 butright_png [ ] ;
extern const u8 butsleft_png [ ] ;
extern const u8 butscenter_png [ ] ;
extern const u8 butsright_png [ ] ;
2012-02-12 02:43:31 +01:00
extern const u8 buthleft_png [ ] ;
extern const u8 buthcenter_png [ ] ;
extern const u8 buthright_png [ ] ;
extern const u8 buthsleft_png [ ] ;
extern const u8 buthscenter_png [ ] ;
extern const u8 buthsright_png [ ] ;
2012-01-21 21:57:41 +01:00
extern const u8 pbarleft_png [ ] ;
extern const u8 pbarcenter_png [ ] ;
extern const u8 pbarright_png [ ] ;
extern const u8 pbarlefts_png [ ] ;
extern const u8 pbarcenters_png [ ] ;
extern const u8 pbarrights_png [ ] ;
2012-02-15 21:18:15 +01:00
extern const u8 butauon_png [ ] ;
extern const u8 butauons_png [ ] ;
extern const u8 butenon_png [ ] ;
extern const u8 butenons_png [ ] ;
extern const u8 butjaon_png [ ] ;
extern const u8 butjaons_png [ ] ;
extern const u8 butfron_png [ ] ;
extern const u8 butfrons_png [ ] ;
extern const u8 butdeon_png [ ] ;
extern const u8 butdeons_png [ ] ;
extern const u8 buteson_png [ ] ;
extern const u8 butesons_png [ ] ;
extern const u8 butiton_png [ ] ;
extern const u8 butitons_png [ ] ;
extern const u8 butnlon_png [ ] ;
extern const u8 butnlons_png [ ] ;
extern const u8 butpton_png [ ] ;
extern const u8 butptons_png [ ] ;
extern const u8 butruon_png [ ] ;
extern const u8 butruons_png [ ] ;
extern const u8 butkoon_png [ ] ;
extern const u8 butkoons_png [ ] ;
extern const u8 butzhcnon_png [ ] ;
extern const u8 butzhcnons_png [ ] ;
2012-04-08 16:48:50 +02:00
extern const u8 checkbox_png [ ] ;
extern const u8 checkboxs_png [ ] ;
- Categories update.
- now you can have as many categories as you want.
- copied the idea of selected, hidden, and required categories from USB Loader GX. Thanks Cyan. Checkmark = selected, X = Hidden, and + = Required.
- redid categories.ini layout and renamed it categories_v4.ini so you can copy and paste settings from the old one to the new one. Each view (USB,DML,EMU,NAND,HOMEBREW) has it's own numcategories, category names, and category settings. All games are now seperated based on the view. Don't forget to add 1 to numcategories for the show All mode.
- Replaced All checkbox with CLEAR button which clears all checkboxes so no category is selected and all games will be shown.
- Added features to the Game Selected Categories Menu. Now the title is the title of the current game. You can now press plus(+) and minus(-) on wiimote to go to the next or previous games without going back to previous screen making it easier to setup categories for your games.
- note: all changes will not be saved in categories_v4.ini unless you exit wiiflow or launch a game.
2012-08-31 19:51:49 +02:00
extern const u8 checkboxhid_png [ ] ;
extern const u8 checkboxreq_png [ ] ;
2012-01-21 21:57:41 +01:00
2012-10-13 18:57:03 +02:00
CMenu : : CMenu ( )
2012-01-21 21:57:41 +01:00
{
m_aa = 0 ;
m_thrdWorking = false ;
m_thrdStop = false ;
m_thrdProgress = 0.f ;
m_thrdStep = 0.f ;
m_thrdStepLen = 0.f ;
m_locked = false ;
m_favorites = false ;
m_thrdNetwork = false ;
m_mutex = 0 ;
m_showtimer = 0 ;
m_gameSoundThread = LWP_THREAD_NULL ;
2012-11-04 15:13:42 +01:00
m_soundThrdBusy = false ;
2012-01-21 21:57:41 +01:00
m_numCFVersions = 0 ;
m_bgCrossFade = 0 ;
m_bnrSndVol = 0 ;
2012-07-10 14:02:06 +02:00
m_bnr_settings = true ;
2012-01-21 21:57:41 +01:00
m_directLaunch = false ;
m_exit = false ;
m_reload = false ;
m_gamesound_changed = false ;
2012-08-16 00:33:54 +02:00
m_video_playing = false ;
2012-09-07 20:13:04 +02:00
m_base_font = NULL ;
2012-01-21 21:57:41 +01:00
m_base_font_size = 0 ;
2012-09-07 20:13:04 +02:00
m_wbf1_font = NULL ;
m_wbf2_font = NULL ;
2012-01-21 21:57:41 +01:00
m_current_view = COVERFLOW_USB ;
2012-04-08 17:54:34 +02:00
m_Emulator_boot = false ;
2012-09-29 13:41:47 +02:00
m_music_info = true ;
2012-11-29 21:30:05 +01:00
m_prevBg = NULL ;
2012-11-16 23:00:20 +01:00
m_nextBg = NULL ;
2012-11-16 23:40:20 +01:00
m_lqBg = NULL ;
2012-12-08 17:17:35 +01:00
m_use_sd_logging = false ;
m_use_wifi_gecko = false ;
init_network = false ;
2012-01-21 21:57:41 +01:00
}
2012-10-13 18:57:03 +02:00
void CMenu : : init ( )
2012-01-21 21:57:41 +01:00
{
2012-10-15 21:16:14 +02:00
SoundHandle . Init ( ) ;
m_gameSound . SetVoice ( 1 ) ;
2012-01-21 21:57:41 +01:00
const char * drive = " empty " ;
const char * check = " empty " ;
struct stat dummy ;
/* Clear Playlog */
Playlog_Delete ( ) ;
for ( int i = SD ; i < = USB8 ; i + + ) //Find the first partition with a wiiflow.ini
2012-09-22 15:47:52 +02:00
if ( DeviceHandle . IsInserted ( i ) & & DeviceHandle . GetFSType ( i ) ! = PART_FS_WBFS & & stat ( fmt ( " %s:/%s/ " CFG_FILENAME , DeviceName [ i ] , APPDATA_DIR2 ) , & dummy ) = = 0 )
2012-01-21 21:57:41 +01:00
{
drive = DeviceName [ i ] ;
break ;
}
if ( drive = = check ) //No wiiflow.ini found
for ( int i = SD ; i < = USB8 ; i + + ) //Find the first partition with a boot.dol
2012-09-22 15:47:52 +02:00
if ( DeviceHandle . IsInserted ( i ) & & DeviceHandle . GetFSType ( i ) ! = PART_FS_WBFS & & stat ( fmt ( " %s:/%s/boot.dol " , DeviceName [ i ] , APPDATA_DIR2 ) , & dummy ) = = 0 )
2012-01-21 21:57:41 +01:00
{
drive = DeviceName [ i ] ;
break ;
}
if ( drive = = check ) //No boot.dol found
for ( int i = SD ; i < = USB8 ; i + + ) //Find the first partition with apps/wiiflow folder
2012-09-22 15:47:52 +02:00
if ( DeviceHandle . IsInserted ( i ) & & DeviceHandle . GetFSType ( i ) ! = PART_FS_WBFS & & stat ( fmt ( " %s:/%s " , DeviceName [ i ] , APPDATA_DIR2 ) , & dummy ) = = 0 )
2012-01-21 21:57:41 +01:00
{
drive = DeviceName [ i ] ;
break ;
}
if ( drive = = check ) //No apps/wiiflow folder found
for ( int i = SD ; i < = USB8 ; i + + ) // Find the first writable partition
2012-09-22 15:47:52 +02:00
if ( DeviceHandle . IsInserted ( i ) & & DeviceHandle . GetFSType ( i ) ! = PART_FS_WBFS )
2012-01-21 21:57:41 +01:00
{
drive = DeviceName [ i ] ;
break ;
}
2012-11-12 21:12:00 +01:00
loadDefaultFont ( ) ;
2012-01-21 21:57:41 +01:00
if ( drive = = check ) // Should not happen
{
_buildMenus ( ) ;
2012-09-14 14:15:10 +02:00
error ( _fmt ( " errboot4 " , L " No available partitions found! " ) ) ;
2012-01-21 21:57:41 +01:00
m_exit = true ;
return ;
}
2012-11-18 14:40:26 +01:00
/* Handle apps dir first, so handling wiiflow.ini does not fail */
m_appDir = fmt ( " %s:/%s " , drive , APPDATA_DIR2 ) ;
gprintf ( " Wiiflow boot.dol Location: %s \n " , m_appDir . c_str ( ) ) ;
fsop_MakeFolder ( m_appDir . c_str ( ) ) ;
/* Load/Create our wiiflow.ini */
m_cfg . load ( fmt ( " %s/ " CFG_FILENAME , m_appDir . c_str ( ) ) ) ;
2012-12-08 17:17:35 +01:00
/* Check if we want WiFi Gecko */
m_use_wifi_gecko = m_cfg . getBool ( " DEBUG " , " wifi_gecko " , false ) ;
WiFiDebugger . SetBuffer ( m_use_wifi_gecko ) ;
/* Check if we want SD Gecko */
m_use_sd_logging = m_cfg . getBool ( " DEBUG " , " sd_write_log " , false ) ;
LogToSD_SetBuffer ( m_use_sd_logging ) ;
/* Init Network if wanted */
init_network = ( m_cfg . getBool ( " GENERAL " , " async_network " ) | | has_enabled_providers ( ) | | m_use_wifi_gecko ) ;
2012-12-21 20:51:22 +01:00
_netInit ( ) ;
2012-11-18 14:40:26 +01:00
/* Check if we want a cIOS loaded */
2012-12-27 02:08:16 +01:00
u8 prevCios = mainIOS ;
bool prevForceCIOS = useMainIOS ;
2012-12-28 18:18:49 +01:00
u8 ForceIOS = min ( m_cfg . getInt ( " GENERAL " , " force_cios_rev " , 0 ) , 254 ) ;
2012-12-28 18:23:27 +01:00
if ( ForceIOS > 0 & & mainIOS ! = ForceIOS )
2012-11-12 21:12:00 +01:00
{
gprintf ( " Using IOS%i instead of IOS%i as main cIOS. \n " , ForceIOS , mainIOS ) ;
mainIOS = ForceIOS ;
}
2012-08-24 20:01:40 +02:00
useMainIOS = m_cfg . getBool ( " GENERAL " , " force_cios_load " , false ) ;
2012-12-27 02:08:16 +01:00
if ( prevCios ! = mainIOS | | prevForceCIOS ! = useMainIOS )
InternalSave . SaveIOS ( mainIOS , useMainIOS ) ;
2013-02-07 13:25:39 +01:00
/* Our Wii game dir */
memset ( wii_games_dir , 0 , 64 ) ;
strncpy ( wii_games_dir , m_cfg . getString ( " GENERAL " , " wii_games_dir " , GAMES_DIR ) . c_str ( ) , 64 ) ;
if ( strncmp ( wii_games_dir , " %s:/ " , 4 ) ! = 0 )
strcpy ( wii_games_dir , GAMES_DIR ) ;
gprintf ( " Wii Games Directory: %s \n " , wii_games_dir ) ;
2012-11-18 14:40:26 +01:00
/* Do our USB HDD Checks */
2012-01-21 21:57:41 +01:00
bool onUSB = m_cfg . getBool ( " GENERAL " , " data_on_usb " , strncmp ( drive , " usb " , 3 ) = = 0 ) ;
drive = check ; //reset the drive variable for the check
2012-11-18 14:40:26 +01:00
if ( onUSB )
2012-01-21 21:57:41 +01:00
{
2012-11-18 14:40:26 +01:00
for ( u8 i = USB1 ; i < = USB8 ; i + + ) //Look for first partition with a wiiflow folder in root
{
if ( DeviceHandle . IsInserted ( i ) & & DeviceHandle . GetFSType ( i ) ! = PART_FS_WBFS & & stat ( fmt ( " %s:/%s " , DeviceName [ i ] , APPDATA_DIR ) , & dummy ) = = 0 )
2012-01-21 21:57:41 +01:00
{
drive = DeviceName [ i ] ;
break ;
}
2012-11-18 14:40:26 +01:00
}
2012-01-21 21:57:41 +01:00
}
2012-11-18 14:40:26 +01:00
else if ( DeviceHandle . IsInserted ( SD ) )
drive = DeviceName [ SD ] ;
2012-01-21 21:57:41 +01:00
if ( drive = = check & & onUSB ) //No wiiflow folder found in root of any usb partition, and data_on_usb=yes
2012-11-18 14:40:26 +01:00
{
for ( u8 i = USB1 ; i < = USB8 ; i + + ) // Try first USB partition with wbfs folder.
{
if ( DeviceHandle . IsInserted ( i ) & & DeviceHandle . GetFSType ( i ) ! = PART_FS_WBFS & & stat ( fmt ( GAMES_DIR , DeviceName [ i ] ) , & dummy ) = = 0 )
2012-01-21 21:57:41 +01:00
{
drive = DeviceName [ i ] ;
break ;
}
2012-11-18 14:40:26 +01:00
}
}
2012-01-21 21:57:41 +01:00
if ( drive = = check & & onUSB ) // No wbfs folder found and data_on_usb=yes
2012-11-18 14:40:26 +01:00
{
for ( u8 i = USB1 ; i < = USB8 ; i + + ) // Try first available USB partition.
{
if ( DeviceHandle . IsInserted ( i ) & & DeviceHandle . GetFSType ( i ) ! = PART_FS_WBFS )
2012-01-21 21:57:41 +01:00
{
drive = DeviceName [ i ] ;
break ;
}
2012-11-18 14:40:26 +01:00
}
}
2012-01-21 21:57:41 +01:00
if ( drive = = check )
{
_buildMenus ( ) ;
2012-09-22 15:47:52 +02:00
if ( DeviceHandle . IsInserted ( SD ) )
2012-01-21 21:57:41 +01:00
{
2012-09-15 13:21:31 +02:00
error ( _fmt ( " errboot5 " , L " data_on_usb=yes and No available usb partitions for data! \n Using SD. " ) ) ;
2012-01-21 21:57:41 +01:00
drive = DeviceName [ SD ] ;
}
else
{
2012-09-15 13:21:31 +02:00
error ( _fmt ( " errboot6 " , L " No available usb partitions for data and no SD inserted! \n Exiting. " ) ) ;
2012-01-21 21:57:41 +01:00
m_exit = true ;
return ;
}
}
2012-11-18 14:40:26 +01:00
/* DIOS_MIOS stuff */
2012-11-04 20:22:02 +01:00
if ( m_cfg . getBool ( GC_DOMAIN , " always_show_button " , false ) )
2012-02-20 16:44:31 +01:00
{
gprintf ( " Force enabling DML view \n " ) ;
m_show_dml = true ;
}
else
m_show_dml = MIOSisDML ( ) ;
2012-11-04 20:22:02 +01:00
m_new_dml = m_cfg . getBool ( GC_DOMAIN , " dml_r52+ " , true ) ;
m_new_dm_cfg = m_cfg . getBool ( GC_DOMAIN , " dm_r2.1+ " , true ) ;
2012-11-18 14:40:26 +01:00
m_DMLgameDir = fmt ( " %%s:/%s " , m_cfg . getString ( GC_DOMAIN , " dir_usb_games " , " games " ) . c_str ( ) ) ;
/* Emu NAND */
2012-11-04 20:22:02 +01:00
m_cfg . getString ( CHANNEL_DOMAIN , " path " , " " ) ;
m_cfg . getInt ( CHANNEL_DOMAIN , " partition " , 1 ) ;
m_cfg . getBool ( CHANNEL_DOMAIN , " disable " , true ) ;
2012-11-18 14:40:26 +01:00
/* Load cIOS Map */
2012-07-20 14:30:18 +02:00
_installed_cios . clear ( ) ;
2012-07-20 22:12:25 +02:00
if ( ! neek2o ( ) )
_load_installed_cioses ( ) ;
else
2012-08-11 14:27:38 +02:00
_installed_cios [ CurrentIOS . Version ] = CurrentIOS . Version ;
2012-12-03 21:32:05 +01:00
/* Path Settings */
2012-03-17 21:25:17 +01:00
snprintf ( m_app_update_drive , sizeof ( m_app_update_drive ) , " %s:/ " , drive ) ;
2012-11-18 14:40:26 +01:00
m_dataDir = fmt ( " %s:/%s " , drive , APPDATA_DIR ) ;
2012-01-21 21:57:41 +01:00
gprintf ( " Data Directory: %s \n " , m_dataDir . c_str ( ) ) ;
2012-03-10 20:02:59 +01:00
2012-11-18 14:40:26 +01:00
m_dol = fmt ( " %s/boot.dol " , m_appDir . c_str ( ) ) ;
m_ver = fmt ( " %s/versions " , m_appDir . c_str ( ) ) ;
m_app_update_zip = fmt ( " %s/update.zip " , m_appDir . c_str ( ) ) ;
m_data_update_zip = fmt ( " %s/update.zip " , m_dataDir . c_str ( ) ) ;
m_customBnrDir = m_cfg . getString ( " GENERAL " , " dir_custom_banners " , fmt ( " %s/custom_banners " , m_dataDir . c_str ( ) ) ) ;
m_pluginsDir = m_cfg . getString ( " GENERAL " , " dir_plugins " , fmt ( " %s/plugins " , m_dataDir . c_str ( ) ) ) ;
m_cacheDir = m_cfg . getString ( " GENERAL " , " dir_cache " , fmt ( " %s/cache " , m_dataDir . c_str ( ) ) ) ;
m_listCacheDir = m_cfg . getString ( " GENERAL " , " dir_list_cache " , fmt ( " %s/lists " , m_cacheDir . c_str ( ) ) ) ;
m_bnrCacheDir = m_cfg . getString ( " GENERAL " , " dir_banner_cache " , fmt ( " %s/banners " , m_cacheDir . c_str ( ) ) ) ;
m_txtCheatDir = m_cfg . getString ( " GENERAL " , " dir_txtcheat " , fmt ( " %s/codes " , m_dataDir . c_str ( ) ) ) ;
m_cheatDir = m_cfg . getString ( " GENERAL " , " dir_cheat " , fmt ( " %s/gct " , m_txtCheatDir . c_str ( ) ) ) ;
m_wipDir = m_cfg . getString ( " GENERAL " , " dir_wip " , fmt ( " %s/wip " , m_txtCheatDir . c_str ( ) ) ) ;
m_settingsDir = m_cfg . getString ( " GENERAL " , " dir_settings " , fmt ( " %s/settings " , m_dataDir . c_str ( ) ) ) ;
m_languagesDir = m_cfg . getString ( " GENERAL " , " dir_languages " , fmt ( " %s/languages " , m_dataDir . c_str ( ) ) ) ;
m_boxPicDir = m_cfg . getString ( " GENERAL " , " dir_box_covers " , fmt ( " %s/boxcovers " , m_dataDir . c_str ( ) ) ) ;
m_picDir = m_cfg . getString ( " GENERAL " , " dir_flat_covers " , fmt ( " %s/covers " , m_dataDir . c_str ( ) ) ) ;
m_themeDir = m_cfg . getString ( " GENERAL " , " dir_themes " , fmt ( " %s/themes " , m_dataDir . c_str ( ) ) ) ;
m_musicDir = m_cfg . getString ( " GENERAL " , " dir_music " , fmt ( " %s/music " , m_dataDir . c_str ( ) ) ) ;
m_videoDir = m_cfg . getString ( " GENERAL " , " dir_trailers " , fmt ( " %s/trailers " , m_dataDir . c_str ( ) ) ) ;
m_fanartDir = m_cfg . getString ( " GENERAL " , " dir_fanart " , fmt ( " %s/fanart " , m_dataDir . c_str ( ) ) ) ;
m_screenshotDir = m_cfg . getString ( " GENERAL " , " dir_screenshot " , fmt ( " %s/screenshots " , m_dataDir . c_str ( ) ) ) ;
m_helpDir = m_cfg . getString ( " GENERAL " , " dir_help " , fmt ( " %s/help " , m_dataDir . c_str ( ) ) ) ;
2012-12-03 21:32:05 +01:00
/* Cache Reload Checks */
u32 ini_rev = m_cfg . getInt ( " GENERAL " , " ini_rev " , 0 ) ;
if ( ini_rev ! = SVN_REV_NUM )
fsop_deleteFolder ( m_listCacheDir . c_str ( ) ) ;
m_cfg . setInt ( " GENERAL " , " ini_rev " , SVN_REV_NUM ) ;
2012-07-18 16:09:28 +02:00
//DeviceHandler::SetWatchdog(m_cfg.getUInt("GENERAL", "watchdog_timeout", 10));
2012-01-21 21:57:41 +01:00
const char * domain = _domainFromView ( ) ;
const char * checkDir = m_current_view = = COVERFLOW_HOMEBREW ? HOMEBREW_DIR : GAMES_DIR ;
2012-03-10 20:02:59 +01:00
2012-01-27 23:28:47 +01:00
u8 partition = m_cfg . getInt ( domain , " partition " , 0 ) ; //Auto find a valid partition and fix old ini partition settings.
2012-09-22 15:47:52 +02:00
if ( m_current_view ! = COVERFLOW_CHANNEL & & ( partition > USB8 | | ! DeviceHandle . IsInserted ( partition ) ) )
2012-01-21 21:57:41 +01:00
{
m_cfg . remove ( domain , " partition " ) ;
for ( int i = SD ; i < = USB8 + 1 ; i + + ) // Find a usb partition with the wbfs folder or wbfs file system, else leave it blank (defaults to 1 later)
{
if ( i > USB8 )
{
m_current_view = COVERFLOW_CHANNEL ;
break ;
}
2012-09-22 15:47:52 +02:00
if ( DeviceHandle . IsInserted ( i )
& & ( ( m_current_view = = COVERFLOW_USB & & DeviceHandle . GetFSType ( i ) = = PART_FS_WBFS )
2012-05-04 14:30:43 +02:00
| | stat ( fmt ( checkDir , DeviceName [ i ] ) , & dummy ) = = 0 ) )
2012-01-21 21:57:41 +01:00
{
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 ( domain , " partition " , i ) ;
break ;
}
}
}
2012-11-11 19:28:03 +01:00
CoverFlow . init ( m_base_font , m_base_font_size , m_vid . vid_50hz ( ) ) ;
2012-01-21 21:57:41 +01:00
2012-11-18 14:40:26 +01:00
/* Create our Folder Structure */
fsop_MakeFolder ( m_dataDir . c_str ( ) ) ; //D'OH!
2012-07-05 18:18:23 +02:00
2012-11-18 14:40:26 +01:00
fsop_MakeFolder ( m_customBnrDir . c_str ( ) ) ;
fsop_MakeFolder ( m_pluginsDir . c_str ( ) ) ;
2012-07-05 18:18:23 +02:00
2012-11-18 14:40:26 +01:00
fsop_MakeFolder ( m_cacheDir . c_str ( ) ) ;
fsop_MakeFolder ( m_listCacheDir . c_str ( ) ) ;
fsop_MakeFolder ( m_bnrCacheDir . c_str ( ) ) ;
2012-07-05 18:18:23 +02:00
2012-11-18 14:40:26 +01:00
fsop_MakeFolder ( m_txtCheatDir . c_str ( ) ) ;
fsop_MakeFolder ( m_cheatDir . c_str ( ) ) ;
fsop_MakeFolder ( m_wipDir . c_str ( ) ) ;
2012-07-05 18:18:23 +02:00
2012-11-18 14:40:26 +01:00
fsop_MakeFolder ( m_settingsDir . c_str ( ) ) ;
fsop_MakeFolder ( m_languagesDir . c_str ( ) ) ;
fsop_MakeFolder ( m_boxPicDir . c_str ( ) ) ;
fsop_MakeFolder ( m_picDir . c_str ( ) ) ;
fsop_MakeFolder ( m_themeDir . c_str ( ) ) ;
fsop_MakeFolder ( m_musicDir . c_str ( ) ) ;
fsop_MakeFolder ( m_videoDir . c_str ( ) ) ;
fsop_MakeFolder ( m_fanartDir . c_str ( ) ) ;
fsop_MakeFolder ( m_screenshotDir . c_str ( ) ) ;
fsop_MakeFolder ( m_helpDir . c_str ( ) ) ;
2012-01-21 21:57:41 +01:00
// INI files
2012-05-04 14:30:43 +02:00
m_cat . load ( fmt ( " %s/ " CAT_FILENAME , m_settingsDir . c_str ( ) ) ) ;
2012-07-29 00:38:46 +02:00
string themeName = m_cfg . getString ( " GENERAL " , " theme " , " default " ) ;
2012-11-18 14:40:26 +01:00
m_themeDataDir = fmt ( " %s/%s " , m_themeDir . c_str ( ) , themeName . c_str ( ) ) ;
2012-05-04 14:30:43 +02:00
m_theme . load ( fmt ( " %s.ini " , m_themeDataDir . c_str ( ) ) ) ;
2012-04-10 19:12:38 +02:00
m_plugin . init ( m_pluginsDir ) ;
2012-07-12 17:53:04 +02:00
m_devo_installed = DEVO_Installed ( m_dataDir . c_str ( ) ) ;
2012-01-21 21:57:41 +01:00
u8 defaultMenuLanguage = 7 ; //English
switch ( CONF_GetLanguage ( ) )
{
case CONF_LANG_JAPANESE :
defaultMenuLanguage = 14 ; //Japanese
break ;
case CONF_LANG_GERMAN :
defaultMenuLanguage = 11 ; //German
break ;
case CONF_LANG_FRENCH :
defaultMenuLanguage = 9 ; //French
break ;
case CONF_LANG_SPANISH :
defaultMenuLanguage = 19 ; //Spanish
break ;
case CONF_LANG_ITALIAN :
defaultMenuLanguage = 13 ; //Italian
break ;
case CONF_LANG_DUTCH :
defaultMenuLanguage = 6 ; //Dutch
break ;
case CONF_LANG_SIMP_CHINESE :
defaultMenuLanguage = 3 ; //Chinese_S
break ;
case CONF_LANG_TRAD_CHINESE :
defaultMenuLanguage = 4 ; //Chinese_T
break ;
case CONF_LANG_KOREAN :
defaultMenuLanguage = 7 ; // No Korean translation has been done for wiiflow, so the menu will use english in this case.
break ;
}
if ( CONF_GetArea ( ) = = CONF_AREA_BRA )
defaultMenuLanguage = 2 ; //Brazilian
m_curLanguage = CMenu : : _translations [ m_cfg . getInt ( " GENERAL " , " language " , defaultMenuLanguage ) ] ;
2012-05-04 14:30:43 +02:00
if ( ! m_loc . load ( fmt ( " %s/%s.ini " , m_languagesDir . c_str ( ) , m_curLanguage . c_str ( ) ) ) )
2012-01-21 21:57:41 +01:00
{
m_cfg . setInt ( " GENERAL " , " language " , 0 ) ;
m_curLanguage = CMenu : : _translations [ 0 ] ;
2012-05-04 14:30:43 +02:00
m_loc . load ( fmt ( " %s/%s.ini " , m_languagesDir . c_str ( ) , m_curLanguage . c_str ( ) ) ) ;
2012-01-21 21:57:41 +01:00
}
2012-06-07 02:34:47 +02:00
m_tempView = false ;
2012-10-03 23:34:37 +02:00
2012-10-04 13:37:53 +02:00
m_gameList . Init ( m_settingsDir . c_str ( ) , m_loc . getString ( m_curLanguage , " gametdb_code " , " EN " ) . c_str ( ) ) ;
2012-01-21 21:57:41 +01:00
m_aa = 3 ;
CColor pShadowColor = m_theme . getColor ( " GENERAL " , " pointer_shadow_color " , CColor ( 0x3F000000 ) ) ;
float pShadowX = m_theme . getFloat ( " GENERAL " , " pointer_shadow_x " , 3.f ) ;
float pShadowY = m_theme . getFloat ( " GENERAL " , " pointer_shadow_y " , 3.f ) ;
bool pShadowBlur = m_theme . getBool ( " GENERAL " , " pointer_shadow_blur " , false ) ;
for ( int chan = WPAD_MAX_WIIMOTES - 2 ; chan > = 0 ; chan - - )
{
2012-05-04 14:30:43 +02:00
m_cursor [ chan ] . init ( fmt ( " %s/%s " , m_themeDataDir . c_str ( ) , m_theme . getString ( " GENERAL " , fmt ( " pointer%i " , chan + 1 ) ) . c_str ( ) ) ,
2012-01-21 21:57:41 +01:00
m_vid . wide ( ) , pShadowColor , pShadowX , pShadowY , pShadowBlur , chan ) ;
WPAD_SetVRes ( chan , m_vid . width ( ) + m_cursor [ chan ] . width ( ) , m_vid . height ( ) + m_cursor [ chan ] . height ( ) ) ;
}
2012-07-12 17:53:04 +02:00
2012-11-11 19:28:03 +01:00
m_btnMgr . init ( ) ;
2012-11-18 14:40:26 +01:00
MusicPlayer . Init ( m_cfg , m_musicDir , fmt ( " %s/music " , m_themeDataDir . c_str ( ) ) ) ;
2012-09-29 13:41:47 +02:00
m_music_info = m_cfg . getBool ( " GENERAL " , " display_music_info " , true ) ;
2012-01-21 21:57:41 +01:00
_buildMenus ( ) ;
m_locked = m_cfg . getString ( " GENERAL " , " parent_code " , " " ) . size ( ) > = 4 ;
2012-04-29 20:44:13 +02:00
m_btnMgr . setRumble ( m_cfg . getBool ( " GENERAL " , " rumble " , true ) ) ;
2012-01-21 21:57:41 +01:00
int exit_to = m_cfg . getInt ( " GENERAL " , " exit_to " , 0 ) ;
2012-09-22 15:47:52 +02:00
if ( exit_to = = EXIT_TO_BOOTMII & & ( ! DeviceHandle . IsInserted ( SD ) | |
2012-05-04 14:30:43 +02:00
stat ( fmt ( " %s:/bootmii/armboot.bin " , DeviceName [ SD ] ) , & dummy ) ! = 0 | |
stat ( fmt ( " %s:/bootmii/ppcboot.elf " , DeviceName [ SD ] ) , & dummy ) ! = 0 ) )
2012-01-21 21:57:41 +01:00
exit_to = EXIT_TO_HBC ;
Sys_ExitTo ( exit_to ) ;
LWP_MutexInit ( & m_mutex , 0 ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setSoundVolume ( m_cfg . getInt ( " GENERAL " , " sound_volume_coverflow " , 255 ) ) ;
2012-01-21 21:57:41 +01:00
m_btnMgr . setSoundVolume ( m_cfg . getInt ( " GENERAL " , " sound_volume_gui " , 255 ) ) ;
m_bnrSndVol = m_cfg . getInt ( " GENERAL " , " sound_volume_bnr " , 255 ) ;
2012-07-10 14:02:06 +02:00
m_bnr_settings = m_cfg . getBool ( " GENERAL " , " banner_in_settings " , true ) ;
2012-02-18 14:51:55 +01:00
m_cfg . setString ( " GAMERCARD " , " gamercards " , " wiinnertag|dutag " ) ;
m_cfg . getString ( " GAMERCARD " , " wiinnertag_url " , WIINNERTAG_URL ) ;
m_cfg . getString ( " GAMERCARD " , " wiinnertag_key " , " " ) ;
m_cfg . getString ( " GAMERCARD " , " dutag_url " , DUTAG_URL ) ;
m_cfg . getString ( " GAMERCARD " , " dutag_key " , " " ) ;
if ( m_cfg . getBool ( " GAMERCARD " , " gamercards_enable " , false ) )
2012-01-21 21:57:41 +01:00
{
2012-05-06 14:03:43 +02:00
vector < string > gamercards = stringToVector ( m_cfg . getString ( " GAMERCARD " , " gamercards " ) , ' | ' ) ;
2012-02-18 14:51:55 +01:00
if ( gamercards . size ( ) = = 0 )
{
gamercards . push_back ( " wiinnertag " ) ;
gamercards . push_back ( " dutag " ) ;
}
2012-01-21 21:57:41 +01:00
2012-05-06 14:03:43 +02:00
for ( vector < string > : : iterator itr = gamercards . begin ( ) ; itr ! = gamercards . end ( ) ; itr + + )
2012-02-18 14:51:55 +01:00
{
gprintf ( " Found gamercard provider: %s \n " , ( * itr ) . c_str ( ) ) ;
register_card_provider (
2012-05-04 14:30:43 +02:00
m_cfg . getString ( " GAMERCARD " , fmt ( " %s_url " , ( * itr ) . c_str ( ) ) ) . c_str ( ) ,
m_cfg . getString ( " GAMERCARD " , fmt ( " %s_key " , ( * itr ) . c_str ( ) ) ) . c_str ( )
2012-02-18 14:51:55 +01:00
) ;
}
2012-01-21 21:57:41 +01:00
}
}
2012-05-22 22:08:56 +02:00
bool cleaned_up = false ;
2012-08-24 20:01:40 +02:00
void CMenu : : cleanup ( )
2012-01-21 21:57:41 +01:00
{
2012-05-22 22:08:56 +02:00
if ( cleaned_up )
return ;
2012-09-16 15:41:31 +02:00
//gprintf("MEM1_freesize(): %i\nMEM2_freesize(): %i\n", MEM1_freesize(), MEM2_freesize());
m_btnMgr . hide ( m_mainLblCurMusic ) ;
2012-07-08 15:35:59 +02:00
_cleanupDefaultFont ( ) ;
2012-10-13 18:57:03 +02:00
m_banner . DeleteBanner ( ) ;
2012-05-16 23:52:14 +02:00
m_plugin . Cleanup ( ) ;
2012-01-21 21:57:41 +01:00
_stopSounds ( ) ;
2012-11-03 20:16:03 +01:00
_Theme_Cleanup ( ) ;
2012-09-22 15:47:52 +02:00
MusicPlayer . Cleanup ( ) ;
2012-11-03 20:16:03 +01:00
m_gameSound . FreeMemory ( ) ;
2012-10-15 21:16:14 +02:00
SoundHandle . Cleanup ( ) ;
2012-01-21 21:57:41 +01:00
soundDeinit ( ) ;
2012-05-09 20:47:25 +02:00
2012-08-13 18:30:34 +02:00
m_vid . cleanup ( ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . shutdown ( ) ;
2012-07-21 19:05:58 +02:00
2012-07-08 15:35:59 +02:00
wiiLightOff ( ) ;
LWP_MutexDestroy ( m_mutex ) ;
m_mutex = 0 ;
2012-05-13 17:13:33 +02:00
2012-05-22 22:08:56 +02:00
cleaned_up = true ;
2012-09-16 15:41:31 +02:00
//gprintf(" \nMemory cleaned up\n");
2012-07-18 16:09:28 +02:00
gprintf ( " MEM1_freesize(): %i \n MEM2_freesize(): %i \n " , MEM1_freesize ( ) , MEM2_freesize ( ) ) ;
2012-05-12 19:14:25 +02:00
}
2012-11-03 20:16:03 +01:00
void CMenu : : _Theme_Cleanup ( void )
{
2012-11-04 20:22:02 +01:00
/* Backgrounds */
2012-12-28 15:19:40 +01:00
TexHandle . Cleanup ( theme . bg ) ;
2012-11-29 21:30:05 +01:00
m_prevBg = NULL ;
2012-11-16 23:00:20 +01:00
m_nextBg = NULL ;
2012-12-28 15:19:40 +01:00
TexHandle . Cleanup ( m_curBg ) ;
2012-11-16 23:40:20 +01:00
m_lqBg = NULL ;
2012-11-04 20:22:02 +01:00
/* Buttons */
2012-12-28 15:19:40 +01:00
TexHandle . Cleanup ( theme . btnTexL ) ;
TexHandle . Cleanup ( theme . btnTexR ) ;
TexHandle . Cleanup ( theme . btnTexC ) ;
TexHandle . Cleanup ( theme . btnTexLS ) ;
TexHandle . Cleanup ( theme . btnTexRS ) ;
TexHandle . Cleanup ( theme . btnTexCS ) ;
TexHandle . Cleanup ( theme . btnTexLH ) ;
TexHandle . Cleanup ( theme . btnTexRH ) ;
TexHandle . Cleanup ( theme . btnTexCH ) ;
TexHandle . Cleanup ( theme . btnTexLSH ) ;
TexHandle . Cleanup ( theme . btnTexRSH ) ;
TexHandle . Cleanup ( theme . btnTexCSH ) ;
TexHandle . Cleanup ( theme . btnAUOn ) ;
TexHandle . Cleanup ( theme . btnAUOns ) ;
TexHandle . Cleanup ( theme . btnAUOff ) ;
TexHandle . Cleanup ( theme . btnAUOffs ) ;
TexHandle . Cleanup ( theme . btnENOn ) ;
TexHandle . Cleanup ( theme . btnENOns ) ;
TexHandle . Cleanup ( theme . btnENOff ) ;
TexHandle . Cleanup ( theme . btnENOffs ) ;
TexHandle . Cleanup ( theme . btnJAOn ) ;
TexHandle . Cleanup ( theme . btnJAOns ) ;
TexHandle . Cleanup ( theme . btnJAOff ) ;
TexHandle . Cleanup ( theme . btnJAOffs ) ;
TexHandle . Cleanup ( theme . btnFROn ) ;
TexHandle . Cleanup ( theme . btnFROns ) ;
TexHandle . Cleanup ( theme . btnFROff ) ;
TexHandle . Cleanup ( theme . btnFROffs ) ;
TexHandle . Cleanup ( theme . btnDEOn ) ;
TexHandle . Cleanup ( theme . btnDEOns ) ;
TexHandle . Cleanup ( theme . btnDEOff ) ;
TexHandle . Cleanup ( theme . btnDEOffs ) ;
TexHandle . Cleanup ( theme . btnESOn ) ;
TexHandle . Cleanup ( theme . btnESOns ) ;
TexHandle . Cleanup ( theme . btnESOff ) ;
TexHandle . Cleanup ( theme . btnESOffs ) ;
TexHandle . Cleanup ( theme . btnITOn ) ;
TexHandle . Cleanup ( theme . btnITOns ) ;
TexHandle . Cleanup ( theme . btnITOff ) ;
TexHandle . Cleanup ( theme . btnITOffs ) ;
TexHandle . Cleanup ( theme . btnNLOn ) ;
TexHandle . Cleanup ( theme . btnNLOns ) ;
TexHandle . Cleanup ( theme . btnNLOff ) ;
TexHandle . Cleanup ( theme . btnNLOffs ) ;
TexHandle . Cleanup ( theme . btnPTOn ) ;
TexHandle . Cleanup ( theme . btnPTOns ) ;
TexHandle . Cleanup ( theme . btnPTOff ) ;
TexHandle . Cleanup ( theme . btnPTOffs ) ;
TexHandle . Cleanup ( theme . btnRUOn ) ;
TexHandle . Cleanup ( theme . btnRUOns ) ;
TexHandle . Cleanup ( theme . btnRUOff ) ;
TexHandle . Cleanup ( theme . btnRUOffs ) ;
TexHandle . Cleanup ( theme . btnKOOn ) ;
TexHandle . Cleanup ( theme . btnKOOns ) ;
TexHandle . Cleanup ( theme . btnKOOff ) ;
TexHandle . Cleanup ( theme . btnKOOffs ) ;
TexHandle . Cleanup ( theme . btnZHCNOn ) ;
TexHandle . Cleanup ( theme . btnZHCNOns ) ;
TexHandle . Cleanup ( theme . btnZHCNOff ) ;
TexHandle . Cleanup ( theme . btnZHCNOffs ) ;
TexHandle . Cleanup ( theme . btnTexPlus ) ;
TexHandle . Cleanup ( theme . btnTexPlusS ) ;
TexHandle . Cleanup ( theme . btnTexMinus ) ;
TexHandle . Cleanup ( theme . btnTexMinusS ) ;
2012-11-04 20:22:02 +01:00
/* Checkboxes */
2012-12-28 15:19:40 +01:00
TexHandle . Cleanup ( theme . checkboxoff ) ;
TexHandle . Cleanup ( theme . checkboxoffs ) ;
TexHandle . Cleanup ( theme . checkboxon ) ;
TexHandle . Cleanup ( theme . checkboxons ) ;
TexHandle . Cleanup ( theme . checkboxHid ) ;
TexHandle . Cleanup ( theme . checkboxHids ) ;
TexHandle . Cleanup ( theme . checkboxReq ) ;
TexHandle . Cleanup ( theme . checkboxReqs ) ;
2012-11-04 20:22:02 +01:00
/* Progress Bars */
2012-12-28 15:19:40 +01:00
TexHandle . Cleanup ( theme . pbarTexL ) ;
TexHandle . Cleanup ( theme . pbarTexR ) ;
TexHandle . Cleanup ( theme . pbarTexC ) ;
TexHandle . Cleanup ( theme . pbarTexLS ) ;
TexHandle . Cleanup ( theme . pbarTexRS ) ;
TexHandle . Cleanup ( theme . pbarTexCS ) ;
2012-11-04 20:22:02 +01:00
/* Other Theme Stuff */
2012-11-03 20:16:03 +01:00
for ( TexSet : : iterator texture = theme . texSet . begin ( ) ; texture ! = theme . texSet . end ( ) ; + + texture )
2012-12-28 15:19:40 +01:00
TexHandle . Cleanup ( texture - > second ) ;
2012-11-03 20:16:03 +01:00
for ( FontSet : : iterator font = theme . fontSet . begin ( ) ; font ! = theme . fontSet . end ( ) ; + + font )
font - > second . ClearData ( ) ;
for ( SoundSet : : iterator sound = theme . soundSet . begin ( ) ; sound ! = theme . soundSet . end ( ) ; + + sound )
sound - > second - > FreeMemory ( ) ;
theme . texSet . clear ( ) ;
theme . fontSet . clear ( ) ;
theme . soundSet . clear ( ) ;
}
2012-12-08 17:17:35 +01:00
void CMenu : : _netInit ( void )
2012-05-12 19:14:25 +02:00
{
2012-12-22 21:57:23 +01:00
if ( networkInit | | ! init_network | | m_exit )
2012-12-08 17:17:35 +01:00
return ;
_initAsyncNetwork ( ) ;
while ( net_get_status ( ) = = - EBUSY )
usleep ( 100 ) ;
2012-01-21 21:57:41 +01:00
}
void CMenu : : _setAA ( int aa )
{
switch ( aa )
{
case 2 :
case 3 :
case 4 :
case 5 :
case 6 :
case 8 :
m_aa = aa ;
break ;
case 7 :
m_aa = 6 ;
break ;
default :
m_aa = 0 ;
}
}
2012-11-03 20:16:03 +01:00
void CMenu : : _loadCFCfg ( )
2012-01-21 21:57:41 +01:00
{
const char * domain = " _COVERFLOW " ;
//gprintf("Preparing to load sounds from %s\n", m_themeDataDir.c_str());
2012-11-11 19:28:03 +01:00
CoverFlow . setCachePath ( m_cacheDir . c_str ( ) , ! m_cfg . getBool ( " GENERAL " , " keep_png " , true ) , m_cfg . getBool ( " GENERAL " , " compress_cache " , false ) ) ;
CoverFlow . setBufferSize ( m_cfg . getInt ( " GENERAL " , " cover_buffer " , 20 ) ) ;
2012-01-21 21:57:41 +01:00
// Coverflow Sounds
2012-11-11 19:28:03 +01:00
CoverFlow . setSounds (
2012-11-04 15:13:42 +01:00
new GuiSound ( fmt ( " %s/%s " , m_themeDataDir . c_str ( ) , m_theme . getString ( domain , " sound_flip " ) . c_str ( ) ) ) ,
_sound ( theme . soundSet , domain , " sound_hover " , hover_wav , hover_wav_size , " default_btn_hover " , false ) ,
_sound ( theme . soundSet , domain , " sound_select " , click_wav , click_wav_size , " default_btn_click " , false ) ,
new GuiSound ( fmt ( " %s/%s " , m_themeDataDir . c_str ( ) , m_theme . getString ( domain , " sound_cancel " ) . c_str ( ) ) )
2012-01-21 21:57:41 +01:00
) ;
// Textures
2012-11-18 14:40:26 +01:00
string texLoading = fmt ( " %s/%s " , m_themeDataDir . c_str ( ) , m_theme . getString ( domain , " loading_cover_box " ) . c_str ( ) ) ;
string texNoCover = fmt ( " %s/%s " , m_themeDataDir . c_str ( ) , m_theme . getString ( domain , " missing_cover_box " ) . c_str ( ) ) ;
string texLoadingFlat = fmt ( " %s/%s " , m_themeDataDir . c_str ( ) , m_theme . getString ( domain , " loading_cover_flat " ) . c_str ( ) ) ;
string texNoCoverFlat = fmt ( " %s/%s " , m_themeDataDir . c_str ( ) , m_theme . getString ( domain , " missing_cover_flat " ) . c_str ( ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setTextures ( texLoading , texLoadingFlat , texNoCover , texNoCoverFlat ) ;
2012-01-21 21:57:41 +01:00
// Font
2012-11-11 19:28:03 +01:00
CoverFlow . setFont ( _font ( theme . fontSet , domain , " font " , TITLEFONT ) , m_theme . getColor ( domain , " font_color " , CColor ( 0xFFFFFFFF ) ) ) ;
2012-02-17 19:51:03 +01:00
// Coverflow Count
m_numCFVersions = min ( max ( 2 , m_theme . getInt ( " _COVERFLOW " , " number_of_modes " , 2 ) ) , 15 ) ;
2012-01-21 21:57:41 +01:00
}
Vector3D CMenu : : _getCFV3D ( const string & domain , const string & key , const Vector3D & def , bool otherScrnFmt )
{
string key169 ( key ) ;
string key43 ( key ) ;
key43 + = " _4_3 " ;
if ( m_vid . wide ( ) = = otherScrnFmt )
swap ( key169 , key43 ) ;
if ( m_theme . has ( domain , key169 ) )
{
Vector3D v ( m_theme . getVector3D ( domain , key169 ) ) ;
m_theme . getVector3D ( domain , key43 , v ) ;
return v ;
}
return m_theme . getVector3D ( domain , key169 , m_theme . getVector3D ( domain , key43 , def ) ) ;
}
int CMenu : : _getCFInt ( const string & domain , const string & key , int def , bool otherScrnFmt )
{
string key169 ( key ) ;
string key43 ( key ) ;
key43 + = " _4_3 " ;
if ( m_vid . wide ( ) = = otherScrnFmt )
swap ( key169 , key43 ) ;
if ( m_theme . has ( domain , key169 ) )
{
int v = m_theme . getInt ( domain , key169 ) ;
m_theme . getInt ( domain , key43 , v ) ;
return v ;
}
return m_theme . getInt ( domain , key169 , m_theme . getInt ( domain , key43 , def ) ) ;
}
float CMenu : : _getCFFloat ( const string & domain , const string & key , float def , bool otherScrnFmt )
{
string key169 ( key ) ;
string key43 ( key ) ;
key43 + = " _4_3 " ;
if ( m_vid . wide ( ) = = otherScrnFmt )
swap ( key169 , key43 ) ;
if ( m_theme . has ( domain , key169 ) )
{
float v = m_theme . getFloat ( domain , key169 ) ;
m_theme . getFloat ( domain , key43 , v ) ;
return v ;
}
return m_theme . getFloat ( domain , key169 , m_theme . getFloat ( domain , key43 , def ) ) ;
}
void CMenu : : _loadCFLayout ( int version , bool forceAA , bool otherScrnFmt )
{
2012-04-08 17:54:34 +02:00
bool homebrew = m_current_view = = COVERFLOW_HOMEBREW ;
2012-10-03 23:34:37 +02:00
bool smallbox = ( homebrew | | m_current_view = = COVERFLOW_PLUGIN ) & & m_cfg . getBool ( _domainFromView ( ) , " smallbox " , true ) ;
string domain ( homebrew ? fmt ( " _BREWFLOW_%i " , version ) : m_current_view = = COVERFLOW_PLUGIN ? fmt ( " _EMUFLOW_%i " , version ) : fmt ( " _COVERFLOW_%i " , version ) ) ;
string domainSel ( homebrew ? fmt ( " _BREWFLOW_%i_S " , version ) : m_current_view = = COVERFLOW_PLUGIN ? fmt ( " _EMUFLOW_%i_S " , version ) : fmt ( " _COVERFLOW_%i_S " , version ) ) ;
2012-01-21 21:57:41 +01:00
bool sf = otherScrnFmt ;
2012-04-08 17:54:34 +02:00
int max_fsaa = m_theme . getInt ( domain , " max_fsaa " , 3 ) ;
_setAA ( forceAA ? max_fsaa : min ( max_fsaa , m_cfg . getInt ( " GENERAL " , " max_fsaa " , 3 ) ) ) ;
2012-01-21 21:57:41 +01:00
2012-11-11 19:28:03 +01:00
CoverFlow . setTextureQuality ( m_theme . getFloat ( domain , " tex_lod_bias " , - 3.f ) ,
2012-01-21 21:57:41 +01:00
m_theme . getInt ( domain , " tex_aniso " , 2 ) ,
m_theme . getBool ( domain , " tex_edge_lod " , true ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setRange ( _getCFInt ( domain , " rows " , ( smallbox & & homebrew ) ? 5 : 1 , sf ) , _getCFInt ( domain , " columns " , 9 , sf ) ) ;
2012-01-21 21:57:41 +01:00
2012-11-11 19:28:03 +01:00
CoverFlow . setCameraPos ( false ,
2012-01-21 21:57:41 +01:00
_getCFV3D ( domain , " camera_pos " , Vector3D ( 0.f , 1.5f , 5.f ) , sf ) ,
_getCFV3D ( domain , " camera_aim " , Vector3D ( 0.f , 0.f , - 1.f ) , sf ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setCameraPos ( true ,
2012-01-21 21:57:41 +01:00
_getCFV3D ( domainSel , " camera_pos " , Vector3D ( 0.f , 1.5f , 5.f ) , sf ) ,
_getCFV3D ( domainSel , " camera_aim " , Vector3D ( 0.f , 0.f , - 1.f ) , sf ) ) ;
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setCameraOsc ( false ,
2012-01-21 21:57:41 +01:00
_getCFV3D ( domain , " camera_osc_speed " , Vector3D ( 2.f , 1.1f , 1.3f ) , sf ) ,
_getCFV3D ( domain , " camera_osc_amp " , Vector3D ( 0.1f , 0.2f , 0.1f ) , sf ) ) ;
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setCameraOsc ( true ,
2012-04-08 17:54:34 +02:00
_getCFV3D ( domainSel , " camera_osc_speed " , Vector3D ( ) , sf ) ,
_getCFV3D ( domainSel , " camera_osc_amp " , Vector3D ( ) , sf ) ) ;
float def_cvr_posX = ( smallbox & & homebrew ) ? 1.f : 1.6f ;
float def_cvr_posY = ( smallbox & & homebrew ) ? - 0.6f : 0.f ;
2012-11-11 19:28:03 +01:00
CoverFlow . setCoverPos ( false ,
2012-04-08 17:54:34 +02:00
_getCFV3D ( domain , " left_pos " , Vector3D ( - def_cvr_posX , def_cvr_posY , 0.f ) , sf ) ,
_getCFV3D ( domain , " right_pos " , Vector3D ( def_cvr_posX , def_cvr_posY , 0.f ) , sf ) ,
_getCFV3D ( domain , " center_pos " , Vector3D ( 0.f , def_cvr_posY , 1.f ) , sf ) ,
_getCFV3D ( domain , " row_center_pos " , Vector3D ( 0.f , def_cvr_posY , 0.f ) , sf ) ) ;
def_cvr_posX = ( smallbox & & homebrew ) ? 1.f : 4.6f ;
float def_cvr_posX1 = ( smallbox & & homebrew ) ? 0.f : - 0.6f ;
2012-11-11 19:28:03 +01:00
CoverFlow . setCoverPos ( true ,
2012-04-08 17:54:34 +02:00
_getCFV3D ( domainSel , " left_pos " , Vector3D ( - def_cvr_posX , def_cvr_posY , 0.f ) , sf ) ,
_getCFV3D ( domainSel , " right_pos " , Vector3D ( def_cvr_posX , def_cvr_posY , 0.f ) , sf ) ,
_getCFV3D ( domainSel , " center_pos " , Vector3D ( def_cvr_posX1 , 0.f , 2.6f ) , sf ) ,
_getCFV3D ( domainSel , " row_center_pos " , Vector3D ( 0.f , def_cvr_posY , 0.f ) , sf ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setCoverAngleOsc ( false ,
2012-01-21 21:57:41 +01:00
m_theme . getVector3D ( domain , " cover_osc_speed " , Vector3D ( 2.f , 2.f , 0.f ) ) ,
m_theme . getVector3D ( domain , " cover_osc_amp " , Vector3D ( 5.f , 10.f , 0.f ) ) ) ;
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setCoverAngleOsc ( true ,
2012-01-21 21:57:41 +01:00
m_theme . getVector3D ( domainSel , " cover_osc_speed " , Vector3D ( 2.1f , 2.1f , 0.f ) ) ,
m_theme . getVector3D ( domainSel , " cover_osc_amp " , Vector3D ( 2.f , 5.f , 0.f ) ) ) ;
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setCoverPosOsc ( false ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domain , " cover_pos_osc_speed " ) ,
m_theme . getVector3D ( domain , " cover_pos_osc_amp " ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setCoverPosOsc ( true ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domainSel , " cover_pos_osc_speed " ) ,
m_theme . getVector3D ( domainSel , " cover_pos_osc_amp " ) ) ;
float spacerX = ( smallbox & & homebrew ) ? 1.f : 0.35f ;
2012-11-11 19:28:03 +01:00
CoverFlow . setSpacers ( false ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domain , " left_spacer " , Vector3D ( - spacerX , 0.f , 0.f ) ) ,
m_theme . getVector3D ( domain , " right_spacer " , Vector3D ( spacerX , 0.f , 0.f ) ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setSpacers ( true ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domainSel , " left_spacer " , Vector3D ( - spacerX , 0.f , 0.f ) ) ,
m_theme . getVector3D ( domainSel , " right_spacer " , Vector3D ( spacerX , 0.f , 0.f ) ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setDeltaAngles ( false ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domain , " left_delta_angle " ) ,
m_theme . getVector3D ( domain , " right_delta_angle " ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setDeltaAngles ( true ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domainSel , " left_delta_angle " ) ,
m_theme . getVector3D ( domainSel , " right_delta_angle " ) ) ;
float angleY = ( smallbox & & homebrew ) ? 0.f : 70.f ;
2012-11-11 19:28:03 +01:00
CoverFlow . setAngles ( false ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domain , " left_angle " , Vector3D ( 0.f , angleY , 0.f ) ) ,
m_theme . getVector3D ( domain , " right_angle " , Vector3D ( 0.f , - angleY , 0.f ) ) ,
m_theme . getVector3D ( domain , " center_angle " ) ,
m_theme . getVector3D ( domain , " row_center_angle " ) ) ;
angleY = ( smallbox & & homebrew ) ? 0.f : 90.f ;
float angleY1 = ( smallbox & & homebrew ) ? 0.f : 380.f ;
float angleX = ( smallbox & & homebrew ) ? 0.f : - 45.f ;
2012-11-11 19:28:03 +01:00
CoverFlow . setAngles ( true ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domainSel , " left_angle " , Vector3D ( angleX , angleY , 0.f ) ) ,
m_theme . getVector3D ( domainSel , " right_angle " , Vector3D ( angleX , - angleY , 0.f ) ) ,
m_theme . getVector3D ( domainSel , " center_angle " , Vector3D ( 0.f , angleY1 , 0.f ) ) ,
m_theme . getVector3D ( domainSel , " row_center_angle " ) ) ;
angleX = smallbox ? 0.f : 55.f ;
2012-11-11 19:28:03 +01:00
CoverFlow . setTitleAngles ( false ,
2012-04-08 17:54:34 +02:00
_getCFFloat ( domain , " text_left_angle " , - angleX , sf ) ,
_getCFFloat ( domain , " text_right_angle " , angleX , sf ) ,
2012-01-21 21:57:41 +01:00
_getCFFloat ( domain , " text_center_angle " , 0.f , sf ) ) ;
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setTitleAngles ( true ,
2012-04-08 17:54:34 +02:00
_getCFFloat ( domainSel , " text_left_angle " , - angleX , sf ) ,
_getCFFloat ( domainSel , " text_right_angle " , angleX , sf ) ,
2012-01-21 21:57:41 +01:00
_getCFFloat ( domainSel , " text_center_angle " , 0.f , sf ) ) ;
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setTitlePos ( false ,
2012-01-21 21:57:41 +01:00
_getCFV3D ( domain , " text_left_pos " , Vector3D ( - 4.f , 0.f , 1.3f ) , sf ) ,
_getCFV3D ( domain , " text_right_pos " , Vector3D ( 4.f , 0.f , 1.3f ) , sf ) ,
_getCFV3D ( domain , " text_center_pos " , Vector3D ( 0.f , 0.f , 2.6f ) , sf ) ) ;
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setTitlePos ( true ,
2012-01-21 21:57:41 +01:00
_getCFV3D ( domainSel , " text_left_pos " , Vector3D ( - 4.f , 0.f , 1.3f ) , sf ) ,
_getCFV3D ( domainSel , " text_right_pos " , Vector3D ( 4.f , 0.f , 1.3f ) , sf ) ,
_getCFV3D ( domainSel , " text_center_pos " , Vector3D ( 1.7f , 1.8f , 1.6f ) , sf ) ) ;
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setTitleWidth ( false ,
2012-01-21 21:57:41 +01:00
_getCFFloat ( domain , " text_side_wrap_width " , 500.f , sf ) ,
_getCFFloat ( domain , " text_center_wrap_width " , 500.f , sf ) ) ;
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setTitleWidth ( true ,
2012-01-21 21:57:41 +01:00
_getCFFloat ( domainSel , " text_side_wrap_width " , 500.f , sf ) ,
_getCFFloat ( domainSel , " text_center_wrap_width " , 310.f , sf ) ) ;
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setTitleStyle ( false ,
2012-04-08 17:54:34 +02:00
_textStyle ( domain . c_str ( ) , " text_side_style " , FTGX_ALIGN_MIDDLE | FTGX_JUSTIFY_CENTER ) ,
_textStyle ( domain . c_str ( ) , " text_center_style " , FTGX_ALIGN_MIDDLE | FTGX_JUSTIFY_CENTER ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setTitleStyle ( true ,
2012-04-08 17:54:34 +02:00
_textStyle ( domainSel . c_str ( ) , " text_side_style " , FTGX_ALIGN_MIDDLE | FTGX_JUSTIFY_CENTER ) ,
2012-01-21 21:57:41 +01:00
_textStyle ( domainSel . c_str ( ) , " text_center_style " , FTGX_ALIGN_TOP | FTGX_JUSTIFY_RIGHT ) ) ;
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setColors ( false ,
2012-01-21 21:57:41 +01:00
m_theme . getColor ( domain , " color_beg " , 0xCFFFFFFF ) ,
m_theme . getColor ( domain , " color_end " , 0x3FFFFFFF ) ,
m_theme . getColor ( domain , " color_off " , 0x7FFFFFFF ) ) ;
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setColors ( true ,
2012-01-21 21:57:41 +01:00
m_theme . getColor ( domainSel , " color_beg " , 0x7FFFFFFF ) ,
m_theme . getColor ( domainSel , " color_end " , 0x1FFFFFFF ) ,
m_theme . getColor ( domain , " color_off " , 0x7FFFFFFF ) ) ; // Mouse not used once a selection has been made
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setMirrorAlpha ( m_theme . getFloat ( domain , " mirror_alpha " , 0.25f ) , m_theme . getFloat ( domain , " title_mirror_alpha " , 0.2f ) ) ; // Doesn't depend on selection
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setMirrorBlur ( m_theme . getBool ( domain , " mirror_blur " , true ) ) ; // Doesn't depend on selection
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setShadowColors ( false ,
2012-01-21 21:57:41 +01:00
m_theme . getColor ( domain , " color_shadow_center " , 0x00000000 ) ,
m_theme . getColor ( domain , " color_shadow_beg " , 0x00000000 ) ,
m_theme . getColor ( domain , " color_shadow_end " , 0x00000000 ) ,
m_theme . getColor ( domain , " color_shadow_off " , 0x00000000 ) ) ;
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setShadowColors ( true ,
2012-01-21 21:57:41 +01:00
m_theme . getColor ( domainSel , " color_shadow_center " , 0x0000007F ) ,
m_theme . getColor ( domainSel , " color_shadow_beg " , 0x0000007F ) ,
m_theme . getColor ( domainSel , " color_shadow_end " , 0x0000007F ) ,
m_theme . getColor ( domainSel , " color_shadow_off " , 0x0000007F ) ) ;
2012-04-08 17:54:34 +02:00
2012-11-11 19:28:03 +01:00
CoverFlow . setShadowPos ( m_theme . getFloat ( domain , " shadow_scale " , 1.1f ) ,
2012-04-08 17:54:34 +02:00
m_theme . getFloat ( domain , " shadow_x " ) ,
m_theme . getFloat ( domain , " shadow_y " ) ) ;
float spacerY = ( smallbox & & homebrew ) ? 0.60f : 2.f ;
2012-11-11 19:28:03 +01:00
CoverFlow . setRowSpacers ( false ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domain , " top_spacer " , Vector3D ( 0.f , spacerY , 0.f ) ) ,
m_theme . getVector3D ( domain , " bottom_spacer " , Vector3D ( 0.f , - spacerY , 0.f ) ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setRowSpacers ( true ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domainSel , " top_spacer " , Vector3D ( 0.f , spacerY , 0.f ) ) ,
m_theme . getVector3D ( domainSel , " bottom_spacer " , Vector3D ( 0.f , - spacerY , 0.f ) ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setRowDeltaAngles ( false ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domain , " top_delta_angle " ) ,
m_theme . getVector3D ( domain , " bottom_delta_angle " ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setRowDeltaAngles ( true ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domainSel , " top_delta_angle " ) ,
m_theme . getVector3D ( domainSel , " bottom_delta_angle " ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setRowAngles ( false ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domain , " top_angle " ) ,
m_theme . getVector3D ( domain , " bottom_angle " ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setRowAngles ( true ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domainSel , " top_angle " ) ,
m_theme . getVector3D ( domainSel , " bottom_angle " ) ) ;
Vector3D def_cvr_scale =
smallbox
? ( homebrew
? Vector3D ( 0.667f , 0.25f , 1.f )
: Vector3D ( 1.f , 0.5f , 1.f ) )
: Vector3D ( 1.f , 1.f , 1.f ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setCoverScale ( false ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domain , " left_scale " , def_cvr_scale ) ,
m_theme . getVector3D ( domain , " right_scale " , def_cvr_scale ) ,
m_theme . getVector3D ( domain , " center_scale " , def_cvr_scale ) ,
m_theme . getVector3D ( domain , " row_center_scale " , def_cvr_scale ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setCoverScale ( true ,
2012-04-08 17:54:34 +02:00
m_theme . getVector3D ( domainSel , " left_scale " , def_cvr_scale ) ,
m_theme . getVector3D ( domainSel , " right_scale " , def_cvr_scale ) ,
m_theme . getVector3D ( domainSel , " center_scale " , def_cvr_scale ) ,
m_theme . getVector3D ( domainSel , " row_center_scale " , def_cvr_scale ) ) ;
float flipX = ( smallbox & & homebrew ) ? 359.f : 180.f ;
2012-11-11 19:28:03 +01:00
CoverFlow . setCoverFlipping (
2012-04-08 17:54:34 +02:00
_getCFV3D ( domainSel , " flip_pos " , Vector3D ( ) , sf ) ,
_getCFV3D ( domainSel , " flip_angle " , Vector3D ( 0.f , flipX , 0.f ) , sf ) ,
_getCFV3D ( domainSel , " flip_scale " , def_cvr_scale , sf ) ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . setBlur (
2012-01-21 21:57:41 +01:00
m_theme . getInt ( domain , " blur_resolution " , 1 ) ,
m_theme . getInt ( domain , " blur_radius " , 2 ) ,
m_theme . getFloat ( domain , " blur_factor " , 1.f ) ) ;
}
void CMenu : : _buildMenus ( void )
{
// Default fonts
theme . btnFont = _font ( theme . fontSet , " GENERAL " , " button_font " , BUTTONFONT ) ;
theme . btnFontColor = m_theme . getColor ( " GENERAL " , " button_font_color " , 0xD0BFDFFF ) ;
theme . lblFont = _font ( theme . fontSet , " GENERAL " , " label_font " , LABELFONT ) ;
theme . lblFontColor = m_theme . getColor ( " GENERAL " , " label_font_color " , 0xD0BFDFFF ) ;
theme . titleFont = _font ( theme . fontSet , " GENERAL " , " title_font " , TITLEFONT ) ;
2012-02-10 19:45:42 +01:00
theme . titleFontColor = m_theme . getColor ( " GENERAL " , " title_font_color " , 0xFFFFFFFF ) ;
2012-09-02 22:05:35 +02:00
2012-01-21 21:57:41 +01:00
theme . txtFont = _font ( theme . fontSet , " GENERAL " , " text_font " , TEXTFONT ) ;
theme . txtFontColor = m_theme . getColor ( " GENERAL " , " text_font_color " , 0xFFFFFFFF ) ;
2012-09-02 22:05:35 +02:00
2012-03-26 16:29:57 +02:00
theme . selsbtnFontColor = m_theme . getColor ( " GENERAL " , " selsbtn_font_color " , 0xFA5882FF ) ;
2012-02-12 02:43:31 +01:00
theme . selubtnFontColor = m_theme . getColor ( " GENERAL " , " selubtn_font_color " , 0xD0BFDFFF ) ;
2012-09-02 22:05:35 +02:00
2012-01-21 21:57:41 +01:00
// Default Sounds
2012-11-04 15:13:42 +01:00
theme . clickSound = _sound ( theme . soundSet , " GENERAL " , " click_sound " , click_wav , click_wav_size , " default_btn_click " , false ) ;
theme . hoverSound = _sound ( theme . soundSet , " GENERAL " , " hover_sound " , hover_wav , hover_wav_size , " default_btn_hover " , false ) ;
theme . cameraSound = _sound ( theme . soundSet , " GENERAL " , " camera_sound " , camera_wav , camera_wav_size , " default_camera " , false ) ;
2012-09-02 22:05:35 +02:00
2012-01-21 21:57:41 +01:00
// Default textures
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexL , butleft_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexL = _texture ( " GENERAL " , " button_texture_left " , theme . btnTexL ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexR , butright_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexR = _texture ( " GENERAL " , " button_texture_right " , theme . btnTexR ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexC , butcenter_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexC = _texture ( " GENERAL " , " button_texture_center " , theme . btnTexC ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexLS , butsleft_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexLS = _texture ( " GENERAL " , " button_texture_left_selected " , theme . btnTexLS ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexRS , butsright_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexRS = _texture ( " GENERAL " , " button_texture_right_selected " , theme . btnTexRS ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexCS , butscenter_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexCS = _texture ( " GENERAL " , " button_texture_center_selected " , theme . btnTexCS ) ;
2012-02-17 17:46:05 +01:00
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexLH , buthleft_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexLH = _texture ( " GENERAL " , " button_texture_hlleft " , theme . btnTexLH ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexRH , buthright_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexRH = _texture ( " GENERAL " , " button_texture_hlright " , theme . btnTexRH ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexCH , buthcenter_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexCH = _texture ( " GENERAL " , " button_texture_hlcenter " , theme . btnTexCH ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexLSH , buthsleft_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexLSH = _texture ( " GENERAL " , " button_texture_hlleft_selected " , theme . btnTexLSH ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexRSH , buthsright_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexRSH = _texture ( " GENERAL " , " button_texture_hlright_selected " , theme . btnTexRSH ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexCSH , buthscenter_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexCSH = _texture ( " GENERAL " , " button_texture_hlcenter_selected " , theme . btnTexCSH ) ;
2012-10-13 18:57:03 +02:00
2013-01-19 13:33:52 +01:00
/* Language Buttons */
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnAUOn , butauon_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnAUOn = _texture ( " GENERAL " , " button_au_on " , theme . btnAUOn ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnAUOns , butauons_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnAUOns = _texture ( " GENERAL " , " button_au_on_selected " , theme . btnAUOns ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnAUOff , butauon_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnAUOff = _texture ( " GENERAL " , " button_au_off " , theme . btnAUOff ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnAUOffs , butauons_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnAUOffs = _texture ( " GENERAL " , " button_au_off_selected " , theme . btnAUOffs ) ;
2012-02-15 21:18:15 +01:00
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnENOn , butenon_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnENOn = _texture ( " GENERAL " , " button_en_on " , theme . btnENOn ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnENOns , butenons_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnENOns = _texture ( " GENERAL " , " button_en_on_selected " , theme . btnENOns ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnENOff , butenon_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnENOff = _texture ( " GENERAL " , " button_en_off " , theme . btnENOff ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnENOffs , butenons_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnENOffs = _texture ( " GENERAL " , " button_en_off_selected " , theme . btnENOffs ) ;
2012-02-15 21:18:15 +01:00
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnJAOn , butjaon_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnJAOn = _texture ( " GENERAL " , " button_ja_on " , theme . btnJAOn ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnJAOns , butjaons_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnJAOns = _texture ( " GENERAL " , " button_ja_on_selected " , theme . btnJAOns ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnJAOff , butjaon_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnJAOff = _texture ( " GENERAL " , " button_ja_off " , theme . btnJAOff ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnJAOffs , butjaons_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnJAOffs = _texture ( " GENERAL " , " button_ja_off_selected " , theme . btnJAOffs ) ;
2012-02-15 21:18:15 +01:00
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnFROn , butfron_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnFROn = _texture ( " GENERAL " , " button_fr_on " , theme . btnFROn ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnFROns , butfrons_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnFROns = _texture ( " GENERAL " , " button_fr_on_selected " , theme . btnFROns ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnFROff , butfron_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnFROff = _texture ( " GENERAL " , " button_fr_off " , theme . btnFROff ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnFROffs , butfrons_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnFROffs = _texture ( " GENERAL " , " button_fr_off_selected " , theme . btnFROffs ) ;
2012-02-15 21:18:15 +01:00
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnDEOn , butdeon_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnDEOn = _texture ( " GENERAL " , " button_de_on " , theme . btnDEOn ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnDEOns , butdeons_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnDEOns = _texture ( " GENERAL " , " button_de_on_selected " , theme . btnDEOns ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnDEOff , butdeon_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnDEOff = _texture ( " GENERAL " , " button_de_off " , theme . btnDEOff ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnDEOffs , butdeons_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnDEOffs = _texture ( " GENERAL " , " button_de_off_selected " , theme . btnDEOffs ) ;
2012-02-15 21:18:15 +01:00
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnESOn , buteson_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnESOn = _texture ( " GENERAL " , " button_es_on " , theme . btnESOn ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnESOns , butesons_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnESOns = _texture ( " GENERAL " , " button_es_on_selected " , theme . btnESOns ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnESOff , buteson_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnESOff = _texture ( " GENERAL " , " button_es_off " , theme . btnESOff ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnESOffs , butesons_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnESOffs = _texture ( " GENERAL " , " button_es_off_selected " , theme . btnESOffs ) ;
2012-02-15 21:18:15 +01:00
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnITOn , butiton_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnITOn = _texture ( " GENERAL " , " button_it_on " , theme . btnITOn ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnITOns , butitons_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnITOns = _texture ( " GENERAL " , " button_it_on_selected " , theme . btnITOns ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnITOff , butiton_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnITOff = _texture ( " GENERAL " , " button_it_off " , theme . btnITOff ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnITOffs , butitons_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnITOffs = _texture ( " GENERAL " , " button_it_off_selected " , theme . btnITOffs ) ;
2012-02-15 21:18:15 +01:00
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnNLOn , butnlon_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnNLOn = _texture ( " GENERAL " , " button_nl_on " , theme . btnNLOn ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnNLOns , butnlons_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnNLOns = _texture ( " GENERAL " , " button_nl_on_selected " , theme . btnNLOns ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnNLOff , butnlon_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnNLOff = _texture ( " GENERAL " , " button_nl_off " , theme . btnNLOff ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnNLOffs , butnlons_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnNLOffs = _texture ( " GENERAL " , " button_nl_off_selected " , theme . btnNLOffs ) ;
2012-02-15 21:18:15 +01:00
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnPTOn , butpton_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnPTOn = _texture ( " GENERAL " , " button_pt_on " , theme . btnPTOn ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnPTOns , butptons_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnPTOns = _texture ( " GENERAL " , " button_pt_on_selected " , theme . btnPTOns ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnPTOff , butpton_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnPTOff = _texture ( " GENERAL " , " button_pt_off " , theme . btnPTOff ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnPTOffs , butptons_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnPTOffs = _texture ( " GENERAL " , " button_pt_off_selected " , theme . btnPTOffs ) ;
2012-02-15 21:18:15 +01:00
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnRUOn , butruon_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnRUOn = _texture ( " GENERAL " , " button_ru_on " , theme . btnRUOn ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnRUOns , butruons_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnRUOns = _texture ( " GENERAL " , " button_ru_on_selected " , theme . btnRUOns ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnRUOff , butruon_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnRUOff = _texture ( " GENERAL " , " button_ru_off " , theme . btnRUOff ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnRUOffs , butruons_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnRUOffs = _texture ( " GENERAL " , " button_ru_off_selected " , theme . btnRUOffs ) ;
2012-02-15 21:18:15 +01:00
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnKOOn , butkoon_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnKOOn = _texture ( " GENERAL " , " button_ko_on " , theme . btnKOOn ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnKOOns , butkoons_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnKOOns = _texture ( " GENERAL " , " button_ko_on_selected " , theme . btnKOOns ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnKOOff , butkoon_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnKOOff = _texture ( " GENERAL " , " button_ko_off " , theme . btnKOOff ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnKOOffs , butkoons_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnKOOffs = _texture ( " GENERAL " , " button_ko_off_selected " , theme . btnKOOffs ) ;
2012-02-15 21:18:15 +01:00
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnZHCNOn , butzhcnon_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnZHCNOn = _texture ( " GENERAL " , " button_zhcn_on " , theme . btnZHCNOn ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnZHCNOns , butzhcnons_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnZHCNOns = _texture ( " GENERAL " , " button_zhcn_on_selected " , theme . btnZHCNOns ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnZHCNOff , butzhcnon_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnZHCNOff = _texture ( " GENERAL " , " button_zhcn_off " , theme . btnZHCNOff ) ;
2013-01-19 13:33:52 +01:00
TexHandle . fromPNG ( theme . btnZHCNOffs , butzhcnons_png , GX_TF_RGBA8 , 0 , 0 , true ) ;
2012-11-03 20:16:03 +01:00
theme . btnZHCNOffs = _texture ( " GENERAL " , " button_zhcn_off_selected " , theme . btnZHCNOffs ) ;
2012-10-13 18:57:03 +02:00
2013-01-19 13:33:52 +01:00
/* Default textures */
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . checkboxoff , checkbox_png ) ;
2012-11-03 20:16:03 +01:00
theme . checkboxoff = _texture ( " GENERAL " , " checkbox_off " , theme . checkboxoff ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . checkboxoffs , checkbox_png ) ;
2012-11-03 20:16:03 +01:00
theme . checkboxoffs = _texture ( " GENERAL " , " checkbox_off_selected " , theme . checkboxoffs ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . checkboxon , checkboxs_png ) ;
2012-11-03 20:16:03 +01:00
theme . checkboxon = _texture ( " GENERAL " , " checkbox_on " , theme . checkboxon ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . checkboxons , checkboxs_png ) ;
2012-11-03 20:16:03 +01:00
theme . checkboxons = _texture ( " GENERAL " , " checkbox_on_selected " , theme . checkboxons ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . checkboxHid , checkboxhid_png ) ;
2012-11-03 20:16:03 +01:00
theme . checkboxHid = _texture ( " GENERAL " , " checkbox_Hid " , theme . checkboxHid ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . checkboxHids , checkboxhid_png ) ;
2012-11-03 20:16:03 +01:00
theme . checkboxHids = _texture ( " GENERAL " , " checkbox_Hid_selected " , theme . checkboxHids ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . checkboxReq , checkboxreq_png ) ;
2012-11-03 20:16:03 +01:00
theme . checkboxReq = _texture ( " GENERAL " , " checkbox_Req " , theme . checkboxReq ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . checkboxReqs , checkboxreq_png ) ;
2012-11-03 20:16:03 +01:00
theme . checkboxReqs = _texture ( " GENERAL " , " checkbox_Req_selected " , theme . checkboxReqs ) ;
2012-04-08 16:48:50 +02:00
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . pbarTexL , pbarleft_png ) ;
2012-11-03 20:16:03 +01:00
theme . pbarTexL = _texture ( " GENERAL " , " progressbar_texture_left " , theme . pbarTexL ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . pbarTexR , pbarright_png ) ;
2012-11-03 20:16:03 +01:00
theme . pbarTexR = _texture ( " GENERAL " , " progressbar_texture_right " , theme . pbarTexR ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . pbarTexC , pbarcenter_png ) ;
2012-11-03 20:16:03 +01:00
theme . pbarTexC = _texture ( " GENERAL " , " progressbar_texture_center " , theme . pbarTexC ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . pbarTexLS , pbarlefts_png ) ;
2012-11-03 20:16:03 +01:00
theme . pbarTexLS = _texture ( " GENERAL " , " progressbar_texture_left_selected " , theme . pbarTexLS ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . pbarTexRS , pbarrights_png ) ;
2012-11-03 20:16:03 +01:00
theme . pbarTexRS = _texture ( " GENERAL " , " progressbar_texture_right_selected " , theme . pbarTexRS ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . pbarTexCS , pbarcenters_png ) ;
2012-11-03 20:16:03 +01:00
theme . pbarTexCS = _texture ( " GENERAL " , " progressbar_texture_center_selected " , theme . pbarTexCS ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexPlus , btnplus_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexPlus = _texture ( " GENERAL " , " plus_button_texture " , theme . btnTexPlus ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexPlusS , btnpluss_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexPlusS = _texture ( " GENERAL " , " plus_button_texture_selected " , theme . btnTexPlusS ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexMinus , btnminus_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexMinus = _texture ( " GENERAL " , " minus_button_texture " , theme . btnTexMinus ) ;
2012-12-28 15:19:40 +01:00
TexHandle . fromPNG ( theme . btnTexMinusS , btnminuss_png ) ;
2012-11-03 20:16:03 +01:00
theme . btnTexMinusS = _texture ( " GENERAL " , " minus_button_texture_selected " , theme . btnTexMinusS ) ;
2012-09-02 22:05:35 +02:00
2012-01-21 21:57:41 +01:00
// Default background
2012-12-28 15:19:40 +01:00
TexHandle . fromJPG ( theme . bg , background_jpg , background_jpg_size ) ;
TexHandle . fromJPG ( m_mainBgLQ , background_jpg , background_jpg_size , GX_TF_CMPR , 64 , 64 ) ;
2012-01-21 21:57:41 +01:00
m_gameBgLQ = m_mainBgLQ ;
// Build menus
2012-11-03 20:16:03 +01:00
_initMainMenu ( ) ;
_initErrorMenu ( ) ;
_initConfigAdvMenu ( ) ;
_initConfigSndMenu ( ) ;
_initConfig4Menu ( ) ;
_initConfigScreenMenu ( ) ;
_initConfig3Menu ( ) ;
_initConfigMenu ( ) ;
_initGameMenu ( ) ;
_initDownloadMenu ( ) ;
_initCodeMenu ( ) ;
_initAboutMenu ( ) ;
_initWBFSMenu ( ) ;
_initCFThemeMenu ( ) ;
_initGameSettingsMenu ( ) ;
_initCheatSettingsMenu ( ) ;
_initSourceMenu ( ) ;
_initPluginSettingsMenu ( ) ;
_initCategorySettingsMenu ( ) ;
_initSystemMenu ( ) ;
_initGameInfoMenu ( ) ;
_initNandEmuMenu ( ) ;
_initHomeAndExitToMenu ( ) ;
2012-12-21 20:51:22 +01:00
_initBoot ( ) ;
2012-11-03 20:16:03 +01:00
_loadCFCfg ( ) ;
2012-01-21 21:57:41 +01:00
}
typedef struct
{
string ext ;
u32 min ;
u32 max ;
u32 def ;
u32 res ;
} FontHolder ;
SFont CMenu : : _font ( CMenu : : FontSet & fontSet , const char * domain , const char * key , u32 fontSize , u32 lineSpacing , u32 weight , u32 index , const char * genKey )
{
string filename = " " ;
bool general = strncmp ( domain , " GENERAL " , 7 ) = = 0 ;
FontHolder fonts [ 3 ] = { { " _size " , 6u , 300u , fontSize , 0 } , { " _line_height " , 6u , 300u , lineSpacing , 0 } , { " _weight " , 1u , 32u , weight , 0 } } ;
if ( ! general )
filename = m_theme . getString ( domain , key ) ;
if ( filename . empty ( ) )
filename = m_theme . getString ( " GENERAL " , genKey , genKey ) ;
bool useDefault = filename = = genKey ;
for ( u32 i = 0 ; i < 3 ; i + + )
{
string defValue = genKey ;
defValue + = fonts [ i ] . ext ;
string value = key ;
value + = fonts [ i ] . ext ;
if ( ! general )
fonts [ i ] . res = ( u32 ) m_theme . getInt ( domain , value ) ;
if ( fonts [ i ] . res < = 0 )
fonts [ i ] . res = ( u32 ) m_theme . getInt ( " GENERAL " , defValue ) ;
fonts [ i ] . res = min ( max ( fonts [ i ] . min , fonts [ i ] . res < = 0 ? fonts [ i ] . def : fonts [ i ] . res ) , fonts [ i ] . max ) ;
}
// Try to find the same font with the same size
CMenu : : FontSet : : iterator i = fontSet . find ( CMenu : : FontDesc ( upperCase ( filename . c_str ( ) ) , fonts [ 0 ] . res ) ) ;
if ( i ! = fontSet . end ( ) ) return i - > second ;
// TTF not found in memory, load it to create a new font
SFont retFont ;
2012-05-04 14:30:43 +02:00
if ( ! useDefault & & retFont . fromFile ( fmt ( " %s/%s " , m_themeDataDir . c_str ( ) , filename . c_str ( ) ) , fonts [ 0 ] . res , fonts [ 1 ] . res , fonts [ 2 ] . res , index ) )
2012-01-21 21:57:41 +01:00
{
// Theme Font
fontSet [ CMenu : : FontDesc ( upperCase ( filename . c_str ( ) ) , fonts [ 0 ] . res ) ] = retFont ;
return retFont ;
}
2012-11-03 20:16:03 +01:00
/* Fallback to default font */
2012-01-21 21:57:41 +01:00
if ( retFont . fromBuffer ( m_base_font , m_base_font_size , fonts [ 0 ] . res , fonts [ 1 ] . res , fonts [ 2 ] . res , index ) )
{
// Default font
fontSet [ CMenu : : FontDesc ( upperCase ( filename . c_str ( ) ) , fonts [ 0 ] . res ) ] = retFont ;
return retFont ;
}
return retFont ;
}
2012-12-28 15:19:40 +01:00
vector < TexData > CMenu : : _textures ( const char * domain , const char * key )
2012-01-21 21:57:41 +01:00
{
2012-12-28 15:19:40 +01:00
vector < TexData > textures ;
2012-01-21 21:57:41 +01:00
if ( m_theme . loaded ( ) )
{
2012-05-06 14:03:43 +02:00
vector < string > filenames = m_theme . getStrings ( domain , key ) ;
2012-01-21 21:57:41 +01:00
if ( filenames . size ( ) > 0 )
{
2012-05-06 14:03:43 +02:00
for ( vector < string > : : iterator itr = filenames . begin ( ) ; itr ! = filenames . end ( ) ; itr + + )
2012-01-21 21:57:41 +01:00
{
2012-11-03 20:16:03 +01:00
const string & filename = * itr ;
TexSet : : iterator i = theme . texSet . find ( filename ) ;
if ( i ! = theme . texSet . end ( ) )
2012-01-21 21:57:41 +01:00
textures . push_back ( i - > second ) ;
2012-12-28 15:19:40 +01:00
TexData tex ;
if ( TexHandle . fromImageFile ( tex , fmt ( " %s/%s " , m_themeDataDir . c_str ( ) , filename . c_str ( ) ) ) = = TE_OK )
2012-01-21 21:57:41 +01:00
{
2012-11-03 20:16:03 +01:00
theme . texSet [ filename ] = tex ;
2012-01-21 21:57:41 +01:00
textures . push_back ( tex ) ;
}
}
}
}
return textures ;
}
2012-12-28 15:19:40 +01:00
TexData CMenu : : _texture ( const char * domain , const char * key , TexData & def , bool freeDef )
2012-01-21 21:57:41 +01:00
{
string filename ;
2012-11-03 20:16:03 +01:00
if ( m_theme . loaded ( ) )
2012-01-21 21:57:41 +01:00
{
2012-11-03 20:16:03 +01:00
/* Load from theme */
2012-01-21 21:57:41 +01:00
filename = m_theme . getString ( domain , key ) ;
2012-11-03 20:16:03 +01:00
if ( ! filename . empty ( ) )
2012-01-21 21:57:41 +01:00
{
2012-11-03 20:16:03 +01:00
TexSet : : iterator i = theme . texSet . find ( filename ) ;
if ( i ! = theme . texSet . end ( ) )
2012-01-21 21:57:41 +01:00
return i - > second ;
2012-11-03 20:16:03 +01:00
/* Load from image file */
2012-12-28 15:19:40 +01:00
TexData tex ;
if ( TexHandle . fromImageFile ( tex , fmt ( " %s/%s " , m_themeDataDir . c_str ( ) , filename . c_str ( ) ) ) = = TE_OK )
2012-01-21 21:57:41 +01:00
{
2012-11-03 20:16:03 +01:00
if ( freeDef & & def . data ! = NULL )
{
free ( def . data ) ;
def . data = NULL ;
}
theme . texSet [ filename ] = tex ;
2012-01-21 21:57:41 +01:00
return tex ;
}
}
}
2012-11-03 20:16:03 +01:00
/* Fallback to default */
theme . texSet [ filename ] = def ;
2012-01-21 21:57:41 +01:00
return def ;
}
// Only for loading defaults and GENERAL domains!!
2012-11-04 15:13:42 +01:00
GuiSound * CMenu : : _sound ( CMenu : : SoundSet & soundSet , const char * domain , const char * key , const u8 * snd , u32 len , const char * name , bool isAllocated )
2012-01-21 21:57:41 +01:00
{
2012-11-04 15:13:42 +01:00
const char * filename = m_theme . getString ( domain , key , " " ) . c_str ( ) ;
2012-11-04 20:22:02 +01:00
if ( filename = = NULL | | filename [ 0 ] = = ' \0 ' )
2012-11-04 15:13:42 +01:00
filename = name ;
2012-01-21 21:57:41 +01:00
2012-11-04 20:22:02 +01:00
CMenu : : SoundSet : : iterator i = soundSet . find ( upperCase ( name ) ) ;
2012-11-04 15:13:42 +01:00
if ( i = = soundSet . end ( ) )
2012-01-21 21:57:41 +01:00
{
2012-11-04 20:22:02 +01:00
if ( filename ! = name )
2012-11-04 15:13:42 +01:00
soundSet [ upperCase ( filename ) ] = new GuiSound ( fmt ( " %s/%s " , m_themeDataDir . c_str ( ) , filename ) ) ;
2012-01-21 21:57:41 +01:00
else
2012-11-04 15:13:42 +01:00
soundSet [ upperCase ( filename ) ] = new GuiSound ( snd , len , filename , isAllocated ) ;
return soundSet [ upperCase ( filename ) ] ;
2012-01-21 21:57:41 +01:00
}
return i - > second ;
}
//For buttons and labels only!!
2012-11-04 15:13:42 +01:00
GuiSound * CMenu : : _sound ( CMenu : : SoundSet & soundSet , const char * domain , const char * key , const char * name )
2012-01-21 21:57:41 +01:00
{
2012-11-04 15:13:42 +01:00
const char * filename = m_theme . getString ( domain , key ) . c_str ( ) ;
2012-11-04 20:22:02 +01:00
if ( filename = = NULL | | filename [ 0 ] = = ' \0 ' )
2012-01-21 21:57:41 +01:00
{
2012-11-04 15:13:42 +01:00
if ( strrchr ( name , ' / ' ) ! = NULL )
name = strrchr ( name , ' / ' ) + 1 ;
return soundSet [ upperCase ( name ) ] ; // General/Default are already cached!
2012-01-21 21:57:41 +01:00
}
2012-11-04 15:13:42 +01:00
SoundSet : : iterator i = soundSet . find ( upperCase ( filename ) ) ;
if ( i = = soundSet . end ( ) )
2012-01-21 21:57:41 +01:00
{
2012-11-04 15:13:42 +01:00
soundSet [ upperCase ( filename ) ] = new GuiSound ( fmt ( " %s/%s " , m_themeDataDir . c_str ( ) , filename ) ) ;
return soundSet [ upperCase ( filename ) ] ;
2012-01-21 21:57:41 +01:00
}
return i - > second ;
}
u16 CMenu : : _textStyle ( const char * domain , const char * key , u16 def )
{
u16 textStyle = 0 ;
string style ( m_theme . getString ( domain , key ) ) ;
if ( style . empty ( ) ) return def ;
if ( style . find_first_of ( " Cc " ) ! = string : : npos )
textStyle | = FTGX_JUSTIFY_CENTER ;
else if ( style . find_first_of ( " Rr " ) ! = string : : npos )
textStyle | = FTGX_JUSTIFY_RIGHT ;
else
textStyle | = FTGX_JUSTIFY_LEFT ;
if ( style . find_first_of ( " Mm " ) ! = string : : npos )
textStyle | = FTGX_ALIGN_MIDDLE ;
else if ( style . find_first_of ( " Bb " ) ! = string : : npos )
textStyle | = FTGX_ALIGN_BOTTOM ;
else
textStyle | = FTGX_ALIGN_TOP ;
return textStyle ;
}
2012-11-03 20:16:03 +01:00
s16 CMenu : : _addButton ( const char * domain , SFont font , const wstringEx & text , int x , int y , u32 width , u32 height , const CColor & color )
2012-01-21 21:57:41 +01:00
{
SButtonTextureSet btnTexSet ;
CColor c ( color ) ;
c = m_theme . getColor ( domain , " color " , c ) ;
2012-05-25 16:21:43 +02:00
x = m_theme . getInt ( domain , " x " , x ) ;
y = m_theme . getInt ( domain , " y " , y ) ;
2012-01-21 21:57:41 +01:00
width = m_theme . getInt ( domain , " width " , width ) ;
height = m_theme . getInt ( domain , " height " , height ) ;
2012-11-03 20:16:03 +01:00
btnTexSet . left = _texture ( domain , " texture_left " , theme . btnTexL , false ) ;
btnTexSet . right = _texture ( domain , " texture_right " , theme . btnTexR , false ) ;
btnTexSet . center = _texture ( domain , " texture_center " , theme . btnTexC , false ) ;
btnTexSet . leftSel = _texture ( domain , " texture_left_selected " , theme . btnTexLS , false ) ;
btnTexSet . rightSel = _texture ( domain , " texture_right_selected " , theme . btnTexRS , false ) ;
btnTexSet . centerSel = _texture ( domain , " texture_center_selected " , theme . btnTexCS , false ) ;
2012-01-21 21:57:41 +01:00
font = _font ( theme . fontSet , domain , " font " , BUTTONFONT ) ;
2012-11-03 20:16:03 +01:00
GuiSound * clickSound = _sound ( theme . soundSet , domain , " click_sound " , theme . clickSound - > GetName ( ) ) ;
GuiSound * hoverSound = _sound ( theme . soundSet , domain , " hover_sound " , theme . hoverSound - > GetName ( ) ) ;
2012-01-21 21:57:41 +01:00
u16 btnPos = _textStyle ( domain , " elmstyle " , FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP ) ;
if ( btnPos & FTGX_JUSTIFY_RIGHT )
x = m_vid . width ( ) - x - width ;
if ( btnPos & FTGX_ALIGN_BOTTOM )
y = m_vid . height ( ) - y - height ;
2012-11-03 20:16:03 +01:00
2012-01-21 21:57:41 +01:00
return m_btnMgr . addButton ( font , text , x , y , width , height , c , btnTexSet , clickSound , hoverSound ) ;
}
2012-11-03 20:16:03 +01:00
s16 CMenu : : _addSelButton ( const char * domain , SFont font , const wstringEx & text , int x , int y , u32 width , u32 height , const CColor & color )
2012-02-12 02:43:31 +01:00
{
SButtonTextureSet btnTexSet ;
CColor c ( color ) ;
c = m_theme . getColor ( domain , " color " , c ) ;
x = m_theme . getInt ( domain , " x " , x ) ;
y = m_theme . getInt ( domain , " y " , y ) ;
width = m_theme . getInt ( domain , " width " , width ) ;
height = m_theme . getInt ( domain , " height " , height ) ;
2012-11-03 20:16:03 +01:00
btnTexSet . left = _texture ( domain , " texture_left " , theme . btnTexLH , false ) ;
btnTexSet . right = _texture ( domain , " texture_right " , theme . btnTexRH , false ) ;
btnTexSet . center = _texture ( domain , " texture_center " , theme . btnTexCH , false ) ;
btnTexSet . leftSel = _texture ( domain , " texture_left_selected " , theme . btnTexLSH , false ) ;
btnTexSet . rightSel = _texture ( domain , " texture_right_selected " , theme . btnTexRSH , false ) ;
btnTexSet . centerSel = _texture ( domain , " texture_center_selected " , theme . btnTexCSH , false ) ;
2012-02-12 02:43:31 +01:00
font = _font ( theme . fontSet , domain , " font " , BUTTONFONT ) ;
2012-11-03 20:16:03 +01:00
GuiSound * clickSound = _sound ( theme . soundSet , domain , " click_sound " , theme . clickSound - > GetName ( ) ) ;
GuiSound * hoverSound = _sound ( theme . soundSet , domain , " hover_sound " , theme . hoverSound - > GetName ( ) ) ;
2012-02-12 02:43:31 +01:00
u16 btnPos = _textStyle ( domain , " elmstyle " , FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP ) ;
if ( btnPos & FTGX_JUSTIFY_RIGHT )
x = m_vid . width ( ) - x - width ;
if ( btnPos & FTGX_ALIGN_BOTTOM )
y = m_vid . height ( ) - y - height ;
2012-11-03 20:16:03 +01:00
2012-02-12 02:43:31 +01:00
return m_btnMgr . addButton ( font , text , x , y , width , height , c , btnTexSet , clickSound , hoverSound ) ;
}
2012-12-28 15:19:40 +01:00
s16 CMenu : : _addPicButton ( const char * domain , TexData & texNormal , TexData & texSelected , int x , int y , u32 width , u32 height )
2012-01-21 21:57:41 +01:00
{
x = m_theme . getInt ( domain , " x " , x ) ;
y = m_theme . getInt ( domain , " y " , y ) ;
width = m_theme . getInt ( domain , " width " , width ) ;
height = m_theme . getInt ( domain , " height " , height ) ;
2012-12-28 15:19:40 +01:00
TexData tex1 = _texture ( domain , " texture_normal " , texNormal , false ) ;
TexData tex2 = _texture ( domain , " texture_selected " , texSelected , false ) ;
2012-11-03 20:16:03 +01:00
GuiSound * clickSound = _sound ( theme . soundSet , domain , " click_sound " , theme . clickSound - > GetName ( ) ) ;
GuiSound * hoverSound = _sound ( theme . soundSet , domain , " hover_sound " , theme . hoverSound - > GetName ( ) ) ;
2012-01-21 21:57:41 +01:00
u16 btnPos = _textStyle ( domain , " elmstyle " , FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP ) ;
if ( btnPos & FTGX_JUSTIFY_RIGHT )
x = m_vid . width ( ) - x - width ;
if ( btnPos & FTGX_ALIGN_BOTTOM )
y = m_vid . height ( ) - y - height ;
return m_btnMgr . addPicButton ( tex1 , tex2 , x , y , width , height , clickSound , hoverSound ) ;
}
2012-11-03 20:16:03 +01:00
s16 CMenu : : _addTitle ( const char * domain , SFont font , const wstringEx & text , int x , int y , u32 width , u32 height , const CColor & color , s16 style )
2012-02-10 19:45:42 +01:00
{
CColor c ( color ) ;
c = m_theme . getColor ( domain , " color " , c ) ;
x = m_theme . getInt ( domain , " x " , x ) ;
y = m_theme . getInt ( domain , " y " , y ) ;
width = m_theme . getInt ( domain , " width " , width ) ;
height = m_theme . getInt ( domain , " height " , height ) ;
font = _font ( theme . fontSet , domain , " font " , TITLEFONT ) ;
style = _textStyle ( domain , " style " , style ) ;
u16 btnPos = _textStyle ( domain , " elmstyle " , FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP ) ;
if ( btnPos & FTGX_JUSTIFY_RIGHT )
x = m_vid . width ( ) - x - width ;
if ( btnPos & FTGX_ALIGN_BOTTOM )
y = m_vid . height ( ) - y - height ;
return m_btnMgr . addLabel ( font , text , x , y , width , height , c , style ) ;
}
2012-11-03 20:16:03 +01:00
s16 CMenu : : _addText ( const char * domain , SFont font , const wstringEx & text , int x , int y , u32 width , u32 height , const CColor & color , s16 style )
2012-02-10 19:45:42 +01:00
{
CColor c ( color ) ;
c = m_theme . getColor ( domain , " color " , c ) ;
x = m_theme . getInt ( domain , " x " , x ) ;
y = m_theme . getInt ( domain , " y " , y ) ;
width = m_theme . getInt ( domain , " width " , width ) ;
height = m_theme . getInt ( domain , " height " , height ) ;
font = _font ( theme . fontSet , domain , " font " , TEXTFONT ) ;
style = _textStyle ( domain , " style " , style ) ;
u16 btnPos = _textStyle ( domain , " elmstyle " , FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP ) ;
if ( btnPos & FTGX_JUSTIFY_RIGHT )
x = m_vid . width ( ) - x - width ;
if ( btnPos & FTGX_ALIGN_BOTTOM )
y = m_vid . height ( ) - y - height ;
return m_btnMgr . addLabel ( font , text , x , y , width , height , c , style ) ;
}
2012-11-03 20:16:03 +01:00
s16 CMenu : : _addLabel ( const char * domain , SFont font , const wstringEx & text , int x , int y , u32 width , u32 height , const CColor & color , s16 style )
2012-01-21 21:57:41 +01:00
{
CColor c ( color ) ;
c = m_theme . getColor ( domain , " color " , c ) ;
x = m_theme . getInt ( domain , " x " , x ) ;
y = m_theme . getInt ( domain , " y " , y ) ;
width = m_theme . getInt ( domain , " width " , width ) ;
height = m_theme . getInt ( domain , " height " , height ) ;
font = _font ( theme . fontSet , domain , " font " , LABELFONT ) ;
style = _textStyle ( domain , " style " , style ) ;
u16 btnPos = _textStyle ( domain , " elmstyle " , FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP ) ;
if ( btnPos & FTGX_JUSTIFY_RIGHT )
x = m_vid . width ( ) - x - width ;
if ( btnPos & FTGX_ALIGN_BOTTOM )
y = m_vid . height ( ) - y - height ;
return m_btnMgr . addLabel ( font , text , x , y , width , height , c , style ) ;
}
2012-12-28 15:19:40 +01:00
s16 CMenu : : _addLabel ( const char * domain , SFont font , const wstringEx & text , int x , int y , u32 width , u32 height , const CColor & color , s16 style , TexData & bg )
2012-01-21 21:57:41 +01:00
{
CColor c ( color ) ;
c = m_theme . getColor ( domain , " color " , c ) ;
x = m_theme . getInt ( domain , " x " , x ) ;
y = m_theme . getInt ( domain , " y " , y ) ;
width = m_theme . getInt ( domain , " width " , width ) ;
height = m_theme . getInt ( domain , " height " , height ) ;
2012-06-27 14:31:48 +02:00
font = _font ( theme . fontSet , domain , " font " , BUTTONFONT ) ;
2012-12-28 15:19:40 +01:00
TexData texBg = _texture ( domain , " background_texture " , bg , false ) ;
2012-01-21 21:57:41 +01:00
style = _textStyle ( domain , " style " , style ) ;
u16 btnPos = _textStyle ( domain , " elmstyle " , FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP ) ;
if ( btnPos & FTGX_JUSTIFY_RIGHT )
x = m_vid . width ( ) - x - width ;
if ( btnPos & FTGX_ALIGN_BOTTOM )
y = m_vid . height ( ) - y - height ;
return m_btnMgr . addLabel ( font , text , x , y , width , height , c , style , texBg ) ;
}
2012-11-03 20:16:03 +01:00
s16 CMenu : : _addProgressBar ( const char * domain , int x , int y , u32 width , u32 height )
2012-01-21 21:57:41 +01:00
{
SButtonTextureSet btnTexSet ;
x = m_theme . getInt ( domain , " x " , x ) ;
y = m_theme . getInt ( domain , " y " , y ) ;
width = m_theme . getInt ( domain , " width " , width ) ;
height = m_theme . getInt ( domain , " height " , height ) ;
2012-11-03 20:16:03 +01:00
btnTexSet . left = _texture ( domain , " texture_left " , theme . pbarTexL , false ) ;
btnTexSet . right = _texture ( domain , " texture_right " , theme . pbarTexR , false ) ;
btnTexSet . center = _texture ( domain , " texture_center " , theme . pbarTexC , false ) ;
btnTexSet . leftSel = _texture ( domain , " texture_left_selected " , theme . pbarTexLS , false ) ;
btnTexSet . rightSel = _texture ( domain , " texture_right_selected " , theme . pbarTexRS , false ) ;
btnTexSet . centerSel = _texture ( domain , " texture_center_selected " , theme . pbarTexCS , false ) ;
2012-01-21 21:57:41 +01:00
u16 btnPos = _textStyle ( domain , " elmstyle " , FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP ) ;
if ( btnPos & FTGX_JUSTIFY_RIGHT )
x = m_vid . width ( ) - x - width ;
if ( btnPos & FTGX_ALIGN_BOTTOM )
y = m_vid . height ( ) - y - height ;
return m_btnMgr . addProgressBar ( x , y , width , height , btnTexSet ) ;
}
2012-09-13 16:54:17 +02:00
void CMenu : : _setHideAnim ( s16 id , const char * domain , int dx , int dy , float scaleX , float scaleY )
2012-01-21 21:57:41 +01:00
{
dx = m_theme . getInt ( domain , " effect_x " , dx ) ;
dy = m_theme . getInt ( domain , " effect_y " , dy ) ;
scaleX = m_theme . getFloat ( domain , " effect_scale_x " , scaleX ) ;
scaleY = m_theme . getFloat ( domain , " effect_scale_y " , scaleY ) ;
int x , y ;
u32 width , height ;
m_btnMgr . getDimensions ( id , x , y , width , height ) ;
u16 btnPos = _textStyle ( domain , " elmstyle " , FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP ) ;
if ( btnPos & FTGX_JUSTIFY_RIGHT )
{
dx = m_vid . width ( ) - dx - width ;
scaleX = m_vid . width ( ) - scaleX - width ;
}
if ( btnPos & FTGX_ALIGN_BOTTOM )
{
dy = m_vid . height ( ) - dy - height ;
scaleY = m_vid . height ( ) - scaleY - height ;
}
m_btnMgr . hide ( id , dx , dy , scaleX , scaleY , true ) ;
}
2012-11-03 20:16:03 +01:00
void CMenu : : _addUserLabels ( s16 * ids , u32 size , const char * domain )
2012-01-21 21:57:41 +01:00
{
2012-11-03 20:16:03 +01:00
_addUserLabels ( ids , 0 , size , domain ) ;
2012-01-21 21:57:41 +01:00
}
2012-11-03 20:16:03 +01:00
void CMenu : : _addUserLabels ( s16 * ids , u32 start , u32 size , const char * domain )
2012-01-21 21:57:41 +01:00
{
2012-07-05 15:15:23 +02:00
for ( u32 i = start ; i < start + size ; + + i )
2012-01-21 21:57:41 +01:00
{
2012-11-18 14:40:26 +01:00
string dom ( fmt ( " %s/USER%i " , domain , i + 1 ) ) ;
2012-01-21 21:57:41 +01:00
if ( m_theme . hasDomain ( dom ) )
{
2012-12-28 15:19:40 +01:00
TexData emptyTex ;
2012-11-03 20:16:03 +01:00
ids [ i ] = _addLabel ( dom . c_str ( ) , theme . lblFont , L " " , 40 , 200 , 64 , 64 , CColor ( 0xFFFFFFFF ) , 0 , emptyTex ) ;
2012-01-21 21:57:41 +01:00
_setHideAnim ( ids [ i ] , dom . c_str ( ) , - 50 , 0 , 0.f , 0.f ) ;
}
else
2012-09-13 16:54:17 +02:00
ids [ i ] = - 1 ;
2012-01-21 21:57:41 +01:00
}
}
2012-12-25 20:09:41 +01:00
void CMenu : : _checkForSinglePlugin ( void )
{
enabledPluginPos = 0 ;
enabledPluginsCount = 0 ;
const vector < bool > & EnabledPlugins = m_plugin . GetEnabledPlugins ( m_cfg ) ;
2013-01-15 14:54:33 +01:00
if ( m_cfg . getBool ( PLUGIN_DOMAIN , " source " , true ) & & EnabledPlugins . size ( ) ! = 0 )
2012-12-25 20:09:41 +01:00
{
for ( u8 i = 0 ; i < EnabledPlugins . size ( ) ; i + + )
{
if ( EnabledPlugins . at ( i ) )
{
enabledPluginPos = i ;
enabledPluginsCount + + ;
}
}
snprintf ( PluginMagicWord , sizeof ( PluginMagicWord ) , " %08x " , m_plugin . getPluginMagic ( enabledPluginPos ) ) ;
}
}
2012-01-21 21:57:41 +01:00
void CMenu : : _initCF ( void )
{
2012-05-14 07:37:10 +02:00
Config dump , gameAgeList ;
GameTDB gametdb ;
2012-01-21 21:57:41 +01:00
const char * domain = _domainFromView ( ) ;
2013-01-21 00:30:28 +01:00
2012-11-11 19:28:03 +01:00
CoverFlow . clear ( ) ;
CoverFlow . reserve ( m_gameList . size ( ) ) ;
2012-01-21 21:57:41 +01:00
2013-01-21 00:30:28 +01:00
bool dumpGameLst = m_cfg . getBool ( domain , " dump_list " , true ) ;
2012-05-14 07:37:10 +02:00
if ( dumpGameLst ) dump . load ( fmt ( " %s/ " TITLES_DUMP_FILENAME , m_settingsDir . c_str ( ) ) ) ;
m_gcfg1 . load ( fmt ( " %s/ " GAME_SETTINGS1_FILENAME , m_settingsDir . c_str ( ) ) ) ;
2013-01-21 00:30:28 +01:00
2012-05-14 07:37:10 +02:00
int ageLock = m_cfg . getInt ( " GENERAL " , " age_lock " ) ;
if ( ageLock < 2 | | ageLock > 19 )
ageLock = 19 ;
if ( ageLock < 19 )
{
gameAgeList . load ( fmt ( " %s/ " AGE_LOCK_FILENAME , m_settingsDir . c_str ( ) ) ) ;
2013-01-15 14:54:33 +01:00
if ( ! gametdb . IsLoaded ( ) )
2012-05-14 07:37:10 +02:00
{
2012-11-18 14:40:26 +01:00
gametdb . OpenFile ( fmt ( " %s/wiitdb.xml " , m_settingsDir . c_str ( ) ) ) ;
2012-05-14 07:37:10 +02:00
gametdb . SetLanguageCode ( m_loc . getString ( m_curLanguage , " gametdb_code " , " EN " ) . c_str ( ) ) ;
}
}
2012-12-25 20:09:41 +01:00
_checkForSinglePlugin ( ) ;
const vector < bool > & EnabledPlugins = m_plugin . GetEnabledPlugins ( m_cfg ) ;
2013-01-21 00:30:28 +01:00
2012-11-03 20:16:03 +01:00
for ( vector < dir_discHdr > : : iterator element = m_gameList . begin ( ) ; element ! = m_gameList . end ( ) ; + + element )
2012-01-21 21:57:41 +01:00
{
2012-06-16 19:03:23 +02:00
string id ;
2012-11-03 20:16:03 +01:00
string tempname = element - > path ;
u64 chantitle = TITLE_ID ( element - > settings [ 0 ] , element - > settings [ 1 ] ) ;
if ( element - > type = = TYPE_HOMEBREW )
2012-05-05 22:07:54 +02:00
{
2012-06-16 19:03:23 +02:00
tempname . assign ( & tempname [ tempname . find_last_of ( ' / ' ) + 1 ] ) ;
id = tempname ;
}
2012-11-03 20:16:03 +01:00
else if ( element - > type = = TYPE_PLUGIN )
2012-06-16 19:03:23 +02:00
{
2012-10-01 21:55:55 +02:00
if ( tempname . find ( ' : ' ) ! = string : : npos )
2012-06-14 22:59:18 +02:00
{
if ( tempname . empty ( ) | | tempname . find_first_of ( ' / ' ) = = string : : npos )
2012-05-29 15:49:28 +02:00
continue ;
tempname . erase ( 0 , tempname . find_first_of ( ' / ' ) + 1 ) ;
string dirName = tempname . substr ( 0 , tempname . find_first_of ( ' / ' ) + 1 ) ;
if ( tempname . find_first_of ( ' / ' ) = = string : : npos )
{
continue ;
}
tempname . assign ( & tempname [ tempname . find_last_of ( ' / ' ) + 1 ] ) ;
if ( tempname . find_last_of ( ' . ' ) = = string : : npos )
{
continue ;
}
tempname . erase ( tempname . find_last_of ( ' . ' ) , tempname . size ( ) - tempname . find_last_of ( ' . ' ) ) ;
id = dirName + tempname ;
2012-05-22 17:38:39 +02:00
}
2012-05-29 15:49:28 +02:00
else
id = tempname ;
2012-05-05 22:07:54 +02:00
}
2012-06-16 19:03:23 +02:00
else
{
2012-11-03 20:16:03 +01:00
if ( element - > type = = TYPE_CHANNEL & & chantitle = = HBC_108 )
strncpy ( element - > id , " JODI " , 6 ) ;
id = element - > id ;
2012-06-16 19:03:23 +02:00
}
2012-05-14 07:37:10 +02:00
bool ageLocked = false ;
if ( ageLock < 19 )
{
int ageRated = min ( max ( gameAgeList . getInt ( domain , id ) , 0 ) , 19 ) ;
2012-11-04 00:38:39 +01:00
if ( ageRated = = 0 & & gametdb . IsLoaded ( ) & & ( element - > type = = TYPE_WII_GAME | | element - > type = = TYPE_CHANNEL ) )
2012-05-14 07:37:10 +02:00
{
2012-11-04 00:38:39 +01:00
const char * RatingValue = NULL ;
if ( gametdb . GetRatingValue ( id . c_str ( ) , RatingValue ) )
2012-05-14 07:37:10 +02:00
{
2012-11-04 00:38:39 +01:00
switch ( gametdb . GetRating ( id . c_str ( ) ) )
2012-05-14 07:37:10 +02:00
{
case GAMETDB_RATING_TYPE_CERO :
2012-11-04 00:38:39 +01:00
if ( RatingValue [ 0 ] = = ' A ' )
2012-05-14 07:37:10 +02:00
ageRated = 3 ;
2012-11-04 00:38:39 +01:00
else if ( RatingValue [ 0 ] = = ' B ' )
2012-05-14 07:37:10 +02:00
ageRated = 12 ;
2012-11-04 00:38:39 +01:00
else if ( RatingValue [ 0 ] = = ' D ' )
2012-05-14 07:37:10 +02:00
ageRated = 15 ;
2012-11-04 00:38:39 +01:00
else if ( RatingValue [ 0 ] = = ' C ' )
2012-05-14 07:37:10 +02:00
ageRated = 17 ;
2012-11-04 00:38:39 +01:00
else if ( RatingValue [ 0 ] = = ' Z ' )
2012-05-14 07:37:10 +02:00
ageRated = 18 ;
break ;
case GAMETDB_RATING_TYPE_ESRB :
2012-11-04 00:38:39 +01:00
if ( RatingValue [ 0 ] = = ' E ' )
2012-05-14 07:37:10 +02:00
ageRated = 6 ;
2012-11-04 00:38:39 +01:00
else if ( memcmp ( RatingValue , " EC " , 2 ) = = 0 )
2012-05-14 07:37:10 +02:00
ageRated = 3 ;
2012-11-04 00:38:39 +01:00
else if ( memcmp ( RatingValue , " E10+ " , 4 ) = = 0 )
2012-05-14 07:37:10 +02:00
ageRated = 10 ;
2012-11-04 00:38:39 +01:00
else if ( RatingValue [ 0 ] = = ' T ' )
2012-05-14 07:37:10 +02:00
ageRated = 13 ;
2012-11-04 00:38:39 +01:00
else if ( RatingValue [ 0 ] = = ' M ' )
2012-05-14 07:37:10 +02:00
ageRated = 17 ;
2012-11-04 00:38:39 +01:00
else if ( memcmp ( RatingValue , " AO " , 2 ) = = 0 )
2012-05-14 07:37:10 +02:00
ageRated = 18 ;
break ;
case GAMETDB_RATING_TYPE_PEGI :
2012-11-04 00:38:39 +01:00
if ( RatingValue [ 0 ] = = ' 3 ' )
2012-05-14 07:37:10 +02:00
ageRated = 3 ;
2012-11-04 00:38:39 +01:00
else if ( RatingValue [ 0 ] = = ' 7 ' )
2012-05-14 07:37:10 +02:00
ageRated = 7 ;
2012-11-04 00:38:39 +01:00
else if ( memcmp ( RatingValue , " 12 " , 2 ) = = 0 )
2012-05-14 07:37:10 +02:00
ageRated = 12 ;
2012-11-04 00:38:39 +01:00
else if ( memcmp ( RatingValue , " 16 " , 2 ) = = 0 )
2012-05-14 07:37:10 +02:00
ageRated = 16 ;
2012-11-04 00:38:39 +01:00
else if ( memcmp ( RatingValue , " 18 " , 2 ) = = 0 )
2012-05-14 07:37:10 +02:00
ageRated = 18 ;
break ;
case GAMETDB_RATING_TYPE_GRB :
2012-11-04 00:38:39 +01:00
if ( RatingValue [ 0 ] = = ' A ' )
2012-05-14 07:37:10 +02:00
ageRated = 3 ;
2012-11-04 00:38:39 +01:00
else if ( memcmp ( RatingValue , " 12 " , 2 ) = = 0 )
2012-05-14 07:37:10 +02:00
ageRated = 12 ;
2012-11-04 00:38:39 +01:00
else if ( memcmp ( RatingValue , " 15 " , 2 ) = = 0 )
2012-05-14 07:37:10 +02:00
ageRated = 15 ;
2012-11-04 00:38:39 +01:00
else if ( memcmp ( RatingValue , " 18 " , 2 ) = = 0 )
2012-05-14 07:37:10 +02:00
ageRated = 18 ;
break ;
default :
break ;
}
}
}
2012-06-16 19:03:23 +02:00
if ( ageRated = = 0 )
2012-05-14 07:37:10 +02:00
ageRated = min ( max ( m_cfg . getInt ( " GENERAL " , " age_lock_default " , AGE_LOCK_DEFAULT ) , 2 ) , 19 ) ;
2012-06-16 19:03:23 +02:00
if ( ageRated = = 0 )
2012-05-14 07:37:10 +02:00
ageRated = AGE_LOCK_DEFAULT ;
2012-06-16 19:03:23 +02:00
if ( ageRated > ageLock )
2012-05-14 07:37:10 +02:00
ageLocked = true ;
}
2012-06-16 19:03:23 +02:00
if ( ( ! m_favorites | | m_gcfg1 . getBool ( " FAVORITES " , id , false ) )
2012-05-14 07:37:10 +02:00
& & ( ! m_locked | | ! m_gcfg1 . getBool ( " ADULTONLY " , id , false ) )
& & ! ageLocked )
2012-01-21 21:57:41 +01:00
{
2012-09-13 23:11:41 +02:00
string catDomain ;
2012-11-03 20:16:03 +01:00
switch ( element - > type )
2012-01-21 21:57:41 +01:00
{
2012-09-13 23:11:41 +02:00
case TYPE_CHANNEL :
2013-01-15 14:54:33 +01:00
catDomain = " NAND " ;
2012-09-13 23:11:41 +02:00
break ;
case TYPE_HOMEBREW :
2013-01-15 14:54:33 +01:00
catDomain = " HOMEBREW " ;
2012-09-13 23:11:41 +02:00
break ;
case TYPE_GC_GAME :
2013-01-15 14:54:33 +01:00
catDomain = " DML " ;
2012-09-13 23:11:41 +02:00
break ;
2013-01-15 14:54:33 +01:00
case TYPE_WII_GAME :
catDomain = " GAMES " ;
2012-09-13 23:11:41 +02:00
break ;
default :
2013-01-15 14:54:33 +01:00
catDomain = ( m_plugin . GetPluginName ( m_plugin . GetPluginPosition ( element - > settings [ 0 ] ) ) ) . toUTF8 ( ) ;
}
const char * requiredCats = m_cat . getString ( " GENERAL " , " required_categories " ) . c_str ( ) ;
const char * selectedCats = m_cat . getString ( " GENERAL " , " selected_categories " ) . c_str ( ) ;
const char * hiddenCats = m_cat . getString ( " GENERAL " , " hidden_categories " ) . c_str ( ) ;
2012-09-13 23:11:41 +02:00
u8 numReqCats = strlen ( requiredCats ) ;
u8 numSelCats = strlen ( selectedCats ) ;
u8 numHidCats = strlen ( hiddenCats ) ;
if ( numReqCats ! = 0 | | numSelCats ! = 0 | | numHidCats ! = 0 ) // if all 0 skip checking cats and show all games
{
const char * idCats = m_cat . getString ( catDomain , id ) . c_str ( ) ;
u8 numIdCats = strlen ( idCats ) ;
- Categories update.
- now you can have as many categories as you want.
- copied the idea of selected, hidden, and required categories from USB Loader GX. Thanks Cyan. Checkmark = selected, X = Hidden, and + = Required.
- redid categories.ini layout and renamed it categories_v4.ini so you can copy and paste settings from the old one to the new one. Each view (USB,DML,EMU,NAND,HOMEBREW) has it's own numcategories, category names, and category settings. All games are now seperated based on the view. Don't forget to add 1 to numcategories for the show All mode.
- Replaced All checkbox with CLEAR button which clears all checkboxes so no category is selected and all games will be shown.
- Added features to the Game Selected Categories Menu. Now the title is the title of the current game. You can now press plus(+) and minus(-) on wiimote to go to the next or previous games without going back to previous screen making it easier to setup categories for your games.
- note: all changes will not be saved in categories_v4.ini unless you exit wiiflow or launch a game.
2012-08-31 19:51:49 +02:00
bool inaCat = false ;
bool inHiddenCat = false ;
int reqMatch = 0 ;
2012-09-13 23:11:41 +02:00
if ( numIdCats ! = 0 )
2012-03-26 16:29:57 +02:00
{
2012-09-13 23:11:41 +02:00
for ( u8 j = 0 ; j < numIdCats ; + + j )
- Categories update.
- now you can have as many categories as you want.
- copied the idea of selected, hidden, and required categories from USB Loader GX. Thanks Cyan. Checkmark = selected, X = Hidden, and + = Required.
- redid categories.ini layout and renamed it categories_v4.ini so you can copy and paste settings from the old one to the new one. Each view (USB,DML,EMU,NAND,HOMEBREW) has it's own numcategories, category names, and category settings. All games are now seperated based on the view. Don't forget to add 1 to numcategories for the show All mode.
- Replaced All checkbox with CLEAR button which clears all checkboxes so no category is selected and all games will be shown.
- Added features to the Game Selected Categories Menu. Now the title is the title of the current game. You can now press plus(+) and minus(-) on wiimote to go to the next or previous games without going back to previous screen making it easier to setup categories for your games.
- note: all changes will not be saved in categories_v4.ini unless you exit wiiflow or launch a game.
2012-08-31 19:51:49 +02:00
{
2012-09-13 23:11:41 +02:00
int k = ( static_cast < int > ( idCats [ j ] ) ) - 32 ;
if ( k < = 0 )
continue ;
bool match = false ;
if ( numReqCats ! = 0 )
{
for ( u8 l = 0 ; l < numReqCats ; + + l )
{
if ( k = = ( static_cast < int > ( requiredCats [ l ] ) - 32 ) )
{
match = true ;
reqMatch + + ;
inaCat = true ;
}
}
}
if ( match )
continue ;
if ( numSelCats ! = 0 )
{
for ( u8 l = 0 ; l < numSelCats ; + + l )
{
if ( k = = ( static_cast < int > ( selectedCats [ l ] ) - 32 ) )
{
match = true ;
inaCat = true ;
}
}
}
if ( match )
continue ;
if ( numHidCats ! = 0 )
{
for ( u8 l = 0 ; l < numHidCats ; + + l )
{
if ( k = = ( static_cast < int > ( hiddenCats [ l ] ) - 32 ) )
inHiddenCat = true ;
}
}
- Categories update.
- now you can have as many categories as you want.
- copied the idea of selected, hidden, and required categories from USB Loader GX. Thanks Cyan. Checkmark = selected, X = Hidden, and + = Required.
- redid categories.ini layout and renamed it categories_v4.ini so you can copy and paste settings from the old one to the new one. Each view (USB,DML,EMU,NAND,HOMEBREW) has it's own numcategories, category names, and category settings. All games are now seperated based on the view. Don't forget to add 1 to numcategories for the show All mode.
- Replaced All checkbox with CLEAR button which clears all checkboxes so no category is selected and all games will be shown.
- Added features to the Game Selected Categories Menu. Now the title is the title of the current game. You can now press plus(+) and minus(-) on wiimote to go to the next or previous games without going back to previous screen making it easier to setup categories for your games.
- note: all changes will not be saved in categories_v4.ini unless you exit wiiflow or launch a game.
2012-08-31 19:51:49 +02:00
}
}
//continue; means don't add game to list (don't show)
if ( inHiddenCat )
continue ;
2012-09-13 23:11:41 +02:00
if ( numReqCats ! = reqMatch )
- Categories update.
- now you can have as many categories as you want.
- copied the idea of selected, hidden, and required categories from USB Loader GX. Thanks Cyan. Checkmark = selected, X = Hidden, and + = Required.
- redid categories.ini layout and renamed it categories_v4.ini so you can copy and paste settings from the old one to the new one. Each view (USB,DML,EMU,NAND,HOMEBREW) has it's own numcategories, category names, and category settings. All games are now seperated based on the view. Don't forget to add 1 to numcategories for the show All mode.
- Replaced All checkbox with CLEAR button which clears all checkboxes so no category is selected and all games will be shown.
- Added features to the Game Selected Categories Menu. Now the title is the title of the current game. You can now press plus(+) and minus(-) on wiimote to go to the next or previous games without going back to previous screen making it easier to setup categories for your games.
- note: all changes will not be saved in categories_v4.ini unless you exit wiiflow or launch a game.
2012-08-31 19:51:49 +02:00
continue ;
if ( ! inaCat )
{
2012-09-13 23:11:41 +02:00
if ( numHidCats = = 0 )
2012-05-16 18:21:03 +02:00
continue ;
2012-09-13 23:11:41 +02:00
else if ( numSelCats > 0 )
- Categories update.
- now you can have as many categories as you want.
- copied the idea of selected, hidden, and required categories from USB Loader GX. Thanks Cyan. Checkmark = selected, X = Hidden, and + = Required.
- redid categories.ini layout and renamed it categories_v4.ini so you can copy and paste settings from the old one to the new one. Each view (USB,DML,EMU,NAND,HOMEBREW) has it's own numcategories, category names, and category settings. All games are now seperated based on the view. Don't forget to add 1 to numcategories for the show All mode.
- Replaced All checkbox with CLEAR button which clears all checkboxes so no category is selected and all games will be shown.
- Added features to the Game Selected Categories Menu. Now the title is the title of the current game. You can now press plus(+) and minus(-) on wiimote to go to the next or previous games without going back to previous screen making it easier to setup categories for your games.
- note: all changes will not be saved in categories_v4.ini unless you exit wiiflow or launch a game.
2012-08-31 19:51:49 +02:00
continue ;
2012-03-26 16:29:57 +02:00
}
2012-01-21 21:57:41 +01:00
}
int playcount = m_gcfg1 . getInt ( " PLAYCOUNT " , id , 0 ) ;
unsigned int lastPlayed = m_gcfg1 . getUInt ( " LASTPLAYED " , id , 0 ) ;
2012-05-14 07:37:10 +02:00
if ( dumpGameLst )
2012-11-03 20:16:03 +01:00
dump . setWString ( domain , id , element - > title ) ;
const char * blankCoverKey = NULL ;
switch ( element - > type )
2012-11-01 19:38:22 +01:00
{
case TYPE_CHANNEL :
blankCoverKey = " channels " ;
break ;
case TYPE_HOMEBREW :
blankCoverKey = " homebrew " ;
break ;
case TYPE_GC_GAME :
blankCoverKey = " gamecube " ;
break ;
case TYPE_PLUGIN :
char PluginMagicWord [ 9 ] ;
memset ( PluginMagicWord , 0 , sizeof ( PluginMagicWord ) ) ;
2012-11-03 20:16:03 +01:00
strncpy ( PluginMagicWord , fmt ( " %08x " , element - > settings [ 0 ] ) , 8 ) ;
2012-11-01 19:38:22 +01:00
blankCoverKey = PluginMagicWord ;
break ;
default :
blankCoverKey = " wii " ;
}
2012-11-03 20:16:03 +01:00
const string & blankCoverName = m_theme . getString ( " BLANK_COVERS " , blankCoverKey , fmt ( " %s.jpg " , blankCoverKey ) ) ;
if ( element - > type = = TYPE_PLUGIN )
2012-04-26 20:43:05 +02:00
{
2012-11-03 20:16:03 +01:00
string tempname ( element - > path ) ;
2012-05-28 14:57:52 +02:00
if ( tempname . find_last_of ( " / " ) ! = string : : npos )
tempname . assign ( & tempname [ tempname . find_last_of ( " / " ) + 1 ] ) ;
2012-11-03 20:16:03 +01:00
string coverFolder ( m_plugin . GetCoverFolderName ( element - > settings [ 0 ] ) ) ;
2012-10-13 00:25:22 +02:00
if ( EnabledPlugins . size ( ) = = 0 ) //all plugins
2012-06-29 16:49:59 +02:00
{
if ( coverFolder . size ( ) > 0 )
2012-11-11 19:28:03 +01:00
CoverFlow . addItem ( & ( * element ) , fmt ( " %s/%s/%s.png " , m_picDir . c_str ( ) , coverFolder . c_str ( ) , tempname . c_str ( ) ) , fmt ( " %s/%s/%s.png " , m_boxPicDir . c_str ( ) , coverFolder . c_str ( ) , tempname . c_str ( ) ) , fmt ( " %s/%s " , m_boxPicDir . c_str ( ) , blankCoverName . c_str ( ) ) , playcount , lastPlayed ) ;
2012-06-29 16:49:59 +02:00
else
2012-11-11 19:28:03 +01:00
CoverFlow . addItem ( & ( * element ) , fmt ( " %s/%s.png " , m_picDir . c_str ( ) , tempname . c_str ( ) ) , fmt ( " %s/%s.png " , m_boxPicDir . c_str ( ) , tempname . c_str ( ) ) , fmt ( " %s/%s " , m_boxPicDir . c_str ( ) , blankCoverName . c_str ( ) ) , playcount , lastPlayed ) ;
2012-06-29 16:49:59 +02:00
}
2012-05-05 22:07:54 +02:00
else
{
2012-10-13 00:25:22 +02:00
for ( u8 j = 0 ; j < EnabledPlugins . size ( ) ; j + + )
2012-05-05 22:07:54 +02:00
{
2012-11-03 20:16:03 +01:00
if ( EnabledPlugins . at ( j ) = = true & & element - > settings [ 0 ] = = m_plugin . getPluginMagic ( j ) )
2012-05-05 22:07:54 +02:00
{
2012-06-29 16:49:59 +02:00
if ( coverFolder . size ( ) > 0 )
2012-11-11 19:28:03 +01:00
CoverFlow . addItem ( & ( * element ) , fmt ( " %s/%s/%s.png " , m_picDir . c_str ( ) , coverFolder . c_str ( ) , tempname . c_str ( ) ) , fmt ( " %s/%s/%s.png " , m_boxPicDir . c_str ( ) , coverFolder . c_str ( ) , tempname . c_str ( ) ) , fmt ( " %s/%s " , m_boxPicDir . c_str ( ) , blankCoverName . c_str ( ) ) , playcount , lastPlayed ) ;
2012-06-29 16:49:59 +02:00
else
2012-11-11 19:28:03 +01:00
CoverFlow . addItem ( & ( * element ) , fmt ( " %s/%s.png " , m_picDir . c_str ( ) , tempname . c_str ( ) ) , fmt ( " %s/%s.png " , m_boxPicDir . c_str ( ) , tempname . c_str ( ) ) , fmt ( " %s/%s " , m_boxPicDir . c_str ( ) , blankCoverName . c_str ( ) ) , playcount , lastPlayed ) ;
2012-05-05 22:07:54 +02:00
break ;
}
}
}
2012-04-26 20:43:05 +02:00
}
2012-11-03 20:16:03 +01:00
else if ( element - > type = = TYPE_HOMEBREW )
2012-11-11 19:28:03 +01:00
CoverFlow . addItem ( & ( * element ) , fmt ( " %s/icon.png " , element - > path ) , fmt ( " %s/%s.png " , m_boxPicDir . c_str ( ) , id . c_str ( ) ) , fmt ( " %s/%s " , m_boxPicDir . c_str ( ) , blankCoverName . c_str ( ) ) , playcount , lastPlayed ) ;
2012-06-14 22:59:18 +02:00
else
2012-11-11 19:28:03 +01:00
CoverFlow . addItem ( & ( * element ) , fmt ( " %s/%s.png " , m_picDir . c_str ( ) , id . c_str ( ) ) , fmt ( " %s/%s.png " , m_boxPicDir . c_str ( ) , id . c_str ( ) ) , fmt ( " %s/%s " , m_boxPicDir . c_str ( ) , blankCoverName . c_str ( ) ) , playcount , lastPlayed ) ;
2012-01-21 21:57:41 +01:00
}
}
2013-01-21 00:30:28 +01:00
if ( gametdb . IsLoaded ( ) )
2013-01-15 14:54:33 +01:00
gametdb . CloseFile ( ) ;
2012-01-21 21:57:41 +01:00
m_gcfg1 . unload ( ) ;
2012-05-14 07:37:10 +02:00
if ( dumpGameLst )
2012-01-21 21:57:41 +01:00
{
2012-05-14 07:37:10 +02:00
dump . save ( true ) ;
2012-01-21 21:57:41 +01:00
m_cfg . setBool ( domain , " dump_list " , false ) ;
}
2012-11-11 19:28:03 +01:00
CoverFlow . setBoxMode ( m_cfg . getBool ( " GENERAL " , " box_mode " , true ) ) ;
CoverFlow . setCompression ( m_cfg . getBool ( " GENERAL " , " allow_texture_compression " , true ) ) ;
CoverFlow . setBufferSize ( m_cfg . getInt ( " GENERAL " , " cover_buffer " , 20 ) ) ;
CoverFlow . setSorting ( ( Sorting ) m_cfg . getInt ( domain , " sort " , 0 ) ) ;
CoverFlow . setHQcover ( m_cfg . getBool ( " GENERAL " , " cover_use_hq " , false ) ) ;
CoverFlow . start ( ) ;
2012-12-28 15:19:40 +01:00
if ( ! CoverFlow . empty ( ) )
{
2013-01-15 14:54:33 +01:00
u8 view = m_current_view ;
if ( m_current_view = = COVERFLOW_MAX ) // target the last launched game type view
m_current_view = m_last_view ;
2012-12-28 15:19:40 +01:00
bool path = ( m_current_view = = COVERFLOW_PLUGIN | | m_current_view = = COVERFLOW_HOMEBREW ) ;
2013-01-15 14:54:33 +01:00
if ( ! CoverFlow . findId ( m_cfg . getString ( _domainFromView ( ) , " current_item " ) . c_str ( ) , true , path ) )
2012-12-28 15:19:40 +01:00
CoverFlow . defaultLoad ( ) ;
2013-01-15 14:54:33 +01:00
m_current_view = view ;
2012-12-28 15:19:40 +01:00
CoverFlow . startCoverLoader ( ) ;
}
2012-01-21 21:57:41 +01:00
}
2012-09-09 20:35:15 +02:00
void CMenu : : _mainLoopCommon ( bool withCF , bool adjusting )
2012-01-21 21:57:41 +01:00
{
2012-06-01 08:43:37 +02:00
if ( withCF )
2012-11-11 19:28:03 +01:00
CoverFlow . tick ( ) ;
2012-01-21 21:57:41 +01:00
m_btnMgr . tick ( ) ;
m_fa . tick ( ) ;
2012-11-11 19:28:03 +01:00
m_fa . hideCover ( ) ? CoverFlow . hideCover ( ) : CoverFlow . showCover ( ) ;
CoverFlow . setFanartPlaying ( m_fa . isLoaded ( ) ) ;
CoverFlow . setFanartTextColor ( m_fa . getTextColor ( m_theme . getColor ( " _COVERFLOW " , " font_color " , CColor ( 0xFFFFFFFF ) ) ) ) ;
2012-01-21 21:57:41 +01:00
2012-11-11 19:28:03 +01:00
m_vid . prepare ( ) ;
2012-11-16 23:00:20 +01:00
m_vid . setup2DProjection ( false , true ) ;
2012-01-21 21:57:41 +01:00
_updateBg ( ) ;
2012-11-11 19:28:03 +01:00
if ( CoverFlow . getRenderTex ( ) )
CoverFlow . RenderTex ( ) ;
2012-11-29 21:30:05 +01:00
if ( withCF & & m_lqBg ! = NULL )
2012-11-11 19:28:03 +01:00
CoverFlow . makeEffectTexture ( m_lqBg ) ;
2012-06-01 08:43:37 +02:00
if ( withCF & & m_aa > 0 )
2012-01-21 21:57:41 +01:00
{
m_vid . setAA ( m_aa , true ) ;
2012-06-01 08:43:37 +02:00
for ( int i = 0 ; i < m_aa ; + + i )
2012-01-21 21:57:41 +01:00
{
m_vid . prepareAAPass ( i ) ;
m_vid . setup2DProjection ( false , true ) ;
_drawBg ( ) ;
m_fa . draw ( false ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . draw ( ) ;
2012-01-21 21:57:41 +01:00
m_vid . setup2DProjection ( false , true ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . drawEffect ( ) ;
2012-10-13 18:57:03 +02:00
if ( ! m_banner . GetSelectedGame ( ) )
2012-11-11 19:28:03 +01:00
CoverFlow . drawText ( adjusting ) ;
2012-01-21 21:57:41 +01:00
m_vid . renderAAPass ( i ) ;
}
m_vid . setup2DProjection ( ) ;
m_vid . drawAAScene ( ) ;
}
else
{
2012-11-16 23:00:20 +01:00
m_vid . setup2DProjection ( ) ;
2012-01-21 21:57:41 +01:00
_drawBg ( ) ;
m_fa . draw ( false ) ;
2012-06-01 08:43:37 +02:00
if ( withCF )
2012-01-21 21:57:41 +01:00
{
2012-11-11 19:28:03 +01:00
CoverFlow . draw ( ) ;
2012-01-21 21:57:41 +01:00
m_vid . setup2DProjection ( ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . drawEffect ( ) ;
2012-10-13 18:57:03 +02:00
if ( ! m_banner . GetSelectedGame ( ) )
2012-11-11 19:28:03 +01:00
CoverFlow . drawText ( adjusting ) ;
2012-01-21 21:57:41 +01:00
}
}
2012-09-29 19:32:31 +02:00
if ( m_fa . isLoaded ( ) )
m_fa . draw ( ) ;
2012-10-13 18:57:03 +02:00
else if ( m_banner . GetSelectedGame ( ) & & ( ! m_banner . GetInGameSettings ( ) | | ( m_banner . GetInGameSettings ( ) & & m_bnr_settings ) ) )
m_banner . Draw ( ) ;
2012-06-01 08:43:37 +02:00
2012-01-21 21:57:41 +01:00
m_btnMgr . draw ( ) ;
ScanInput ( ) ;
2012-07-26 00:12:17 +02:00
if ( ! m_vid . showingWaitMessage ( ) )
m_vid . render ( ) ;
2012-01-21 21:57:41 +01:00
2012-09-09 20:35:15 +02:00
if ( Sys_Exiting ( ) )
exitHandler ( BUTTON_CALLBACK ) ;
2012-06-01 08:43:37 +02:00
2012-11-04 15:13:42 +01:00
if ( withCF & & m_gameSelected & & m_gamesound_changed & & ! m_soundThrdBusy & & ! m_gameSound . IsPlaying ( ) & & MusicPlayer . GetVolume ( ) = = 0 )
2012-01-21 21:57:41 +01:00
{
2012-04-27 21:05:38 +02:00
CheckGameSoundThread ( ) ;
2012-08-16 00:33:54 +02:00
m_gameSound . Play ( m_bnrSndVol ) ;
2012-01-21 21:57:41 +01:00
m_gamesound_changed = false ;
}
2012-05-18 20:13:49 +02:00
else if ( ! m_gameSelected )
2012-08-16 00:33:54 +02:00
m_gameSound . Stop ( ) ;
2012-01-21 21:57:41 +01:00
2012-09-22 15:47:52 +02:00
MusicPlayer . Tick ( m_video_playing | | ( m_gameSelected & &
2012-08-16 00:33:54 +02:00
m_gameSound . IsLoaded ( ) ) | | m_gameSound . IsPlaying ( ) ) ;
2012-06-01 08:43:37 +02:00
2012-09-29 13:41:47 +02:00
if ( MusicPlayer . SongChanged ( ) & & m_music_info )
2012-09-16 15:41:31 +02:00
{
2012-09-22 15:47:52 +02:00
m_btnMgr . setText ( m_mainLblCurMusic , MusicPlayer . GetFileName ( ) , true ) ;
2012-09-16 15:41:31 +02:00
m_btnMgr . show ( m_mainLblCurMusic ) ;
2012-09-22 15:47:52 +02:00
MusicPlayer . DisplayTime = time ( NULL ) ;
2012-09-16 15:41:31 +02:00
}
2012-09-22 15:47:52 +02:00
else if ( MusicPlayer . DisplayTime > 0 & & time ( NULL ) - MusicPlayer . DisplayTime > 3 )
2012-09-16 15:41:31 +02:00
{
2012-09-22 15:47:52 +02:00
MusicPlayer . DisplayTime = 0 ;
2012-09-16 15:41:31 +02:00
m_btnMgr . hide ( m_mainLblCurMusic ) ;
}
2012-01-21 21:57:41 +01:00
//Take Screenshot
2012-06-01 08:43:37 +02:00
if ( gc_btnsPressed & PAD_TRIGGER_Z )
2012-01-21 21:57:41 +01:00
{
time_t rawtime ;
2012-06-01 08:43:37 +02:00
struct tm * timeinfo ;
2012-01-21 21:57:41 +01:00
char buffer [ 80 ] ;
time ( & rawtime ) ;
timeinfo = localtime ( & rawtime ) ;
strftime ( buffer , 80 , " %b-%d-20%y-%Hh%Mm%Ss.png " , timeinfo ) ;
gprintf ( " Screenshot taken and saved to: %s/%s \n " , m_screenshotDir . c_str ( ) , buffer ) ;
2012-05-04 14:30:43 +02:00
m_vid . TakeScreenshot ( fmt ( " %s/%s " , m_screenshotDir . c_str ( ) , buffer ) ) ;
2012-11-03 20:16:03 +01:00
if ( theme . cameraSound ! = NULL )
theme . cameraSound - > Play ( 255 ) ;
2012-01-21 21:57:41 +01:00
}
2012-06-01 08:43:37 +02:00
# ifdef SHOWMEM
2013-01-21 00:30:28 +01:00
m_btnMgr . setText ( m_mem1FreeSize , wfmt ( L " Mem1 lo Free:%u, Mem1 Free:%u " ,
MEM1_lo_freesize ( ) , MEM1_freesize ( ) ) , true ) ;
m_btnMgr . setText ( m_mem2FreeSize , wfmt ( L " Mem2 lo Free:%u, Mem2 Free:%u " ,
MEM2_lo_freesize ( ) , MEM2_freesize ( ) ) , true ) ;
2012-06-01 08:43:37 +02:00
# endif
# ifdef SHOWMEMGECKO
mem1 = MEM1_freesize ( ) ;
mem2 = MEM2_freesize ( ) ;
if ( mem1 ! = mem1old )
{
mem1old = mem1 ;
gprintf ( " Mem1 Free: %u \n " , mem1 ) ;
}
if ( mem2 ! = mem2old )
{
mem2old = mem2 ;
gprintf ( " Mem2 Free: %u \n " , mem2 ) ;
}
# endif
2012-01-21 21:57:41 +01:00
}
2012-12-28 15:19:40 +01:00
void CMenu : : _setBg ( const TexData & tex , const TexData & lqTex )
2012-01-21 21:57:41 +01:00
{
2012-11-29 21:30:05 +01:00
/* Not setting same bg again */
2012-11-16 23:00:20 +01:00
if ( m_nextBg = = & tex )
2012-11-03 20:16:03 +01:00
return ;
2012-11-29 21:30:05 +01:00
m_lqBg = & lqTex ;
/* before setting new next bg set previous */
if ( m_nextBg ! = NULL )
m_prevBg = m_nextBg ;
2012-11-16 23:00:20 +01:00
m_nextBg = & tex ;
2012-01-21 21:57:41 +01:00
m_bgCrossFade = 0xFF ;
}
void CMenu : : _updateBg ( void )
{
2012-11-29 21:30:05 +01:00
if ( m_bgCrossFade = = 0 )
return ;
m_bgCrossFade = max ( 0 , ( int ) m_bgCrossFade - 14 ) ;
2012-01-21 21:57:41 +01:00
Mtx modelViewMtx ;
GXTexObj texObj ;
GXTexObj texObj2 ;
2012-11-29 21:30:05 +01:00
/* last pass so remove previous bg */
if ( m_bgCrossFade = = 0 )
m_prevBg = NULL ;
2012-01-21 21:57:41 +01:00
GX_ClearVtxDesc ( ) ;
2012-11-29 21:30:05 +01:00
GX_SetNumTevStages ( m_prevBg = = NULL ? 1 : 2 ) ;
2012-01-21 21:57:41 +01:00
GX_SetNumChans ( 0 ) ;
GX_SetVtxDesc ( GX_VA_POS , GX_DIRECT ) ;
GX_SetVtxAttrFmt ( GX_VTXFMT0 , GX_VA_POS , GX_POS_XYZ , GX_F32 , 0 ) ;
GX_SetVtxDesc ( GX_VA_TEX0 , GX_DIRECT ) ;
GX_SetVtxAttrFmt ( GX_VTXFMT0 , GX_VA_TEX0 , GX_TEX_ST , GX_F32 , 0 ) ;
2012-11-29 21:30:05 +01:00
GX_SetNumTexGens ( m_prevBg = = NULL ? 1 : 2 ) ;
2012-01-21 21:57:41 +01:00
GX_SetTexCoordGen ( GX_TEXCOORD0 , GX_TG_MTX2x4 , GX_TG_TEX0 , GX_IDENTITY ) ;
GX_SetTexCoordGen ( GX_TEXCOORD1 , GX_TG_MTX2x4 , GX_TG_TEX0 , GX_IDENTITY ) ;
GX_SetTevKColor ( GX_KCOLOR0 , CColor ( m_bgCrossFade , 0xFF - m_bgCrossFade , 0 , 0 ) ) ;
GX_SetTevKColorSel ( GX_TEVSTAGE0 , GX_TEV_KCSEL_K0_R ) ;
GX_SetTevColorIn ( GX_TEVSTAGE0 , GX_CC_TEXC , GX_CC_ZERO , GX_CC_KONST , GX_CC_ZERO ) ;
GX_SetTevAlphaIn ( GX_TEVSTAGE0 , GX_CA_ZERO , GX_CA_ZERO , GX_CA_ZERO , GX_CA_ZERO ) ;
GX_SetTevColorOp ( GX_TEVSTAGE0 , GX_TEV_ADD , GX_TB_ZERO , GX_CS_SCALE_1 , GX_TRUE , GX_TEVPREV ) ;
GX_SetTevAlphaOp ( GX_TEVSTAGE0 , GX_TEV_ADD , GX_TB_ZERO , GX_CS_SCALE_1 , GX_TRUE , GX_TEVPREV ) ;
GX_SetTevOrder ( GX_TEVSTAGE0 , GX_TEXCOORD0 , GX_TEXMAP0 , GX_COLORNULL ) ;
GX_SetTevKColorSel ( GX_TEVSTAGE1 , GX_TEV_KCSEL_K0_G ) ;
GX_SetTevColorIn ( GX_TEVSTAGE1 , GX_CC_TEXC , GX_CC_ZERO , GX_CC_KONST , GX_CC_CPREV ) ;
GX_SetTevAlphaIn ( GX_TEVSTAGE1 , GX_CA_ZERO , GX_CA_ZERO , GX_CA_ZERO , GX_CA_ZERO ) ;
GX_SetTevColorOp ( GX_TEVSTAGE1 , GX_TEV_ADD , GX_TB_ZERO , GX_CS_SCALE_1 , GX_TRUE , GX_TEVPREV ) ;
GX_SetTevAlphaOp ( GX_TEVSTAGE1 , GX_TEV_ADD , GX_TB_ZERO , GX_CS_SCALE_1 , GX_TRUE , GX_TEVPREV ) ;
GX_SetTevOrder ( GX_TEVSTAGE1 , GX_TEXCOORD1 , GX_TEXMAP1 , GX_COLORNULL ) ;
GX_SetBlendMode ( GX_BM_NONE , GX_BL_SRCALPHA , GX_BL_INVSRCALPHA , GX_LO_CLEAR ) ;
GX_SetAlphaUpdate ( GX_FALSE ) ;
GX_SetCullMode ( GX_CULL_NONE ) ;
GX_SetZMode ( GX_DISABLE , GX_ALWAYS , GX_FALSE ) ;
guMtxIdentity ( modelViewMtx ) ;
GX_LoadPosMtxImm ( modelViewMtx , GX_PNMTX0 ) ;
2012-11-16 23:00:20 +01:00
if ( m_nextBg ! = NULL & & m_nextBg - > data ! = NULL )
{
GX_InitTexObj ( & texObj , m_nextBg - > data , m_nextBg - > width , m_nextBg - > height , m_nextBg - > format , GX_CLAMP , GX_CLAMP , GX_FALSE ) ;
GX_LoadTexObj ( & texObj , GX_TEXMAP0 ) ;
}
2012-11-29 21:30:05 +01:00
if ( m_prevBg ! = NULL & & m_prevBg - > data ! = NULL )
2012-01-21 21:57:41 +01:00
{
2012-11-29 21:30:05 +01:00
GX_InitTexObj ( & texObj2 , m_prevBg - > data , m_prevBg - > width , m_prevBg - > height , m_prevBg - > format , GX_CLAMP , GX_CLAMP , GX_FALSE ) ;
2012-01-21 21:57:41 +01:00
GX_LoadTexObj ( & texObj2 , GX_TEXMAP1 ) ;
}
GX_Begin ( GX_QUADS , GX_VTXFMT0 , 4 ) ;
GX_Position3f32 ( 0.f , 0.f , 0.f ) ;
GX_TexCoord2f32 ( 0.f , 0.f ) ;
GX_Position3f32 ( 640.f , 0.f , 0.f ) ;
GX_TexCoord2f32 ( 1.f , 0.f ) ;
GX_Position3f32 ( 640.f , 480.f , 0.f ) ;
GX_TexCoord2f32 ( 1.f , 1.f ) ;
GX_Position3f32 ( 0.f , 480.f , 0.f ) ;
GX_TexCoord2f32 ( 0.f , 1.f ) ;
GX_End ( ) ;
GX_SetNumTevStages ( 1 ) ;
m_curBg . width = 640 ;
m_curBg . height = 480 ;
m_curBg . format = GX_TF_RGBA8 ;
m_curBg . maxLOD = 0 ;
m_vid . renderToTexture ( m_curBg , true ) ;
}
void CMenu : : _drawBg ( void )
{
Mtx modelViewMtx ;
GXTexObj texObj ;
GX_ClearVtxDesc ( ) ;
GX_SetNumTevStages ( 1 ) ;
GX_SetNumChans ( 0 ) ;
GX_SetVtxDesc ( GX_VA_POS , GX_DIRECT ) ;
GX_SetVtxAttrFmt ( GX_VTXFMT0 , GX_VA_POS , GX_POS_XYZ , GX_F32 , 0 ) ;
GX_SetVtxDesc ( GX_VA_TEX0 , GX_DIRECT ) ;
GX_SetVtxAttrFmt ( GX_VTXFMT0 , GX_VA_TEX0 , GX_TEX_ST , GX_F32 , 0 ) ;
GX_SetNumTexGens ( 1 ) ;
GX_SetTevColorIn ( GX_TEVSTAGE0 , GX_CC_ZERO , GX_CC_ZERO , GX_CC_ZERO , GX_CC_TEXC ) ;
GX_SetTevAlphaIn ( GX_TEVSTAGE0 , GX_CA_ZERO , GX_CA_ZERO , GX_CA_ZERO , GX_CA_ZERO ) ;
GX_SetTevColorOp ( GX_TEVSTAGE0 , GX_TEV_ADD , GX_TB_ZERO , GX_CS_SCALE_1 , GX_TRUE , GX_TEVPREV ) ;
GX_SetTevAlphaOp ( GX_TEVSTAGE0 , GX_TEV_ADD , GX_TB_ZERO , GX_CS_SCALE_1 , GX_TRUE , GX_TEVPREV ) ;
GX_SetTexCoordGen ( GX_TEXCOORD0 , GX_TG_MTX2x4 , GX_TG_TEX0 , GX_IDENTITY ) ;
GX_SetTevOrder ( GX_TEVSTAGE0 , GX_TEXCOORD0 , GX_TEXMAP0 , GX_COLORNULL ) ;
GX_SetBlendMode ( GX_BM_NONE , GX_BL_SRCALPHA , GX_BL_INVSRCALPHA , GX_LO_CLEAR ) ;
GX_SetAlphaUpdate ( GX_FALSE ) ;
GX_SetCullMode ( GX_CULL_NONE ) ;
GX_SetZMode ( GX_DISABLE , GX_ALWAYS , GX_FALSE ) ;
guMtxIdentity ( modelViewMtx ) ;
GX_LoadPosMtxImm ( modelViewMtx , GX_PNMTX0 ) ;
2012-11-03 20:16:03 +01:00
GX_InitTexObj ( & texObj , m_curBg . data , m_curBg . width , m_curBg . height , m_curBg . format , GX_CLAMP , GX_CLAMP , GX_FALSE ) ;
2012-01-21 21:57:41 +01:00
GX_LoadTexObj ( & texObj , GX_TEXMAP0 ) ;
GX_Begin ( GX_QUADS , GX_VTXFMT0 , 4 ) ;
GX_Position3f32 ( 0.f , 0.f , 0.f ) ;
GX_TexCoord2f32 ( 0.f , 0.f ) ;
GX_Position3f32 ( 640.f , 0.f , 0.f ) ;
GX_TexCoord2f32 ( 1.f , 0.f ) ;
GX_Position3f32 ( 640.f , 480.f , 0.f ) ;
GX_TexCoord2f32 ( 1.f , 1.f ) ;
GX_Position3f32 ( 0.f , 480.f , 0.f ) ;
GX_TexCoord2f32 ( 0.f , 1.f ) ;
GX_End ( ) ;
}
void CMenu : : _updateText ( void )
{
_textMain ( ) ;
_textError ( ) ;
_textConfig ( ) ;
_textConfig3 ( ) ;
_textConfigScreen ( ) ;
_textConfig4 ( ) ;
_textConfigSnd ( ) ;
_textConfigAdv ( ) ;
_textDownload ( ) ;
_textGame ( ) ;
_textCode ( ) ;
_textWBFS ( ) ;
_textGameSettings ( ) ;
_textCategorySettings ( ) ;
_textSystem ( ) ;
}
const wstringEx CMenu : : _fmt ( const char * key , const wchar_t * def )
{
wstringEx ws = m_loc . getWString ( m_curLanguage , key , def ) ;
if ( checkFmt ( def , ws ) ) return ws ;
return def ;
}
bool CMenu : : _loadChannelList ( void )
{
2012-12-22 17:47:02 +01:00
string emuPath ;
string cacheDir ;
2012-09-10 00:38:42 +02:00
int emuPartition = - 1 ;
2012-12-22 17:47:02 +01:00
NANDemuView = ( ! neek2o ( ) & & m_cfg . getBool ( CHANNEL_DOMAIN , " disable " , true ) = = false ) ;
if ( NANDemuView )
2012-09-10 00:38:42 +02:00
{
2012-12-22 23:37:11 +01:00
emuPartition = _FindEmuPart ( emuPath , false ) ;
2012-09-10 00:38:42 +02:00
if ( emuPartition < 0 )
2012-12-22 23:37:11 +01:00
emuPartition = _FindEmuPart ( emuPath , true ) ;
2012-09-10 00:38:42 +02:00
if ( emuPartition < 0 )
return false ;
2012-12-22 17:47:02 +01:00
currentPartition = emuPartition ;
NandHandle . PreNandCfg ( m_cfg . getBool ( CHANNEL_DOMAIN , " real_nand_miis " , false ) ,
m_cfg . getBool ( CHANNEL_DOMAIN , " real_nand_config " , false ) ) ;
2012-10-21 17:28:00 +02:00
cacheDir = fmt ( " %s/%s_channels.db " , m_listCacheDir . c_str ( ) , DeviceName [ currentPartition ] ) ;
2012-12-22 17:47:02 +01:00
}
2013-01-15 14:54:33 +01:00
bool updateCache = m_cfg . getBool ( CHANNEL_DOMAIN , " update_cache " ) ;
2012-10-21 17:28:00 +02:00
vector < string > NullVector ;
2013-01-15 14:54:33 +01:00
m_gameList . CreateList ( COVERFLOW_CHANNEL , currentPartition , std : : string ( ) ,
2012-10-21 17:28:00 +02:00
NullVector , cacheDir , updateCache ) ;
2013-01-15 14:54:33 +01:00
m_cfg . remove ( CHANNEL_DOMAIN , " update_cache " ) ;
return true ;
2012-01-21 21:57:41 +01:00
}
bool CMenu : : _loadList ( void )
{
2012-11-11 19:28:03 +01:00
CoverFlow . clear ( ) ;
2013-01-15 14:54:33 +01:00
m_gameList . clear ( ) ;
2012-12-22 17:47:02 +01:00
NANDemuView = false ;
2013-01-15 14:54:33 +01:00
u8 sources = 0 ;
gprintf ( " Creating Gamelist \n " ) ;
2012-01-30 00:11:43 +01:00
2013-01-15 14:54:33 +01:00
if ( m_cfg . getBool ( PLUGIN_DOMAIN , " source " , false ) )
2012-01-21 21:57:41 +01:00
{
2013-01-15 14:54:33 +01:00
_loadEmuList ( ) ;
m_current_view = COVERFLOW_PLUGIN ;
sources + + ;
}
if ( m_cfg . getBool ( WII_DOMAIN , " source " , false ) )
{
_loadGameList ( ) ;
m_current_view = COVERFLOW_USB ;
sources + + ;
}
if ( m_cfg . getBool ( CHANNEL_DOMAIN , " source " , false ) )
{
m_current_view = COVERFLOW_CHANNEL ;
_loadChannelList ( ) ;
sources + + ;
}
if ( m_cfg . getBool ( GC_DOMAIN , " source " , false ) )
{
_loadDmlList ( ) ;
m_current_view = COVERFLOW_DML ;
sources + + ;
}
if ( m_cfg . getBool ( HOMEBREW_DOMAIN , " source " , false ) )
{
_loadHomebrewList ( ) ;
m_current_view = COVERFLOW_HOMEBREW ;
sources + + ;
2012-01-21 21:57:41 +01:00
}
2013-01-15 14:54:33 +01:00
if ( sources > 1 )
m_current_view = COVERFLOW_MAX ;
2012-01-21 21:57:41 +01:00
2013-01-15 14:54:33 +01:00
gprintf ( " Games found: %i \n " , m_gameList . size ( ) ) ;
return m_gameList . size ( ) > 0 ? true : false ;
2012-01-21 21:57:41 +01:00
}
bool CMenu : : _loadGameList ( void )
{
2012-11-04 20:22:02 +01:00
currentPartition = m_cfg . getInt ( WII_DOMAIN , " partition " , USB1 ) ;
2012-09-22 15:47:52 +02:00
if ( ! DeviceHandle . IsInserted ( currentPartition ) )
2012-01-21 21:57:41 +01:00
return false ;
2012-09-22 15:47:52 +02:00
DeviceHandle . OpenWBFS ( currentPartition ) ;
2012-10-03 23:34:37 +02:00
string gameDir ( fmt ( GAMES_DIR , DeviceName [ currentPartition ] ) ) ;
2012-10-04 17:25:35 +02:00
string cacheDir ( fmt ( " %s/%s_wii.db " , m_listCacheDir . c_str ( ) , DeviceName [ currentPartition ] ) ) ;
2012-11-04 20:22:02 +01:00
bool updateCache = m_cfg . getBool ( WII_DOMAIN , " update_cache " ) ;
2013-01-15 14:54:33 +01:00
m_gameList . CreateList ( COVERFLOW_USB , currentPartition , gameDir , stringToVector ( " .wbfs|.iso " , ' | ' ) , cacheDir , updateCache ) ;
2012-09-22 15:47:52 +02:00
WBFS_Close ( ) ;
2013-01-15 14:54:33 +01:00
m_cfg . remove ( WII_DOMAIN , " update_cache " ) ;
return true ;
2012-01-21 21:57:41 +01:00
}
bool CMenu : : _loadHomebrewList ( )
{
2012-11-04 20:22:02 +01:00
currentPartition = m_cfg . getInt ( HOMEBREW_DOMAIN , " partition " , SD ) ;
2012-09-22 15:47:52 +02:00
if ( ! DeviceHandle . IsInserted ( currentPartition ) )
2012-01-21 21:57:41 +01:00
return false ;
2012-10-03 23:34:37 +02:00
string gameDir ( fmt ( HOMEBREW_DIR , DeviceName [ currentPartition ] ) ) ;
2012-10-04 17:25:35 +02:00
string cacheDir ( fmt ( " %s/%s_homebrew.db " , m_listCacheDir . c_str ( ) , DeviceName [ currentPartition ] ) ) ;
2012-11-04 20:22:02 +01:00
bool updateCache = m_cfg . getBool ( HOMEBREW_DOMAIN , " update_cache " ) ;
2013-01-15 14:54:33 +01:00
m_gameList . CreateList ( COVERFLOW_HOMEBREW , currentPartition , gameDir , stringToVector ( " .dol|.elf " , ' | ' ) , cacheDir , updateCache ) ;
m_cfg . remove ( HOMEBREW_DOMAIN , " update_cache " ) ;
return true ;
2012-01-21 21:57:41 +01:00
}
2012-01-21 22:15:45 +01:00
bool CMenu : : _loadDmlList ( )
{
2012-11-04 20:22:02 +01:00
currentPartition = m_cfg . getInt ( GC_DOMAIN , " partition " , USB1 ) ;
2012-09-22 15:47:52 +02:00
if ( ! DeviceHandle . IsInserted ( currentPartition ) )
2012-01-21 22:15:45 +01:00
return false ;
2012-10-03 23:34:37 +02:00
string gameDir ( fmt ( currentPartition = = SD ? DML_DIR : m_DMLgameDir . c_str ( ) , DeviceName [ currentPartition ] ) ) ;
2012-10-04 17:25:35 +02:00
string cacheDir ( fmt ( " %s/%s_gamecube.db " , m_listCacheDir . c_str ( ) , DeviceName [ currentPartition ] ) ) ;
2012-11-04 20:22:02 +01:00
bool updateCache = m_cfg . getBool ( GC_DOMAIN , " update_cache " ) ;
2013-01-15 14:54:33 +01:00
m_gameList . CreateList ( COVERFLOW_DML , currentPartition , gameDir ,
2012-10-04 13:37:53 +02:00
stringToVector ( " .iso|root " , ' | ' ) , cacheDir , updateCache ) ;
2013-01-15 14:54:33 +01:00
m_cfg . remove ( GC_DOMAIN , " update_cache " ) ;
return true ;
2012-01-21 22:15:45 +01:00
}
2012-10-06 18:38:21 +02:00
static vector < string > INI_List ;
static void GrabINIFiles ( char * FullPath )
{
//Just push back
INI_List . push_back ( FullPath ) ;
}
2012-04-08 17:54:34 +02:00
bool CMenu : : _loadEmuList ( )
{
2012-11-04 20:22:02 +01:00
currentPartition = m_cfg . getInt ( PLUGIN_DOMAIN , " partition " , SD ) ;
2012-09-22 15:47:52 +02:00
if ( ! DeviceHandle . IsInserted ( currentPartition ) )
2012-04-08 17:54:34 +02:00
return false ;
2013-01-15 14:54:33 +01:00
2012-11-04 20:22:02 +01:00
bool updateCache = m_cfg . getBool ( PLUGIN_DOMAIN , " update_cache " ) ;
2012-05-06 14:03:43 +02:00
vector < dir_discHdr > emuList ;
2012-04-21 19:15:35 +02:00
Config m_plugin_cfg ;
2012-04-10 15:37:57 +02:00
2012-10-06 18:38:21 +02:00
INI_List . clear ( ) ;
GetFiles ( m_pluginsDir . c_str ( ) , stringToVector ( " .ini " , ' | ' ) , GrabINIFiles , false , 1 ) ;
2012-10-04 13:37:53 +02:00
for ( vector < string > : : const_iterator Name = INI_List . begin ( ) ; Name ! = INI_List . end ( ) ; + + Name )
2012-04-10 01:19:08 +02:00
{
2013-01-15 14:54:33 +01:00
m_gameList . clear ( ) ;
2012-10-04 13:37:53 +02:00
if ( Name - > find ( " scummvm.ini " ) ! = string : : npos )
2012-04-10 01:19:08 +02:00
continue ;
2012-10-04 13:37:53 +02:00
m_plugin_cfg . load ( Name - > c_str ( ) ) ;
if ( m_plugin_cfg . loaded ( ) )
2012-04-10 01:19:08 +02:00
{
2012-10-04 13:37:53 +02:00
m_plugin . AddPlugin ( m_plugin_cfg ) ;
2012-11-11 16:36:08 +01:00
const char * MagicNumber = m_plugin_cfg . getString ( PLUGIN_INI_DEF , " magic " ) . c_str ( ) ;
if ( ! m_cfg . getBool ( " PLUGIN " , MagicNumber , false ) )
continue ;
u32 MagicWord = strtoul ( MagicNumber , NULL , 16 ) ;
2012-11-04 20:22:02 +01:00
if ( m_plugin_cfg . getString ( PLUGIN_INI_DEF , " romDir " ) . find ( " scummvm.ini " ) = = string : : npos )
2012-04-10 01:19:08 +02:00
{
2012-11-04 20:22:02 +01:00
string gameDir ( fmt ( " %s:/%s " , DeviceName [ currentPartition ] , m_plugin_cfg . getString ( PLUGIN_INI_DEF , " romDir " ) . c_str ( ) ) ) ;
string cacheDir ( fmt ( " %s/%s_%s.db " , m_listCacheDir . c_str ( ) , DeviceName [ currentPartition ] , m_plugin_cfg . getString ( PLUGIN_INI_DEF , " magic " ) . c_str ( ) ) ) ;
vector < string > FileTypes = stringToVector ( m_plugin_cfg . getString ( PLUGIN_INI_DEF , " fileTypes " ) , ' | ' ) ;
m_gameList . Color = strtoul ( m_plugin_cfg . getString ( PLUGIN_INI_DEF , " coverColor " ) . c_str ( ) , NULL , 16 ) ;
2012-10-13 00:25:22 +02:00
m_gameList . Magic = MagicWord ;
2013-01-15 14:54:33 +01:00
m_gameList . CreateList ( COVERFLOW_PLUGIN , currentPartition , gameDir , FileTypes , cacheDir , updateCache ) ;
2012-10-04 13:37:53 +02:00
for ( vector < dir_discHdr > : : iterator tmp_itr = m_gameList . begin ( ) ; tmp_itr ! = m_gameList . end ( ) ; tmp_itr + + )
emuList . push_back ( * tmp_itr ) ;
}
else
{
Config scummvm ;
vector < dir_discHdr > scummvmList ;
scummvm . load ( fmt ( " %s/%s " , m_pluginsDir . c_str ( ) , " scummvm.ini " ) ) ;
2012-10-13 00:25:22 +02:00
scummvmList = m_plugin . ParseScummvmINI ( scummvm , DeviceName [ currentPartition ] , MagicWord ) ;
2012-10-04 13:37:53 +02:00
for ( vector < dir_discHdr > : : iterator tmp_itr = scummvmList . begin ( ) ; tmp_itr ! = scummvmList . end ( ) ; tmp_itr + + )
emuList . push_back ( * tmp_itr ) ;
2012-04-10 01:19:08 +02:00
}
}
2012-10-04 13:37:53 +02:00
m_plugin_cfg . unload ( ) ;
2012-04-10 01:19:08 +02:00
}
2012-04-10 15:37:57 +02:00
m_gameList . clear ( ) ;
2012-05-06 14:03:43 +02:00
for ( vector < dir_discHdr > : : iterator tmp_itr = emuList . begin ( ) ; tmp_itr ! = emuList . end ( ) ; tmp_itr + + )
2012-10-04 13:37:53 +02:00
{
tmp_itr - > index = m_gameList . size ( ) ;
2012-04-10 15:37:57 +02:00
m_gameList . push_back ( * tmp_itr ) ;
2012-10-04 13:37:53 +02:00
}
2012-04-10 15:37:57 +02:00
emuList . clear ( ) ;
2012-04-10 19:12:38 +02:00
//If we return to the coverflow before wiiflow quit we dont need to reload plugins
m_plugin . EndAdd ( ) ;
2013-01-15 14:54:33 +01:00
m_cfg . remove ( PLUGIN_DOMAIN , " update_cache " ) ;
return true ;
2012-04-08 17:54:34 +02:00
}
2012-01-21 21:57:41 +01:00
void CMenu : : _stopSounds ( void )
{
// Fade out sounds
int fade_rate = m_cfg . getInt ( " GENERAL " , " music_fade_rate " , 8 ) ;
2012-09-22 15:47:52 +02:00
if ( ! MusicPlayer . IsStopped ( ) )
2012-01-21 21:57:41 +01:00
{
2012-09-22 15:47:52 +02:00
while ( MusicPlayer . GetVolume ( ) > 0 | | m_gameSound . GetVolume ( ) > 0 )
2012-01-21 21:57:41 +01:00
{
2012-09-22 15:47:52 +02:00
MusicPlayer . Tick ( true ) ;
2012-08-16 00:33:54 +02:00
if ( m_gameSound . GetVolume ( ) > 0 )
m_gameSound . SetVolume ( m_gameSound . GetVolume ( ) < fade_rate ? 0 : m_gameSound . GetVolume ( ) - fade_rate ) ;
2012-06-14 17:27:57 +02:00
VIDEO_WaitVSync ( ) ;
2012-01-21 21:57:41 +01:00
}
}
m_btnMgr . stopSounds ( ) ;
2012-11-11 19:28:03 +01:00
CoverFlow . stopSound ( ) ;
2012-08-16 00:33:54 +02:00
m_gameSound . Stop ( ) ;
2012-01-21 21:57:41 +01:00
}
2012-11-04 00:46:21 +01:00
bool CMenu : : _loadFile ( u8 * & buffer , u32 & size , const char * path , const char * file )
2012-01-21 21:57:41 +01:00
{
size = 0 ;
FILE * fp = fopen ( file = = NULL ? path : fmt ( " %s/%s " , path , file ) , " rb " ) ;
2012-05-13 17:13:33 +02:00
if ( fp = = NULL )
return false ;
2012-01-21 21:57:41 +01:00
fseek ( fp , 0 , SEEK_END ) ;
u32 fileSize = ftell ( fp ) ;
fseek ( fp , 0 , SEEK_SET ) ;
2012-11-03 20:16:03 +01:00
u8 * fileBuf = ( u8 * ) MEM2_alloc ( fileSize ) ;
if ( fileBuf = = NULL )
2012-01-21 21:57:41 +01:00
{
2012-05-13 17:13:33 +02:00
fclose ( fp ) ;
2012-01-21 21:57:41 +01:00
return false ;
}
2012-11-03 20:16:03 +01:00
if ( fread ( fileBuf , 1 , fileSize , fp ) ! = fileSize )
2012-01-21 21:57:41 +01:00
{
2012-05-13 17:13:33 +02:00
fclose ( fp ) ;
2012-01-21 21:57:41 +01:00
return false ;
}
2012-05-13 17:13:33 +02:00
fclose ( fp ) ;
2012-11-03 20:16:03 +01:00
if ( buffer ! = NULL )
free ( buffer ) ;
2012-01-21 21:57:41 +01:00
buffer = fileBuf ;
2012-05-13 17:13:33 +02:00
2012-11-03 20:16:03 +01:00
size = fileSize ;
2012-01-21 21:57:41 +01:00
return true ;
}
void CMenu : : _load_installed_cioses ( )
{
gprintf ( " Loading cIOS map \n " ) ;
_installed_cios [ 0 ] = 1 ;
2012-07-20 14:30:18 +02:00
for ( u8 slot = 200 ; slot < 254 ; slot + + )
2012-07-16 16:05:57 +02:00
{
2012-07-20 14:30:18 +02:00
u8 base = 1 ;
2012-08-11 14:27:38 +02:00
if ( IOS_D2X ( slot , & base ) )
2012-01-21 21:57:41 +01:00
{
2012-07-20 14:30:18 +02:00
gprintf ( " Found d2x base %u in slot %u \n " , base , slot ) ;
_installed_cios [ slot ] = base ;
}
2012-08-24 00:29:15 +02:00
else if ( CustomIOS ( IOS_GetType ( slot ) ) )
2012-07-20 14:30:18 +02:00
{
gprintf ( " Found cIOS in slot %u \n " , slot ) ;
2012-07-20 22:12:25 +02:00
_installed_cios [ slot ] = slot ;
2012-01-21 21:57:41 +01:00
}
2012-05-13 17:13:33 +02:00
}
2012-01-21 21:57:41 +01:00
}
2012-01-30 15:29:40 +01:00
void CMenu : : _hideWaitMessage ( )
2012-01-21 21:57:41 +01:00
{
2012-01-30 15:29:40 +01:00
m_vid . hideWaitMessage ( ) ;
2012-01-21 21:57:41 +01:00
}
void CMenu : : _showWaitMessage ( )
{
2012-11-03 20:16:03 +01:00
m_vid . waitMessage ( _textures ( " GENERAL " , " waitmessage " ) , m_theme . getFloat ( " GENERAL " , " waitmessage_delay " , 0.f ) ) ;
2012-01-21 21:57:41 +01:00
}
typedef struct map_entry
{
char filename [ 8 ] ;
u8 sha1 [ 20 ] ;
2013-01-01 18:42:46 +01:00
} ATTRIBUTE_PACKED map_entry_t ;
2012-01-21 21:57:41 +01:00
2012-11-12 21:12:00 +01:00
void CMenu : : loadDefaultFont ( void )
2012-01-21 21:57:41 +01:00
{
2012-11-12 21:12:00 +01:00
if ( m_base_font ! = NULL )
return ;
u32 size = 0 ;
2012-01-21 21:57:41 +01:00
bool retry = false ;
2012-11-12 21:12:00 +01:00
bool korean = ( CONF_GetLanguage ( ) = = CONF_LANG_KOREAN ) ;
char ISFS_Filename [ 32 ] ATTRIBUTE_ALIGN ( 32 ) ;
2012-05-13 17:13:33 +02:00
2012-01-21 21:57:41 +01:00
// Read content.map from ISFS
2012-11-12 21:12:00 +01:00
strcpy ( ISFS_Filename , " /shared1/content.map " ) ;
u8 * content = ISFS_GetFile ( ISFS_Filename , & size , - 1 ) ;
2012-05-13 19:25:26 +02:00
if ( content = = NULL )
return ;
2012-11-12 21:12:00 +01:00
u32 items = size / sizeof ( map_entry_t ) ;
2012-01-21 21:57:41 +01:00
//gprintf("Open content.map, size %d, items %d\n", size, items);
2012-11-12 21:12:00 +01:00
map_entry_t * cm = ( map_entry_t * ) content ;
2012-01-21 21:57:41 +01:00
2012-11-12 21:12:00 +01:00
retry :
2012-01-21 21:57:41 +01:00
bool kor_font = ( korean & & ! retry ) | | ( ! korean & & retry ) ;
2012-11-12 21:12:00 +01:00
for ( u32 i = 0 ; i < items ; i + + )
2012-01-21 21:57:41 +01:00
{
2012-11-12 21:12:00 +01:00
if ( m_base_font ! = NULL & & m_wbf1_font ! = NULL & & m_wbf2_font ! = NULL )
break ;
if ( memcmp ( cm [ i ] . sha1 , kor_font ? WIIFONT_HASH_KOR : WIIFONT_HASH , 20 ) = = 0 & & m_base_font = = NULL )
2012-01-21 21:57:41 +01:00
{
2012-11-12 21:12:00 +01:00
sprintf ( ISFS_Filename , " /shared1/%.8s.app " , cm [ i ] . filename ) ; //who cares about the few ticks more?
u8 * u8_font_archive = ISFS_GetFile ( ISFS_Filename , & size , - 1 ) ;
2012-07-03 18:26:49 +02:00
if ( u8_font_archive ! = NULL )
2012-01-21 21:57:41 +01:00
{
const u8 * font_file = u8_get_file_by_index ( u8_font_archive , 1 , & size ) ; // There is only one file in that app
//gprintf("Extracted font: %d\n", size);
2012-09-20 14:40:47 +02:00
m_base_font = ( u8 * ) MEM1_lo_alloc ( size ) ;
2012-09-07 20:13:04 +02:00
memcpy ( m_base_font , font_file , size ) ;
DCFlushRange ( m_base_font , size ) ;
m_base_font_size = size ;
2012-07-27 19:26:49 +02:00
free ( u8_font_archive ) ;
2012-01-21 21:57:41 +01:00
}
}
2012-11-12 21:12:00 +01:00
else if ( memcmp ( cm [ i ] . sha1 , WFB_HASH , 20 ) = = 0 & & m_wbf1_font = = NULL & & m_wbf2_font = = NULL )
2012-07-03 18:26:49 +02:00
{
2012-11-12 21:12:00 +01:00
sprintf ( ISFS_Filename , " /shared1/%.8s.app " , cm [ i ] . filename ) ; //who cares about the few ticks more?
u8 * u8_font_archive = ISFS_GetFile ( ISFS_Filename , & size , - 1 ) ;
2012-07-03 18:26:49 +02:00
if ( u8_font_archive ! = NULL )
{
const u8 * font_file1 = u8_get_file ( u8_font_archive , " wbf1.brfna " , & size ) ;
2012-09-07 20:13:04 +02:00
m_wbf1_font = ( u8 * ) MEM1_lo_alloc ( size ) ;
memcpy ( m_wbf1_font , font_file1 , size ) ;
DCFlushRange ( m_wbf1_font , size ) ;
2012-07-03 18:26:49 +02:00
const u8 * font_file2 = u8_get_file ( u8_font_archive , " wbf2.brfna " , & size ) ;
2012-09-07 20:13:04 +02:00
m_wbf2_font = ( u8 * ) MEM1_lo_alloc ( size ) ;
memcpy ( m_wbf2_font , font_file2 , size ) ;
DCFlushRange ( m_wbf2_font , size ) ;
2012-07-03 18:26:49 +02:00
2012-07-27 19:26:49 +02:00
free ( u8_font_archive ) ;
2012-07-03 18:26:49 +02:00
}
}
2012-01-21 21:57:41 +01:00
}
2012-11-12 21:12:00 +01:00
if ( ! retry & & m_base_font = = NULL )
2012-01-21 21:57:41 +01:00
{
retry = true ;
goto retry ;
}
2012-07-27 19:26:49 +02:00
free ( content ) ;
2012-01-21 21:57:41 +01:00
}
void CMenu : : _cleanupDefaultFont ( )
{
2012-09-07 20:13:04 +02:00
MEM1_lo_free ( m_base_font ) ;
2012-11-12 21:12:00 +01:00
m_base_font = NULL ;
2012-01-21 21:57:41 +01:00
m_base_font_size = 0 ;
2012-09-07 20:13:04 +02:00
MEM1_lo_free ( m_wbf1_font ) ;
2012-11-12 21:12:00 +01:00
m_wbf1_font = NULL ;
2012-09-07 20:13:04 +02:00
MEM1_lo_free ( m_wbf2_font ) ;
2012-11-12 21:12:00 +01:00
m_wbf2_font = NULL ;
2012-01-21 21:57:41 +01:00
}
2012-12-28 18:18:49 +01:00
char tmp [ 256 ] ;
2012-12-27 21:22:40 +01:00
const char * CMenu : : _getId ( )
2012-09-11 14:01:07 +02:00
{
2012-12-27 21:22:40 +01:00
const char * id = NULL ;
2013-01-21 00:30:28 +01:00
const dir_discHdr * hdr = CoverFlow . getHdr ( ) ;
2012-12-28 18:18:49 +01:00
if ( hdr - > type = = TYPE_HOMEBREW )
2012-12-27 21:22:40 +01:00
id = strrchr ( hdr - > path , ' / ' ) + 1 ;
2012-12-28 18:18:49 +01:00
else if ( hdr - > type = = TYPE_PLUGIN )
{
tmp [ 0 ] = ' \0 ' ;
if ( strrchr ( hdr - > path , ' : ' ) ! = NULL )
{
strcat ( tmp , strchr ( hdr - > path , ' / ' ) + 1 ) ;
* ( strchr ( tmp , ' / ' ) + 1 ) = ' \0 ' ;
}
strcat ( tmp , fmt ( " %ls " , hdr - > title ) ) ;
id = tmp ;
}
2012-09-11 14:01:07 +02:00
else
2012-12-27 21:22:40 +01:00
id = CoverFlow . getId ( ) ;
2012-09-11 14:01:07 +02:00
return id ;
}
2012-01-21 21:57:41 +01:00
const char * CMenu : : _domainFromView ( )
{
switch ( m_current_view )
{
case COVERFLOW_CHANNEL :
2012-11-04 20:22:02 +01:00
return CHANNEL_DOMAIN ;
2012-01-21 21:57:41 +01:00
case COVERFLOW_HOMEBREW :
2012-11-04 20:22:02 +01:00
return HOMEBREW_DOMAIN ;
2012-01-21 22:15:45 +01:00
case COVERFLOW_DML :
2012-11-04 20:22:02 +01:00
return GC_DOMAIN ;
2012-10-03 23:34:37 +02:00
case COVERFLOW_PLUGIN :
2012-11-04 20:22:02 +01:00
return PLUGIN_DOMAIN ;
2012-01-21 21:57:41 +01:00
default :
2012-11-04 20:22:02 +01:00
return WII_DOMAIN ;
2012-01-21 21:57:41 +01:00
}
return " NULL " ;
}
void CMenu : : UpdateCache ( u32 view )
{
if ( view = = COVERFLOW_MAX )
{
UpdateCache ( COVERFLOW_USB ) ;
UpdateCache ( COVERFLOW_HOMEBREW ) ;
2012-01-21 22:15:45 +01:00
UpdateCache ( COVERFLOW_DML ) ;
2012-10-03 23:34:37 +02:00
UpdateCache ( COVERFLOW_PLUGIN ) ;
2012-01-21 21:57:41 +01:00
UpdateCache ( COVERFLOW_CHANNEL ) ;
return ;
}
2013-01-15 14:54:33 +01:00
m_cfg . setBool ( _domainFromView ( ) , " update_cache " , true ) ;
2012-01-22 05:23:45 +01:00
}
2012-01-28 09:40:19 +01:00
2012-06-23 20:54:18 +02:00
int CMenu : : MIOSisDML ( )
2012-01-28 09:40:19 +01:00
{
2012-02-20 16:44:31 +01:00
u32 size = 0 ;
2012-11-12 21:12:00 +01:00
char ISFS_Filename [ ISFS_MAXPATH ] ATTRIBUTE_ALIGN ( 32 ) ;
strcpy ( ISFS_Filename , " /title/00000001/00000101/content/0000000c.app " ) ;
u8 * appfile = ISFS_GetFile ( ISFS_Filename , & size , - 1 ) ;
2012-02-20 16:44:31 +01:00
if ( appfile )
2012-01-28 09:40:19 +01:00
{
2012-06-23 20:54:18 +02:00
for ( u32 i = 0 ; i < size ; + + i )
2012-02-20 16:44:31 +01:00
{
2012-06-23 20:54:18 +02:00
if ( * ( vu32 * ) ( appfile + i ) = = 0x44494F53 )
2012-01-28 09:40:19 +01:00
{
2012-06-23 20:54:18 +02:00
for ( u32 j = 0 ; j < size ; + + j )
{
if ( * ( vu32 * ) ( appfile + j ) = = 0x4C697465 )
{
gprintf ( " DIOS-MIOS Lite is installed as MIOS \n " ) ;
2012-07-27 19:26:49 +02:00
free ( appfile ) ;
2012-06-23 20:54:18 +02:00
return 2 ;
}
}
gprintf ( " DIOS-MIOS is installed as MIOS \n " ) ;
2012-07-27 19:26:49 +02:00
free ( appfile ) ;
2012-06-23 20:54:18 +02:00
return 1 ;
2012-01-28 09:40:19 +01:00
}
2012-02-20 16:44:31 +01:00
}
2012-07-27 19:26:49 +02:00
free ( appfile ) ;
2012-01-28 09:40:19 +01:00
}
2012-06-23 20:54:18 +02:00
gprintf ( " DIOS-MIOS (Lite) not found \n " ) ;
return 0 ;
2012-01-28 09:40:19 +01:00
}
2012-02-05 01:07:07 +01:00
2012-11-01 17:39:42 +01:00
void CMenu : : RemoveCover ( const char * id )
2012-02-05 01:07:07 +01:00
{
2012-11-01 17:39:42 +01:00
const char * CoverPath = NULL ;
if ( id = = NULL )
return ;
CoverPath = fmt ( " %s/%s.png " , m_boxPicDir . c_str ( ) , id ) ;
fsop_deleteFile ( CoverPath ) ;
CoverPath = fmt ( " %s/%s.png " , m_picDir . c_str ( ) , id ) ;
fsop_deleteFile ( CoverPath ) ;
2012-12-27 21:22:40 +01:00
CoverPath = fmt ( " %s/%s.wfc " , m_cacheDir . c_str ( ) , id ) ;
2012-11-01 17:39:42 +01:00
fsop_deleteFile ( CoverPath ) ;
2012-04-26 20:43:05 +02:00
}
2012-09-05 17:52:32 +02:00
2012-11-12 21:12:00 +01:00
void CMenu : : TempLoadIOS ( int IOS )
2012-09-05 17:52:32 +02:00
{
/* Only temp reload in IOS58 mode */
2012-09-20 18:09:32 +02:00
if ( useMainIOS | | neek2o ( ) | | Sys_DolphinMode ( ) )
2012-09-05 17:52:32 +02:00
return ;
if ( IOS = = IOS_TYPE_NORMAL_IOS )
IOS = 58 ;
else if ( IOS = = 0 )
IOS = mainIOS ;
if ( CurrentIOS . Version ! = IOS )
{
loadIOS ( IOS , true ) ;
2012-12-27 21:22:40 +01:00
Sys_Init ( ) ;
2012-09-05 17:52:32 +02:00
Open_Inputs ( ) ;
for ( int chan = WPAD_MAX_WIIMOTES - 2 ; chan > = 0 ; chan - - )
WPAD_SetVRes ( chan , m_vid . width ( ) + m_cursor [ chan ] . width ( ) , m_vid . height ( ) + m_cursor [ chan ] . height ( ) ) ;
2012-12-21 20:51:22 +01:00
_netInit ( ) ;
2012-09-05 17:52:32 +02:00
}
}