diff --git a/HBC/META.XML b/HBC/META.XML index b9fc1c84..e4144098 100644 --- a/HBC/META.XML +++ b/HBC/META.XML @@ -2,8 +2,8 @@ USB Loader GX USB Loader GX Team - 1.0 r957 - 201009191357 + 1.0 r958 + 201009191649 Loads games from USB-devices USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times. The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller. diff --git a/gui.pnproj b/gui.pnproj index 0cb6dc9d..172a1b4d 100644 --- a/gui.pnproj +++ b/gui.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/cheats/cheatmenu.cpp b/source/cheats/cheatmenu.cpp index 012245f9..8a364e2d 100644 --- a/source/cheats/cheatmenu.cpp +++ b/source/cheats/cheatmenu.cpp @@ -34,9 +34,9 @@ int CheatMenu( const char * gameID ) // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%ssettings_background.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssettings_background.png", Settings.theme_path ); GuiImageData settingsbg( imgPath, settings_background_png ); GuiImage settingsbackground( &settingsbg ); @@ -84,7 +84,7 @@ int CheatMenu( const char * gameID ) case 1: int cntcheats = c.getCnt(); customOptionList cheatslst( cntcheats ); - GuiCustomOptionBrowser chtBrowser( 400, 280, &cheatslst, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, 1, 90 ); + GuiCustomOptionBrowser chtBrowser( 400, 280, &cheatslst, Settings.theme_path, "bg_options_settings.png", bg_options_settings_png, 1, 90 ); chtBrowser.SetPosition( 0, 90 ); chtBrowser.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); chtBrowser.SetClickable( true ); diff --git a/source/homebrewboot/HomebrewBrowse.cpp b/source/homebrewboot/HomebrewBrowse.cpp index c50e1be7..c4b33c6e 100644 --- a/source/homebrewboot/HomebrewBrowse.cpp +++ b/source/homebrewboot/HomebrewBrowse.cpp @@ -40,7 +40,6 @@ extern u32 uncfilesize; extern char wiiloadVersion[2]; extern u8 shutdown; extern u8 reset; -extern struct SSettings Settings; /*** Variables used elsewhere ***/ u8 boothomebrew = 0; @@ -95,28 +94,28 @@ int MenuHomebrewBrowse() /*** Image Variables ***/ char imgPath[150]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%ssettings_background.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssettings_background.png", Settings.theme_path ); GuiImageData bgData( imgPath, settings_background_png ); - snprintf( imgPath, sizeof( imgPath ), "%ssettings_title.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssettings_title.png", Settings.theme_path ); GuiImageData MainButtonImgData( imgPath, settings_title_png ); - snprintf( imgPath, sizeof( imgPath ), "%ssettings_title_over.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssettings_title_over.png", Settings.theme_path ); GuiImageData MainButtonImgOverData( imgPath, settings_title_over_png ); - snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_left.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_left.png", Settings.theme_path ); GuiImageData arrow_left( imgPath, startgame_arrow_left_png ); - snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_right.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_right.png", Settings.theme_path ); GuiImageData arrow_right( imgPath, startgame_arrow_right_png ); - snprintf( imgPath, sizeof( imgPath ), "%sWifi_btn.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sWifi_btn.png", Settings.theme_path ); GuiImageData wifiImgData( imgPath, Wifi_btn_png ); - snprintf( imgPath, sizeof( imgPath ), "%sChannel_btn.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sChannel_btn.png", Settings.theme_path ); GuiImageData channelImgData( imgPath, Channel_btn_png ); @@ -157,8 +156,8 @@ int MenuHomebrewBrowse() GuiImage backBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - backBtnTxt.SetWidescreen( CFG.widescreen ); - backBtnImg.SetWidescreen( CFG.widescreen ); + backBtnTxt.SetWidescreen( Settings.widescreen ); + backBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton backBtn( &backBtnImg, &backBtnImg, 2, 3, -180, 400, &trigA, &btnSoundOver, btnClick2, 1 ); backBtn.SetLabel( &backBtnTxt ); @@ -305,7 +304,7 @@ int MenuHomebrewBrowse() GuiImage wifiImg( &wifiImgData ); if ( Settings.wsprompt == yes ) { - wifiImg.SetWidescreen( CFG.widescreen ); + wifiImg.SetWidescreen( Settings.widescreen ); } GuiButton wifiBtn( wifiImg.GetWidth(), wifiImg.GetHeight() ); wifiBtn.SetImage( &wifiImg ); @@ -317,7 +316,7 @@ int MenuHomebrewBrowse() wifiBtn.SetTrigger( &trigA ); GuiImage channelBtnImg( &channelImgData ); - channelBtnImg.SetWidescreen( CFG.widescreen ); + channelBtnImg.SetWidescreen( Settings.widescreen ); GuiButton channelBtn( channelBtnImg.GetWidth(), channelBtnImg.GetHeight() ); channelBtn.SetAlignment( ALIGN_LEFT, ALIGN_TOP ); channelBtn.SetPosition( 440, 400 ); @@ -835,7 +834,7 @@ int MenuHomebrewBrowse() else if ( homo.GetState() == STATE_CLICKED ) { - cfg_save_global(); + Settings.Save(); bgMusic->Pause(); choice = WindowExitPrompt(); bgMusic->Resume(); diff --git a/source/libntfs/ntfs.h b/source/libntfs/ntfs.h index 22474232..e26af8ce 100644 --- a/source/libntfs/ntfs.h +++ b/source/libntfs/ntfs.h @@ -140,6 +140,9 @@ extern const char *ntfsGetVolumeName (const char *name); */ extern bool ntfsSetVolumeName (const char *name, const char *volumeName); +typedef int ( *_ntfs_frag_append_t )( void *ff, u32 offset, u32 sector, u32 count ); +int _NTFS_get_fragments ( const char *path, _ntfs_frag_append_t append_fragment, void *callback_data ); + #ifdef __cplusplus } #endif diff --git a/source/libwiigui/gui_customoptionbrowser.cpp b/source/libwiigui/gui_customoptionbrowser.cpp index ec75f81b..ab80c11f 100644 --- a/source/libwiigui/gui_customoptionbrowser.cpp +++ b/source/libwiigui/gui_customoptionbrowser.cpp @@ -10,7 +10,7 @@ #include "../wpad.h" #include "../main.h" #include "../gecko.h" -#include "../settings/cfg.h" +#include "../settings/CSettings.h" #include "gui_customoptionbrowser.h" #include diff --git a/source/libwiigui/gui_filebrowser.cpp b/source/libwiigui/gui_filebrowser.cpp index e453c4a9..e8178106 100644 --- a/source/libwiigui/gui_filebrowser.cpp +++ b/source/libwiigui/gui_filebrowser.cpp @@ -10,7 +10,7 @@ #include "gui.h" #include "prompts/filebrowser.h" -#include "settings/cfg.h" +#include "settings/CSettings.h" /** * Constructor for the GuiFileBrowser class. @@ -35,13 +35,13 @@ GuiFileBrowser::GuiFileBrowser( int w, int h ) btnSoundClick = new GuiSound( button_click_pcm, button_click_pcm_size, Settings.sfxvolume ); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbg_browser.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbg_browser.png", Settings.theme_path ); bgFileSelection = new GuiImageData( imgPath, bg_browser_png ); bgFileSelectionImg = new GuiImage( bgFileSelection ); bgFileSelectionImg->SetParent( this ); bgFileSelectionImg->SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); - snprintf( imgPath, sizeof( imgPath ), "%sbg_browser_selection.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbg_browser_selection.png", Settings.theme_path ); bgFileSelectionEntry = new GuiImageData( imgPath, bg_browser_selection_png ); // fileArchives = new GuiImageData(icon_archives_png); // fileDefault = new GuiImageData(icon_default_png); @@ -52,7 +52,7 @@ GuiFileBrowser::GuiFileBrowser( int w, int h ) // fileTXT = new GuiImageData(icon_txt_png); // fileXML = new GuiImageData(icon_xml_png); - snprintf( imgPath, sizeof( imgPath ), "%sscrollbar.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sscrollbar.png", Settings.theme_path ); scrollbar = new GuiImageData( imgPath, scrollbar_png ); scrollbarImg = new GuiImage( scrollbar ); scrollbarImg->SetParent( this ); @@ -60,13 +60,13 @@ GuiFileBrowser::GuiFileBrowser( int w, int h ) scrollbarImg->SetPosition( 0, 2 ); scrollbarImg->SetSkew( 0, 0, 0, 0, 0, -30, 0, -30 ); - snprintf( imgPath, sizeof( imgPath ), "%sscrollbar_arrowdown.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sscrollbar_arrowdown.png", Settings.theme_path ); arrowDown = new GuiImageData( imgPath, scrollbar_arrowdown_png ); arrowDownImg = new GuiImage( arrowDown ); - snprintf( imgPath, sizeof( imgPath ), "%sscrollbar_arrowup.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sscrollbar_arrowup.png", Settings.theme_path ); arrowUp = new GuiImageData( imgPath, scrollbar_arrowup_png ); arrowUpImg = new GuiImage( arrowUp ); - snprintf( imgPath, sizeof( imgPath ), "%sscrollbar_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sscrollbar_box.png", Settings.theme_path ); scrollbarBox = new GuiImageData( imgPath, scrollbar_box_png ); scrollbarBoxImg = new GuiImage( scrollbarBox ); diff --git a/source/libwiigui/gui_gamebrowser.cpp b/source/libwiigui/gui_gamebrowser.cpp index cc4ce8bb..56b88317 100644 --- a/source/libwiigui/gui_gamebrowser.cpp +++ b/source/libwiigui/gui_gamebrowser.cpp @@ -11,7 +11,7 @@ #include #include "gui_gamebrowser.h" -#include "../settings/cfg.h" +#include "../settings/CSettings.h" #include "../main.h" #include "settings/newtitles.h" #include "usbloader/GameList.h" diff --git a/source/libwiigui/gui_gamecarousel.cpp b/source/libwiigui/gui_gamecarousel.cpp index 8bd014e3..9a0aa1ca 100644 --- a/source/libwiigui/gui_gamecarousel.cpp +++ b/source/libwiigui/gui_gamecarousel.cpp @@ -14,7 +14,7 @@ #include "gui_image_async.h" #include "gui_gamecarousel.h" #include "usbloader/GameList.h" -#include "../settings/cfg.h" +#include "../settings/CSettings.h" #include "../main.h" #include @@ -71,16 +71,16 @@ GuiGameCarousel::GuiGameCarousel( int w, int h, const char *themePath, const u8 btnSoundClick = new GuiSound( button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume ); btnSoundOver = new GuiSound( button_over_pcm, button_over_pcm_size, Settings.sfxvolume ); - snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_left.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_left.png", Settings.theme_path ); imgLeft = new GuiImageData( imgPath, startgame_arrow_left_png ); - snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_right.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_right.png", Settings.theme_path ); imgRight = new GuiImageData( imgPath, startgame_arrow_right_png ); int btnHeight = ( int ) lround( sqrt( RADIUS * RADIUS - 90000 ) - RADIUS - 50 ); btnLeftImg = new GuiImage( imgLeft ); if ( Settings.wsprompt == yes ) - btnLeftImg->SetWidescreen( CFG.widescreen ); + btnLeftImg->SetWidescreen( Settings.widescreen ); btnLeft = new GuiButton( imgLeft->GetWidth(), imgLeft->GetHeight() ); btnLeft->SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); btnLeft->SetPosition( 20, btnHeight ); @@ -94,7 +94,7 @@ GuiGameCarousel::GuiGameCarousel( int w, int h, const char *themePath, const u8 btnRightImg = new GuiImage( imgRight ); if ( Settings.wsprompt == yes ) - btnRightImg->SetWidescreen( CFG.widescreen ); + btnRightImg->SetWidescreen( Settings.widescreen ); btnRight = new GuiButton( imgRight->GetWidth(), imgRight->GetHeight() ); btnRight->SetParent( this ); btnRight->SetAlignment( ALIGN_RIGHT, ALIGN_MIDDLE ); @@ -128,7 +128,7 @@ GuiGameCarousel::GuiGameCarousel( int w, int h, const char *themePath, const u8 //------------------------ coverImg[i] = new( std::nothrow ) GuiImageAsync( GameCarouselLoadCoverImage, gameList[gameIndex[i]], sizeof( struct discHdr ), &noCover ); if ( coverImg[i] ) - coverImg[i]->SetWidescreen( CFG.widescreen ); + coverImg[i]->SetWidescreen( Settings.widescreen ); //------------------------ // GameButton @@ -403,7 +403,7 @@ void GuiGameCarousel::Update( GuiTrigger * t ) // set saved Button & gameIndex to right gameIndex[0] = listOffset; coverImg[0] = new GuiImageAsync( GameCarouselLoadCoverImage, gameList[gameIndex[0]], sizeof( struct discHdr ), &noCover ); - coverImg[0] ->SetWidescreen( CFG.widescreen ); + coverImg[0] ->SetWidescreen( Settings.widescreen ); game[0] = tmpButton; game[0] ->SetImage( coverImg[0] ); @@ -436,7 +436,7 @@ void GuiGameCarousel::Update( GuiTrigger * t ) int ii = pagesize - 1; gameIndex[ii] = OFFSETLIMIT( listOffset + ii, gameList.size() ); coverImg[ii] = new GuiImageAsync( GameCarouselLoadCoverImage, gameList[gameIndex[ii]], sizeof( struct discHdr ), &noCover ); - coverImg[ii] ->SetWidescreen( CFG.widescreen ); + coverImg[ii] ->SetWidescreen( Settings.widescreen ); game[ii] = tmpButton; game[ii] ->SetImage( coverImg[ii] ); diff --git a/source/libwiigui/gui_gamegrid.cpp b/source/libwiigui/gui_gamegrid.cpp index f2ed7b03..b0ba8fd0 100644 --- a/source/libwiigui/gui_gamegrid.cpp +++ b/source/libwiigui/gui_gamegrid.cpp @@ -13,7 +13,7 @@ #include "gui_gamegrid.h" #include "gui_image_async.h" #include "usbloader/GameList.h" -#include "../settings/cfg.h" +#include "../settings/CSettings.h" #include "../prompts/PromptWindows.h" #include "../language/gettext.h" #include "../menu.h" @@ -488,7 +488,7 @@ void GuiGameGrid::Draw() if ( goLeft > 0 ) { goLeft--; - int wsi = CFG.widescreen ? 0 : 1; + int wsi = Settings.widescreen ? 0 : 1; float f2 = ( ( float )goLeft ) / goSteps; float f1 = 1.0 - f2; int ( *Pos )[2][2] = VALUE4ROWS( rows, Pos1, Pos2, Pos3 ); @@ -512,7 +512,7 @@ void GuiGameGrid::Draw() else if ( goRight > 0 ) { goRight--; - int wsi = CFG.widescreen ? 0 : 1; + int wsi = Settings.widescreen ? 0 : 1; float f2 = ( ( float )goRight ) / goSteps; float f1 = 1.0 - f2; int ( *Pos )[2][2] = VALUE4ROWS( rows, Pos1, Pos2, Pos3 ); @@ -656,7 +656,7 @@ void GuiGameGrid::Update( GuiTrigger * t ) gameIndex[i] = gameIndex[i+rows]; } // set saved Tooltip, Button & gameIndex to right - int wsi = CFG.widescreen ? 0 : 1; + int wsi = Settings.widescreen ? 0 : 1; int ( *Pos )[2][2] = VALUE4ROWS( rows, Pos1, Pos2, Pos3 ); int ( *Skew )[8] = VALUE4ROWS( rows, Skew1, Skew2, Skew3 ); @@ -671,7 +671,7 @@ void GuiGameGrid::Update( GuiTrigger * t ) coverImg[ii] = new GuiImageAsync( GameGridLoadCoverImage, gameList[gameIndex[ii]], sizeof( struct discHdr ), &noCover ); if ( coverImg[ii] ) { - coverImg[ii] ->SetWidescreen( CFG.widescreen ); + coverImg[ii] ->SetWidescreen( Settings.widescreen ); coverImg[ii] ->SetScale( VALUE4ROWS( rows, 1.0, 0.6, 0.26 ) ); coverImg[ii] ->SetPosition( 0, VALUE4ROWS( rows, 0, -50, -80 ) ); } @@ -700,7 +700,7 @@ void GuiGameGrid::Update( GuiTrigger * t ) } } // Set Tooltip-Position - int ttoffset_x = CFG.widescreen ? VALUE4ROWS( rows, 70, 35, 0 ) : VALUE4ROWS( rows, 150, 55, 25 ); + int ttoffset_x = Settings.widescreen ? VALUE4ROWS( rows, 70, 35, 0 ) : VALUE4ROWS( rows, 150, 55, 25 ); int ttoffset_y = -VALUE4ROWS( rows, 224, 133, 68 ) / 4; for ( int i = 0; i < pagesize; i++ ) { @@ -742,7 +742,7 @@ void GuiGameGrid::Update( GuiTrigger * t ) gameIndex[i] = gameIndex[i-rows]; } // set saved Image, Button & gameIndex to left - int wsi = CFG.widescreen ? 0 : 1; + int wsi = Settings.widescreen ? 0 : 1; int ( *Pos )[2][2] = VALUE4ROWS( rows, Pos1, Pos2, Pos3 ); int ( *Skew )[8] = VALUE4ROWS( rows, Skew1, Skew2, Skew3 ); @@ -756,7 +756,7 @@ void GuiGameGrid::Update( GuiTrigger * t ) coverImg[i] = new GuiImageAsync( GameGridLoadCoverImage, gameList[gameIndex[i]], sizeof( struct discHdr ), &noCover ); if ( coverImg[i] ) { - coverImg[i] ->SetWidescreen( CFG.widescreen ); + coverImg[i] ->SetWidescreen( Settings.widescreen ); coverImg[i] ->SetScale( VALUE4ROWS( rows, 1.0, 0.6, 0.26 ) ); coverImg[i] ->SetPosition( 0, VALUE4ROWS( rows, 0, -50, -80 ) ); } @@ -784,7 +784,7 @@ void GuiGameGrid::Update( GuiTrigger * t ) } } // Set Tooltip-Position - int ttoffset_x = CFG.widescreen ? VALUE4ROWS( rows, 70, 35, 0 ) : VALUE4ROWS( rows, 150, 55, 25 ); + int ttoffset_x = Settings.widescreen ? VALUE4ROWS( rows, 70, 35, 0 ) : VALUE4ROWS( rows, 150, 55, 25 ); int ttoffset_y = -VALUE4ROWS( rows, 224, 133, 68 ) / 4; for ( int i = 0; i < pagesize; i++ ) { @@ -878,11 +878,11 @@ void GuiGameGrid::Reload( int Rows, int ListOffset ) game = new GuiButton *[pagesize]; - int wsi = CFG.widescreen ? 0 : 1; + int wsi = Settings.widescreen ? 0 : 1; int ( *Pos )[2][2] = VALUE4ROWS( rows, Pos1, Pos2, Pos3 ); int ( *Skew )[8] = VALUE4ROWS( rows, Skew1, Skew2, Skew3 ); - int ttoffset_x = CFG.widescreen ? VALUE4ROWS( rows, 70, 35, 0 ) : VALUE4ROWS( rows, 150, 55, 25 ); + int ttoffset_x = Settings.widescreen ? VALUE4ROWS( rows, 70, 35, 0 ) : VALUE4ROWS( rows, 150, 55, 25 ); int ttoffset_y = -VALUE4ROWS( rows, 224, 133, 68 ) / 4; for ( int i = 0; i < pagesize; i++ ) @@ -917,7 +917,7 @@ void GuiGameGrid::Reload( int Rows, int ListOffset ) coverImg[i] = new GuiImageAsync( GameGridLoadCoverImage, gameList[gameIndex[i]], sizeof( struct discHdr ), &noCover ); if ( coverImg[i] ) { - coverImg[i]->SetWidescreen( CFG.widescreen ); + coverImg[i]->SetWidescreen( Settings.widescreen ); // if ( rows == 2 ) coverImg[i]->SetScale(.6); //these are the numbers for 2 rows // else if ( rows == 3 ) coverImg[i]->SetScale(.26); //these are the numbers for 3 rows coverImg[i]->SetScale( VALUE4ROWS( rows, 1.0, 0.6, 0.26 ) ); @@ -965,7 +965,5 @@ void GuiGameGrid::Reload( int Rows, int ListOffset ) } } Settings.gridRows = rows; - if ( isInserted( bootDevice ) ) - cfg_save_global(); } diff --git a/source/libwiigui/gui_keyboard.cpp b/source/libwiigui/gui_keyboard.cpp index f2746509..14aea3ff 100644 --- a/source/libwiigui/gui_keyboard.cpp +++ b/source/libwiigui/gui_keyboard.cpp @@ -10,7 +10,7 @@ #include "gui.h" #include "../main.h" -#include "../settings/cfg.h" +#include "../settings/CSettings.h" #include #include /** diff --git a/source/libwiigui/gui_numpad.cpp b/source/libwiigui/gui_numpad.cpp index 07517eef..1e8543fc 100644 --- a/source/libwiigui/gui_numpad.cpp +++ b/source/libwiigui/gui_numpad.cpp @@ -10,7 +10,7 @@ #include "gui.h" #include "../main.h" -#include "../settings/cfg.h" +#include "../settings/CSettings.h" #include #include /** diff --git a/source/libwiigui/gui_optionbrowser.cpp b/source/libwiigui/gui_optionbrowser.cpp index 7d5c73d3..71428ebb 100644 --- a/source/libwiigui/gui_optionbrowser.cpp +++ b/source/libwiigui/gui_optionbrowser.cpp @@ -10,7 +10,7 @@ #include "gui.h" #include "../wpad.h" -#include "settings/cfg.h" +#include "settings/CSettings.h" #include diff --git a/source/libwiigui/gui_searchbar.cpp b/source/libwiigui/gui_searchbar.cpp index 81662acc..a7d403be 100644 --- a/source/libwiigui/gui_searchbar.cpp +++ b/source/libwiigui/gui_searchbar.cpp @@ -3,7 +3,7 @@ #include "../wpad.h" #include "../main.h" -#include "../settings/cfg.h" +#include "../settings/CSettings.h" #include "../usbloader/GameList.h" extern GuiWindow * mainWindow; @@ -69,18 +69,18 @@ sndClick( button_click_pcm, button_click_pcm_size, Settings.sfxvolume ) text.SetText( gameList.GetCurrentFilter() ); text.SetPosition( 10, 15 ); text.SetAlignment( ALIGN_LEFT, ALIGN_TOP ); - text.SetWidescreen( CFG.widescreen ); + text.SetWidescreen( Settings.widescreen ); text.SetMaxWidth( width - ( 10 + 2*42 + 10 ), SCROLL_HORIZONTAL ); this->Append( &text ); - snprintf( imgPath, sizeof( imgPath ), "%skeyboard_backspace_over.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%skeyboard_backspace_over.png", Settings.theme_path ); imgBacspaceBtn = new GuiImageData( imgPath, keyboard_backspace_over_png ); BacspaceBtnImg_Over = new GuiImage( imgBacspaceBtn ); BacspaceBtnImg = new GuiImage( BacspaceBtnImg_Over ); BacspaceBtnImg->SetGrayscale(); BacspaceBtn = new GuiButton( BacspaceBtnImg, BacspaceBtnImg_Over, ALIGN_RIGHT, ALIGN_TOP, -52, 10, &trig, &sndOver, &sndClick, 1 ); this->Append( BacspaceBtn ); - snprintf( imgPath, sizeof( imgPath ), "%skeyboard_clear_over.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%skeyboard_clear_over.png", Settings.theme_path ); imgClearBtn = new GuiImageData( imgPath, keyboard_clear_over_png ); ClearBtnImg_Over = new GuiImage( imgClearBtn ); ClearBtnImg = new GuiImage( ClearBtnImg_Over ); ClearBtnImg->SetGrayscale(); diff --git a/source/main.cpp b/source/main.cpp index 0841321c..a019c07f 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -56,6 +56,7 @@ extern "C" extern bool geckoinit; extern char headlessID[8]; +char bootDevice[10]; NandTitle titles; PartList partitions; @@ -105,8 +106,8 @@ int main( int argc, char *argv[] ) gettextCleanUp(); printf( "\tLoading configuration..." ); - CFG_Load(); - VIDEO_SetWidescreen(CFG.widescreen); + Settings.Load(); + VIDEO_SetWidescreen(Settings.widescreen); printf( "done\n" ); SDCard_deInit();// unmount SD for reloading IOS @@ -149,7 +150,7 @@ int main( int argc, char *argv[] ) InitAudio(); char *fontPath = NULL; - asprintf( &fontPath, "%sfont.ttf", CFG.theme_path ); + asprintf( &fontPath, "%sfont.ttf", Settings.theme_path ); SetupDefaultFont( fontPath ); free( fontPath ); diff --git a/source/menu.cpp b/source/menu.cpp index 890a295a..528a7808 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -127,7 +127,7 @@ static void * UpdateGUI ( void *arg ) if ( userInput[i].wpad.ir.valid ) { Menu_DrawImg( userInput[i].wpad.ir.x - 48, userInput[i].wpad.ir.y - 48, 200.0, - 96, 96, pointer[i]->GetImage(), userInput[i].wpad.ir.angle, CFG.widescreen ? 0.8 : 1, 1, 255, 0, 0, 0, 0, 0, 0, 0, 0 ); + 96, 96, pointer[i]->GetImage(), userInput[i].wpad.ir.angle, Settings.widescreen ? 0.8 : 1, 1, 255, 0, 0, 0, 0, 0, 0, 0, 0 ); } } @@ -237,7 +237,7 @@ GuiImageData *LoadCoverImage( struct discHdr *header, bool Prefere3D, bool noCov for ( int i = 0; i < 2; ++i ) { const char *nocoverPath = ( flag ? "%snoimage.png" : "%snoimage2d.png" ); flag = !flag; - snprintf( Path, sizeof( Path ), nocoverPath, CFG.theme_path ); + snprintf( Path, sizeof( Path ), nocoverPath, Settings.theme_path ); delete Cover; Cover = new( std::nothrow ) GuiImageData( Path, ( Prefere3D ? nocover_png : nocoverFlat_png ) ); if ( Cover && Cover->GetImage() ) break; @@ -263,23 +263,23 @@ int MainMenu( int menu ) //if (strcmp(headlessID,"")!=0)HaltGui(); //WindowPrompt("Can you see me now",0,"ok"); - snprintf( imgPath, sizeof( imgPath ), "%splayer1_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%splayer1_point.png", Settings.theme_path ); pointer[0] = new GuiImageData( imgPath, player1_point_png ); - snprintf( imgPath, sizeof( imgPath ), "%splayer2_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%splayer2_point.png", Settings.theme_path ); pointer[1] = new GuiImageData( imgPath, player2_point_png ); - snprintf( imgPath, sizeof( imgPath ), "%splayer3_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%splayer3_point.png", Settings.theme_path ); pointer[2] = new GuiImageData( imgPath, player3_point_png ); - snprintf( imgPath, sizeof( imgPath ), "%splayer4_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%splayer4_point.png", Settings.theme_path ); pointer[3] = new GuiImageData( imgPath, player4_point_png ); mainWindow = new GuiWindow( screenwidth, screenheight ); - if ( CFG.widescreen ) - snprintf( imgPath, sizeof( imgPath ), "%swbackground.png", CFG.theme_path ); + if ( Settings.widescreen ) + snprintf( imgPath, sizeof( imgPath ), "%swbackground.png", Settings.theme_path ); else - snprintf( imgPath, sizeof( imgPath ), "%sbackground.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbackground.png", Settings.theme_path ); - background = new GuiImageData( imgPath, CFG.widescreen ? wbackground_png : background_png ); + background = new GuiImageData( imgPath, Settings.widescreen ? wbackground_png : background_png ); bgImg = new GuiImage( background ); mainWindow->Append( bgImg ); @@ -443,18 +443,11 @@ int MainMenu( int menu ) } else { - videoChoice = Settings.video; + videoChoice = Settings.videomode; languageChoice = Settings.language; ocarinaChoice = Settings.ocarina; - viChoice = Settings.vpatch; - if ( Settings.cios == ios222 ) - { - iosChoice = i222; - } - else - { - iosChoice = i249; - } + viChoice = Settings.videopatch; + iosChoice = Settings.cios; fix002 = Settings.error002; countrystrings = Settings.patchcountrystrings; if ( !altdoldefault ) @@ -467,25 +460,6 @@ int MainMenu( int menu ) } int ios2; - switch ( iosChoice ) - { - case i249: - ios2 = 249; - break; - - case i222: - ios2 = 222; - break; - - case i223: - ios2 = 223; - break; - - default: - ios2 = 249; - break; - } - // When the selected ios is 249, and you're loading from FAT, reset ios to 222 if ( load_from_fs != PART_FS_WBFS && ios2 == 249 ) { @@ -540,19 +514,7 @@ int MainMenu( int menu ) } } - u8 errorfixer002 = 0; - switch ( fix002 ) - { - case on: - errorfixer002 = 1; - break; - case off: - errorfixer002 = 0; - break; - case anti: - errorfixer002 = 2; - break; - } + u8 errorfixer002 = fix002; switch ( languageChoice ) { @@ -677,9 +639,14 @@ int MainMenu( int menu ) if( idx >= 0 ) channel = TITLE_LOWER( titles.At( idx ) ); } + + //This is temporary + SetCheatFilepath(Settings.Cheatcodespath); + SetBCAFilepath(Settings.BcaCodepath); + gprintf( "\tDisc_wiiBoot\n" ); - ret = Disc_WiiBoot( videoselected, cheat, vipatch, countrystrings, errorfixer002, alternatedol, alternatedoloffset, channel ); + ret = Disc_WiiBoot( Settings.dolpath, videoselected, cheat, vipatch, countrystrings, errorfixer002, alternatedol, alternatedoloffset, channel ); if ( ret < 0 ) { Sys_LoadMenu(); diff --git a/source/menu.h b/source/menu.h index db0bdb1a..bd45a7ad 100644 --- a/source/menu.h +++ b/source/menu.h @@ -10,7 +10,7 @@ #define _MENU_H_ #include -#include "settings/cfg.h" +#include "settings/CSettings.h" #include "main.h" void InitGUIThreads( void ); diff --git a/source/menu/menu_check.cpp b/source/menu/menu_check.cpp index abbed563..8ddd659b 100644 --- a/source/menu/menu_check.cpp +++ b/source/menu/menu_check.cpp @@ -5,6 +5,7 @@ #include "wpad.h" #include "fatmounter.h" #include "usbloader/wbfs.h" +#include "xml/xml.h" extern int load_from_fs; extern char game_partition[6]; @@ -36,11 +37,11 @@ int MenuCheck() WPAD_Shutdown(); if ( ret2 == 1 ) { - Settings.cios = ios249; + Settings.cios = 249; } else if ( ret2 == 2 ) { - Settings.cios = ios222; + Settings.cios = 222; } else { @@ -128,7 +129,7 @@ int MenuCheck() if ( ( ret2 >= 0 || load_from_fs != PART_FS_WBFS ) && isInserted( bootDevice ) ) { - cfg_save_global(); + Settings.Save(); break; } sleep( 1 ); diff --git a/source/menu/menu_disclist.cpp b/source/menu/menu_disclist.cpp index b6404cb6..ee7c362a 100644 --- a/source/menu/menu_disclist.cpp +++ b/source/menu/menu_disclist.cpp @@ -104,81 +104,81 @@ int MenuDiscList() if ( !btnClick2 ) btnClick2 = new GuiSound( button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume ); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); - snprintf( imgPath, sizeof( imgPath ), "%sbutton_install.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_install.png", Settings.theme_path ); GuiImageData btnInstall( imgPath, button_install_png ); - snprintf( imgPath, sizeof( imgPath ), "%sbutton_install_over.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_install_over.png", Settings.theme_path ); GuiImageData btnInstallOver( imgPath, button_install_over_png ); - snprintf( imgPath, sizeof( imgPath ), "%ssettings_button.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssettings_button.png", Settings.theme_path ); GuiImageData btnSettings( imgPath, settings_button_png ); - snprintf( imgPath, sizeof( imgPath ), "%ssettings_button_over.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssettings_button_over.png", Settings.theme_path ); GuiImageData btnSettingsOver( imgPath, settings_button_over_png ); GuiImageData dataID( &data1 ); - snprintf( imgPath, sizeof( imgPath ), "%swiimote_poweroff.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%swiimote_poweroff.png", Settings.theme_path ); GuiImageData btnpwroff( imgPath, wiimote_poweroff_png ); - snprintf( imgPath, sizeof( imgPath ), "%swiimote_poweroff_over.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%swiimote_poweroff_over.png", Settings.theme_path ); GuiImageData btnpwroffOver( imgPath, wiimote_poweroff_over_png ); - snprintf( imgPath, sizeof( imgPath ), "%smenu_button.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%smenu_button.png", Settings.theme_path ); GuiImageData btnhome( imgPath, menu_button_png ); - snprintf( imgPath, sizeof( imgPath ), "%smenu_button_over.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%smenu_button_over.png", Settings.theme_path ); GuiImageData btnhomeOver( imgPath, menu_button_over_png ); - snprintf( imgPath, sizeof( imgPath ), "%sSDcard_over.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sSDcard_over.png", Settings.theme_path ); GuiImageData btnsdcardOver( imgPath, sdcard_over_png ); - snprintf( imgPath, sizeof( imgPath ), "%sSDcard.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sSDcard.png", Settings.theme_path ); GuiImageData btnsdcard( imgPath, sdcard_png ); - snprintf( imgPath, sizeof( imgPath ), "%sfavIcon.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sfavIcon.png", Settings.theme_path ); GuiImageData imgfavIcon( imgPath, favIcon_png ); - snprintf( imgPath, sizeof( imgPath ), "%sfavIcon_gray.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sfavIcon_gray.png", Settings.theme_path ); GuiImageData imgfavIcon_gray( imgPath, NULL ); - snprintf( imgPath, sizeof( imgPath ), "%ssearchIcon.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssearchIcon.png", Settings.theme_path ); GuiImageData imgsearchIcon( imgPath, searchIcon_png ); - snprintf( imgPath, sizeof( imgPath ), "%ssearchIcon_gray.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssearchIcon_gray.png", Settings.theme_path ); GuiImageData imgsearchIcon_gray( imgPath, NULL ); - snprintf( imgPath, sizeof( imgPath ), "%sabcIcon.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sabcIcon.png", Settings.theme_path ); GuiImageData imgabcIcon( imgPath, abcIcon_png ); - snprintf( imgPath, sizeof( imgPath ), "%sabcIcon_gray.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sabcIcon_gray.png", Settings.theme_path ); GuiImageData imgabcIcon_gray( imgPath, NULL ); - snprintf( imgPath, sizeof( imgPath ), "%srankIcon.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%srankIcon.png", Settings.theme_path ); GuiImageData imgrankIcon( imgPath, rankIcon_png ); - snprintf( imgPath, sizeof( imgPath ), "%srankIcon_gray.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%srankIcon_gray.png", Settings.theme_path ); GuiImageData imgrankIcon_gray( imgPath, NULL ); - snprintf( imgPath, sizeof( imgPath ), "%splayCountIcon.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%splayCountIcon.png", Settings.theme_path ); GuiImageData imgplayCountIcon( imgPath, playCountIcon_png ); - snprintf( imgPath, sizeof( imgPath ), "%splayCountIcon_gray.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%splayCountIcon_gray.png", Settings.theme_path ); GuiImageData imgplayCountIcon_gray( imgPath, NULL ); - snprintf( imgPath, sizeof( imgPath ), "%sarrangeGrid.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sarrangeGrid.png", Settings.theme_path ); GuiImageData imgarrangeGrid( imgPath, arrangeGrid_png ); - snprintf( imgPath, sizeof( imgPath ), "%sarrangeGrid_gray.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sarrangeGrid_gray.png", Settings.theme_path ); GuiImageData imgarrangeGrid_gray( imgPath, NULL ); - snprintf( imgPath, sizeof( imgPath ), "%sarrangeList.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sarrangeList.png", Settings.theme_path ); GuiImageData imgarrangeList( imgPath, arrangeList_png ); - snprintf( imgPath, sizeof( imgPath ), "%sarrangeList_gray.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sarrangeList_gray.png", Settings.theme_path ); GuiImageData imgarrangeList_gray( imgPath, NULL ); - snprintf( imgPath, sizeof( imgPath ), "%sarrangeCarousel.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sarrangeCarousel.png", Settings.theme_path ); GuiImageData imgarrangeCarousel( imgPath, arrangeCarousel_png ); - snprintf( imgPath, sizeof( imgPath ), "%sarrangeCarousel_gray.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sarrangeCarousel_gray.png", Settings.theme_path ); GuiImageData imgarrangeCarousel_gray( imgPath, NULL ); - snprintf( imgPath, sizeof( imgPath ), "%slock.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%slock.png", Settings.theme_path ); GuiImageData imgLock( imgPath, lock_png ); - snprintf( imgPath, sizeof( imgPath ), "%slock_gray.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%slock_gray.png", Settings.theme_path ); GuiImageData imgLock_gray( imgPath, NULL ); - snprintf( imgPath, sizeof( imgPath ), "%sunlock.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sunlock.png", Settings.theme_path ); GuiImageData imgUnlock( imgPath, unlock_png ); - snprintf( imgPath, sizeof( imgPath ), "%sunlock_gray.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sunlock_gray.png", Settings.theme_path ); GuiImageData imgUnlock_gray( imgPath, NULL ); - snprintf( imgPath, sizeof( imgPath ), "%sdvd.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdvd.png", Settings.theme_path ); GuiImageData imgdvd( imgPath, dvd_png ); - snprintf( imgPath, sizeof( imgPath ), "%sdvd_gray.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdvd_gray.png", Settings.theme_path ); GuiImageData imgdvd_gray( imgPath, NULL ); - snprintf( imgPath, sizeof( imgPath ), "%sbrowser.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbrowser.png", Settings.theme_path ); GuiImageData homebrewImgData( imgPath, browser_png ); - snprintf( imgPath, sizeof( imgPath ), "%sbrowser_over.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbrowser_over.png", Settings.theme_path ); GuiImageData homebrewImgDataOver( imgPath, browser_over_png ); @@ -231,56 +231,56 @@ int MenuDiscList() GuiTooltip installBtnTT( tr( "Install a game" ) ); if ( Settings.wsprompt == yes ) - installBtnTT.SetWidescreen( CFG.widescreen ); + installBtnTT.SetWidescreen( Settings.widescreen ); installBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage installBtnImg( &btnInstall ); GuiImage installBtnImgOver( &btnInstallOver ); - installBtnImg.SetWidescreen( CFG.widescreen ); - installBtnImgOver.SetWidescreen( CFG.widescreen ); + installBtnImg.SetWidescreen( Settings.widescreen ); + installBtnImgOver.SetWidescreen( Settings.widescreen ); GuiButton installBtn( &installBtnImg, &installBtnImgOver, ALIGN_LEFT, ALIGN_TOP, THEME.install_x, THEME.install_y, &trigA, &btnSoundOver, btnClick2, 1, &installBtnTT, 24, -30, 0, 5 ); GuiTooltip settingsBtnTT( tr( "Settings" ) ); if ( Settings.wsprompt == yes ) - settingsBtnTT.SetWidescreen( CFG.widescreen ); + settingsBtnTT.SetWidescreen( Settings.widescreen ); settingsBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage settingsBtnImg( &btnSettings ); - settingsBtnImg.SetWidescreen( CFG.widescreen ); + settingsBtnImg.SetWidescreen( Settings.widescreen ); GuiImage settingsBtnImgOver( &btnSettingsOver ); - settingsBtnImgOver.SetWidescreen( CFG.widescreen ); + settingsBtnImgOver.SetWidescreen( Settings.widescreen ); GuiButton settingsBtn( &settingsBtnImg, &settingsBtnImgOver, 0, 3, THEME.setting_x, THEME.setting_y, &trigA, &btnSoundOver, btnClick2, 1, &settingsBtnTT, 65, -30, 0, 5 ); GuiTooltip homeBtnTT( tr( "Back to HBC or Wii Menu" ) ); if ( Settings.wsprompt == yes ) - homeBtnTT.SetWidescreen( CFG.widescreen ); + homeBtnTT.SetWidescreen( Settings.widescreen ); settingsBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage homeBtnImg( &btnhome ); - homeBtnImg.SetWidescreen( CFG.widescreen ); + homeBtnImg.SetWidescreen( Settings.widescreen ); GuiImage homeBtnImgOver( &btnhomeOver ); - homeBtnImgOver.SetWidescreen( CFG.widescreen ); + homeBtnImgOver.SetWidescreen( Settings.widescreen ); GuiButton homeBtn( &homeBtnImg, &homeBtnImgOver, 0, 3, THEME.home_x, THEME.home_y, &trigA, &btnSoundOver, btnClick2, 1, &homeBtnTT, 15, -30, 1, 5 ); homeBtn.RemoveSoundClick(); homeBtn.SetTrigger( &trigHome ); GuiTooltip poweroffBtnTT( tr( "Power off the Wii" ) ); if ( Settings.wsprompt == yes ) - poweroffBtnTT.SetWidescreen( CFG.widescreen ); + poweroffBtnTT.SetWidescreen( Settings.widescreen ); poweroffBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage poweroffBtnImg( &btnpwroff ); GuiImage poweroffBtnImgOver( &btnpwroffOver ); - poweroffBtnImg.SetWidescreen( CFG.widescreen ); - poweroffBtnImgOver.SetWidescreen( CFG.widescreen ); + poweroffBtnImg.SetWidescreen( Settings.widescreen ); + poweroffBtnImgOver.SetWidescreen( Settings.widescreen ); GuiButton poweroffBtn( &poweroffBtnImg, &poweroffBtnImgOver, 0, 3, THEME.power_x, THEME.power_y, &trigA, &btnSoundOver, btnClick2, 1, &poweroffBtnTT, -10, -30, 1, 5 ); GuiTooltip sdcardBtnTT( tr( "Reload SD" ) ); if ( Settings.wsprompt == yes ) - sdcardBtnTT.SetWidescreen( CFG.widescreen ); + sdcardBtnTT.SetWidescreen( Settings.widescreen ); sdcardBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage sdcardImg( &btnsdcard ); GuiImage sdcardImgOver( &btnsdcardOver ); - sdcardImg.SetWidescreen( CFG.widescreen ); - sdcardImgOver.SetWidescreen( CFG.widescreen ); + sdcardImg.SetWidescreen( Settings.widescreen ); + sdcardImgOver.SetWidescreen( Settings.widescreen ); GuiButton sdcardBtn( &sdcardImg, &sdcardImgOver, 0, 3, THEME.sdcard_x, THEME.sdcard_y, &trigA, &btnSoundOver, btnClick2, 1, &sdcardBtnTT, 15, -30, 0, 5 ); GuiButton gameInfo( 0, 0 ); @@ -289,116 +289,116 @@ int MenuDiscList() GuiImage wiiBtnImg( &dataID ); - wiiBtnImg.SetWidescreen( CFG.widescreen ); + wiiBtnImg.SetWidescreen( Settings.widescreen ); GuiButton wiiBtn( &wiiBtnImg, &wiiBtnImg, 0, 4, 0, -10, &trigA, &btnSoundOver, btnClick2, 0 ); GuiTooltip favoriteBtnTT( tr( "Display favorites" ) ); if ( Settings.wsprompt == yes ) - favoriteBtnTT.SetWidescreen( CFG.widescreen ); + favoriteBtnTT.SetWidescreen( Settings.widescreen ); favoriteBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage favoriteBtnImg( &imgfavIcon ); - favoriteBtnImg.SetWidescreen( CFG.widescreen ); + favoriteBtnImg.SetWidescreen( Settings.widescreen ); GuiImage favoriteBtnImg_g( &imgfavIcon_gray ); if ( favoriteBtnImg_g.GetImage() == NULL ) { favoriteBtnImg_g = favoriteBtnImg; favoriteBtnImg_g.SetGrayscale();} - favoriteBtnImg_g.SetWidescreen( CFG.widescreen ); + favoriteBtnImg_g.SetWidescreen( Settings.widescreen ); GuiButton favoriteBtn( &favoriteBtnImg_g, &favoriteBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_favorite_x, THEME.gamelist_favorite_y, &trigA, &btnSoundOver, btnClick2, 1, &favoriteBtnTT, -15, 52, 0, 3 ); favoriteBtn.SetAlpha( 180 ); GuiTooltip searchBtnTT( tr( "Set Search-Filter" ) ); if ( Settings.wsprompt == yes ) - searchBtnTT.SetWidescreen( CFG.widescreen ); + searchBtnTT.SetWidescreen( Settings.widescreen ); searchBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage searchBtnImg( &imgsearchIcon ); - searchBtnImg.SetWidescreen( CFG.widescreen ); + searchBtnImg.SetWidescreen( Settings.widescreen ); GuiImage searchBtnImg_g( &imgsearchIcon_gray ); if ( searchBtnImg_g.GetImage() == NULL ) { searchBtnImg_g = searchBtnImg; searchBtnImg_g.SetGrayscale();} - searchBtnImg_g.SetWidescreen( CFG.widescreen ); + searchBtnImg_g.SetWidescreen( Settings.widescreen ); GuiButton searchBtn( &searchBtnImg_g, &searchBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_search_x, THEME.gamelist_search_y, &trigA, &btnSoundOver, btnClick2, 1, &searchBtnTT, -15, 52, 0, 3 ); searchBtn.SetAlpha( 180 ); GuiTooltip abcBtnTT( Settings.fave ? tr( "Sort by rank" ) : tr( "Sort alphabetically" ) ); if ( Settings.wsprompt == yes ) - abcBtnTT.SetWidescreen( CFG.widescreen ); + abcBtnTT.SetWidescreen( Settings.widescreen ); abcBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage abcBtnImg( Settings.fave ? &imgrankIcon : &imgabcIcon ); - abcBtnImg.SetWidescreen( CFG.widescreen ); + abcBtnImg.SetWidescreen( Settings.widescreen ); GuiImage abcBtnImg_g( Settings.fave ? &imgrankIcon_gray : &imgabcIcon_gray ); if ( abcBtnImg_g.GetImage() == NULL ) { abcBtnImg_g = abcBtnImg; abcBtnImg_g.SetGrayscale();} - abcBtnImg_g.SetWidescreen( CFG.widescreen ); + abcBtnImg_g.SetWidescreen( Settings.widescreen ); GuiButton abcBtn( &abcBtnImg_g, &abcBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_abc_x, THEME.gamelist_abc_y, &trigA, &btnSoundOver, btnClick2, 1, &abcBtnTT, -15, 52, 0, 3 ); abcBtn.SetAlpha( 180 ); GuiTooltip countBtnTT( tr( "Sort order by most played" ) ); if ( Settings.wsprompt == yes ) - countBtnTT.SetWidescreen( CFG.widescreen ); + countBtnTT.SetWidescreen( Settings.widescreen ); countBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage countBtnImg( &imgplayCountIcon ); - countBtnImg.SetWidescreen( CFG.widescreen ); + countBtnImg.SetWidescreen( Settings.widescreen ); GuiImage countBtnImg_g( &imgplayCountIcon_gray ); if ( countBtnImg_g.GetImage() == NULL ) { countBtnImg_g = countBtnImg; countBtnImg_g.SetGrayscale();} - countBtnImg_g.SetWidescreen( CFG.widescreen ); + countBtnImg_g.SetWidescreen( Settings.widescreen ); GuiButton countBtn( &countBtnImg_g, &countBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_count_x, THEME.gamelist_count_y, &trigA, &btnSoundOver, btnClick2, 1, &countBtnTT, -15, 52, 0, 3 ); countBtn.SetAlpha( 180 ); GuiTooltip listBtnTT( tr( "Display as a list" ) ); if ( Settings.wsprompt == yes ) - listBtnTT.SetWidescreen( CFG.widescreen ); + listBtnTT.SetWidescreen( Settings.widescreen ); listBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage listBtnImg( &imgarrangeList ); - listBtnImg.SetWidescreen( CFG.widescreen ); + listBtnImg.SetWidescreen( Settings.widescreen ); GuiImage listBtnImg_g( &imgarrangeList_gray ); if ( listBtnImg_g.GetImage() == NULL ) { listBtnImg_g = listBtnImg; listBtnImg_g.SetGrayscale();} - listBtnImg_g.SetWidescreen( CFG.widescreen ); + listBtnImg_g.SetWidescreen( Settings.widescreen ); GuiButton listBtn( &listBtnImg_g, &listBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_list_x, THEME.gamelist_list_y, &trigA, &btnSoundOver, btnClick2, 1, &listBtnTT, 15, 52, 1, 3 ); listBtn.SetAlpha( 180 ); GuiTooltip gridBtnTT( tr( "Display as a grid" ) ); if ( Settings.wsprompt == yes ) - gridBtnTT.SetWidescreen( CFG.widescreen ); + gridBtnTT.SetWidescreen( Settings.widescreen ); gridBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage gridBtnImg( &imgarrangeGrid ); - gridBtnImg.SetWidescreen( CFG.widescreen ); + gridBtnImg.SetWidescreen( Settings.widescreen ); GuiImage gridBtnImg_g( &imgarrangeGrid_gray ); if ( gridBtnImg_g.GetImage() == NULL ) { gridBtnImg_g = gridBtnImg; gridBtnImg_g.SetGrayscale();} - gridBtnImg_g.SetWidescreen( CFG.widescreen ); + gridBtnImg_g.SetWidescreen( Settings.widescreen ); GuiButton gridBtn( &gridBtnImg_g, &gridBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_grid_x, THEME.gamelist_grid_y, &trigA, &btnSoundOver, btnClick2, 1, &gridBtnTT, 15, 52, 1, 3 ); gridBtn.SetAlpha( 180 ); GuiTooltip carouselBtnTT( tr( "Display as a carousel" ) ); if ( Settings.wsprompt == yes ) - carouselBtnTT.SetWidescreen( CFG.widescreen ); + carouselBtnTT.SetWidescreen( Settings.widescreen ); carouselBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage carouselBtnImg( &imgarrangeCarousel ); - carouselBtnImg.SetWidescreen( CFG.widescreen ); + carouselBtnImg.SetWidescreen( Settings.widescreen ); GuiImage carouselBtnImg_g( &imgarrangeCarousel_gray ); if ( carouselBtnImg_g.GetImage() == NULL ) { carouselBtnImg_g = carouselBtnImg; carouselBtnImg_g.SetGrayscale();} - carouselBtnImg_g.SetWidescreen( CFG.widescreen ); + carouselBtnImg_g.SetWidescreen( Settings.widescreen ); GuiButton carouselBtn( &carouselBtnImg_g, &carouselBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_carousel_x, THEME.gamelist_carousel_y, &trigA, &btnSoundOver, btnClick2, 1, &carouselBtnTT, 15, 52, 1, 3 ); carouselBtn.SetAlpha( 180 ); - bool canUnlock = ( Settings.parentalcontrol == 0 && Settings.parental.enabled == 1 ); + bool canUnlock = ( Settings.parentalcontrol == 0 && Settings.Parental.enabled == 1 ); GuiTooltip lockBtnTT( canUnlock ? tr( "Unlock Parental Control" ) : tr( "Parental Control disabled" ) ); if ( Settings.wsprompt == yes ) - lockBtnTT.SetWidescreen( CFG.widescreen ); + lockBtnTT.SetWidescreen( Settings.widescreen ); lockBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage lockBtnImg( &imgLock ); - lockBtnImg.SetWidescreen( CFG.widescreen ); + lockBtnImg.SetWidescreen( Settings.widescreen ); GuiImage lockBtnImg_g( &imgLock_gray ); if ( lockBtnImg_g.GetImage() == NULL ) { lockBtnImg_g = lockBtnImg; lockBtnImg_g.SetGrayscale(); } - lockBtnImg_g.SetWidescreen( CFG.widescreen ); + lockBtnImg_g.SetWidescreen( Settings.widescreen ); GuiButton lockBtn( &lockBtnImg_g, &lockBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_lock_x, THEME.gamelist_lock_y, &trigA, &btnSoundOver, btnClick2, 1, &lockBtnTT, 15, 52, 1, 3 ); lockBtn.SetAlpha( 180 ); GuiTooltip unlockBtnTT( tr( "Enable Parental Control" ) ); if ( Settings.wsprompt == yes ) - unlockBtnTT.SetWidescreen( CFG.widescreen ); + unlockBtnTT.SetWidescreen( Settings.widescreen ); unlockBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage unlockBtnImg( &imgUnlock ); - unlockBtnImg.SetWidescreen( CFG.widescreen ); + unlockBtnImg.SetWidescreen( Settings.widescreen ); GuiImage unlockBtnImg_g( &imgUnlock_gray ); if ( unlockBtnImg_g.GetImage() == NULL ) { unlockBtnImg_g = unlockBtnImg; unlockBtnImg_g.SetGrayscale(); } - unlockBtnImg_g.SetWidescreen( CFG.widescreen ); + unlockBtnImg_g.SetWidescreen( Settings.widescreen ); if ( canUnlock && Settings.godmode ) { @@ -414,23 +414,23 @@ int MenuDiscList() GuiTooltip dvdBtnTT( tr( "Mount DVD drive" ) ); if ( Settings.wsprompt == yes ) - dvdBtnTT.SetWidescreen( CFG.widescreen ); + dvdBtnTT.SetWidescreen( Settings.widescreen ); dvdBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage dvdBtnImg( &imgdvd ); - dvdBtnImg.SetWidescreen( CFG.widescreen ); + dvdBtnImg.SetWidescreen( Settings.widescreen ); GuiImage dvdBtnImg_g( dvdBtnImg ); - dvdBtnImg_g.SetWidescreen( CFG.widescreen ); + dvdBtnImg_g.SetWidescreen( Settings.widescreen ); GuiButton dvdBtn( &dvdBtnImg_g, &dvdBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_dvd_x, THEME.gamelist_dvd_y, &trigA, &btnSoundOver, btnClick2, 1, &dvdBtnTT, 15, 52, 1, 3 ); dvdBtn.SetAlpha( 180 ); GuiTooltip homebrewBtnTT( tr( "Homebrew Launcher" ) ); if ( Settings.wsprompt == yes ) - homebrewBtnTT.SetWidescreen( CFG.widescreen ); + homebrewBtnTT.SetWidescreen( Settings.widescreen ); homebrewBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiImage homebrewImg( &homebrewImgData ); GuiImage homebrewImgOver( &homebrewImgDataOver ); - homebrewImg.SetWidescreen( CFG.widescreen ); - homebrewImgOver.SetWidescreen( CFG.widescreen ); + homebrewImg.SetWidescreen( Settings.widescreen ); + homebrewImgOver.SetWidescreen( Settings.widescreen ); GuiButton homebrewBtn( &homebrewImg, &homebrewImgOver, ALIGN_LEFT, ALIGN_TOP, THEME.homebrew_x, THEME.homebrew_y, &trigA, &btnSoundOver, btnClick2, 1, &homebrewBtnTT, 15, -30, 1, 5 ); if ( Settings.fave ) @@ -522,7 +522,7 @@ int MenuDiscList() //Downloading Covers GuiTooltip DownloadBtnTT( tr( "Click to Download Covers" ) ); if ( Settings.wsprompt == yes ) - DownloadBtnTT.SetWidescreen( CFG.widescreen ); + DownloadBtnTT.SetWidescreen( Settings.widescreen ); DownloadBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiButton DownloadBtn( 0, 0 ); DownloadBtn.SetAlignment( ALIGN_LEFT, ALIGN_TOP ); @@ -530,7 +530,7 @@ int MenuDiscList() GuiTooltip IDBtnTT( tr( "Click to change game ID" ) ); if ( Settings.wsprompt == yes ) - IDBtnTT.SetWidescreen( CFG.widescreen ); + IDBtnTT.SetWidescreen( Settings.widescreen ); IDBtnTT.SetAlpha( THEME.tooltipAlpha ); GuiButton idBtn( 0, 0 ); idBtn.SetAlignment( ALIGN_LEFT, ALIGN_TOP ); @@ -559,20 +559,20 @@ int MenuDiscList() GuiGameCarousel * gameCarousel = NULL; if ( Settings.gameDisplay == list ) { - gameBrowser = new GuiGameBrowser( THEME.gamelist_w, THEME.gamelist_h, CFG.theme_path, bg_options_png, startat, offset ); + gameBrowser = new GuiGameBrowser( THEME.gamelist_w, THEME.gamelist_h, Settings.theme_path, bg_options_png, startat, offset ); gameBrowser->SetPosition( THEME.gamelist_x, THEME.gamelist_y ); gameBrowser->SetAlignment( ALIGN_LEFT, ALIGN_CENTRE ); } else if ( Settings.gameDisplay == grid ) { - gameGrid = new GuiGameGrid( THEME.gamegrid_w, THEME.gamegrid_h, CFG.theme_path, bg_options_png, 0, 0 ); + gameGrid = new GuiGameGrid( THEME.gamegrid_w, THEME.gamegrid_h, Settings.theme_path, bg_options_png, 0, 0 ); gameGrid->SetPosition( THEME.gamegrid_x, THEME.gamegrid_y ); gameGrid->SetAlignment( ALIGN_LEFT, ALIGN_CENTRE ); } else if ( Settings.gameDisplay == carousel ) { - //GuiGameCarousel gameCarousel(THEME.gamecarousel_w, THEME.gamecarousel_h, gameList, gameList.size(), CFG.theme_path, bg_options_png, startat, offset); - gameCarousel = new GuiGameCarousel( 640, 400, CFG.theme_path, bg_options_png, startat, offset ); + //GuiGameCarousel gameCarousel(THEME.gamecarousel_w, THEME.gamecarousel_h, gameList, gameList.size(), Settings.theme_path, bg_options_png, startat, offset); + gameCarousel = new GuiGameCarousel( 640, 400, Settings.theme_path, bg_options_png, startat, offset ); gameCarousel->SetPosition( THEME.gamecarousel_x, THEME.gamecarousel_y ); gameCarousel->SetAlignment( ALIGN_LEFT, ALIGN_CENTRE ); } @@ -700,7 +700,7 @@ int MenuDiscList() Settings.fave = !Settings.fave; if ( isInserted( bootDevice ) ) { - cfg_save_global(); + Settings.Save(); } gameList.FilterList(); menu = MENU_DISCLIST; @@ -740,7 +740,7 @@ int MenuDiscList() } - if ( ( datagB < 1 ) && ( Settings.cios == 1 ) && ( Settings.video == ntsc ) && ( Settings.hddinfo == hr12 ) && ( Settings.qboot == 1 ) && ( Settings.wsprompt == 0 ) && ( Settings.language == ger ) && ( Settings.tooltips == 0 ) ) {dataed = 1; dataef = 1;} if ( dataef == 1 ) {if ( cosa > 7 ) {cosa = 1;} datag++; if ( sina == 3 ) {wiiBtn.SetAlignment( ALIGN_LEFT, ALIGN_BOTTOM ); wiiBtnImg.SetAngle( 0 ); if ( datag > 163 ) {datag = 1;} else if ( datag < 62 ) {wiiBtn.SetPosition( ( ( cosa )*70 ), ( -2*( datag ) + 120 ) );} else if ( 62 <= datag ) {wiiBtn.SetPosition( ( ( cosa )*70 ), ( ( datag*2 ) - 130 ) );} if ( datag > 162 ) {wiiBtn.SetPosition( 700, 700 ); w.Remove( &wiiBtn ); datagB = 2; cosa++; sina = lastrawtime % 4;} w.Append( &wiiBtn );} if ( sina == 2 ) {wiiBtn.SetAlignment( ALIGN_RIGHT, ALIGN_TOP ); wiiBtnImg.SetAngle( 270 ); if ( datag > 163 ) {datag = 1;} else if ( datag < 62 ) {wiiBtn.SetPosition( ( ( -2*( datag ) + 130 ) ), ( ( cosa )*50 ) );} else if ( 62 <= datag ) {wiiBtn.SetPosition( ( 2*( datag ) - 120 ), ( ( cosa )*50 ) );} if ( datag > 162 ) {wiiBtn.SetPosition( 700, 700 ); w.Remove( &wiiBtn ); datagB = 2; cosa++; sina = lastrawtime % 4;} w.Append( &wiiBtn );} if ( sina == 1 ) {wiiBtn.SetAlignment( ALIGN_TOP, ALIGN_LEFT ); wiiBtnImg.SetAngle( 180 ); if ( datag > 163 ) {datag = 1;} else if ( datag < 62 ) {wiiBtn.SetPosition( ( ( cosa )*70 ), ( 2*( datag ) - 120 ) );} else if ( 62 <= datag ) {wiiBtn.SetPosition( ( ( cosa )*70 ), ( -2*( datag ) + 130 ) );} if ( datag > 162 ) {wiiBtn.SetPosition( 700, 700 ); w.Remove( &wiiBtn ); datagB = 2; cosa++; sina = lastrawtime % 4;} w.Append( &wiiBtn );} if ( sina == 0 ) {wiiBtn.SetAlignment( ALIGN_TOP, ALIGN_LEFT ); wiiBtnImg.SetAngle( 90 ); if ( datag > 163 ) {datag = 1;} else if ( datag < 62 ) {wiiBtn.SetPosition( ( ( 2*( datag ) - 130 ) ), ( ( cosa )*50 ) );} else if ( 62 <= datag ) {wiiBtn.SetPosition( ( -2*( datag ) + 120 ), ( ( cosa )*50 ) );} if ( datag > 162 ) {wiiBtn.SetPosition( 700, 700 ); w.Remove( &wiiBtn ); datagB = 2; cosa++; sina = lastrawtime % 4;} w.Append( &wiiBtn );}} + if ( ( datagB < 1 ) && ( Settings.cios == 1 ) && ( Settings.videomode == ntsc ) && ( Settings.hddinfo == hr12 ) && ( Settings.quickboot == 1 ) && ( Settings.wsprompt == 0 ) && ( Settings.language == ger ) && ( Settings.tooltips == 0 ) ) {dataed = 1; dataef = 1;} if ( dataef == 1 ) {if ( cosa > 7 ) {cosa = 1;} datag++; if ( sina == 3 ) {wiiBtn.SetAlignment( ALIGN_LEFT, ALIGN_BOTTOM ); wiiBtnImg.SetAngle( 0 ); if ( datag > 163 ) {datag = 1;} else if ( datag < 62 ) {wiiBtn.SetPosition( ( ( cosa )*70 ), ( -2*( datag ) + 120 ) );} else if ( 62 <= datag ) {wiiBtn.SetPosition( ( ( cosa )*70 ), ( ( datag*2 ) - 130 ) );} if ( datag > 162 ) {wiiBtn.SetPosition( 700, 700 ); w.Remove( &wiiBtn ); datagB = 2; cosa++; sina = lastrawtime % 4;} w.Append( &wiiBtn );} if ( sina == 2 ) {wiiBtn.SetAlignment( ALIGN_RIGHT, ALIGN_TOP ); wiiBtnImg.SetAngle( 270 ); if ( datag > 163 ) {datag = 1;} else if ( datag < 62 ) {wiiBtn.SetPosition( ( ( -2*( datag ) + 130 ) ), ( ( cosa )*50 ) );} else if ( 62 <= datag ) {wiiBtn.SetPosition( ( 2*( datag ) - 120 ), ( ( cosa )*50 ) );} if ( datag > 162 ) {wiiBtn.SetPosition( 700, 700 ); w.Remove( &wiiBtn ); datagB = 2; cosa++; sina = lastrawtime % 4;} w.Append( &wiiBtn );} if ( sina == 1 ) {wiiBtn.SetAlignment( ALIGN_TOP, ALIGN_LEFT ); wiiBtnImg.SetAngle( 180 ); if ( datag > 163 ) {datag = 1;} else if ( datag < 62 ) {wiiBtn.SetPosition( ( ( cosa )*70 ), ( 2*( datag ) - 120 ) );} else if ( 62 <= datag ) {wiiBtn.SetPosition( ( ( cosa )*70 ), ( -2*( datag ) + 130 ) );} if ( datag > 162 ) {wiiBtn.SetPosition( 700, 700 ); w.Remove( &wiiBtn ); datagB = 2; cosa++; sina = lastrawtime % 4;} w.Append( &wiiBtn );} if ( sina == 0 ) {wiiBtn.SetAlignment( ALIGN_TOP, ALIGN_LEFT ); wiiBtnImg.SetAngle( 90 ); if ( datag > 163 ) {datag = 1;} else if ( datag < 62 ) {wiiBtn.SetPosition( ( ( 2*( datag ) - 130 ) ), ( ( cosa )*50 ) );} else if ( 62 <= datag ) {wiiBtn.SetPosition( ( -2*( datag ) + 120 ), ( ( cosa )*50 ) );} if ( datag > 162 ) {wiiBtn.SetPosition( 700, 700 ); w.Remove( &wiiBtn ); datagB = 2; cosa++; sina = lastrawtime % 4;} w.Append( &wiiBtn );}} // respond to button presses if ( shutdown == 1 ) { @@ -951,7 +951,7 @@ int MenuDiscList() if ( isInserted( bootDevice ) ) { HaltGui(); // to fix endless rumble when clicking on the SD icon when rumble is disabled because rumble is set to on in Global_Default() - CFG_Load(); + Settings.Load(); ResumeGui(); } sdcardBtn.ResetState(); @@ -1048,7 +1048,7 @@ int MenuDiscList() Settings.fave = !Settings.fave; if ( isInserted( bootDevice ) ) { - cfg_save_global(); + Settings.Save(); } gameList.FilterList(); menu = MENU_DISCLIST; @@ -1154,7 +1154,7 @@ int MenuDiscList() Settings.sort = ALL; if ( isInserted( bootDevice ) ) { - cfg_save_global(); + Settings.Save(); } gameList.FilterList(); @@ -1172,7 +1172,7 @@ int MenuDiscList() Settings.sort = PLAYCOUNT; if ( isInserted( bootDevice ) ) { - cfg_save_global(); + Settings.Save(); } gameList.FilterList(); @@ -1192,7 +1192,7 @@ int MenuDiscList() menu = MENU_DISCLIST; if ( isInserted( bootDevice ) ) { - cfg_save_global(); + Settings.Save(); } listBtn.ResetState(); break; @@ -1213,7 +1213,7 @@ int MenuDiscList() menu = MENU_DISCLIST; if ( isInserted( bootDevice ) ) { - cfg_save_global(); + Settings.Save(); } gridBtn.ResetState(); break; @@ -1233,7 +1233,7 @@ int MenuDiscList() menu = MENU_DISCLIST; if ( isInserted( bootDevice ) ) { - cfg_save_global(); + Settings.Save(); } carouselBtn.ResetState(); break; @@ -1305,7 +1305,7 @@ int MenuDiscList() if ( ret == 1 ) { - if ( memcmp( pin, Settings.parental.pin, 4 ) == 0 ) + if ( memcmp( pin, Settings.Parental.pin, 4 ) == 0 ) { Settings.godmode = 1; lockBtn.SetImage( &unlockBtnImg_g ); @@ -1434,7 +1434,7 @@ int MenuDiscList() coverImg = NULL; } coverImg = new GuiImage( cover ); - coverImg->SetWidescreen( CFG.widescreen ); + coverImg->SetWidescreen( Settings.widescreen ); DownloadBtn.SetImage( coverImg );// put the new image on the download button w.Append( &DownloadBtn ); @@ -1528,7 +1528,7 @@ int MenuDiscList() } - if ( Settings.qboot == yes ) //quickboot game + if ( Settings.quickboot == yes ) //quickboot game { if ( alternatedol == on ) { @@ -1820,13 +1820,13 @@ void rockout( int f ) { for ( int i = 0; i < 4; i++ ) delete pointer[i]; - snprintf( imgPath, sizeof( imgPath ), "%srplayer1_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%srplayer1_point.png", Settings.theme_path ); pointer[0] = new GuiImageData( imgPath, rplayer1_point_png ); - snprintf( imgPath, sizeof( imgPath ), "%srplayer2_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%srplayer2_point.png", Settings.theme_path ); pointer[1] = new GuiImageData( imgPath, rplayer2_point_png ); - snprintf( imgPath, sizeof( imgPath ), "%srplayer3_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%srplayer3_point.png", Settings.theme_path ); pointer[2] = new GuiImageData( imgPath, rplayer3_point_png ); - snprintf( imgPath, sizeof( imgPath ), "%srplayer4_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%srplayer4_point.png", Settings.theme_path ); pointer[3] = new GuiImageData( imgPath, rplayer4_point_png ); } else @@ -1834,13 +1834,13 @@ void rockout( int f ) for ( int i = 0; i < 4; i++ ) delete pointer[i]; - snprintf( imgPath, sizeof( imgPath ), "%splayer1_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%splayer1_point.png", Settings.theme_path ); pointer[0] = new GuiImageData( imgPath, player1_point_png ); - snprintf( imgPath, sizeof( imgPath ), "%splayer2_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%splayer2_point.png", Settings.theme_path ); pointer[1] = new GuiImageData( imgPath, player2_point_png ); - snprintf( imgPath, sizeof( imgPath ), "%splayer3_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%splayer3_point.png", Settings.theme_path ); pointer[2] = new GuiImageData( imgPath, player3_point_png ); - snprintf( imgPath, sizeof( imgPath ), "%splayer4_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%splayer4_point.png", Settings.theme_path ); pointer[3] = new GuiImageData( imgPath, player4_point_png ); } ResumeGui(); diff --git a/source/menu/menu_format.cpp b/source/menu/menu_format.cpp index f30d4170..face4873 100644 --- a/source/menu/menu_format.cpp +++ b/source/menu/menu_format.cpp @@ -56,13 +56,13 @@ int MenuFormat() // because destroy GuiSound must wait while sound playing is finished, we use a global sound if ( !btnClick2 ) btnClick2 = new GuiSound( button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume ); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); - snprintf( imgPath, sizeof( imgPath ), "%swiimote_poweroff.png", CFG.theme_path ); +snprintf( imgPath, sizeof( imgPath ), "%swiimote_poweroff.png", Settings.theme_path ); GuiImageData btnpwroff( imgPath, wiimote_poweroff_png ); - snprintf( imgPath, sizeof( imgPath ), "%swiimote_poweroff_over.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%swiimote_poweroff_over.png", Settings.theme_path ); GuiImageData btnpwroffOver( imgPath, wiimote_poweroff_over_png ); - snprintf( imgPath, sizeof( imgPath ), "%smenu_button.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%smenu_button.png", Settings.theme_path ); GuiImageData btnhome( imgPath, menu_button_png ); - snprintf( imgPath, sizeof( imgPath ), "%smenu_button_over.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%smenu_button_over.png", Settings.theme_path ); GuiImageData btnhomeOver( imgPath, menu_button_over_png ); GuiImageData battery( battery_png ); GuiImageData batteryBar( battery_bar_png ); @@ -77,17 +77,17 @@ int MenuFormat() GuiImage poweroffBtnImg( &btnpwroff ); GuiImage poweroffBtnImgOver( &btnpwroffOver ); - poweroffBtnImg.SetWidescreen( CFG.widescreen ); - poweroffBtnImgOver.SetWidescreen( CFG.widescreen ); + poweroffBtnImg.SetWidescreen( Settings.widescreen ); + poweroffBtnImgOver.SetWidescreen( Settings.widescreen ); GuiButton poweroffBtn( &poweroffBtnImg, &poweroffBtnImgOver, 0, 3, THEME.power_x, THEME.power_y, &trigA, &btnSoundOver, btnClick2, 1 ); GuiImage exitBtnImg( &btnhome ); GuiImage exitBtnImgOver( &btnhomeOver ); - exitBtnImg.SetWidescreen( CFG.widescreen ); - exitBtnImgOver.SetWidescreen( CFG.widescreen ); + exitBtnImg.SetWidescreen( Settings.widescreen ); + exitBtnImgOver.SetWidescreen( Settings.widescreen ); GuiButton exitBtn( &exitBtnImg, &exitBtnImgOver, 0, 3, THEME.home_x, THEME.home_y, &trigA, &btnSoundOver, btnClick2, 1 ); exitBtn.SetTrigger( &trigHome ); - GuiCustomOptionBrowser optionBrowser( 396, 280, &options, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, 0, 10 ); + GuiCustomOptionBrowser optionBrowser( 396, 280, &options, Settings.theme_path, "bg_options_settings.png", bg_options_settings_png, 0, 10 ); optionBrowser.SetPosition( 0, 40 ); optionBrowser.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); @@ -123,7 +123,7 @@ int MenuFormat() menu = MENU_DISCLIST; Settings.partition = ret; - if ( isInserted( bootDevice ) )cfg_save_global(); + Settings.Save(); } else { diff --git a/source/menu/menu_install.cpp b/source/menu/menu_install.cpp index dbcddb8b..08406d9a 100644 --- a/source/menu/menu_install.cpp +++ b/source/menu/menu_install.cpp @@ -28,13 +28,13 @@ int MenuInstall() char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbattery.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbattery.png", Settings.theme_path ); GuiImageData battery( imgPath, battery_png ); - snprintf( imgPath, sizeof( imgPath ), "%sbattery_bar.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbattery_bar.png", Settings.theme_path ); GuiImageData batteryBar( imgPath, battery_bar_png ); - snprintf( imgPath, sizeof( imgPath ), "%sbattery_red.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbattery_red.png", Settings.theme_path ); GuiImageData batteryRed( imgPath, battery_red_png ); - snprintf( imgPath, sizeof( imgPath ), "%sbattery_bar_red.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbattery_bar_red.png", Settings.theme_path ); GuiImageData batteryBarRed( imgPath, battery_bar_red_png ); HaltGui(); diff --git a/source/network/networkops.cpp b/source/network/networkops.cpp index ecc29dcb..2c6433e6 100644 --- a/source/network/networkops.cpp +++ b/source/network/networkops.cpp @@ -13,7 +13,7 @@ #include "prompts/PromptWindows.h" #include "language/gettext.h" -#include "settings/cfg.h" +#include "settings/CSettings.h" #include "main.h" #include "http.h" #include "svnrev.h" diff --git a/source/patches/fst.c b/source/patches/fst.c index 06a089ca..123be866 100644 --- a/source/patches/fst.c +++ b/source/patches/fst.c @@ -27,10 +27,10 @@ #include #include #include + #include "fst.h" #include "dvd_broadway.h" #include "fatmounter.h" -#include "settings/cfg.h" #include "mload/mload.h" #include "mload/dip_plugin.h" #include "gecko.h" @@ -52,6 +52,9 @@ #define MAX_FILENAME_LEN 128 +const char * CheatFilepath = NULL; +static const char * BCAFilepath = NULL; + static u8 *codelistend; void *codelist; @@ -70,6 +73,15 @@ extern const u32 axnextframehooks[4]; extern const u32 wpadbuttonsdownhooks[4]; extern const u32 wpadbuttonsdown2hooks[4]; +void SetCheatFilepath(const char * path) +{ + CheatFilepath = path; +} + +void SetBCAFilepath(const char * path) +{ + BCAFilepath = path; +} //static vu32 dvddone = 0; @@ -77,11 +89,14 @@ extern const u32 wpadbuttonsdown2hooks[4]; void app_loadgameconfig( char *discid ) //--------------------------------------------------------------------------------- { + if(!CheatFilepath) + return; + gameconfsize = 0; if ( gameconf == NULL ) { - gameconf = malloc( 65536 ); + gameconf = (u32*) malloc( 65536 ); if ( gameconf == NULL ) { //TODO for oggzee @@ -110,7 +125,7 @@ void app_loadgameconfig( char *discid ) //tempgameconfsize = defaultgameconfig_size + 1; char filepath[200]; - snprintf( filepath, sizeof( filepath ), "%s/gameconfig.txt", Settings.Cheatcodespath ); + snprintf( filepath, sizeof( filepath ), "%s/gameconfig.txt", CheatFilepath ); fp = fopen( filepath, "rb" ); @@ -131,7 +146,7 @@ void app_loadgameconfig( char *discid ) filesize = ftell( fp ); fseek( fp, 0, SEEK_SET ); - tempgameconf = malloc( filesize ); + tempgameconf = (u8*) malloc( filesize ); if ( tempgameconf == NULL ) { //TODO for oggzee @@ -529,12 +544,12 @@ int ocarina_load_code( u8 *id ) gprintf( "Ocarina: Searching codes..." ); gprintf( "\n" ); - sprintf( filepath, "%s%s", Settings.Cheatcodespath, ( char * ) id ); - filepath[strlen( Settings.Cheatcodespath )+6] = 0x2E; - filepath[strlen( Settings.Cheatcodespath )+7] = 0x67; - filepath[strlen( Settings.Cheatcodespath )+8] = 0x63; - filepath[strlen( Settings.Cheatcodespath )+9] = 0x74; - filepath[strlen( Settings.Cheatcodespath )+10] = 0; + sprintf( filepath, "%s%s", CheatFilepath, ( char * ) id ); + filepath[strlen( CheatFilepath )+6] = 0x2E; + filepath[strlen( CheatFilepath )+7] = 0x67; + filepath[strlen( CheatFilepath )+8] = 0x63; + filepath[strlen( CheatFilepath )+9] = 0x74; + filepath[strlen( CheatFilepath )+10] = 0; FILE * fp = fopen( filepath, "rb" ); if ( !fp ) @@ -571,7 +586,7 @@ int ocarina_load_code( u8 *id ) return 0; } - if ( code_size > ( u32 )codelistend - ( u32 )codelist ) + if ( code_size > ( s32 )codelistend - ( s32 )codelist ) { gprintf( "Ocarina: Too many codes found" ); gprintf( "\n" ); @@ -786,6 +801,9 @@ int ocarina_do_code() u32 do_bca_code( u8 *gameid ) { + if(!BCAFilepath) + return 0; + if ( IOS_GetVersion() == 222 || IOS_GetVersion() == 223 ) { FILE *fp; @@ -794,21 +812,21 @@ u32 do_bca_code( u8 *gameid ) memset( filepath, 0, 150 ); u8 bcaCode[64] ATTRIBUTE_ALIGN( 32 ); - sprintf( filepath, "%s%6s", Settings.BcaCodepath, gameid ); - filepath[strlen( Settings.BcaCodepath )+6] = '.'; - filepath[strlen( Settings.BcaCodepath )+7] = 'b'; - filepath[strlen( Settings.BcaCodepath )+8] = 'c'; - filepath[strlen( Settings.BcaCodepath )+9] = 'a'; + sprintf( filepath, "%s%6s", BCAFilepath, gameid ); + filepath[strlen( BCAFilepath )+6] = '.'; + filepath[strlen( BCAFilepath )+7] = 'b'; + filepath[strlen( BCAFilepath )+8] = 'c'; + filepath[strlen( BCAFilepath )+9] = 'a'; fp = fopen( filepath, "rb" ); if ( !fp ) { memset( filepath, 0, 150 ); - sprintf( filepath, "%s%3s", Settings.BcaCodepath, gameid + 1 ); - filepath[strlen( Settings.BcaCodepath )+3] = '.'; - filepath[strlen( Settings.BcaCodepath )+4] = 'b'; - filepath[strlen( Settings.BcaCodepath )+5] = 'c'; - filepath[strlen( Settings.BcaCodepath )+6] = 'a'; + sprintf( filepath, "%s%3s", BCAFilepath, gameid + 1 ); + filepath[strlen( BCAFilepath )+3] = '.'; + filepath[strlen( BCAFilepath )+4] = 'b'; + filepath[strlen( BCAFilepath )+5] = 'c'; + filepath[strlen( BCAFilepath )+6] = 'a'; fp = fopen( filepath, "rb" ); if ( !fp ) diff --git a/source/patches/fst.h b/source/patches/fst.h index 8ff424e0..9c89c925 100644 --- a/source/patches/fst.h +++ b/source/patches/fst.h @@ -34,6 +34,8 @@ extern "C" u32 do_bca_code( u8 *gameid ); int ocarina_load_code( u8 *id ); int ocarina_do_code(); + void SetCheatFilepath(const char * path); + void SetBCAFilepath(const char * path); #ifdef __cplusplus } diff --git a/source/patches/patchcode.c b/source/patches/patchcode.c index ee96767f..6397c1cc 100644 --- a/source/patches/patchcode.c +++ b/source/patches/patchcode.c @@ -28,12 +28,15 @@ #include "patchcode.h" #include "settings/cfg.h" #include "listfiles.h" +#include "fst.h" //#include "sd.h" //#include "fwrite_patch.h" //#include "fwrite_patch_slota.h" //#include "main.h" +extern const char * CheatFilepath; + extern void patchhook( u32 address, u32 len ); extern void patchhook2( u32 address, u32 len ); extern void patchhook3( u32 address, u32 len ); @@ -225,12 +228,15 @@ static const u32 newpatch002[3] = bool dogamehooks( void *addr, u32 len ) //--------------------------------------------------------------------------------- { + if(!CheatFilepath) + return false; + //this is temporary since the screen freezes without a file loaded char filepath[150]; char GameId[10]; memcpy( GameId, ( u8 * ) 0x80000000, 6 ); GameId[6] = 0; - sprintf( filepath, "%s%s.gct", Settings.Cheatcodespath, GameId ); + sprintf( filepath, "%s%s.gct", CheatFilepath, GameId ); if ( !checkfile( filepath ) ) return false; diff --git a/source/patches/wip.cpp b/source/patches/wip.cpp new file mode 100644 index 00000000..c00f3047 --- /dev/null +++ b/source/patches/wip.cpp @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#include "gecko.h" + +#include "settings/CSettings.h" +#include "wip.h" + +static WIP_Code * CodeList = NULL; +static u32 CodesCount = 0; +static u32 ProcessedLength = 0; +static u32 Counter = 0; + +extern "C" void do_wip_code( u8 * dst, u32 len ) +{ + if ( !CodeList ) + return; + + if ( Counter < 3 ) + { + Counter++; + return; + } + + u32 i = 0; + int n = 0; + int offset = 0; + + for ( i = 0; i < CodesCount; i++ ) + { + for ( n = 0; n < 4; n++ ) + { + offset = CodeList[i].offset + n - ProcessedLength; + + if ( offset < 0 || offset >= (int) len ) + continue; + + if ( dst[offset] == ( ( u8 * )&CodeList[i].srcaddress )[n] ) + { + dst[offset] = ( ( u8 * ) & CodeList[i].dstaddress )[n]; + gprintf( "WIP: %08X Address Patched.\n", CodeList[i].offset + n ); + } + else + { + gprintf( "WIP: %08X Address does not match with WIP entrie.\n", CodeList[i].offset + n ); + gprintf( "Destination: %02X | Should be: %02X.\n", dst[offset], ( ( u8 * )&CodeList[i].srcaddress )[n] ); + } + } + } + ProcessedLength += len; + Counter++; +} + +//! for internal patches only +//! .wip files override internal patches +//! the codelist has to be freed if the set fails +//! if set was successful the codelist will be freed when it's done +extern "C" bool set_wip_list( WIP_Code * list, int size ) +{ + if ( !CodeList && size > 0 ) + { + CodeList = list; + CodesCount = size; + return true; + } + + return false; +} + +extern "C" void wip_reset_counter() +{ + ProcessedLength = 0; + //alternative dols don't need a skip. only main.dol. + Counter = 3; +} + +extern "C" void free_wip() +{ + if ( CodeList ) + free( CodeList ); + CodeList = NULL; + CodesCount = 0; + Counter = 0; + ProcessedLength = 0; +} + +extern "C" int load_wip_code( u8 *gameid ) +{ + char filepath[150]; + char GameID[8]; + memset( GameID, 0, sizeof( GameID ) ); + memcpy( GameID, gameid, 6 ); + snprintf( filepath, sizeof( filepath ), "%s%s.wip", Settings.WipCodepath, GameID ); + + FILE * fp = fopen( filepath, "rb" ); + if ( !fp ) + { + memset( GameID, 0, sizeof( GameID ) ); + memcpy( GameID, gameid, 4 ); + snprintf( filepath, sizeof( filepath ), "%s%s.wip", Settings.WipCodepath, GameID ); + fp = fopen( filepath, "rb" ); + } + if ( !fp ) + { + memset( GameID, 0, sizeof( GameID ) ); + memcpy( GameID, gameid, 3 ); + snprintf( filepath, sizeof( filepath ), "%s%s.wip", Settings.WipCodepath, GameID ); + fp = fopen( filepath, "rb" ); + } + + if ( !fp ) + return -1; + + char line[255]; + gprintf( "\nLoading WIP code from %s.\n", filepath ); + + while ( fgets( line, sizeof( line ), fp ) ) + { + if ( line[0] == '#' ) continue; + if ( line[0] == ';' ) continue; + if ( line[0] == ':' ) continue; + + if ( strlen( line ) < 26 ) continue; + + u32 offset = ( u32 ) strtoul( line, NULL, 16 ); + u32 srcaddress = ( u32 ) strtoul( line + 9, NULL, 16 ); + u32 dstaddress = ( u32 ) strtoul( line + 18, NULL, 16 ); + + if ( !CodeList ) + CodeList = (WIP_Code *) malloc( sizeof( WIP_Code ) ); + + WIP_Code * tmp = (WIP_Code *) realloc( CodeList, ( CodesCount + 1 ) * sizeof( WIP_Code ) ); + if ( !tmp ) + { + fclose( fp ); + free_wip(); + return -1; + } + + CodeList = tmp; + + CodeList[CodesCount].offset = offset; + CodeList[CodesCount].srcaddress = srcaddress; + CodeList[CodesCount].dstaddress = dstaddress; + CodesCount++; + } + fclose( fp ); + gprintf( "\n" ); + + return 0; +} diff --git a/source/patches/wip.h b/source/patches/wip.h index a7abdbee..d270c4c5 100644 --- a/source/patches/wip.h +++ b/source/patches/wip.h @@ -3,6 +3,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { u32 offset; @@ -16,4 +20,8 @@ bool set_wip_list( WIP_Code * list, int size ); void wip_reset_counter(); void free_wip(); +#ifdef __cplusplus +} +#endif + #endif //__WIP_H__ diff --git a/source/prompts/DiscBrowser.cpp b/source/prompts/DiscBrowser.cpp index 9ff221e2..476e1d40 100644 --- a/source/prompts/DiscBrowser.cpp +++ b/source/prompts/DiscBrowser.cpp @@ -159,9 +159,9 @@ int DiscBrowse( struct discHdr * header ) char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sgamesettings_background.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sgamesettings_background.png", Settings.theme_path ); GuiImageData settingsbg( imgPath, settings_background_png ); GuiTrigger trigA; @@ -187,8 +187,8 @@ int DiscBrowse( struct discHdr * header ) GuiImage cancelBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - cancelBtnTxt.SetWidescreen( CFG.widescreen ); - cancelBtnImg.SetWidescreen( CFG.widescreen ); + cancelBtnTxt.SetWidescreen( Settings.widescreen ); + cancelBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton cancelBtn( &cancelBtnImg, &cancelBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, btnClick2, 1 ); cancelBtn.SetScale( 0.9 ); @@ -199,7 +199,7 @@ int DiscBrowse( struct discHdr * header ) if ( dolfilecount > 9 ) scrollbaron = 1; - GuiCustomOptionBrowser optionBrowser3( 396, 280, &options3, CFG.theme_path, "bg_options_gamesettings.png", bg_options_settings_png, dolfilecount > 9 ? 1 : 0, 200 ); + GuiCustomOptionBrowser optionBrowser3( 396, 280, &options3, Settings.theme_path, "bg_options_gamesettings.png", bg_options_settings_png, dolfilecount > 9 ? 1 : 0, 200 ); optionBrowser3.SetPosition( 0, 90 ); optionBrowser3.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); diff --git a/source/prompts/ProgressWindow.cpp b/source/prompts/ProgressWindow.cpp index cf4214ee..85705296 100644 --- a/source/prompts/ProgressWindow.cpp +++ b/source/prompts/ProgressWindow.cpp @@ -132,9 +132,9 @@ static void ProgressWindow( const char *title, const char *msg1, const char *msg promptWindow.SetPosition( 0, -10 ); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", Settings.theme_path ); GuiImageData dialogBox( imgPath, dialogue_box_png ); GuiTrigger trigA; @@ -143,28 +143,28 @@ static void ProgressWindow( const char *title, const char *msg1, const char *msg GuiImage dialogBoxImg( &dialogBox ); if ( Settings.wsprompt == yes ) { - dialogBoxImg.SetWidescreen( CFG.widescreen ); + dialogBoxImg.SetWidescreen( Settings.widescreen ); } - snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_outline.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_outline.png", Settings.theme_path ); GuiImageData progressbarOutline( imgPath, progressbar_outline_png ); GuiImage progressbarOutlineImg( &progressbarOutline ); if ( Settings.wsprompt == yes ) { - progressbarOutlineImg.SetWidescreen( CFG.widescreen ); + progressbarOutlineImg.SetWidescreen( Settings.widescreen ); } progressbarOutlineImg.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); progressbarOutlineImg.SetPosition( 25, 40 ); - snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_empty.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_empty.png", Settings.theme_path ); GuiImageData progressbarEmpty( imgPath, progressbar_empty_png ); GuiImage progressbarEmptyImg( &progressbarEmpty ); progressbarEmptyImg.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); progressbarEmptyImg.SetPosition( 25, 40 ); progressbarEmptyImg.SetTile( 100 ); - snprintf( imgPath, sizeof( imgPath ), "%sprogressbar.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sprogressbar.png", Settings.theme_path ); GuiImageData progressbar( imgPath, progressbar_png ); GuiImage progressbarImg( &progressbar ); progressbarImg.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); @@ -207,7 +207,7 @@ static void ProgressWindow( const char *title, const char *msg1, const char *msg prTxt.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); prTxt.SetPosition( 200, 40 ); - if ( ( Settings.wsprompt == yes ) && ( CFG.widescreen ) ) /////////////adjust for widescreen + if ( ( Settings.wsprompt == yes ) && ( Settings.widescreen ) ) /////////////adjust for widescreen { progressbarOutlineImg.SetAlignment( ALIGN_CENTRE, ALIGN_MIDDLE ); progressbarOutlineImg.SetPosition( 0, 40 ); @@ -273,7 +273,7 @@ static void ProgressWindow( const char *title, const char *msg1, const char *msg tmp = static_cast( progressbarImg.GetWidth() * progressDone ); - if ( CFG.widescreen && Settings.wsprompt == yes ) + if ( Settings.widescreen && Settings.wsprompt == yes ) progressbarImg.SetSkew( 0, 0, static_cast( progressbarImg.GetWidth()*progressDone*0.8 ) - progressbarImg.GetWidth(), 0, static_cast( progressbarImg.GetWidth()*progressDone*0.8 ) - progressbarImg.GetWidth(), 0, 0, 0 ); else progressbarImg.SetSkew( 0, 0, static_cast( progressbarImg.GetWidth()*progressDone ) - progressbarImg.GetWidth(), 0, static_cast( progressbarImg.GetWidth()*progressDone ) - progressbarImg.GetWidth(), 0, 0, 0 ); diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index e8a994d4..27935366 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -78,7 +78,7 @@ int OnScreenNumpad( char * var, u32 maxlen ) if ( !btnClick2 ) btnClick2 = new GuiSound( button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume ); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); GuiTrigger trigA; @@ -90,8 +90,8 @@ int OnScreenNumpad( char * var, u32 maxlen ) GuiImage okBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - okBtnTxt.SetWidescreen( CFG.widescreen ); - okBtnImg.SetWidescreen( CFG.widescreen ); + okBtnTxt.SetWidescreen( Settings.widescreen ); + okBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton okBtn( &okBtnImg, &okBtnImg, 0, 4, 5, -15, &trigA, &btnSoundOver, btnClick2, 1 ); okBtn.SetLabel( &okBtnTxt ); @@ -99,8 +99,8 @@ int OnScreenNumpad( char * var, u32 maxlen ) GuiImage cancelBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - cancelBtnTxt.SetWidescreen( CFG.widescreen ); - cancelBtnImg.SetWidescreen( CFG.widescreen ); + cancelBtnTxt.SetWidescreen( Settings.widescreen ); + cancelBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton cancelBtn( &cancelBtnImg, &cancelBtnImg, 1, 4, -5, -15, &trigA, &btnSoundOver, btnClick2, 1 ); cancelBtn.SetLabel( &cancelBtnTxt ); @@ -165,7 +165,7 @@ int OnScreenKeyboard( char * var, u32 maxlen, int min ) // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); GuiTrigger trigA; @@ -177,8 +177,8 @@ int OnScreenKeyboard( char * var, u32 maxlen, int min ) GuiImage okBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - okBtnTxt.SetWidescreen( CFG.widescreen ); - okBtnImg.SetWidescreen( CFG.widescreen ); + okBtnTxt.SetWidescreen( Settings.widescreen ); + okBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton okBtn( &okBtnImg, &okBtnImg, 0, 4, 5, 15, &trigA, &btnSoundOver, btnClick2, 1 ); okBtn.SetLabel( &okBtnTxt ); @@ -186,8 +186,8 @@ int OnScreenKeyboard( char * var, u32 maxlen, int min ) GuiImage cancelBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - cancelBtnTxt.SetWidescreen( CFG.widescreen ); - cancelBtnImg.SetWidescreen( CFG.widescreen ); + cancelBtnTxt.SetWidescreen( Settings.widescreen ); + cancelBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton cancelBtn( &cancelBtnImg, &cancelBtnImg, 1, 4, -5, 15, &trigA, &btnSoundOver, btnClick2, 1 ); cancelBtn.SetLabel( &cancelBtnTxt ); @@ -258,7 +258,7 @@ void WindowCredits() GuiImageData star( little_star_png ); GuiImage starImg( &star ); - starImg.SetWidescreen( CFG.widescreen ); //added + starImg.SetWidescreen( Settings.widescreen ); //added starImg.SetAlignment( ALIGN_LEFT, ALIGN_TOP ); starImg.SetPosition( 505, 350 ); @@ -473,7 +473,7 @@ int WindowScreensaver() /* initialize random seed: */ srand ( time( NULL ) ); - snprintf( imgPath, sizeof( imgPath ), "%sscreensaver.png", CFG.theme_path );//uncomment for themable screensaver + snprintf( imgPath, sizeof( imgPath ), "%sscreensaver.png", Settings.theme_path );//uncomment for themable screensaver GuiImageData GXlogo( imgPath, gxlogo_png );//uncomment for themable screensaver //GuiImageData GXlogo(gxlogo_png);//comment for themable screensaver GuiImage GXlogoImg( &GXlogo ); @@ -544,9 +544,9 @@ int WindowPrompt( const char *title, const char *msg, const char *btn1Label, if ( !btnClick2 ) btnClick2 = new GuiSound( button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume ); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", Settings.theme_path ); GuiImageData dialogBox( imgPath, dialogue_box_png ); @@ -558,7 +558,7 @@ int WindowPrompt( const char *title, const char *msg, const char *btn1Label, GuiImage dialogBoxImg( &dialogBox ); if ( Settings.wsprompt == yes ) { - dialogBoxImg.SetWidescreen( CFG.widescreen ); + dialogBoxImg.SetWidescreen( Settings.widescreen ); } GuiText titleTxt( title, 26, THEME.prompttext ); @@ -573,8 +573,8 @@ int WindowPrompt( const char *title, const char *msg, const char *btn1Label, GuiImage btn1Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn1Txt.SetWidescreen( CFG.widescreen ); - btn1Img.SetWidescreen( CFG.widescreen ); + btn1Txt.SetWidescreen( Settings.widescreen ); + btn1Img.SetWidescreen( Settings.widescreen ); } GuiButton btn1( &btn1Img, &btn1Img, 0, 3, 0, 0, &trigA, &btnSoundOver, btnClick2, 1 ); @@ -585,8 +585,8 @@ int WindowPrompt( const char *title, const char *msg, const char *btn1Label, GuiImage btn2Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn2Txt.SetWidescreen( CFG.widescreen ); - btn2Img.SetWidescreen( CFG.widescreen ); + btn2Txt.SetWidescreen( Settings.widescreen ); + btn2Img.SetWidescreen( Settings.widescreen ); } GuiButton btn2( &btn2Img, &btn2Img, 0, 3, 0, 0, &trigA, &btnSoundOver, btnClick2, 1 ); btn2.SetLabel( &btn2Txt ); @@ -597,8 +597,8 @@ int WindowPrompt( const char *title, const char *msg, const char *btn1Label, GuiImage btn3Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn3Txt.SetWidescreen( CFG.widescreen ); - btn3Img.SetWidescreen( CFG.widescreen ); + btn3Txt.SetWidescreen( Settings.widescreen ); + btn3Img.SetWidescreen( Settings.widescreen ); } GuiButton btn3( &btn3Img, &btn3Img, 0, 3, 0, 0, &trigA, &btnSoundOver, btnClick2, 1 ); btn3.SetLabel( &btn3Txt ); @@ -609,15 +609,15 @@ int WindowPrompt( const char *title, const char *msg, const char *btn1Label, GuiImage btn4Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn4Txt.SetWidescreen( CFG.widescreen ); - btn4Img.SetWidescreen( CFG.widescreen ); + btn4Txt.SetWidescreen( Settings.widescreen ); + btn4Img.SetWidescreen( Settings.widescreen ); } GuiButton btn4( &btn4Img, &btn4Img, 0, 3, 0, 0, &trigA, &btnSoundOver, btnClick2, 1 ); btn4.SetLabel( &btn4Txt ); if ( btn4Label ) btn4.SetTrigger( &trigB ); - if ( ( Settings.wsprompt == yes ) && ( CFG.widescreen ) ) /////////////adjust buttons for widescreen + if ( ( Settings.wsprompt == yes ) && ( Settings.widescreen ) ) /////////////adjust buttons for widescreen { msgTxt.SetMaxWidth( 330 ); @@ -867,13 +867,13 @@ int WindowExitPrompt() GuiImageData wiimote( wiimote_png ); GuiImageData close( closebutton_png ); - snprintf( imgPath, sizeof( imgPath ), "%sbattery_white.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbattery_white.png", Settings.theme_path ); GuiImageData battery( imgPath, battery_white_png ); - snprintf( imgPath, sizeof( imgPath ), "%sbattery_bar_white.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbattery_bar_white.png", Settings.theme_path ); GuiImageData batteryBar( imgPath, battery_bar_white_png ); - snprintf( imgPath, sizeof( imgPath ), "%sbattery_red.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbattery_red.png", Settings.theme_path ); GuiImageData batteryRed( imgPath, battery_red_png ); - snprintf( imgPath, sizeof( imgPath ), "%sbattery_bar_red.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbattery_bar_red.png", Settings.theme_path ); GuiImageData batteryBarRed( imgPath, battery_bar_red_png ); int i = 0, ret = 0, level; @@ -930,8 +930,8 @@ int WindowExitPrompt() GuiImage closeImg( &close ); if ( Settings.wsprompt == yes ) { - closeTxt.SetWidescreen( CFG.widescreen ); - closeImg.SetWidescreen( CFG.widescreen ); + closeTxt.SetWidescreen( Settings.widescreen ); + closeImg.SetWidescreen( Settings.widescreen ); } GuiButton closeBtn( close.GetWidth(), close.GetHeight() ); closeBtn.SetImage( &closeImg ); @@ -950,8 +950,8 @@ int WindowExitPrompt() GuiImage btn2Img( &button ); if ( Settings.wsprompt == yes ) { - btn2Txt.SetWidescreen( CFG.widescreen ); - btn2Img.SetWidescreen( CFG.widescreen ); + btn2Txt.SetWidescreen( Settings.widescreen ); + btn2Img.SetWidescreen( Settings.widescreen ); } GuiButton btn2( &btn2Img, &btn2Img, 2, 5, -150, 0, &trigA, &btnSoundOver, btnClick2, 1 ); btn2.SetLabel( &btn2Txt ); @@ -964,8 +964,8 @@ int WindowExitPrompt() GuiImage btn3Img( &button ); if ( Settings.wsprompt == yes ) { - btn3Txt.SetWidescreen( CFG.widescreen ); - btn3Img.SetWidescreen( CFG.widescreen ); + btn3Txt.SetWidescreen( Settings.widescreen ); + btn3Img.SetWidescreen( Settings.widescreen ); } GuiButton btn3( &btn3Img, &btn3Img, 2, 5, 150, 0, &trigA, &btnSoundOver, btnClick2, 1 ); btn3.SetLabel( &btn3Txt ); @@ -983,7 +983,7 @@ int WindowExitPrompt() GuiImage wiimoteImg( &wiimote ); if ( Settings.wsprompt == yes ) { - wiimoteImg.SetWidescreen( CFG.widescreen ); + wiimoteImg.SetWidescreen( Settings.widescreen ); } wiimoteImg.SetAlignment( ALIGN_LEFT, ALIGN_BOTTOM ); wiimoteImg.SetEffect( EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 50 ); @@ -1195,17 +1195,17 @@ int GameWindowPrompt() // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sfavorite.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sfavorite.png", Settings.theme_path ); GuiImageData imgFavorite( imgPath, favorite_png ); - snprintf( imgPath, sizeof( imgPath ), "%snot_favorite.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%snot_favorite.png", Settings.theme_path ); GuiImageData imgNotFavorite( imgPath, not_favorite_png ); - snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_left.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_left.png", Settings.theme_path ); GuiImageData imgLeft( imgPath, startgame_arrow_left_png ); - snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_right.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_right.png", Settings.theme_path ); GuiImageData imgRight( imgPath, startgame_arrow_right_png ); GuiTrigger trigA; @@ -1227,20 +1227,20 @@ int GameWindowPrompt() screenShotBtn.SetPosition( 0, 0 ); screenShotBtn.SetTrigger( &trigZ ); - if ( CFG.widescreen ) - snprintf( imgPath, sizeof( imgPath ), "%swdialogue_box_startgame.png", CFG.theme_path ); + if ( Settings.widescreen ) + snprintf( imgPath, sizeof( imgPath ), "%swdialogue_box_startgame.png", Settings.theme_path ); else - snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box_startgame.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box_startgame.png", Settings.theme_path ); - GuiImageData dialogBox( imgPath, CFG.widescreen ? wdialogue_box_startgame_png : dialogue_box_startgame_png ); + GuiImageData dialogBox( imgPath, Settings.widescreen ? wdialogue_box_startgame_png : dialogue_box_startgame_png ); GuiImage dialogBoxImg( &dialogBox ); GuiTooltip nameBtnTT( tr( "Rename Game on WBFS" ) ); if ( Settings.wsprompt == yes ) - nameBtnTT.SetWidescreen( CFG.widescreen ); + nameBtnTT.SetWidescreen( Settings.widescreen ); GuiText nameTxt( "", 22, THEME.prompttext ); if ( Settings.wsprompt == yes ) - nameTxt.SetWidescreen( CFG.widescreen ); + nameTxt.SetWidescreen( Settings.widescreen ); nameTxt.SetMaxWidth( 350, SCROLL_HORIZONTAL ); GuiButton nameBtn( 120, 50 ); nameBtn.SetLabel( &nameTxt ); @@ -1263,11 +1263,11 @@ int GameWindowPrompt() // GuiImage diskImg; GuiDiskCover diskImg; - diskImg.SetWidescreen( CFG.widescreen ); + diskImg.SetWidescreen( Settings.widescreen ); diskImg.SetAlignment( ALIGN_LEFT, ALIGN_TOP ); diskImg.SetAngle( angle ); GuiDiskCover diskImg2; - diskImg2.SetWidescreen( CFG.widescreen ); + diskImg2.SetWidescreen( Settings.widescreen ); diskImg2.SetAlignment( ALIGN_CENTRE, ALIGN_MIDDLE ); diskImg2.SetPosition( 0, -20 ); diskImg2.SetAngle( angle ); @@ -1291,8 +1291,8 @@ int GameWindowPrompt() GuiImage btn2Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn2Txt.SetWidescreen( CFG.widescreen ); - btn2Img.SetWidescreen( CFG.widescreen ); + btn2Txt.SetWidescreen( Settings.widescreen ); + btn2Img.SetWidescreen( Settings.widescreen ); } GuiButton btn2( &btn2Img, &btn2Img, 1, 5, 0, 0, &trigA, &btnSoundOver, btnClick2, 1 ); if ( Settings.godmode == 1 && mountMethod != 2 && mountMethod != 3 ) @@ -1313,22 +1313,22 @@ int GameWindowPrompt() GuiImage btn3Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn3Txt.SetWidescreen( CFG.widescreen ); - btn3Img.SetWidescreen( CFG.widescreen ); + btn3Txt.SetWidescreen( Settings.widescreen ); + btn3Img.SetWidescreen( Settings.widescreen ); } GuiButton btn3( &btn3Img, &btn3Img, 0, 4, 50, -40, &trigA, &btnSoundOver, btnClick2, 1 ); btn3.SetLabel( &btn3Txt ); GuiImage btnFavoriteImg1; - btnFavoriteImg1.SetWidescreen( CFG.widescreen ); + btnFavoriteImg1.SetWidescreen( Settings.widescreen ); GuiImage btnFavoriteImg2; - btnFavoriteImg2.SetWidescreen( CFG.widescreen ); + btnFavoriteImg2.SetWidescreen( Settings.widescreen ); GuiImage btnFavoriteImg3; - btnFavoriteImg3.SetWidescreen( CFG.widescreen ); + btnFavoriteImg3.SetWidescreen( Settings.widescreen ); GuiImage btnFavoriteImg4; - btnFavoriteImg4.SetWidescreen( CFG.widescreen ); + btnFavoriteImg4.SetWidescreen( Settings.widescreen ); GuiImage btnFavoriteImg5; - btnFavoriteImg5.SetWidescreen( CFG.widescreen ); + btnFavoriteImg5.SetWidescreen( Settings.widescreen ); //GuiButton btnFavorite(&btnFavoriteImg,&btnFavoriteImg, 2, 5, -125, -60, &trigA, &btnSoundOver, &btnClick,1); GuiButton btnFavorite1( imgFavorite.GetWidth(), imgFavorite.GetHeight() ); @@ -1346,7 +1346,7 @@ int GameWindowPrompt() GuiImage btnLeftImg( &imgLeft ); if ( Settings.wsprompt == yes ) { - btnLeftImg.SetWidescreen( CFG.widescreen ); + btnLeftImg.SetWidescreen( Settings.widescreen ); } GuiButton btnLeft( &btnLeftImg, &btnLeftImg, 0, 5, 20, 0, &trigA, &btnSoundOver, btnClick2, 1 ); btnLeft.SetTrigger( &trigL ); @@ -1355,7 +1355,7 @@ int GameWindowPrompt() GuiImage btnRightImg( &imgRight ); if ( Settings.wsprompt == yes ) { - btnRightImg.SetWidescreen( CFG.widescreen ); + btnRightImg.SetWidescreen( Settings.widescreen ); } GuiButton btnRight( &btnRightImg, &btnRightImg, 1, 5, -20, 0, &trigA, &btnSoundOver, btnClick2, 1 ); btnRight.SetTrigger( &trigR ); @@ -1463,7 +1463,7 @@ int GameWindowPrompt() if ( !diskCover->GetImage() ) { delete diskCover; - snprintf( imgPath, sizeof( imgPath ), "%snodisc.png", CFG.theme_path ); //changed to nodisc.png + snprintf( imgPath, sizeof( imgPath ), "%snodisc.png", Settings.theme_path ); //changed to nodisc.png diskCover = new GuiImageData( imgPath, nodisc_png ); } } @@ -1821,9 +1821,9 @@ DiscWait( const char *title, const char *msg, const char *btn1Label, const char // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", Settings.theme_path ); GuiImageData dialogBox( imgPath, dialogue_box_png ); GuiTrigger trigA; trigA.SetSimpleTrigger( -1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A ); @@ -1833,7 +1833,7 @@ DiscWait( const char *title, const char *msg, const char *btn1Label, const char GuiImage dialogBoxImg( &dialogBox ); if ( Settings.wsprompt == yes ) { - dialogBoxImg.SetWidescreen( CFG.widescreen ); + dialogBoxImg.SetWidescreen( Settings.widescreen ); } GuiText titleTxt( title, 26, THEME.prompttext ); @@ -1848,8 +1848,8 @@ DiscWait( const char *title, const char *msg, const char *btn1Label, const char GuiImage btn1Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn1Txt.SetWidescreen( CFG.widescreen ); - btn1Img.SetWidescreen( CFG.widescreen ); + btn1Txt.SetWidescreen( Settings.widescreen ); + btn1Img.SetWidescreen( Settings.widescreen ); } GuiButton btn1( &btn1Img, &btn1Img, 1, 5, 0, 0, &trigA, &btnSoundOver, btnClick2, 1 ); @@ -1872,13 +1872,13 @@ DiscWait( const char *title, const char *msg, const char *btn1Label, const char GuiImage btn2Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn2Txt.SetWidescreen( CFG.widescreen ); - btn2Img.SetWidescreen( CFG.widescreen ); + btn2Txt.SetWidescreen( Settings.widescreen ); + btn2Img.SetWidescreen( Settings.widescreen ); } GuiButton btn2( &btn2Img, &btn2Img, 1, 4, -20, -25, &trigA, &btnSoundOver, btnClick2, 1 ); btn2.SetLabel( &btn2Txt ); - if ( ( Settings.wsprompt == yes ) && ( CFG.widescreen ) ) /////////////adjust buttons for widescreen + if ( ( Settings.wsprompt == yes ) && ( Settings.widescreen ) ) /////////////adjust buttons for widescreen { msgTxt.SetMaxWidth( 380 ); if ( btn2Label ) @@ -1978,9 +1978,9 @@ FormatingPartition( const char *title, partitionEntry *entry ) promptWindow.SetPosition( 0, -10 ); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", Settings.theme_path ); GuiImageData dialogBox( imgPath, dialogue_box_png ); @@ -1990,7 +1990,7 @@ FormatingPartition( const char *title, partitionEntry *entry ) GuiImage dialogBoxImg( &dialogBox ); if ( Settings.wsprompt == yes ) { - dialogBoxImg.SetWidescreen( CFG.widescreen ); + dialogBoxImg.SetWidescreen( Settings.widescreen ); } GuiText titleTxt( title, 26, THEME.prompttext ); @@ -2039,9 +2039,9 @@ bool SearchMissingImages( int choice2 ) // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", Settings.theme_path ); GuiImageData dialogBox( imgPath, dialogue_box_png ); GuiTrigger trigA; trigA.SetSimpleTrigger( -1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A ); @@ -2050,7 +2050,7 @@ bool SearchMissingImages( int choice2 ) if ( Settings.wsprompt == yes ) { - dialogBoxImg.SetWidescreen( CFG.widescreen ); + dialogBoxImg.SetWidescreen( Settings.widescreen ); } GuiText titleTxt( tr( "Checking existing artwork" ), 26, THEME.prompttext ); @@ -2173,9 +2173,9 @@ bool NetworkInitPrompt() // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", Settings.theme_path ); GuiImageData dialogBox( imgPath, dialogue_box_png ); GuiTrigger trigA; trigA.SetSimpleTrigger( -1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A ); @@ -2184,7 +2184,7 @@ bool NetworkInitPrompt() if ( Settings.wsprompt == yes ) { - dialogBoxImg.SetWidescreen( CFG.widescreen ); + dialogBoxImg.SetWidescreen( Settings.widescreen ); } GuiText titleTxt( tr( "Initializing Network" ), 26, THEME.prompttext ); @@ -2200,14 +2200,14 @@ bool NetworkInitPrompt() GuiImage btn1Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn1Txt.SetWidescreen( CFG.widescreen ); - btn1Img.SetWidescreen( CFG.widescreen ); + btn1Txt.SetWidescreen( Settings.widescreen ); + btn1Img.SetWidescreen( Settings.widescreen ); } GuiButton btn1( &btn1Img, &btn1Img, 2, 4, 0, -45, &trigA, &btnSoundOver, btnClick2, 1 ); btn1.SetLabel( &btn1Txt ); btn1.SetState( STATE_SELECTED ); - if ( ( Settings.wsprompt == yes ) && ( CFG.widescreen ) ) /////////////adjust buttons for widescreen + if ( ( Settings.wsprompt == yes ) && ( Settings.widescreen ) ) /////////////adjust buttons for widescreen { btn1.SetAlignment( ALIGN_CENTRE, ALIGN_BOTTOM ); btn1.SetPosition( 0, -80 ); @@ -2282,9 +2282,9 @@ ProgressDownloadWindow( int choice2 ) // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", Settings.theme_path ); GuiImageData dialogBox( imgPath, dialogue_box_png ); GuiTrigger trigA; trigA.SetSimpleTrigger( -1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A ); @@ -2292,27 +2292,27 @@ ProgressDownloadWindow( int choice2 ) GuiImage dialogBoxImg( &dialogBox ); if ( Settings.wsprompt == yes ) { - dialogBoxImg.SetWidescreen( CFG.widescreen ); + dialogBoxImg.SetWidescreen( Settings.widescreen ); } - snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_outline.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_outline.png", Settings.theme_path ); GuiImageData progressbarOutline( imgPath, progressbar_outline_png ); GuiImage progressbarOutlineImg( &progressbarOutline ); if ( Settings.wsprompt == yes ) { - progressbarOutlineImg.SetWidescreen( CFG.widescreen ); + progressbarOutlineImg.SetWidescreen( Settings.widescreen ); } progressbarOutlineImg.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); progressbarOutlineImg.SetPosition( 25, 40 ); - snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_empty.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_empty.png", Settings.theme_path ); GuiImageData progressbarEmpty( imgPath, progressbar_empty_png ); GuiImage progressbarEmptyImg( &progressbarEmpty ); progressbarEmptyImg.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); progressbarEmptyImg.SetPosition( 25, 40 ); progressbarEmptyImg.SetTile( 100 ); - snprintf( imgPath, sizeof( imgPath ), "%sprogressbar.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sprogressbar.png", Settings.theme_path ); GuiImageData progressbar( imgPath, progressbar_png ); GuiImage progressbarImg( &progressbar ); progressbarImg.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); @@ -2338,14 +2338,14 @@ ProgressDownloadWindow( int choice2 ) GuiImage btn1Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn1Txt.SetWidescreen( CFG.widescreen ); - btn1Img.SetWidescreen( CFG.widescreen ); + btn1Txt.SetWidescreen( Settings.widescreen ); + btn1Img.SetWidescreen( Settings.widescreen ); } GuiButton btn1( &btn1Img, &btn1Img, 2, 4, 0, -45, &trigA, &btnSoundOver, btnClick2, 1 ); btn1.SetLabel( &btn1Txt ); btn1.SetState( STATE_SELECTED ); - if ( ( Settings.wsprompt == yes ) && ( CFG.widescreen ) ) /////////////adjust for widescreen + if ( ( Settings.wsprompt == yes ) && ( Settings.widescreen ) ) /////////////adjust for widescreen { progressbarOutlineImg.SetAlignment( ALIGN_CENTRE, ALIGN_MIDDLE ); progressbarOutlineImg.SetPosition( 0, 40 ); @@ -2416,7 +2416,7 @@ ProgressDownloadWindow( int choice2 ) tries = 0; prTxt.SetTextf( "%i%%", 100*i / cntMissFiles ); - if ( ( Settings.wsprompt == yes ) && ( CFG.widescreen ) ) + if ( ( Settings.wsprompt == yes ) && ( Settings.widescreen ) ) { //adjust for widescreen progressbarImg.SetPosition( 80, 40 ); @@ -2885,9 +2885,9 @@ int ProgressUpdateWindow() // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", Settings.theme_path ); GuiImageData dialogBox( imgPath, dialogue_box_png ); GuiTrigger trigA; trigA.SetSimpleTrigger( -1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A ); @@ -2895,27 +2895,27 @@ int ProgressUpdateWindow() GuiImage dialogBoxImg( &dialogBox ); if ( Settings.wsprompt == yes ) { - dialogBoxImg.SetWidescreen( CFG.widescreen ); + dialogBoxImg.SetWidescreen( Settings.widescreen ); } - snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_outline.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_outline.png", Settings.theme_path ); GuiImageData progressbarOutline( imgPath, progressbar_outline_png ); GuiImage progressbarOutlineImg( &progressbarOutline ); if ( Settings.wsprompt == yes ) { - progressbarOutlineImg.SetWidescreen( CFG.widescreen ); + progressbarOutlineImg.SetWidescreen( Settings.widescreen ); } progressbarOutlineImg.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); progressbarOutlineImg.SetPosition( 25, 7 ); - snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_empty.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_empty.png", Settings.theme_path ); GuiImageData progressbarEmpty( imgPath, progressbar_empty_png ); GuiImage progressbarEmptyImg( &progressbarEmpty ); progressbarEmptyImg.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); progressbarEmptyImg.SetPosition( 25, 7 ); progressbarEmptyImg.SetTile( 100 ); - snprintf( imgPath, sizeof( imgPath ), "%sprogressbar.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sprogressbar.png", Settings.theme_path ); GuiImageData progressbar( imgPath, progressbar_png ); GuiImage progressbarImg( &progressbar ); progressbarImg.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); @@ -2944,14 +2944,14 @@ int ProgressUpdateWindow() GuiImage btn1Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn1Txt.SetWidescreen( CFG.widescreen ); - btn1Img.SetWidescreen( CFG.widescreen ); + btn1Txt.SetWidescreen( Settings.widescreen ); + btn1Img.SetWidescreen( Settings.widescreen ); } GuiButton btn1( &btn1Img, &btn1Img, 2, 4, 0, -40, &trigA, &btnSoundOver, btnClick2, 1 ); btn1.SetLabel( &btn1Txt ); btn1.SetState( STATE_SELECTED ); - if ( ( Settings.wsprompt == yes ) && ( CFG.widescreen ) ) /////////////adjust for widescreen + if ( ( Settings.wsprompt == yes ) && ( Settings.widescreen ) ) /////////////adjust for widescreen { progressbarOutlineImg.SetAlignment( ALIGN_CENTRE, ALIGN_MIDDLE ); progressbarOutlineImg.SetPosition( 0, 7 ); @@ -3099,7 +3099,7 @@ int ProgressUpdateWindow() { usleep( 100 ); prTxt.SetTextf( "%i%%", ( 100*i / filesize ) + 1 ); - if ( ( Settings.wsprompt == yes ) && ( CFG.widescreen ) ) + if ( ( Settings.wsprompt == yes ) && ( Settings.widescreen ) ) { progressbarImg.SetTile( 80*i / filesize ); } @@ -3248,9 +3248,9 @@ int ProgressUpdateWindow() // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", Settings.theme_path ); GuiImageData dialogBox( imgPath, dialogue_box_png ); GuiTrigger trigA; trigA.SetSimpleTrigger( -1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A ); @@ -3258,27 +3258,27 @@ int ProgressUpdateWindow() GuiImage dialogBoxImg( &dialogBox ); if ( Settings.wsprompt == yes ) { - dialogBoxImg.SetWidescreen( CFG.widescreen ); + dialogBoxImg.SetWidescreen( Settings.widescreen ); } - snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_outline.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_outline.png", Settings.theme_path ); GuiImageData progressbarOutline( imgPath, progressbar_outline_png ); GuiImage progressbarOutlineImg( &progressbarOutline ); if ( Settings.wsprompt == yes ) { - progressbarOutlineImg.SetWidescreen( CFG.widescreen ); + progressbarOutlineImg.SetWidescreen( Settings.widescreen ); } progressbarOutlineImg.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); progressbarOutlineImg.SetPosition( 25, 7 ); - snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_empty.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_empty.png", Settings.theme_path ); GuiImageData progressbarEmpty( imgPath, progressbar_empty_png ); GuiImage progressbarEmptyImg( &progressbarEmpty ); progressbarEmptyImg.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); progressbarEmptyImg.SetPosition( 25, 7 ); progressbarEmptyImg.SetTile( 100 ); - snprintf( imgPath, sizeof( imgPath ), "%sprogressbar.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sprogressbar.png", Settings.theme_path ); GuiImageData progressbar( imgPath, progressbar_png ); GuiImage progressbarImg( &progressbar ); progressbarImg.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); @@ -3307,14 +3307,14 @@ int ProgressUpdateWindow() GuiImage btn1Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn1Txt.SetWidescreen( CFG.widescreen ); - btn1Img.SetWidescreen( CFG.widescreen ); + btn1Txt.SetWidescreen( Settings.widescreen ); + btn1Img.SetWidescreen( Settings.widescreen ); } GuiButton btn1( &btn1Img, &btn1Img, 2, 4, 0, -40, &trigA, &btnSoundOver, btnClick2, 1 ); btn1.SetLabel( &btn1Txt ); btn1.SetState( STATE_SELECTED ); - if ( ( Settings.wsprompt == yes ) && ( CFG.widescreen ) ) /////////////adjust for widescreen + if ( ( Settings.wsprompt == yes ) && ( Settings.widescreen ) ) /////////////adjust for widescreen { progressbarOutlineImg.SetAlignment( ALIGN_CENTRE, ALIGN_MIDDLE ); progressbarOutlineImg.SetPosition( 0, 7 ); @@ -3433,7 +3433,7 @@ int ProgressUpdateWindow() { usleep( 100 ); prTxt.SetTextf( "%i%%", ( 100*i / filesize ) + 1 ); - if ( ( Settings.wsprompt == yes ) && ( CFG.widescreen ) ) + if ( ( Settings.wsprompt == yes ) && ( Settings.widescreen ) ) { progressbarImg.SetTile( 80*i / filesize ); } @@ -3638,9 +3638,9 @@ int CodeDownload( const char *id ) // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", Settings.theme_path ); GuiImageData dialogBox( imgPath, dialogue_box_png ); GuiTrigger trigA; trigA.SetSimpleTrigger( -1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A ); @@ -3648,7 +3648,7 @@ int CodeDownload( const char *id ) GuiImage dialogBoxImg( &dialogBox ); if ( Settings.wsprompt == yes ) { - dialogBoxImg.SetWidescreen( CFG.widescreen ); + dialogBoxImg.SetWidescreen( Settings.widescreen ); } @@ -3672,8 +3672,8 @@ int CodeDownload( const char *id ) GuiImage btn1Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn1Txt.SetWidescreen( CFG.widescreen ); - btn1Img.SetWidescreen( CFG.widescreen ); + btn1Txt.SetWidescreen( Settings.widescreen ); + btn1Img.SetWidescreen( Settings.widescreen ); } GuiButton btn1( &btn1Img, &btn1Img, 2, 4, 0, -40, &trigA, &btnSoundOver, btnClick2, 1 ); btn1.SetLabel( &btn1Txt ); @@ -3830,26 +3830,26 @@ HBCWindowPrompt( const char *name, const char *coder, const char *version, if ( !btnClick2 ) btnClick2 = new GuiSound( button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume ); // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", Settings.theme_path ); GuiImageData dialogBox( imgPath, dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sbg_options.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbg_options.png", Settings.theme_path ); GuiImageData whiteBox( imgPath, bg_options_png ); - snprintf( imgPath, sizeof( imgPath ), "%sscrollbar.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sscrollbar.png", Settings.theme_path ); GuiImageData scrollbar( imgPath, scrollbar_png ); GuiImage scrollbarImg( &scrollbar ); scrollbarImg.SetAlignment( ALIGN_RIGHT, ALIGN_TOP ); scrollbarImg.SetPosition( -40, 114 ); scrollbarImg.SetSkew( 0, 0, 0, 0, 0, -120, 0, -120 ); - snprintf( imgPath, sizeof( imgPath ), "%sscrollbar_arrowdown.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sscrollbar_arrowdown.png", Settings.theme_path ); GuiImageData arrowDown( imgPath, scrollbar_arrowdown_png ); GuiImage arrowDownImg( &arrowDown ); arrowDownImg.SetScale( .8 ); - snprintf( imgPath, sizeof( imgPath ), "%sscrollbar_arrowup.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sscrollbar_arrowup.png", Settings.theme_path ); GuiImageData arrowUp( imgPath, scrollbar_arrowup_png ); GuiImage arrowUpImg ( &arrowUp ); arrowUpImg.SetScale( .8 ); @@ -3893,7 +3893,7 @@ HBCWindowPrompt( const char *name, const char *coder, const char *version, whiteBoxImg.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); whiteBoxImg.SetSkew( 0, 0, 0, 0, 0, -120, 0, -120 ); /*if (Settings.wsprompt == yes){ - dialogBoxImg.SetWidescreen(CFG.widescreen); + dialogBoxImg.SetWidescreen(Settings.widescreen); }*/ char tmp[510]; @@ -3966,8 +3966,8 @@ HBCWindowPrompt( const char *name, const char *coder, const char *version, GuiImage btn1Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn1Txt.SetWidescreen( CFG.widescreen ); - btn1Img.SetWidescreen( CFG.widescreen ); + btn1Txt.SetWidescreen( Settings.widescreen ); + btn1Img.SetWidescreen( Settings.widescreen ); } GuiButton btn1( &btn1Img, &btn1Img, 0, 3, 0, 0, &trigA, &btnSoundOver, btnClick2, 1 ); @@ -3978,8 +3978,8 @@ HBCWindowPrompt( const char *name, const char *coder, const char *version, GuiImage btn2Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn2Txt.SetWidescreen( CFG.widescreen ); - btn2Img.SetWidescreen( CFG.widescreen ); + btn2Txt.SetWidescreen( Settings.widescreen ); + btn2Img.SetWidescreen( Settings.widescreen ); } GuiButton btn2( &btn2Img, &btn2Img, 0, 3, 0, 0, &trigA, &btnSoundOver, btnClick2, 1 ); btn2.SetLabel( &btn2Txt ); diff --git a/source/prompts/TitleBrowser.cpp b/source/prompts/TitleBrowser.cpp index 58dff465..14ed7551 100644 --- a/source/prompts/TitleBrowser.cpp +++ b/source/prompts/TitleBrowser.cpp @@ -136,9 +136,9 @@ bool TitleSelector( char output[] ) char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sgamesettings_background.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sgamesettings_background.png", Settings.theme_path ); GuiImageData settingsbg( imgPath, settings_background_png ); GuiImage settingsbackground( &settingsbg ); @@ -157,8 +157,8 @@ bool TitleSelector( char output[] ) GuiImage cancelBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - cancelBtnTxt.SetWidescreen( CFG.widescreen ); - cancelBtnImg.SetWidescreen( CFG.widescreen ); + cancelBtnTxt.SetWidescreen( Settings.widescreen ); + cancelBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton cancelBtn( &cancelBtnImg, &cancelBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, btnClick2, 1 ); cancelBtn.SetLabel( &cancelBtnTxt ); @@ -168,7 +168,7 @@ bool TitleSelector( char output[] ) if ( num_titles + 1 > 9 ) scrollbaron = 1; - GuiCustomOptionBrowser optionBrowser4( 396, 280, &options4, CFG.theme_path, "bg_options_gamesettings.png", bg_options_settings_png, scrollbaron, 200 ); + GuiCustomOptionBrowser optionBrowser4( 396, 280, &options4, Settings.theme_path, "bg_options_gamesettings.png", bg_options_settings_png, scrollbaron, 200 ); optionBrowser4.SetPosition( 0, 90 ); optionBrowser4.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); @@ -375,9 +375,9 @@ int TitleBrowser() char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sgamesettings_background.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sgamesettings_background.png", Settings.theme_path ); GuiImageData settingsbg( imgPath, settings_background_png ); GuiTrigger trigA; @@ -403,8 +403,8 @@ int TitleBrowser() GuiImage cancelBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - cancelBtnTxt.SetWidescreen( CFG.widescreen ); - cancelBtnImg.SetWidescreen( CFG.widescreen ); + cancelBtnTxt.SetWidescreen( Settings.widescreen ); + cancelBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton cancelBtn( &cancelBtnImg, &cancelBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, btnClick2, 1 ); cancelBtn.SetScale( 0.9 ); @@ -415,16 +415,16 @@ int TitleBrowser() if ( total + 1 > 9 ) scrollbaron = 1; - GuiCustomOptionBrowser optionBrowser3( 396, 280, &options3, CFG.theme_path, "bg_options_gamesettings.png", bg_options_settings_png, scrollbaron, 200 ); + GuiCustomOptionBrowser optionBrowser3( 396, 280, &options3, Settings.theme_path, "bg_options_gamesettings.png", bg_options_settings_png, scrollbaron, 200 ); optionBrowser3.SetPosition( 0, 90 ); optionBrowser3.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); - snprintf( imgPath, sizeof( imgPath ), "%sWifi_btn.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sWifi_btn.png", Settings.theme_path ); GuiImageData wifiImgData( imgPath, Wifi_btn_png ); GuiImage wifiImg( &wifiImgData ); if ( Settings.wsprompt == yes ) { - wifiImg.SetWidescreen( CFG.widescreen ); + wifiImg.SetWidescreen( Settings.widescreen ); } GuiButton wifiBtn( wifiImg.GetWidth(), wifiImg.GetHeight() ); wifiBtn.SetImage( &wifiImg ); diff --git a/source/prompts/filebrowser.cpp b/source/prompts/filebrowser.cpp index 91a9ccd2..2e2992c2 100644 --- a/source/prompts/filebrowser.cpp +++ b/source/prompts/filebrowser.cpp @@ -328,14 +328,14 @@ int BrowseDevice( char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/* folderBtn.SetEffectGrow(); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); GuiText ExitBtnTxt( tr( "Cancel" ), 24, ( GXColor ) {0, 0, 0, 255} ); GuiImage ExitBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - ExitBtnTxt.SetWidescreen( CFG.widescreen ); - ExitBtnImg.SetWidescreen( CFG.widescreen ); + ExitBtnTxt.SetWidescreen( Settings.widescreen ); + ExitBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton ExitBtn( btnOutline.GetWidth(), btnOutline.GetHeight() ); ExitBtn.SetAlignment( ALIGN_RIGHT, ALIGN_BOTTOM ); @@ -350,8 +350,8 @@ int BrowseDevice( char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/* GuiImage usbBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - usbBtnTxt.SetWidescreen( CFG.widescreen ); - usbBtnImg.SetWidescreen( CFG.widescreen ); + usbBtnTxt.SetWidescreen( Settings.widescreen ); + usbBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton usbBtn( btnOutline.GetWidth(), btnOutline.GetHeight() ); usbBtn.SetAlignment( ALIGN_CENTRE, ALIGN_BOTTOM ); @@ -365,8 +365,8 @@ int BrowseDevice( char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/* GuiImage okBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - okBtnTxt.SetWidescreen( CFG.widescreen ); - okBtnImg.SetWidescreen( CFG.widescreen ); + okBtnTxt.SetWidescreen( Settings.widescreen ); + okBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton okBtn( &okBtnImg, &okBtnImg, 0, 4, 40, -35, &trigA, &btnSoundOver, btnClick2, 1 ); okBtn.SetLabel( &okBtnTxt ); diff --git a/source/prompts/gameinfo.cpp b/source/prompts/gameinfo.cpp index 374e3118..2fdba831 100644 --- a/source/prompts/gameinfo.cpp +++ b/source/prompts/gameinfo.cpp @@ -150,15 +150,15 @@ int showGameInfo( char *ID ) GuiSound btnSoundOver( button_over_pcm, button_over_pcm_size, Settings.sfxvolume ); GuiSound btnClick( button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume ); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sgameinfo1_png.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sgameinfo1_png.png", Settings.theme_path ); GuiImageData dialogBox1( imgPath, gameinfo1_png ); - snprintf( imgPath, sizeof( imgPath ), "%sgameinfo1a_png.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sgameinfo1a_png.png", Settings.theme_path ); GuiImageData dialogBox2( imgPath, gameinfo1a_png ); - snprintf( imgPath, sizeof( imgPath ), "%sgameinfo2_png.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sgameinfo2_png.png", Settings.theme_path ); GuiImageData dialogBox3( imgPath, gameinfo2_png ); - snprintf( imgPath, sizeof( imgPath ), "%sgameinfo2a_png.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sgameinfo2a_png.png", Settings.theme_path ); GuiImageData dialogBox4( imgPath, gameinfo2a_png ); GuiTrigger trig1; @@ -349,7 +349,7 @@ int showGameInfo( char *ID ) coverImg = NULL; coverImg = new GuiImage( cover ); - coverImg->SetWidescreen( CFG.widescreen ); + coverImg->SetWidescreen( Settings.widescreen ); coverImg->SetPosition( 15, 30 ); gameinfoWindow.Append( coverImg ); @@ -367,140 +367,140 @@ int showGameInfo( char *ID ) } playersImg = new GuiImage( playersImgData ); - playersImg->SetWidescreen( CFG.widescreen ); + playersImg->SetWidescreen( Settings.widescreen ); playersImg->SetPosition( intputX , inputY ); playersImg->SetAlignment( 0, 4 ); gameinfoWindow.Append( playersImg ); - intputX += ( CFG.widescreen ? playersImg->GetWidth() * .8 : playersImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? playersImg->GetWidth() * .8 : playersImg->GetWidth() ) + 5; } //draw the input types for this game if ( motionplus == 1 ) { motionplusImg = new GuiImage( motionplusImgData ); - motionplusImg->SetWidescreen( CFG.widescreen ); + motionplusImg->SetWidescreen( Settings.widescreen ); motionplusImg->SetPosition( intputX , inputY ); motionplusImg->SetAlignment( 0, 4 ); gameinfoWindow.Append( motionplusImg ); - intputX += ( CFG.widescreen ? motionplusImg->GetWidth() * .8 : motionplusImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? motionplusImg->GetWidth() * .8 : motionplusImg->GetWidth() ) + 5; } if ( nunchuk == 1 ) { nunchukImg = new GuiImage( nunchukImgData ); - nunchukImg->SetWidescreen( CFG.widescreen ); + nunchukImg->SetWidescreen( Settings.widescreen ); nunchukImg->SetPosition( intputX , inputY ); nunchukImg->SetAlignment( 0, 4 ); gameinfoWindow.Append( nunchukImg ); - intputX += ( CFG.widescreen ? nunchukImg->GetWidth() * .8 : nunchukImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? nunchukImg->GetWidth() * .8 : nunchukImg->GetWidth() ) + 5; } if ( classiccontroller == 1 ) { classiccontrollerImg = new GuiImage( classiccontrollerImgData ); - classiccontrollerImg->SetWidescreen( CFG.widescreen ); + classiccontrollerImg->SetWidescreen( Settings.widescreen ); classiccontrollerImg->SetPosition( intputX , inputY ); classiccontrollerImg->SetAlignment( 0, 4 ); gameinfoWindow.Append( classiccontrollerImg ); - intputX += ( CFG.widescreen ? classiccontrollerImg->GetWidth() * .8 : classiccontrollerImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? classiccontrollerImg->GetWidth() * .8 : classiccontrollerImg->GetWidth() ) + 5; } if ( gamecube == 1 ) { gcImg = new GuiImage( gamecubeImgData ); - gcImg->SetWidescreen( CFG.widescreen ); + gcImg->SetWidescreen( Settings.widescreen ); gcImg->SetPosition( intputX , inputY ); gcImg->SetAlignment( 0, 4 ); gameinfoWindow.Append( gcImg ); - intputX += ( CFG.widescreen ? gcImg->GetWidth() * .8 : gcImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? gcImg->GetWidth() * .8 : gcImg->GetWidth() ) + 5; } if ( wheel == 1 ) { wheelImg = new GuiImage( wheelImgData ); - wheelImg->SetWidescreen( CFG.widescreen ); + wheelImg->SetWidescreen( Settings.widescreen ); wheelImg->SetPosition( intputX , inputY ); wheelImg->SetAlignment( 0, 4 ); gameinfoWindow.Append( wheelImg ); - intputX += ( CFG.widescreen ? wheelImg->GetWidth() * .8 : wheelImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? wheelImg->GetWidth() * .8 : wheelImg->GetWidth() ) + 5; } if ( guitar == 1 ) { guitarImg = new GuiImage( guitarImgData ); - guitarImg->SetWidescreen( CFG.widescreen ); + guitarImg->SetWidescreen( Settings.widescreen ); guitarImg->SetPosition( intputX , inputY ); guitarImg->SetAlignment( 0, 4 ); gameinfoWindow.Append( guitarImg ); - intputX += ( CFG.widescreen ? guitarImg->GetWidth() * .8 : guitarImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? guitarImg->GetWidth() * .8 : guitarImg->GetWidth() ) + 5; } if ( drums == 1 ) { drumsImg = new GuiImage( drumsImgData ); - drumsImg->SetWidescreen( CFG.widescreen ); + drumsImg->SetWidescreen( Settings.widescreen ); drumsImg->SetPosition( intputX , inputY ); drumsImg->SetAlignment( 0, 4 ); gameinfoWindow.Append( drumsImg ); - intputX += ( CFG.widescreen ? drumsImg->GetWidth() * .8 : drumsImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? drumsImg->GetWidth() * .8 : drumsImg->GetWidth() ) + 5; } if ( microphone == 1 ) { microphoneImg = new GuiImage( microphoneImgData ); - microphoneImg->SetWidescreen( CFG.widescreen ); + microphoneImg->SetWidescreen( Settings.widescreen ); microphoneImg->SetPosition( intputX , inputY ); microphoneImg->SetAlignment( 0, 4 ); gameinfoWindow.Append( microphoneImg ); - intputX += ( CFG.widescreen ? microphoneImg->GetWidth() * .8 : microphoneImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? microphoneImg->GetWidth() * .8 : microphoneImg->GetWidth() ) + 5; } if ( zapper == 1 ) { zapperImg = new GuiImage( zapperImgData ); - zapperImg->SetWidescreen( CFG.widescreen ); + zapperImg->SetWidescreen( Settings.widescreen ); zapperImg->SetPosition( intputX , inputY ); zapperImg->SetAlignment( 0, 4 ); gameinfoWindow.Append( zapperImg ); - intputX += ( CFG.widescreen ? zapperImg->GetWidth() * .8 : zapperImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? zapperImg->GetWidth() * .8 : zapperImg->GetWidth() ) + 5; } if ( wiispeak == 1 ) { wiispeakImg = new GuiImage( wiispeakImgData ); - wiispeakImg->SetWidescreen( CFG.widescreen ); + wiispeakImg->SetWidescreen( Settings.widescreen ); wiispeakImg->SetPosition( intputX , inputY ); wiispeakImg->SetAlignment( 0, 4 ); gameinfoWindow.Append( wiispeakImg ); - intputX += ( CFG.widescreen ? wiispeakImg->GetWidth() * .8 : wiispeakImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? wiispeakImg->GetWidth() * .8 : wiispeakImg->GetWidth() ) + 5; } if ( nintendods == 1 ) { nintendodsImg = new GuiImage( nintendodsImgData ); - nintendodsImg->SetWidescreen( CFG.widescreen ); + nintendodsImg->SetWidescreen( Settings.widescreen ); nintendodsImg->SetPosition( intputX , inputY ); nintendodsImg->SetAlignment( 0, 4 ); gameinfoWindow.Append( nintendodsImg ); - intputX += ( CFG.widescreen ? nintendodsImg->GetWidth() * .8 : nintendodsImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? nintendodsImg->GetWidth() * .8 : nintendodsImg->GetWidth() ) + 5; } /* if (vitalitysensor==1) { vitalitysensorImg = new GuiImage(vitalitysensorImgData); - vitalitysensorImg->SetWidescreen(CFG.widescreen); + vitalitysensorImg->SetWidescreen(Settings.widescreen); vitalitysensorImg->SetPosition(intputX , inputY); vitalitysensorImg->SetAlignment(0,4); gameinfoWindow.Append(vitalitysensorImg); - intputX += (CFG.widescreen ? vitalitysensorImg->GetWidth() * .8 : vitalitysensorImg->GetWidth())+5; + intputX += (Settings.widescreen ? vitalitysensorImg->GetWidth() * .8 : vitalitysensorImg->GetWidth())+5; } */ if ( dancepad == 1 ) { dancepadImg = new GuiImage( dancepadImgData ); - dancepadImg->SetWidescreen( CFG.widescreen ); + dancepadImg->SetWidescreen( Settings.widescreen ); dancepadImg->SetPosition( intputX , inputY ); dancepadImg->SetAlignment( 0, 4 ); gameinfoWindow.Append( dancepadImg ); - intputX += ( CFG.widescreen ? dancepadImg->GetWidth() * .8 : dancepadImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? dancepadImg->GetWidth() * .8 : dancepadImg->GetWidth() ) + 5; } if ( balanceboard == 1 ) { balanceboardImg = new GuiImage( balanceboardImgData ); - balanceboardImg->SetWidescreen( CFG.widescreen ); + balanceboardImg->SetWidescreen( Settings.widescreen ); balanceboardImg->SetPosition( intputX , inputY ); balanceboardImg->SetAlignment( 0, 4 ); gameinfoWindow.Append( balanceboardImg ); - intputX += ( CFG.widescreen ? balanceboardImg->GetWidth() * .8 : balanceboardImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? balanceboardImg->GetWidth() * .8 : balanceboardImg->GetWidth() ) + 5; } // # online players @@ -538,11 +538,11 @@ int showGameInfo( char *ID ) wifiplayersImgData = new GuiImageData( wifi32_png ); } wifiplayersImg = new GuiImage( wifiplayersImgData ); - wifiplayersImg->SetWidescreen( CFG.widescreen ); + wifiplayersImg->SetWidescreen( Settings.widescreen ); wifiplayersImg->SetPosition( intputX , inputY ); wifiplayersImg->SetAlignment( 0, 4 ); gameinfoWindow.Append( wifiplayersImg ); - intputX += ( CFG.widescreen ? wifiplayersImg->GetWidth() * .8 : wifiplayersImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? wifiplayersImg->GetWidth() * .8 : wifiplayersImg->GetWidth() ) + 5; } // ratings @@ -607,11 +607,11 @@ int showGameInfo( char *ID ) ratingImgData = new GuiImageData( norating_png ); } ratingImg = new GuiImage( ratingImgData ); - ratingImg->SetWidescreen( CFG.widescreen ); + ratingImg->SetWidescreen( Settings.widescreen ); ratingImg->SetPosition( -25 , inputY ); ratingImg->SetAlignment( 1, 4 ); gameinfoWindow.Append( ratingImg ); - intputX += ( CFG.widescreen ? ratingImg->GetWidth() * .8 : ratingImg->GetWidth() ) + 5; + intputX += ( Settings.widescreen ? ratingImg->GetWidth() * .8 : ratingImg->GetWidth() ) + 5; } // memory info @@ -808,7 +808,7 @@ int showGameInfo( char *ID ) txtWindow.Append( &upBtn ); txtWindow.Append( &dnBtn ); coverImg2 = new GuiImage( cover ); - coverImg2->SetWidescreen( CFG.widescreen ); + coverImg2->SetWidescreen( Settings.widescreen ); coverImg2->SetPosition( 15, 30 ); gameinfoWindow2.Append( coverImg2 ); gameinfoWindow2.Append( &txtWindow ); diff --git a/source/settings/CSettings.cpp b/source/settings/CSettings.cpp new file mode 100644 index 00000000..b8514f6c --- /dev/null +++ b/source/settings/CSettings.cpp @@ -0,0 +1,721 @@ + /**************************************************************************** + * Copyright (C) 2010 + * by Dimok + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you use + * this software in a product, an acknowledgment in the product + * documentation would be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + ***************************************************************************/ +#include +#include +#include +#include + +#include "CSettings.h" +#include "language/gettext.h" +#include "listfiles.h" + +#define DEFAULT_APP_PATH "apps/usbloader_gx/" +#define CONFIGPATH "config/" +#define CONFIGNAME "GXGlobal.cfg" + +CSettings Settings; + +CSettings::CSettings() +{ + strcpy(BootDevice, "SD:"); + this->SetDefault(); +} + +CSettings::~CSettings() +{ +} + +void CSettings::SetDefault() +{ + snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/GXGlobal.cfg", BootDevice); + snprintf(covers_path, sizeof( covers_path ), "%s/images/", BootDevice ); + snprintf(covers2d_path, sizeof( covers2d_path ), "%s/images/2D/", BootDevice ); + snprintf(disc_path, sizeof( disc_path ), "%s/images/disc/", BootDevice ); + snprintf(titlestxt_path, sizeof( titlestxt_path ), "%s/config/", BootDevice ); + snprintf(language_path, sizeof( language_path ), "notset" ); + snprintf(languagefiles_path, sizeof( languagefiles_path ), "%s/config/language/", BootDevice ); + snprintf(update_path, sizeof( update_path ), "%s/apps/usbloader_gx/", BootDevice ); + snprintf(theme_downloadpath, sizeof( theme_downloadpath ), "%s/config/themes/", BootDevice ); + snprintf(homebrewapps_path, sizeof( homebrewapps_path ), "%s/apps/", BootDevice ); + snprintf(Cheatcodespath, sizeof( Cheatcodespath ), "%s/codes/", BootDevice ); + snprintf(TxtCheatcodespath, sizeof( TxtCheatcodespath ), "%s/txtcodes/", BootDevice ); + snprintf(BcaCodepath, sizeof( BcaCodepath ), "%s/bca/", BootDevice ); + snprintf(WipCodepath, sizeof( WipCodepath ), "%s/wip/", BootDevice ); + snprintf(theme_path, sizeof( theme_path ), "%s/theme/", BootDevice ); + snprintf(dolpath, sizeof( dolpath ), "%s/", BootDevice ); + strcpy(ogg_path, ""); + strcpy(unlockCode, ""); + + videomode = discdefault; + videopatch = off; + language = ConsoleLangDefault; + ocarina = off; + hddinfo = hr12; + sinfo = on; + rumble = RumbleOn; + volume = 80; + widescreen = 0; + sfxvolume = 80; + gamesoundvolume = 80; + tooltips = TooltipsOn; + gamesound = 1; + parentalcontrol = 0; + cios = 249; + xflip = no; + qboot = no; + wiilight = 1; + autonetwork = 0; + discart = 0; + patchcountrystrings = 0; + gridRows = 3; + error002 = 2; + titlesOverride = 1; + db_JPtoEN = 0; + screensaver = 3; + musicloopmode = 1; + partition = -1; + marknewtitles = 1; + FatInstallToDir = 0; + partitions_to_install = install_game_only; + fullcopy = 0; + beta_upgrades = 0; + strcpy(db_url, ""); + strcpy(db_language, ""); + strcpy(unlockCode, ""); + strcpy(returnTo, ""); + + memset( &Parental, 0, sizeof( Parental ) ); + + char buf[0x4a]; + CONF_Init(); + s32 res = CONF_Get( "IPL.PC", buf, 0x4A ); + if ( res > 0 ) + { + if ( buf[2] != 0x14 ) + { + Parental.enabled = 1; + Parental.rating = buf[2]; + } + Parental.question = buf[7]; + memcpy( Parental.pin, buf + 3, 4 ); + memcpy( Parental.answer, buf + 8, 32 ); + } + godmode = ( Parental.enabled == 0 ) ? 1 : 0; + + CFG_DefaultTheme(); +} + +bool CSettings::Save() +{ + if(!FindConfig()) + return false; + + char filedest[100]; + snprintf(filedest, sizeof(filedest), "%s", ConfigPath); + + char * tmppath = strrchr(filedest, '/'); + if(tmppath) + { + tmppath++; + tmppath[0] = '\0'; + } + + subfoldercreate(filedest); + + file = fopen(ConfigPath, "w"); + if(!file) + return false; + + fprintf(file, "# USB Loader global settings file\n" ); + fprintf(file, "# Note: This file is automatically generated\n " ); + fprintf(file, "videomode = %d\n ", videomode ); + fprintf(file, "videopatch = %d\n ", videopatch ); + fprintf(file, "language = %d\n ", language ); + fprintf(file, "ocarina = %d\n ", ocarina ); + fprintf(file, "hddinfo = %d\n ", hddinfo ); + fprintf(file, "sinfo = %d\n ", sinfo ); + fprintf(file, "rumble = %d\n ", rumble ); + fprintf(file, "volume = %d\n ", volume ); + fprintf(file, "sfxvolume = %d\n ", sfxvolume ); + fprintf(file, "gamesoundvolume = %d\n ", gamesoundvolume ); + fprintf(file, "tooltips = %d\n ", tooltips ); + fprintf(file, "password = %s\n ", unlockCode ); + fprintf(file, "sort = %d\n ", sort ); + fprintf(file, "fave = %d\n ", fave ); + fprintf(file, "cios = %d\n ", cios ); + fprintf(file, "keyset = %d\n ", keyset ); + fprintf(file, "xflip = %d\n ", xflip ); + fprintf(file, "gridRows = %d\n ", gridRows ); + fprintf(file, "qboot = %d\n ", qboot ); + fprintf(file, "wsprompt = %d\n ", wsprompt ); + fprintf(file, "parentalcontrol = %d\n ", parentalcontrol ); + fprintf(file, "cover_path = %s\n ", covers_path ); + fprintf(file, "cover2d_path = %s\n ", covers2d_path ); + fprintf(file, "theme_path = %s\n ", theme_path ); + fprintf(file, "disc_path = %s\n ", disc_path ); + fprintf(file, "language_path = %s\n ", language_path ); + fprintf(file, "languagefiles_path = %s\n ", languagefiles_path ); + fprintf(file, "TxtCheatcodespath = %s\n ", TxtCheatcodespath ); + fprintf(file, "titlestxt_path = %s\n ", titlestxt_path ); + fprintf(file, "gamesound = %d\n ", gamesound ); + fprintf(file, "dolpath = %s\n ", dolpath ); + fprintf(file, "ogg_path = %s\n ", ogg_path ); + fprintf(file, "wiilight = %d\n ", wiilight ); + fprintf(file, "gameDisplay = %d\n ", gameDisplay ); + fprintf(file, "update_path = %s\n ", update_path ); + fprintf(file, "theme_downloadpath = %s\n ", theme_downloadpath ); + fprintf(file, "homebrewapps_path = %s\n ", homebrewapps_path ); + fprintf(file, "Cheatcodespath = %s\n ", Cheatcodespath ); + fprintf(file, "BcaCodepath = %s\n ", BcaCodepath ); + fprintf(file, "WipCodepath = %s\n ", WipCodepath ); + fprintf(file, "titlesOverride = %d\n ", titlesOverride ); + fprintf(file, "patchcountrystrings = %d\n ", patchcountrystrings ); + fprintf(file, "screensaver = %d\n ", screensaver ); + fprintf(file, "musicloopmode = %d\n ", musicloopmode ); + fprintf(file, "error002 = %d\n ", error002 ); + fprintf(file, "autonetwork = %d\n ", autonetwork ); + fprintf(file, "discart = %d\n ", discart ); + fprintf(file, "partition = %d\n ", partition ); + fprintf(file, "marknewtitles = %d\n ", marknewtitles ); + fprintf(file, "fatInstallToDir = %d\n ", FatInstallToDir ); + fprintf(file, "partitions = %d\n ", partitions_to_install ); + fprintf(file, "fullcopy = %d\n ", fullcopy ); + fprintf(file, "beta_upgrades = %d\n ", beta_upgrades ); + fprintf(file, "returnTo = %s\n ", returnTo ); + fprintf(file, "widescreen = %d\n ", widescreen); + fclose(file); + + return true; +} + +bool CSettings::FindConfig() +{ + bool found = false; + strcpy(BootDevice, "SD:"); + + for(int i = 0; i < 2; ++i) + { + if(i == 1) + strcpy(BootDevice, "USB:"); + + snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/GXGlobal.cfg", BootDevice); + if((found = checkfile(ConfigPath))) + break; + + snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/GXGlobal.cfg", BootDevice); + if((found = checkfile(ConfigPath))) + break; + } + + if(!found) + { + FILE * testFp = NULL; + strcpy(BootDevice, "SD:"); + //! No existing config so try to find a place where we can write it too + for(int i = 0; i < 2; ++i) + { + if(i == 1) + strcpy(BootDevice, "USB:"); + if(!found) + { + snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/GXGlobal.cfg", BootDevice); + testFp = fopen(ConfigPath, "wb"); + found = (testFp != NULL); + fclose(testFp); + } + if(!found) + { + snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/GXGlobal.cfg", BootDevice); + testFp = fopen(ConfigPath, "wb"); + found = (testFp != NULL); + fclose(testFp); + } + } + } + + return found; +} + +bool CSettings::Load() +{ + FindConfig(); + + char line[1024]; + char filepath[300]; + snprintf(filepath, sizeof(filepath), "%s", ConfigPath); + + file = fopen(filepath, "r"); + if (!file) + return false; + + while (fgets(line, sizeof(line), file)) + { + if (line[0] == '#') continue; + + this->ParseLine(line); + } + fclose(file); + + CFG_LoadTheme(widescreen, theme_path); + + return true; + +} + +bool CSettings::Reset() +{ + this->SetDefault(); + + if(this->Save()) + return true; + + return false; +} + +bool CSettings::SetSetting(char *name, char *value) +{ + int i = 0; + + if (strcmp(name, "videomode") == 0) { + if (sscanf(value, "%d", &i) == 1) { + videomode = i; + } + return true; + } + else if (strcmp(name, "videopatch") == 0) { + if (sscanf(value, "%d", &i) == 1) { + videopatch = i; + } + return true; + } + else if (strcmp(name, "language") == 0) { + if (sscanf(value, "%d", &i) == 1) { + language = i; + } + return true; + } + else if (strcmp(name, "ocarina") == 0) { + if (sscanf(value, "%d", &i) == 1) { + ocarina = i; + } + return true; + } + else if (strcmp(name, "hddinfo") == 0) { + if (sscanf(value, "%d", &i) == 1) { + hddinfo = i; + } + return true; + } + else if (strcmp(name, "sinfo") == 0) { + if (sscanf(value, "%d", &i) == 1) { + sinfo = i; + } + return true; + } + else if (strcmp(name, "rumble") == 0) { + if (sscanf(value, "%d", &i) == 1) { + rumble = i; + } + return true; + } + else if (strcmp(name, "volume") == 0) { + if (sscanf(value, "%d", &i) == 1) { + volume = i; + } + return true; + } + else if (strcmp(name, "sfxvolume") == 0) { + if (sscanf(value, "%d", &i) == 1) { + sfxvolume = i; + } + return true; + } + else if (strcmp(name, "gamesoundvolume") == 0) { + if (sscanf(value, "%d", &i) == 1) { + gamesoundvolume = i; + } + return true; + } + else if (strcmp(name, "tooltips") == 0) { + if (sscanf(value, "%d", &i) == 1) { + tooltips = i; + } + return true; + } + else if (strcmp(name, "unlockCode") == 0) { + strcpy(unlockCode, value); + return true; + } + else if (strcmp(name, "sort") == 0) { + if (sscanf(value, "%d", &i) == 1) + sort = i; + return true; + } + else if (strcmp(name, "fave") == 0) { + if (sscanf(value, "%d", &i) == 1) + fave = i; + return true; + } + else if (strcmp(name, "cios") == 0) { + if (sscanf(value, "%d", &i) == 1) + cios = i; + return true; + } + else if (strcmp(name, "keyset") == 0) { + if (sscanf(value, "%d", &i) == 1) + keyset = i; + return true; + } + else if (strcmp(name, "xflip") == 0) { + if (sscanf(value, "%d", &i) == 1) + xflip = i; + return true; + } + else if (strcmp(name, "gridRows") == 0) { + if (sscanf(value, "%d", &i) == 1) + gridRows = i; + return true; + } + else if (strcmp(name, "qboot") == 0) { + if (sscanf(value, "%d", &i) == 1) + qboot = i; + return true; + } + else if (strcmp(name, "partition") == 0) { + if (sscanf(value, "%d", &i) == 1) + partition = i; + return true; + } + else if (strcmp(name, "wsprompt") == 0) { + if (sscanf(value, "%d", &i) == 1) + wsprompt = i; + return true; + } + else if (strcmp(name, "gameDisplay") == 0) { + if (sscanf(value, "%d", &i) == 1) + gameDisplay = i; + return true; + } + else if (strcmp(name, "parentalcontrol") == 0) { + if (sscanf(value, "%d", &i) == 1) + parentalcontrol = i; + return true; + } + else if (strcmp(name, "screensaver") == 0) { + if (sscanf(value, "%d", &i) == 1) + screensaver = i; + return true; + } + else if (strcmp(name, "titlesOverride") == 0) { + if (sscanf(value, "%d", &i) == 1) + titlesOverride = i; + return true; + } + else if (strcmp(name, "musicloopmode") == 0) { + if (sscanf(value, "%d", &i) == 1) + musicloopmode = i; + return true; + } + else if (strcmp(name, "gamesound") == 0) { + if (sscanf(value, "%d", &i) == 1) + gamesound = i; + return true; + } + else if (strcmp(name, "wiilight") == 0) { + if (sscanf(value, "%d", &i) == 1) + wiilight = i; + return true; + } + else if (strcmp(name, "marknewtitles") == 0) { + if (sscanf(value, "%d", &i) == 1) + marknewtitles = i; + return true; + } + else if (strcmp(name, "patchcountrystrings") == 0) { + if (sscanf(value, "%d", &i) == 1) + patchcountrystrings = i; + return true; + } + else if (strcmp(name, "fullcopy") == 0) { + if (sscanf(value, "%d", &i) == 1) + fullcopy = i; + return true; + } + else if (strcmp(name, "discart") == 0) { + if (sscanf(value, "%d", &i) == 1) + discart = i; + return true; + } + else if (strcmp(name, "error002") == 0) { + if (sscanf(value, "%d", &i) == 1) + error002 = i; + return true; + } + else if (strcmp(name, "autonetwork") == 0) { + if (sscanf(value, "%d", &i) == 1) + autonetwork = i; + return true; + } + else if (strcmp(name, "FatInstallToDir") == 0) { + if (sscanf(value, "%d", &i) == 1) + FatInstallToDir = i; + return true; + } + else if (strcmp(name, "widescreen") == 0) { + if (sscanf(value, "%d", &i) == 1) + widescreen = i; + return true; + } + else if (strcmp(name, "beta_upgrades") == 0) { + if (sscanf(value, "%d", &i) == 1) + beta_upgrades = i; + return true; + } + else if (strcmp(name, "partitions_to_install") == 0) { + if (sscanf(value, "%d", &i) == 1) + partitions_to_install = i; + return true; + } + else if (strcmp(name, "covers_path") == 0) { + strcpy(covers_path, value); + return true; + } + else if (strcmp(name, "covers2d_path") == 0) { + strcpy(covers2d_path, value); + return true; + } + else if (strcmp(name, "theme_path") == 0) { + strcpy(theme_path, value); + return true; + } + else if (strcmp(name, "disc_path") == 0) { + strcpy(disc_path, value); + return true; + } + else if (strcmp(name, "language_path") == 0) { + strcpy(language_path, value); + return true; + } + else if (strcmp(name, "languagefiles_path") == 0) { + strcpy(languagefiles_path, value); + return true; + } + else if (strcmp(name, "TxtCheatcodespath") == 0) { + strcpy(TxtCheatcodespath, value); + return true; + } + else if (strcmp(name, "titlestxt_path") == 0) { + strcpy(titlestxt_path, value); + return true; + } + else if (strcmp(name, "dolpath") == 0) { + strcpy(dolpath, value); + return true; + } + else if (strcmp(name, "ogg_path") == 0) { + strcpy(ogg_path, value); + return true; + } + else if (strcmp(name, "update_path") == 0) { + strcpy(update_path, value); + return true; + } + else if (strcmp(name, "theme_downloadpath") == 0) { + strcpy(theme_downloadpath, value); + return true; + } + else if (strcmp(name, "homebrewapps_path") == 0) { + strcpy(homebrewapps_path, value); + return true; + } + else if (strcmp(name, "Cheatcodespath") == 0) { + strcpy(Cheatcodespath, value); + return true; + } + else if (strcmp(name, "BcaCodepath") == 0) { + strcpy(BcaCodepath, value); + return true; + } + else if (strcmp(name, "WipCodepath") == 0) { + strcpy(WipCodepath, value); + return true; + } + else if (strcmp(name, "returnTo") == 0) { + strcpy(returnTo, value); + return true; + } + + return false; +} + +void CSettings::ParseLine(char *line) +{ + char temp[1024], name[1024], value[1024]; + + strncpy(temp, line, sizeof(temp)); + + char * eq = strchr(temp, '='); + + if(!eq) return; + + *eq = 0; + + this->TrimLine(name, temp, sizeof(name)); + this->TrimLine(value, eq+1, sizeof(value)); + + this->SetSetting(name, value); +} + +void CSettings::TrimLine(char *dest, char *src, int size) +{ + int len; + while (*src == ' ') src++; + len = strlen(src); + while (len > 0 && strchr(" \r\n", src[len-1])) len--; + if (len >= size) len = size-1; + strncpy(dest, src, len); + dest[len] = 0; +} + +static inline const char * GetLangCode( int langid ) +{ + switch ( langid ) + { + case CONF_LANG_JAPANESE: + return "JA"; + case CONF_LANG_ENGLISH: + return "EN"; + case CONF_LANG_GERMAN: + return "DE"; + case CONF_LANG_FRENCH: + return "FR"; + case CONF_LANG_SPANISH: + return "ES"; + case CONF_LANG_ITALIAN: + return "IT"; + case CONF_LANG_DUTCH: + return "NL"; + case CONF_LANG_SIMP_CHINESE: + return "ZHCN"; + case CONF_LANG_TRAD_CHINESE: + return "ZHTW"; + case CONF_LANG_KOREAN: + return "KO"; + default: + return "EN"; + } +} + +bool CSettings::LoadLanguage(const char *path, int language) +{ + bool ret = false; + + if(language >= 0 || !path) + { + if(language < 0) + return false; + + char filepath[150]; + char langpath[150]; + snprintf(langpath, sizeof(langpath), "%s", language_path); + if(langpath[strlen(langpath)-1] != '/') + { + char * ptr = strrchr(langpath, '/'); + if(ptr) + { + ptr++; + ptr[0] = '\0'; + } + } + + if(language == APP_DEFAULT) + { + strcpy(language_path, langpath); + gettextCleanUp(); + return true; + } + else if(language == CONSOLE_DEFAULT) + { + return LoadLanguage(NULL, CONF_GetLanguage()+2); + } + else if(language == JAPANESE) + { + snprintf(filepath, sizeof(filepath), "%s/japanese.lang", langpath); + } + else if(language == ENGLISH) + { + snprintf(filepath, sizeof(filepath), "%s/english.lang", langpath); + } + else if(language == GERMAN) + { + snprintf(filepath, sizeof(filepath), "%s/german.lang", langpath); + } + else if(language == FRENCH) + { + snprintf(filepath, sizeof(filepath), "%s/french.lang", langpath); + } + else if(language == SPANISH) + { + snprintf(filepath, sizeof(filepath), "%s/spanish.lang", langpath); + } + else if(language == ITALIAN) + { + snprintf(filepath, sizeof(filepath), "%s/italian.lang", langpath); + } + else if(language == DUTCH) + { + snprintf(filepath, sizeof(filepath), "%s/dutch.lang", langpath); + } + else if(language == S_CHINESE) + { + snprintf(filepath, sizeof(filepath), "%s/s_chinese.lang", langpath); + } + else if(language == T_CHINESE) + { + snprintf(filepath, sizeof(filepath), "%s/t_chinese.lang", langpath); + } + else if(language == KOREAN) + { + snprintf(filepath, sizeof(filepath), "%s%s/korean.lang", BootDevice, langpath); + } + + ret = gettextLoadLanguage(filepath); + if(ret) + strncpy(language_path, filepath, sizeof(language_path)); + + strcpy(db_language, GetLangCode(language)); + } + else if(strlen(path) < 3) + { + return LoadLanguage(NULL, CONF_GetLanguage()+2); + } + else + { + ret = gettextLoadLanguage(path); + if(ret) + strncpy(language_path, path, sizeof(language_path)); + } + + return ret; +} diff --git a/source/settings/CSettings.h b/source/settings/CSettings.h new file mode 100644 index 00000000..f6816ff6 --- /dev/null +++ b/source/settings/CSettings.h @@ -0,0 +1,150 @@ + /**************************************************************************** + * Copyright (C) 2010 + * by Dimok + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you use + * this software in a product, an acknowledgment in the product + * documentation would be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + ***************************************************************************/ +#ifndef _CSETTINGS_H_ +#define _CSETTINGS_H_ + +#include +#include +#include +#include "cfg.h" + +enum { + APP_DEFAULT = 0, + CONSOLE_DEFAULT, + JAPANESE, + ENGLISH, + GERMAN, + FRENCH, + SPANISH, + ITALIAN, + DUTCH, + S_CHINESE, + T_CHINESE, + KOREAN, + MAX_LANGUAGE +}; + +class CSettings +{ + public: + //!Constructor + CSettings(); + //!Destructor + ~CSettings(); + //!Set Default Settings + void SetDefault(); + //!Load Settings + bool Load(); + //!Save Settings + bool Save(); + //!Reset Settings + bool Reset(); + //!Load a languagefile + //!\param language + bool LoadLanguage(const char *path, int language = -1); + + /** Variables **/ + char BootDevice[10]; + char ConfigPath[80]; + short videomode; + short language; + short ocarina; + short videopatch; + short sinfo; + short hddinfo; + short rumble; + short xflip; + int volume; + int sfxvolume; + int gamesoundvolume; + short tooltips; + char unlockCode[20]; + short parentalcontrol; + short cios; + short quickboot; + short wsprompt; + short keyset; + short sort; + short fave; + short wiilight; + short gameDisplay; + short patchcountrystrings; + short screensaver; + short partition; + short musicloopmode; + short widescreen; + short godmode; + char covers_path[100]; + char covers2d_path[100]; + char theme_path[100]; + char theme_downloadpath[100]; + char disc_path[100]; + char titlestxt_path[100]; + char language_path[100]; + char languagefiles_path[100]; + char ogg_path[250]; + char dolpath[150]; + char update_path[150]; + char homebrewapps_path[150]; + char selected_homebrew[200]; + char Cheatcodespath[100]; + char TxtCheatcodespath[100]; + char BcaCodepath[100]; + char WipCodepath[100]; + short error002; + short titlesOverride; // db_titles + char db_url[200]; + char db_language[20]; + short db_JPtoEN; + short gridRows; + short autonetwork; + short discart; + short gamesound; + short marknewtitles; + short FatInstallToDir; + short partitions_to_install; + short fullcopy; + short beta_upgrades; + char returnTo[20]; + struct + { + u8 enabled; + u8 rating; + u8 pin[4]; + u8 question; + wchar_t answer[32]; // IS WCHAR! + } Parental; + protected: + bool SetSetting(char *name, char *value); + //!Find the config file in the default paths + bool FindConfig(); + + void ParseLine(char *line); + void TrimLine(char *dest, char *src, int size); + FILE * file; +}; + +extern CSettings Settings; + +#endif diff --git a/source/settings/Settings.cpp b/source/settings/Settings.cpp index 14997609..ade47bb0 100644 --- a/source/settings/Settings.cpp +++ b/source/settings/Settings.cpp @@ -48,9 +48,8 @@ static const char *opts_no_yes[settings_off_on_max] = {trNOOP( "No" ), trNOOP( " static const char *opts_off_on[settings_off_on_max] = {trNOOP( "OFF" ), trNOOP( "ON" ) }; static const char *opts_videomode[settings_language_max][2] = {{"", trNOOP( "Disc Default" )}, {trNOOP( "System Default" ), ""}, {trNOOP( "AutoPatch" ), ""}, {trNOOP( "Force" ), " PAL50"}, {trNOOP( "Force" ), " PAL60"}, {trNOOP( "Force" ), " NTSC"}}; static const char *opts_language[settings_language_max] = {trNOOP( "Console Default" ), trNOOP( "Japanese" ), trNOOP( "English" ), trNOOP( "German" ), trNOOP( "French" ), trNOOP( "Spanish" ), trNOOP( "Italian" ), trNOOP( "Dutch" ), trNOOP( "SChinese" ), trNOOP( "TChinese" ), trNOOP( "Korean" )}; -static const char *opts_cios[settings_ios_max] = {"IOS 249", "IOS 222", "IOS 223", "IOS 250"}; static const char *opts_parentalcontrol[5] = {trNOOP( "0 (Everyone)" ), trNOOP( "1 (Child 7+)" ), trNOOP( "2 (Teen 12+)" ), trNOOP( "3 (Mature 16+)" ), trNOOP( "4 (Adults Only 18+)" )}; -static const char *opts_error002[settings_error002_max] = {trNOOP( "No" ), trNOOP( "Yes" ), trNOOP( "Anti" )}; +static const char *opts_error002[3] = {trNOOP( "No" ), trNOOP( "Yes" ), trNOOP( "Anti" )}; static const char *opts_partitions[settings_partitions_max] = {trNOOP( "Game partition" ), trNOOP( "All partitions" ), trNOOP( "Remove update" )}; static const char *opts_installdir[settings_installdir_max] = {trNOOP( "None" ), trNOOP( "GAMEID_Gamename" ), trNOOP( "Gamename [GAMEID]" )}; @@ -102,30 +101,30 @@ int MenuSettings() char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%ssettings_background.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssettings_background.png", Settings.theme_path ); GuiImageData settingsbg( imgPath, settings_background_png ); - snprintf( imgPath, sizeof( imgPath ), "%ssettings_title.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssettings_title.png", Settings.theme_path ); GuiImageData MainButtonImgData( imgPath, settings_title_png ); - snprintf( imgPath, sizeof( imgPath ), "%ssettings_title_over.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssettings_title_over.png", Settings.theme_path ); GuiImageData MainButtonImgOverData( imgPath, settings_title_over_png ); - snprintf( imgPath, sizeof( imgPath ), "%spageindicator.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%spageindicator.png", Settings.theme_path ); GuiImageData PageindicatorImgData( imgPath, pageindicator_png ); - snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_left.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_left.png", Settings.theme_path ); GuiImageData arrow_left( imgPath, startgame_arrow_left_png ); - snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_right.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_right.png", Settings.theme_path ); GuiImageData arrow_right( imgPath, startgame_arrow_right_png ); - snprintf( imgPath, sizeof( imgPath ), "%scredits_button.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%scredits_button.png", Settings.theme_path ); GuiImageData creditsImgData( imgPath, credits_button_png ); - snprintf( imgPath, sizeof( imgPath ), "%scredits_button_over.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%scredits_button_over.png", Settings.theme_path ); GuiImageData creditsOver( imgPath, credits_button_over_png ); GuiImage creditsImg( &creditsImgData ); @@ -157,8 +156,8 @@ int MenuSettings() GuiImage backBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - backBtnTxt.SetWidescreen( CFG.widescreen ); - backBtnImg.SetWidescreen( CFG.widescreen ); + backBtnTxt.SetWidescreen( Settings.widescreen ); + backBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton backBtn( &backBtnImg, &backBtnImg, 2, 3, -180, 400, &trigA, &btnSoundOver, btnClick2, 1 ); backBtn.SetLabel( &backBtnTxt ); @@ -291,7 +290,7 @@ int MenuSettings() MainButton4.SetTrigger( &trigA ); customOptionList options2( MAXOPTIONS ); - GuiCustomOptionBrowser optionBrowser2( 396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, 0, 150 ); + GuiCustomOptionBrowser optionBrowser2( 396, 280, &options2, Settings.theme_path, "bg_options_settings.png", bg_options_settings_png, 0, 150 ); optionBrowser2.SetPosition( 0, 90 ); optionBrowser2.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); @@ -688,7 +687,7 @@ int MenuSettings() else if ( homo.GetState() == STATE_CLICKED ) { - cfg_save_global(); + Settings.Save(); optionBrowser2.SetState( STATE_DISABLED ); bgMusic->Pause(); choice = WindowExitPrompt(); @@ -941,7 +940,7 @@ int MenuSettings() else if ( homo.GetState() == STATE_CLICKED ) { - cfg_save_global(); + Settings.Save(); optionBrowser2.SetState( STATE_DISABLED ); bgMusic->Pause(); choice = WindowExitPrompt(); @@ -964,17 +963,17 @@ int MenuSettings() if ( ret == ++Idx || firstRun ) { if ( firstRun ) options2.SetName( Idx, "%s", tr( "Video Mode" ) ); - if ( ret == Idx && ++Settings.video >= settings_video_max ) - Settings.video = 0; - options2.SetValue( Idx, "%s%s", opts_videomode[Settings.video][0], tr( opts_videomode[Settings.video][1] ) ); + if ( ret == Idx && ++Settings.videomode >= settings_video_max ) + Settings.videomode = 0; + options2.SetValue( Idx, "%s%s", opts_videomode[Settings.videomode][0], tr( opts_videomode[Settings.videomode][1] ) ); } if ( ret == ++Idx || firstRun ) { if ( firstRun ) options2.SetName( Idx, "%s", tr( "VIDTV Patch" ) ); - if ( ret == Idx && ++Settings.vpatch >= settings_off_on_max ) - Settings.vpatch = 0; - options2.SetValue( Idx, "%s", tr( opts_off_on[Settings.vpatch] ) ); + if ( ret == Idx && ++Settings.videopatch >= settings_off_on_max ) + Settings.videopatch = 0; + options2.SetValue( Idx, "%s", tr( opts_off_on[Settings.videopatch] ) ); } if ( ret == ++Idx || firstRun ) @@ -1006,17 +1005,34 @@ int MenuSettings() if ( firstRun ) options2.SetName( Idx, "%s", tr( "Boot/Standard" ) ); if ( ret == Idx && Settings.godmode == 1 ) { - if ( ++Settings.cios >= settings_cios_max ) + switch(Settings.cios) { - Settings.cios = 0; + case 222: + Settings.cios = 223; + break; + case 223: + Settings.cios = 224; + break; + case 224: + Settings.cios = 249; + break; + case 249: + Settings.cios = 250; + break; + case 250: + Settings.cios = 222; + break; + default: + Settings.cios = 222; + break; } - if ( ( Settings.cios == 1 && titles.VersionOf( 0x1000000deULL ) != 4 ) || ( Settings.cios == 2 && titles.VersionOf( 0x1000000dfULL ) != 4 ) ) + if ( ( Settings.cios == 222 && titles.VersionOf( 0x1000000deULL ) != 4 ) || ( Settings.cios == 2 && titles.VersionOf( 0x1000000dfULL ) != 4 ) ) { WindowPrompt( tr( "Hermes CIOS" ), tr( "USB Loader GX will only run with Hermes CIOS rev 4! Please make sure you have revision 4 installed!" ), tr( "OK" ) ); } } if ( Settings.godmode == 1 ) - options2.SetValue( Idx, "%s", opts_cios[Settings.cios] ); + options2.SetValue( Idx, "IOS %i", Settings.cios ); else options2.SetValue( Idx, "********" ); } @@ -1054,15 +1070,15 @@ int MenuSettings() if ( ret == ++Idx || firstRun ) { if ( firstRun ) options2.SetName( Idx, "%s", tr( "Quick Boot" ) ); - if ( ret == Idx && ++Settings.qboot >= settings_off_on_max ) - Settings.qboot = 0; - options2.SetValue( Idx, "%s", tr( opts_no_yes[Settings.qboot] ) ); + if ( ret == Idx && ++Settings.quickboot >= settings_off_on_max ) + Settings.quickboot = 0; + options2.SetValue( Idx, "%s", tr( opts_no_yes[Settings.quickboot] ) ); } if ( ret == ++Idx || firstRun ) { if ( firstRun ) options2.SetName( Idx, "%s", tr( "Error 002 fix" ) ); - if ( ret == Idx && ++Settings.error002 >= settings_error002_max ) + if ( ret == Idx && ++Settings.error002 >= 3 ) Settings.error002 = 0; options2.SetValue( Idx, "%s", tr( opts_error002[Settings.error002] ) ); } @@ -1166,7 +1182,7 @@ int MenuSettings() else if ( homo.GetState() == STATE_CLICKED ) { - cfg_save_global(); + Settings.Save(); optionBrowser2.SetState( STATE_DISABLED ); bgMusic->Pause(); choice = WindowExitPrompt(); @@ -1192,7 +1208,7 @@ int MenuSettings() if ( firstRun ) options2.SetName( Idx, "%s", tr( "Console" ) ); if ( ret == Idx ) { - if ( !strcmp( "", Settings.unlockCode ) && Settings.parental.enabled == 0 ) + if ( !strcmp( "", Settings.unlockCode ) && Settings.Parental.enabled == 0 ) { Settings.godmode = !Settings.godmode; } @@ -1204,12 +1220,12 @@ int MenuSettings() //password check to unlock Install,Delete and Format w.Remove( &optionBrowser2 ); w.Remove( &backBtn ); - int result = Settings.parental.enabled == 0 ? OnScreenKeyboard( entered, 20, 0 ) : OnScreenNumpad( entered, 5 ); + int result = Settings.Parental.enabled == 0 ? OnScreenKeyboard( entered, 20, 0 ) : OnScreenNumpad( entered, 5 ); w.Append( &optionBrowser2 ); w.Append( &backBtn ); if ( result == 1 ) { - if ( !strcmp( entered, Settings.unlockCode ) || !memcmp( entered, Settings.parental.pin, 4 ) ) //if password correct + if ( !strcmp( entered, Settings.unlockCode ) || !memcmp( entered, Settings.Parental.pin, 4 ) ) //if password correct { if ( Settings.godmode == 0 ) { @@ -1338,7 +1354,7 @@ int MenuSettings() else if ( homo.GetState() == STATE_CLICKED ) { - cfg_save_global(); + Settings.Save(); optionBrowser2.SetState( STATE_DISABLED ); bgMusic->Pause(); choice = WindowExitPrompt(); @@ -1558,7 +1574,7 @@ int MenuSettings() else if ( homo.GetState() == STATE_CLICKED ) { - cfg_save_global(); + Settings.Save(); optionBrowser2.SetState( STATE_DISABLED ); bgMusic->Pause(); choice = WindowExitPrompt(); @@ -1673,7 +1689,7 @@ int MenuSettings() w.Remove( &backBtn ); char entered[100] = ""; titleTxt.SetText( tr( "Theme Path" ) ); - strlcpy( entered, CFG.theme_path, sizeof( entered ) ); + strlcpy( entered, Settings.theme_path, sizeof( entered ) ); int result = BrowseDevice( entered, sizeof( entered ), FB_DEFAULT, noFILES ); HaltGui(); w.RemoveAll(); @@ -1682,32 +1698,31 @@ int MenuSettings() int len = ( strlen( entered ) - 1 ); if ( entered[len] != '/' ) strncat ( entered, "/", 1 ); - strlcpy( CFG.theme_path, entered, sizeof( CFG.theme_path ) ); + strlcpy( Settings.theme_path, entered, sizeof( Settings.theme_path ) ); WindowPrompt( tr( "Theme Path Changed" ), 0, tr( "OK" ) ); if ( !isInserted( bootDevice ) ) WindowPrompt( tr( "No SD-Card inserted!" ), tr( "Insert an SD-Card to save." ), tr( "OK" ) ); else - cfg_save_global(); + Settings.Save(); mainWindow->Remove( bgImg ); HaltGui(); - CFG_Load(); - CFG_LoadGlobal(); + CFG_LoadTheme(Settings.widescreen, Settings.theme_path); ResumeGui(); menu = MENU_SETTINGS; - snprintf( imgPath, sizeof( imgPath ), "%splayer1_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%splayer1_point.png", Settings.theme_path ); pointer[0] = new GuiImageData( imgPath, player1_point_png ); - snprintf( imgPath, sizeof( imgPath ), "%splayer2_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%splayer2_point.png", Settings.theme_path ); pointer[1] = new GuiImageData( imgPath, player2_point_png ); - snprintf( imgPath, sizeof( imgPath ), "%splayer3_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%splayer3_point.png", Settings.theme_path ); pointer[2] = new GuiImageData( imgPath, player3_point_png ); - snprintf( imgPath, sizeof( imgPath ), "%splayer4_point.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%splayer4_point.png", Settings.theme_path ); pointer[3] = new GuiImageData( imgPath, player4_point_png ); - if ( CFG.widescreen ) - snprintf( imgPath, sizeof( imgPath ), "%swbackground.png", CFG.theme_path ); + if ( Settings.widescreen ) + snprintf( imgPath, sizeof( imgPath ), "%swbackground.png", Settings.theme_path ); else - snprintf( imgPath, sizeof( imgPath ), "%sbackground.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbackground.png", Settings.theme_path ); - background = new GuiImageData( imgPath, CFG.widescreen ? wbackground_png : background_png ); + background = new GuiImageData( imgPath, Settings.widescreen ? wbackground_png : background_png ); bgImg = new GuiImage( background ); mainWindow->Append( bgImg ); @@ -1720,7 +1735,7 @@ int MenuSettings() w.Append( &optionBrowser2 ); ResumeGui(); } - options2.SetValue( Idx, "%s", CFG.theme_path ); + options2.SetValue( Idx, "%s", Settings.theme_path ); } @@ -1747,9 +1762,9 @@ int MenuSettings() WindowPrompt( tr( "WiiTDB Path changed." ), 0, tr( "OK" ) ); if ( isInserted( bootDevice ) ) { - cfg_save_global(); + Settings.Save(); HaltGui(); - CFG_Load(); + Settings.Load(); ResumeGui(); } else @@ -2060,15 +2075,9 @@ int MenuSettings() int choice = WindowPrompt( tr( "Are you sure?" ), 0, tr( "Yes" ), tr( "Cancel" ) ); if ( choice == 1 ) { - if ( isInserted( bootDevice ) ) - { - char GXGlobal_cfg[26]; - sprintf( GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice ); - remove( GXGlobal_cfg ); - } gettextCleanUp(); HaltGui(); - CFG_Load(); + Settings.Reset(); ResumeGui(); menu = MENU_SETTINGS; pageToDisplay = 0; @@ -2113,7 +2122,7 @@ int MenuSettings() if ( MainButton1.GetState() == STATE_CLICKED ) { if ( isInserted( bootDevice ) ) - cfg_save_global(); + Settings.Save(); menu = MENU_THEMEDOWNLOADER; pageToDisplay = 0; break; @@ -2125,7 +2134,7 @@ int MenuSettings() { //Add the procedure call to save the global configuration if ( isInserted( bootDevice ) ) - cfg_save_global(); + Settings.Save(); menu = MENU_DISCLIST; pageToDisplay = 0; backBtn.ResetState(); @@ -2197,7 +2206,7 @@ int MenuSettings() } else if ( homo.GetState() == STATE_CLICKED ) { - cfg_save_global(); + Settings.Save(); optionBrowser2.SetState( STATE_DISABLED ); bgMusic->Pause(); choice = WindowExitPrompt(); @@ -2275,15 +2284,15 @@ int GameSettings( struct discHdr * header ) char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%ssettings_background.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssettings_background.png", Settings.theme_path ); GuiImageData settingsbg( imgPath, settings_background_png ); - snprintf( imgPath, sizeof( imgPath ), "%ssettings_title.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssettings_title.png", Settings.theme_path ); GuiImageData MainButtonImgData( imgPath, settings_title_png ); - snprintf( imgPath, sizeof( imgPath ), "%ssettings_title_over.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssettings_title_over.png", Settings.theme_path ); GuiImageData MainButtonImgOverData( imgPath, settings_title_over_png ); GuiTrigger trigA; @@ -2320,8 +2329,8 @@ int GameSettings( struct discHdr * header ) GuiImage backBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - backBtnTxt.SetWidescreen( CFG.widescreen ); - backBtnImg.SetWidescreen( CFG.widescreen ); + backBtnTxt.SetWidescreen( Settings.widescreen ); + backBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton backBtn( &backBtnImg, &backBtnImg, 2, 3, -180, 400, &trigA, &btnSoundOver, btnClick2, 1 ); backBtn.SetLabel( &backBtnTxt ); @@ -2335,8 +2344,8 @@ int GameSettings( struct discHdr * header ) GuiImage saveBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - saveBtnTxt.SetWidescreen( CFG.widescreen ); - saveBtnImg.SetWidescreen( CFG.widescreen ); + saveBtnTxt.SetWidescreen( Settings.widescreen ); + saveBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton saveBtn( &saveBtnImg, &saveBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, btnClick2, 1 ); saveBtn.SetLabel( &saveBtnTxt ); @@ -2407,7 +2416,7 @@ int GameSettings( struct discHdr * header ) MainButton4.SetTrigger( &trigA ); customOptionList options2( MAXOPTIONS ); - GuiCustomOptionBrowser optionBrowser2( 396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, 0, 150 ); + GuiCustomOptionBrowser optionBrowser2( 396, 280, &options2, Settings.theme_path, "bg_options_settings.png", bg_options_settings_png, 0, 150 ); optionBrowser2.SetPosition( 0, 90 ); optionBrowser2.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); @@ -2489,32 +2498,25 @@ int GameSettings( struct discHdr * header ) countrystrings = game_cfg->patchcountrystrings; alternatedol = game_cfg->loadalternatedol; alternatedoloffset = game_cfg->alternatedolstart; - reloadblock = game_cfg->iosreloadblock; - strlcpy( alternatedname, game_cfg->alternatedolname, sizeof( alternatedname ) ); - returnToLoaderGV = game_cfg->returnTo; + reloadblock = game_cfg->iosreloadblock; + strlcpy( alternatedname, game_cfg->alternatedolname, sizeof( alternatedname ) ); + returnToLoaderGV = game_cfg->returnTo; } else { - videoChoice = Settings.video; + videoChoice = Settings.videomode; languageChoice = Settings.language; ocarinaChoice = Settings.ocarina; - viChoice = Settings.vpatch; - if ( Settings.cios == ios222 ) - iosChoice = i222; - else if ( Settings.cios == ios250 ) - iosChoice = i250; - else if ( Settings.cios == ios223 ) - iosChoice = i223; - else - iosChoice = i249; + viChoice = Settings.videopatch; + iosChoice = Settings.cios; parentalcontrolChoice = 0; fix002 = Settings.error002; countrystrings = Settings.patchcountrystrings; alternatedol = off; alternatedoloffset = 0; reloadblock = off; - strcpy( alternatedname, "" ); - returnToLoaderGV = 1; + strcpy( alternatedname, "" ); + returnToLoaderGV = 1; } ResumeGui(); @@ -2587,7 +2589,7 @@ int GameSettings( struct discHdr * header ) else if ( homo.GetState() == STATE_CLICKED ) { - cfg_save_global(); + Settings.Save(); optionBrowser2.SetState( STATE_DISABLED ); bgMusic->Pause(); choice = WindowExitPrompt(); @@ -2671,9 +2673,31 @@ int GameSettings( struct discHdr * header ) if ( ret == ++Idx || firstRun ) { if ( firstRun ) options2.SetName( Idx, "IOS" ); - if ( ret == Idx && ++iosChoice >= settings_ios_max ) - iosChoice = 0; - options2.SetValue( Idx, "%s", opts_cios[iosChoice] ); + if ( ret == Idx ) + { + switch(iosChoice) + { + case 222: + iosChoice = 223; + break; + case 223: + iosChoice = 224; + break; + case 224: + iosChoice = 249; + break; + case 249: + iosChoice = 250; + break; + case 250: + iosChoice = 222; + break; + default: + iosChoice = 222; + break; + } + } + options2.SetValue( Idx, "IOS %i", iosChoice ); } if ( ret == ++Idx || firstRun ) @@ -2687,7 +2711,7 @@ int GameSettings( struct discHdr * header ) if ( ret == ++Idx || firstRun ) { if ( firstRun ) options2.SetName( Idx, "%s", tr( "Error 002 fix" ) ); - if ( ret == Idx && ++fix002 >= settings_error002_max ) + if ( ret == Idx && ++fix002 >= 3 ) fix002 = 0; options2.SetValue( Idx, "%s", tr( opts_error002[fix002] ) ); } @@ -2868,7 +2892,7 @@ int GameSettings( struct discHdr * header ) else if ( homo.GetState() == STATE_CLICKED ) { - cfg_save_global(); + Settings.Save(); optionBrowser2.SetState( STATE_DISABLED ); bgMusic->Pause(); choice = WindowExitPrompt(); @@ -3027,8 +3051,8 @@ int GameSettings( struct discHdr * header ) int choice1 = WindowPrompt( tr( "Are you sure?" ), 0, tr( "Yes" ), tr( "Cancel" ) ); if ( choice1 == 1 ) { - videoChoice = Settings.video; - viChoice = Settings.vpatch; + videoChoice = Settings.videomode; + viChoice = Settings.videopatch; languageChoice = Settings.language; ocarinaChoice = Settings.ocarina; fix002 = Settings.error002; @@ -3036,26 +3060,11 @@ int GameSettings( struct discHdr * header ) alternatedol = off; alternatedoloffset = 0; reloadblock = off; - if ( Settings.cios == ios222 ) - iosChoice = i222; - else if ( Settings.cios == ios250 ) - iosChoice = i250; - else if ( Settings.cios == ios223 ) - iosChoice = i223; - else - iosChoice = i249; - parentalcontrolChoice = 0; - strcpy( alternatedname, "" ); - returnToLoaderGV = 1; + iosChoice = Settings.cios; + parentalcontrolChoice = 0; + strcpy( alternatedname, "" ); + returnToLoaderGV = 1; CFG_forget_game_opt( header->id ); - /* commented because the database language now depends on the main language setting, this could be enabled again if there is a separate language setting for the database - // if default language is different than language from main settings, reload titles - int opt_langnew = 0; - opt_langnew = Settings.language; - if (Settings.titlesOverride==1 && opt_lang != opt_langnew) - OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, true, true, false); // open file, reload titles, do not keep in memory - // titles are refreshed in menu.cpp as soon as this function returns - */ } pageToDisplay = 1; @@ -3074,7 +3083,7 @@ int GameSettings( struct discHdr * header ) else if ( homo.GetState() == STATE_CLICKED ) { - cfg_save_global(); + Settings.Save(); optionBrowser2.SetState( STATE_DISABLED ); bgMusic->Pause(); choice = WindowExitPrompt(); diff --git a/source/settings/SettingsPrompts.cpp b/source/settings/SettingsPrompts.cpp index 72800bad..2ee89999 100644 --- a/source/settings/SettingsPrompts.cpp +++ b/source/settings/SettingsPrompts.cpp @@ -7,7 +7,7 @@ #include "prompts/ProgressWindow.h" #include "libwiigui/gui.h" #include "libwiigui/gui_customoptionbrowser.h" -#include "settings/cfg.h" +#include "settings/CSettings.h" #include "network/URL_List.h" #include "listfiles.h" #include "main.h" @@ -100,9 +100,9 @@ int MenuLanguageSelect() char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%ssettings_background.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssettings_background.png", Settings.theme_path ); GuiImageData settingsbg( imgPath, settings_background_png ); GuiTrigger trigA; @@ -143,8 +143,8 @@ int MenuLanguageSelect() GuiImage backBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - backBtnTxt.SetWidescreen( CFG.widescreen ); - backBtnImg.SetWidescreen( CFG.widescreen ); + backBtnTxt.SetWidescreen( Settings.widescreen ); + backBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton backBtn( btnOutline.GetWidth(), btnOutline.GetHeight() ); backBtn.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); @@ -162,8 +162,8 @@ int MenuLanguageSelect() GuiImage defaultBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - defaultBtnTxt.SetWidescreen( CFG.widescreen ); - defaultBtnImg.SetWidescreen( CFG.widescreen ); + defaultBtnTxt.SetWidescreen( Settings.widescreen ); + defaultBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton defaultBtn( btnOutline.GetWidth(), btnOutline.GetHeight() ); defaultBtn.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); @@ -180,8 +180,8 @@ int MenuLanguageSelect() GuiImage updateBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - updateBtnTxt.SetWidescreen( CFG.widescreen ); - updateBtnImg.SetWidescreen( CFG.widescreen ); + updateBtnTxt.SetWidescreen( Settings.widescreen ); + updateBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton updateBtn( btnOutline.GetWidth(), btnOutline.GetHeight() ); updateBtn.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); @@ -215,7 +215,7 @@ int MenuLanguageSelect() scrollon = 1; } - GuiCustomOptionBrowser optionBrowser4( 396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, scrollon, 10 ); + GuiCustomOptionBrowser optionBrowser4( 396, 280, &options2, Settings.theme_path, "bg_options_settings.png", bg_options_settings_png, scrollon, 10 ); optionBrowser4.SetPosition( 0, 90 ); optionBrowser4.SetAlignment( ALIGN_CENTRE, ALIGN_TOP ); @@ -254,11 +254,11 @@ int MenuLanguageSelect() choice = WindowPrompt( tr( "Loading standard language." ), 0, tr( "OK" ), tr( "Cancel" ) ); if ( choice == 1 ) { - sprintf( Settings.language_path, "notset" ); - cfg_save_global(); + strcpy( Settings.language_path, "" ); + Settings.Save(); gettextCleanUp(); HaltGui(); - CFG_Load(); + Settings.Load(); ResumeGui(); returnhere = 2; } @@ -346,7 +346,7 @@ int MenuLanguageSelect() WindowPrompt( tr( "Languagepath changed." ), 0, tr( "OK" ) ); if ( isInserted( bootDevice ) ) { - cfg_save_global(); + Settings.Save(); returnhere = 1; break; } @@ -372,7 +372,7 @@ int MenuLanguageSelect() if ( isInserted( bootDevice ) ) { snprintf( Settings.language_path, sizeof( Settings.language_path ), "%s%s", Settings.languagefiles_path, GetFileName( ret ) ); - cfg_save_global(); + Settings.Save(); if ( !checkfile( Settings.language_path ) ) { sprintf( Settings.language_path, tr( "not set" ) ); @@ -380,7 +380,7 @@ int MenuLanguageSelect() } gettextCleanUp(); HaltGui(); - CFG_Load(); + Settings.Load(); ResumeGui(); returnhere = 2; break; diff --git a/source/settings/cfg.c b/source/settings/cfg.c index 8f222366..6685a639 100644 --- a/source/settings/cfg.c +++ b/source/settings/cfg.c @@ -8,15 +8,11 @@ #include "language/gettext.h" #include "listfiles.h" -#include "xml/xml.h" /* XML - Lustar*/ #include "cfg.h" #define isspace2(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v') -struct SSettings Settings; +static bool WideScreen = false; -char bootDevice[10] = "SD:"; - -struct CFG CFG; struct THEME THEME; u8 ocarinaChoice = 0; u8 videoChoice = 0; @@ -191,42 +187,8 @@ void cfg_int( char *name, short *var, int count ) //static char bg_path[100]; -void CFG_Default( int widescreen ) // -1 = non forced Mode +void CFG_DefaultTheme() // -1 = non forced Mode { - if ( widescreen == -1 ) - CFG.widescreen = CONF_GetAspectRatio(); - else - CFG.widescreen = widescreen; - - if ( CFG.widescreen ) - { - snprintf( CFG.theme_path, sizeof( CFG.theme_path ), "%s/wtheme/", bootDevice ); - } - else - { - snprintf( CFG.theme_path, sizeof( CFG.theme_path ), "%s/theme/", bootDevice ); - } - - if ( widescreen == -1 ) - { - snprintf( Settings.covers_path, sizeof( Settings.covers_path ), "%s/images/", bootDevice ); //default image path - snprintf( Settings.covers2d_path, sizeof( Settings.covers2d_path ), "%s/images/2D/", bootDevice ); //default image path - snprintf( Settings.disc_path, sizeof( Settings.disc_path ), "%s/images/disc/", bootDevice ); - snprintf( Settings.titlestxt_path, sizeof( Settings.titlestxt_path ), "%s/config/", bootDevice );//default path for disc images - char * empty = ""; - snprintf( Settings.unlockCode, sizeof( Settings.unlockCode ), empty ); // default password - snprintf( Settings.language_path, sizeof( Settings.language_path ), "notset" ); - snprintf( Settings.languagefiles_path, sizeof( Settings.languagefiles_path ), "%s/config/language/", bootDevice ); - snprintf( Settings.update_path, sizeof( Settings.update_path ), "%s/apps/usbloader_gx/", bootDevice ); - snprintf( Settings.theme_downloadpath, sizeof( Settings.theme_downloadpath ), "%s/config/themes/", bootDevice ); - snprintf( Settings.homebrewapps_path, sizeof( Settings.homebrewapps_path ), "%s/apps/", bootDevice ); - snprintf( Settings.Cheatcodespath, sizeof( Settings.Cheatcodespath ), "%s/codes/", bootDevice ); - snprintf( Settings.TxtCheatcodespath, sizeof( Settings.TxtCheatcodespath ), "%s/txtcodes/", bootDevice ); - snprintf( Settings.BcaCodepath, sizeof( Settings.BcaCodepath ), "%s/bca/", bootDevice ); - snprintf( Settings.WipCodepath, sizeof( Settings.WipCodepath ), "%s/wip/", bootDevice ); - snprintf( Settings.dolpath, sizeof( Settings.dolpath ), "%s/", bootDevice ); - strcpy( Settings.ogg_path, "" ); - } //always set Theme defaults //all alignments are left top here THEME.gamelist_x = 200; @@ -289,128 +251,64 @@ void CFG_Default( int widescreen ) // -1 = non forced Mode THEME.pagesize = 9; - THEME.gamelist_favorite_x = CFG.widescreen ? 256 : 220; + THEME.gamelist_favorite_x = WideScreen ? 256 : 220; THEME.gamelist_favorite_y = 13; - THEME.gamelist_search_x = CFG.widescreen ? 288 : 260; + THEME.gamelist_search_x = WideScreen ? 288 : 260; THEME.gamelist_search_y = 13; - THEME.gamelist_abc_x = CFG.widescreen ? 320 : 300; + THEME.gamelist_abc_x = WideScreen ? 320 : 300; THEME.gamelist_abc_y = 13; - THEME.gamelist_count_x = CFG.widescreen ? 352 : 340; + THEME.gamelist_count_x = WideScreen ? 352 : 340; THEME.gamelist_count_y = 13; - THEME.gamelist_list_x = CFG.widescreen ? 384 : 380; + THEME.gamelist_list_x = WideScreen ? 384 : 380; THEME.gamelist_list_y = 13; - THEME.gamelist_grid_x = CFG.widescreen ? 416 : 420; + THEME.gamelist_grid_x = WideScreen ? 416 : 420; THEME.gamelist_grid_y = 13; - THEME.gamelist_carousel_x = CFG.widescreen ? 448 : 460; + THEME.gamelist_carousel_x = WideScreen ? 448 : 460; THEME.gamelist_carousel_y = 13; - THEME.gamelist_lock_x = CFG.widescreen ? 480 : 500; + THEME.gamelist_lock_x = WideScreen ? 480 : 500; THEME.gamelist_lock_y = 13; - THEME.gamelist_dvd_x = CFG.widescreen ? 512 : 540; + THEME.gamelist_dvd_x = WideScreen ? 512 : 540; THEME.gamelist_dvd_y = 13; - THEME.gamegrid_favorite_x = CFG.widescreen ? 192 : 160; + THEME.gamegrid_favorite_x = WideScreen ? 192 : 160; THEME.gamegrid_favorite_y = 13; - THEME.gamegrid_search_x = CFG.widescreen ? 224 : 200; + THEME.gamegrid_search_x = WideScreen ? 224 : 200; THEME.gamegrid_search_y = 13; - THEME.gamegrid_abc_x = CFG.widescreen ? 256 : 240; + THEME.gamegrid_abc_x = WideScreen ? 256 : 240; THEME.gamegrid_abc_y = 13; - THEME.gamegrid_count_x = CFG.widescreen ? 288 : 280; + THEME.gamegrid_count_x = WideScreen ? 288 : 280; THEME.gamegrid_count_y = 13; - THEME.gamegrid_list_x = CFG.widescreen ? 320 : 320; + THEME.gamegrid_list_x = WideScreen ? 320 : 320; THEME.gamegrid_list_y = 13; - THEME.gamegrid_grid_x = CFG.widescreen ? 352 : 360; + THEME.gamegrid_grid_x = WideScreen ? 352 : 360; THEME.gamegrid_grid_y = 13; - THEME.gamegrid_carousel_x = CFG.widescreen ? 384 : 400; + THEME.gamegrid_carousel_x = WideScreen ? 384 : 400; THEME.gamegrid_carousel_y = 13; - THEME.gamegrid_lock_x = CFG.widescreen ? 416 : 440; + THEME.gamegrid_lock_x = WideScreen ? 416 : 440; THEME.gamegrid_lock_y = 13; - THEME.gamegrid_dvd_x = CFG.widescreen ? 448 : 480; + THEME.gamegrid_dvd_x = WideScreen ? 448 : 480; THEME.gamegrid_dvd_y = 13; - THEME.gamecarousel_favorite_x = CFG.widescreen ? 192 : 160; + THEME.gamecarousel_favorite_x = WideScreen ? 192 : 160; THEME.gamecarousel_favorite_y = 13; - THEME.gamecarousel_search_x = CFG.widescreen ? 224 : 200; + THEME.gamecarousel_search_x = WideScreen ? 224 : 200; THEME.gamecarousel_search_y = 13; - THEME.gamecarousel_abc_x = CFG.widescreen ? 256 : 240; + THEME.gamecarousel_abc_x = WideScreen ? 256 : 240; THEME.gamecarousel_abc_y = 13; - THEME.gamecarousel_count_x = CFG.widescreen ? 288 : 280; + THEME.gamecarousel_count_x = WideScreen ? 288 : 280; THEME.gamecarousel_count_y = 13; - THEME.gamecarousel_list_x = CFG.widescreen ? 320 : 320; + THEME.gamecarousel_list_x = WideScreen ? 320 : 320; THEME.gamecarousel_list_y = 13; - THEME.gamecarousel_grid_x = CFG.widescreen ? 352 : 360; + THEME.gamecarousel_grid_x = WideScreen ? 352 : 360; THEME.gamecarousel_grid_y = 13; - THEME.gamecarousel_carousel_x = CFG.widescreen ? 384 : 400; + THEME.gamecarousel_carousel_x = WideScreen ? 384 : 400; THEME.gamecarousel_carousel_y = 13; - THEME.gamecarousel_lock_x = CFG.widescreen ? 416 : 440; + THEME.gamecarousel_lock_x = WideScreen ? 416 : 440; THEME.gamecarousel_lock_y = 13; - THEME.gamecarousel_dvd_x = CFG.widescreen ? 448 : 480; + THEME.gamecarousel_dvd_x = WideScreen ? 448 : 480; THEME.gamecarousel_dvd_y = 13; } -void Global_Default( void ) -{ - Settings.video = discdefault; - Settings.vpatch = off; - Settings.language = ConsoleLangDefault; - Settings.ocarina = off; - Settings.hddinfo = hr12; - Settings.sinfo = ( ( THEME.show_id ) ? GameID : Neither ); - Settings.rumble = RumbleOn; - if ( THEME.show_region ) - { - Settings.sinfo = ( ( Settings.sinfo == GameID ) ? Both : GameRegion ); - } - Settings.volume = 80; - Settings.sfxvolume = 80; - Settings.gamesoundvolume = 80; - Settings.tooltips = TooltipsOn; - char * empty = ""; - snprintf( Settings.unlockCode, sizeof( Settings.unlockCode ), empty ); - snprintf( Settings.returnTo, sizeof( Settings.returnTo ), empty ); -// Settings.godmode = 1; - Settings.gamesound = 1; - Settings.parentalcontrol = 0; - Settings.cios = ios249; - Settings.xflip = no; - Settings.qboot = no; - Settings.wiilight = 1; - Settings.autonetwork = 0; - Settings.discart = 0; - Settings.patchcountrystrings = 0; - Settings.gridRows = 3; - Settings.error002 = 2; - Settings.titlesOverride = 1; - snprintf( Settings.db_url, sizeof( Settings.db_url ), empty ); - snprintf( Settings.db_language, sizeof( Settings.db_language ), empty ); - Settings.db_JPtoEN = 0; - Settings.screensaver = 3; - Settings.musicloopmode = 1; - Settings.partition = -1; - Settings.marknewtitles = 1; - Settings.FatInstallToDir = 0; - Settings.partitions_to_install = install_game_only; - Settings.fullcopy = 0; - Settings.beta_upgrades = 0; - - memset( &Settings.parental, 0, sizeof( struct SParental ) ); - - char buf[0x4a]; - CONF_Init(); - s32 res = CONF_Get( "IPL.PC", buf, 0x4A ); - if ( res > 0 ) - { - if ( buf[2] != 0x14 ) - { - Settings.parental.enabled = 1; - Settings.parental.rating = buf[2]; - } - Settings.parental.question = buf[7]; - memcpy( Settings.parental.pin, buf + 3, 4 ); - memcpy( Settings.parental.answer, buf + 8, 32 ); - } - Settings.godmode = ( Settings.parental.enabled == 0 ) ? 1 : 0; -} - char *cfg_get_title( u8 *id ) { @@ -547,119 +445,6 @@ char* trimcopy( char *dest, char *src, int size ) return dest; } -void widescreen_set( char *name, char *val ) -{ - cfg_name = name; - cfg_val = val; - - short widescreen; - if ( cfg_bool( "widescreen", &widescreen ) && CFG.widescreen != widescreen ) - CFG_Default( widescreen ); //reset default when forced an other Screenmode -} - - - -void path_set( char *name, char *val ) -{ - cfg_name = name; - cfg_val = val; - - // if these are defined in txt file, use them. otherwise use defaults - - if ( !CFG.widescreen && ( strcmp( name, "theme_path" ) == 0 ) ) // if in 4:3 - { - strlcpy( CFG.theme_path, val, sizeof( CFG.theme_path ) ); - return; - } - - if ( CFG.widescreen && strcmp( name, "wtheme_path" ) == 0 ) // if in 16:9 - { - strlcpy( CFG.theme_path, val, sizeof( CFG.theme_path ) ); - return; - } - - if ( strcmp( name, "cover_path" ) == 0 ) - { - strlcpy( Settings.covers_path, val, sizeof( Settings.covers_path ) ); - return; - } - - if ( strcmp( name, "cover2d_path" ) == 0 ) - { - strlcpy( Settings.covers2d_path, val, sizeof( Settings.covers2d_path ) ); - return; - } - - if ( strcmp( name, "disc_path" ) == 0 ) - { - strlcpy( Settings.disc_path, val, sizeof( Settings.disc_path ) ); - return; - } - if ( strcmp( name, "titlestxt_path" ) == 0 ) - { - strlcpy( Settings.titlestxt_path, val, sizeof( Settings.titlestxt_path ) ); - return; - } - if ( strcmp( name, "language_path" ) == 0 ) - { - strlcpy( Settings.language_path, val, sizeof( Settings.language_path ) ); - return; - } - if ( strcmp( name, "languagefiles_path" ) == 0 ) - { - strlcpy( Settings.languagefiles_path, val, sizeof( Settings.languagefiles_path ) ); - return; - } - if ( strcmp( name, "update_path" ) == 0 ) - { - strlcpy( Settings.update_path, val, sizeof( Settings.update_path ) ); - return; - } - if ( strcmp( name, "theme_downloadpath" ) == 0 ) - { - strlcpy( Settings.theme_downloadpath, val, sizeof( Settings.theme_downloadpath ) ); - return; - } - if ( strcmp( name, "homebrewapps_path" ) == 0 ) - { - strlcpy( Settings.homebrewapps_path, val, sizeof( Settings.homebrewapps_path ) ); - return; - } - if ( strcmp( name, "Cheatcodespath" ) == 0 ) - { - strlcpy( Settings.Cheatcodespath, val, sizeof( Settings.Cheatcodespath ) ); - return; - } - if ( strcmp( name, "TxtCheatcodespath" ) == 0 ) - { - strlcpy( Settings.TxtCheatcodespath, val, sizeof( Settings.TxtCheatcodespath ) ); - return; - } - if ( strcmp( name, "dolpath" ) == 0 ) - { - strlcpy( Settings.dolpath, val, sizeof( Settings.dolpath ) ); - return; - } - if ( strcmp( name, "ogg_path" ) == 0 ) - { - strlcpy( Settings.ogg_path, val, sizeof( Settings.ogg_path ) ); - return; - } - if ( strcmp( name, "BcaCodepath" ) == 0 ) - { - strlcpy( Settings.BcaCodepath, val, sizeof( Settings.BcaCodepath ) ); - return; - } - if ( strcmp( name, "WipCodepath" ) == 0 ) - { - strlcpy( Settings.WipCodepath, val, sizeof( Settings.WipCodepath ) ); - return; - } - - return; - -} - static u32 wCOORDS_FLAGS[2] = {0, 0}; // space for 64 coords - this is enough, also for the future #define GET_wCOORD_FLAG(i) (wCOORDS_FLAGS[i/32] & (1UL << (i%32))) #define SET_wCOORD_FLAG(i) (wCOORDS_FLAGS[i/32] |= (1UL << (i%32))) @@ -675,7 +460,7 @@ static u32 wCOORDS_FLAGS[2] = {0, 0}; // space for 64 coords - this is enough, a THEME.name##_y = y; \ } \ } \ - else if (CFG.widescreen && \ + else if (WideScreen && \ strcmp(cfg_name, "w" #name "_coords") == 0) { \ short x,y; \ if (sscanf(val, "%hd,%hd", &x, &y) == 2) { \ @@ -695,7 +480,7 @@ static u32 wCOORDS_FLAGS[2] = {0, 0}; // space for 64 coords - this is enough, a THEME.name##_h = h; \ } \ } \ - else if (CFG.widescreen && \ + else if (WideScreen && \ strcmp(cfg_name, "w" #name "_coords") == 0) { \ short x,y,w,h; \ if (sscanf(val, "%hd,%hd,%hd,%hd", &x, &y, &w, &h) == 4) { \ @@ -741,7 +526,7 @@ static u32 wCOORDS_FLAGS[2] = {0, 0}; // space for 64 coords - this is enough, a static short WorkAroundIconSet = 0; static short WorkAroundBarOffset = 100; -void theme_set( char *name, char *val ) +void theme_set(char *name, char *val ) { cfg_name = name; cfg_val = val; @@ -835,16 +620,16 @@ void theme_set( char *name, char *val ) // the old Icons are aligned at center and the new at the left top corner. // we must add 320 and sub the half image width to get the correct position. x += 300; - // the old stuff is optimized for widescreen. - // if no widescreen, we must reposition the pos - if ( !CFG.widescreen ) x -= 20; + // the old stuff is optimized for WideScreen. + // if no WideScreen, we must reposition the pos + if ( !WideScreen ) x -= 20; // old themes have no search_coords // set the searchIcon to the Position of the favIcon THEME.gamelist_search_x = x; THEME.gamegrid_search_x = THEME.gamecarousel_search_x = x - WorkAroundBarOffset; THEME.gamelist_search_y = THEME.gamegrid_search_y = THEME.gamecarousel_search_y = y; // place the favIcon to the left side of the searchIcon - if ( !CFG.widescreen ) x -= CFG.widescreen ? 32 : 40; + if ( !WideScreen ) x -= WideScreen ? 32 : 40; THEME.gamelist_favorite_x = x; THEME.gamegrid_favorite_x = THEME.gamecarousel_favorite_x = x - WorkAroundBarOffset; THEME.gamelist_favorite_y = THEME.gamegrid_favorite_y = THEME.gamecarousel_favorite_y = y; @@ -859,9 +644,9 @@ void theme_set( char *name, char *val ) // the old Icons are aligned at center and the new at the left top corner. // we must add 320 and sub the half image width to get the correct position. x += 300; - // the old stuff is optimized for widescreen. - // if no widescreen, we must reposition the pos - if ( !CFG.widescreen ) x -= 12; + // the old stuff is optimized for WideScreen. + // if no WideScreen, we must reposition the pos + if ( !WideScreen ) x -= 12; THEME.gamelist_abc_x = x; THEME.gamegrid_abc_x = THEME.gamecarousel_abc_x = x - WorkAroundBarOffset; THEME.gamelist_abc_y = THEME.gamegrid_abc_y = THEME.gamecarousel_abc_y = y; @@ -876,9 +661,9 @@ void theme_set( char *name, char *val ) // the old Icons are aligned at center and the new at the left top corner. // we must add 320 and sub the half image width to get the correct position. x += 300; - // the old stuff is optimized for widescreen. - // if no widescreen, we must reposition the pos - if ( !CFG.widescreen ) x -= 4; + // the old stuff is optimized for WideScreen. + // if no WideScreen, we must reposition the pos + if ( !WideScreen ) x -= 4; THEME.gamelist_count_x = x; THEME.gamegrid_count_x = THEME.gamecarousel_count_x = x - WorkAroundBarOffset; THEME.gamelist_count_y = THEME.gamegrid_count_y = THEME.gamecarousel_count_y = y; @@ -893,9 +678,9 @@ void theme_set( char *name, char *val ) // the old Icons are aligned at center and the new at the left top corner. // we must add 320 and sub the half image width to get the correct position. x += 300; - // the old stuff is optimized for widescreen. - // if no widescreen, we must reposition the pos - if ( !CFG.widescreen ) x += 4; + // the old stuff is optimized for WideScreen. + // if no WideScreen, we must reposition the pos + if ( !WideScreen ) x += 4; THEME.gamelist_list_x = x; THEME.gamegrid_list_x = THEME.gamecarousel_list_x = x - WorkAroundBarOffset; THEME.gamelist_list_y = THEME.gamegrid_list_y = THEME.gamecarousel_list_y = y; @@ -910,9 +695,9 @@ void theme_set( char *name, char *val ) // the old Icons are aligned at center and the new at the left top corner. // we must add 320 and sub the half image width to get the correct position. x += 300; - // the old stuff is optimized for widescreen. - // if no widescreen, we must reposition the pos - if ( !CFG.widescreen ) x += 12; + // the old stuff is optimized for WideScreen. + // if no WideScreen, we must reposition the pos + if ( !WideScreen ) x += 12; THEME.gamelist_grid_x = x; THEME.gamegrid_grid_x = THEME.gamecarousel_grid_x = x - WorkAroundBarOffset; THEME.gamelist_grid_y = THEME.gamegrid_grid_y = THEME.gamecarousel_grid_y = y; @@ -927,9 +712,9 @@ void theme_set( char *name, char *val ) // the old Icons are aligned at center and the new at the left top corner. // we must add 320 and sub the half image width to get the correct position. x += 300; - // the old stuff is optimized for widescreen. - // if no widescreen, we must reposition the pos - if ( !CFG.widescreen ) x += 20; + // the old stuff is optimized for WideScreen. + // if no WideScreen, we must reposition the pos + if ( !WideScreen ) x += 20; THEME.gamelist_carousel_x = x; THEME.gamegrid_carousel_x = THEME.gamecarousel_carousel_x = x - WorkAroundBarOffset; THEME.gamelist_carousel_y = THEME.gamegrid_carousel_y = THEME.gamecarousel_carousel_y = y; @@ -937,12 +722,12 @@ void theme_set( char *name, char *val ) // old themes have no dvd_coords // place the dvdIcon to the right side of the carouselIcon - if ( !CFG.widescreen ) x += CFG.widescreen ? 32 : 40; + if ( !WideScreen ) x += WideScreen ? 32 : 40; THEME.gamelist_lock_x = x; THEME.gamegrid_lock_x = THEME.gamecarousel_lock_x = x - WorkAroundBarOffset; THEME.gamelist_lock_y = THEME.gamegrid_lock_y = THEME.gamecarousel_lock_y = y; - x += CFG.widescreen ? 32 : 40; + x += WideScreen ? 32 : 40; THEME.gamelist_dvd_x = x; THEME.gamegrid_dvd_x = THEME.gamecarousel_dvd_x = x - WorkAroundBarOffset; THEME.gamelist_dvd_y = THEME.gamegrid_dvd_y = THEME.gamecarousel_dvd_y = y; @@ -997,356 +782,6 @@ void theme_set( char *name, char *val ) } -void global_cfg_set( char *name, char *val ) -{ - cfg_name = name; - cfg_val = val; - - if ( strcmp( name, "video" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.video = i; - } - return; - } - else if ( strcmp( name, "vpatch" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.vpatch = i; - } - return; - } - - else if ( strcmp( name, "language" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.language = i; - } - return; - } - else if ( strcmp( name, "ocarina" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.ocarina = i; - } - return; - } - else if ( strcmp( name, "sort" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.sort = i; - } - return; - } - else if ( strcmp( name, "fave" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.fave = i; - } - return; - } - else if ( strcmp( name, "keyset" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.keyset = i; - } - return; - } - else if ( strcmp( name, "hddinfo" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.hddinfo = i; - } - return; - } - else if ( strcmp( name, "sinfo" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.sinfo = i; - } - return; - } - else if ( strcmp( name, "rumble" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.rumble = i; - } - return; - } - else if ( strcmp( name, "volume" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.volume = i; - } - return; - } - else if ( strcmp( name, "sfxvolume" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.sfxvolume = i; - } - return; - } - else if ( strcmp( name, "gamesoundvolume" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.gamesoundvolume = i; - } - return; - } - else if ( strcmp( name, "tooltips" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.tooltips = i; - } - return; - } - else if ( strcmp( name, "password" ) == 0 ) - { - strlcpy( Settings.unlockCode, val, sizeof( Settings.unlockCode ) ); - return; - } - else if ( strcmp( name, "returnTo" ) == 0 ) - { - strlcpy( Settings.returnTo, val, sizeof( Settings.returnTo ) ); - return; - } - else if ( strcmp( name, "parentalcontrol" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.parentalcontrol = i; - } - return; - } - else if ( strcmp( name, "cios" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.cios = i; - } - return; - } - else if ( strcmp( name, "gridRows" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.gridRows = i; - } - return; - } - else if ( strcmp( name, "xflip" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.xflip = i; - } - return; - } - else if ( strcmp( name, "qboot" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.qboot = i; - } - return; - } - else if ( strcmp( name, "wsprompt" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.wsprompt = i; - } - return; - } - else if ( strcmp( name, "wiilight" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.wiilight = i; - } - return; - } - else if ( strcmp( name, "autonetwork" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.autonetwork = i; - } - return; - } - else if ( strcmp( name, "discart" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.discart = i; - } - return; - } - else if ( strcmp( name, "patchcountrystrings" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.patchcountrystrings = i; - } - return; - } - else if ( strcmp( name, "error002" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.error002 = i; - } - return; - } - else if ( strcmp( name, "gamesound" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.gamesound = i; - } - return; - } - else if ( strcmp( name, "titlesOverride" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.titlesOverride = i; - } - return; - } - else if ( strcmp( name, "db_JPtoEN" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.db_JPtoEN = i; - } - return; - } - else if ( strcmp( name, "gameDisplay" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.gameDisplay = i; - } - return; - } - else if ( strcmp( name, "screensaver" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.screensaver = i; - } - return; - } - else if ( strcmp( name, "musicloopmode" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.musicloopmode = i; - } - return; - } - else if ( strcmp( name, "partition" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.partition = i; - } - return; - } - else if ( strcmp( name, "marknewtitles" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.marknewtitles = i; - } - return; - } - else if ( strcmp( name, "fatInstallToDir" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.FatInstallToDir = i; - } - } - else if ( strcmp( name, "partitions" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.partitions_to_install = i; - } - } - else if ( strcmp( name, "fullcopy" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.fullcopy = i; - } - } - else if ( strcmp( name, "beta_upgrades" ) == 0 ) - { - int i; - if ( sscanf( val, "%d", &i ) == 1 ) - { - Settings.beta_upgrades = i; - } - } - - cfg_bool( "godmode", &Settings.godmode ); - - return; -} // split line to part1 delimiter part2 bool trimsplit( char *line, char *part1, char *part2, char delim, int size ) @@ -1521,100 +956,6 @@ void cfg_set_game_num( struct Game_NUM *game, u8 *id ) game->count = playcount; } - -bool cfg_save_global() // save global settings -{ - char GXGlobal_cfg[26]; - sprintf( GXGlobal_cfg, "%s/config", bootDevice ); - struct stat st; - if ( stat( GXGlobal_cfg, &st ) != 0 ) - { - mkdir( GXGlobal_cfg, 0777 ); - } - FILE *f; - sprintf( GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice ); - f = fopen( GXGlobal_cfg, "w" ); - if ( !f ) - { - printf( "Error saving %s\n", GXGlobal_cfg ); - sleep( 1 ); - return false; - } - fprintf( f, "# USB Loader global settings file\n" ); - fprintf( f, "# Note: This file is automatically generated\n" ); - fclose( f ); - /* Closing and reopening because of a write issue we are having right now */ - f = fopen( GXGlobal_cfg, "w" ); - fprintf( f, "# USB Loader global settings file\n" ); - fprintf( f, "# Note: This file is automatically generated\n " ); - fprintf( f, "video = %d\n ", Settings.video ); - fprintf( f, "vpatch = %d\n ", Settings.vpatch ); - fprintf( f, "language = %d\n ", Settings.language ); - fprintf( f, "ocarina = %d\n ", Settings.ocarina ); - fprintf( f, "hddinfo = %d\n ", Settings.hddinfo ); - fprintf( f, "sinfo = %d\n ", Settings.sinfo ); - fprintf( f, "rumble = %d\n ", Settings.rumble ); - fprintf( f, "volume = %d\n ", Settings.volume ); - fprintf( f, "sfxvolume = %d\n ", Settings.sfxvolume ); - fprintf( f, "gamesoundvolume = %d\n ", Settings.gamesoundvolume ); - fprintf( f, "tooltips = %d\n ", Settings.tooltips ); - fprintf( f, "password = %s\n ", Settings.unlockCode ); - fprintf( f, "sort = %d\n ", Settings.sort ); - fprintf( f, "fave = %d\n ", Settings.fave ); - fprintf( f, "cios = %d\n ", Settings.cios ); - fprintf( f, "keyset = %d\n ", Settings.keyset ); - fprintf( f, "xflip = %d\n ", Settings.xflip ); - fprintf( f, "gridRows = %d\n ", Settings.gridRows ); - fprintf( f, "qboot = %d\n ", Settings.qboot ); - fprintf( f, "wsprompt = %d\n ", Settings.wsprompt ); - fprintf( f, "parentalcontrol = %d\n ", Settings.parentalcontrol ); - fprintf( f, "cover_path = %s\n ", Settings.covers_path ); - fprintf( f, "cover2d_path = %s\n ", Settings.covers2d_path ); - if ( CFG.widescreen ) - { - fprintf( f, "wtheme_path = %s\n ", CFG.theme_path ); - } - else - { - fprintf( f, "theme_path = %s\n ", CFG.theme_path ); - } - fprintf( f, "disc_path = %s\n ", Settings.disc_path ); - fprintf( f, "language_path = %s\n ", Settings.language_path ); - fprintf( f, "languagefiles_path = %s\n ", Settings.languagefiles_path ); - fprintf( f, "TxtCheatcodespath = %s\n ", Settings.TxtCheatcodespath ); - fprintf( f, "titlestxt_path = %s\n ", Settings.titlestxt_path ); - fprintf( f, "gamesound = %d\n ", Settings.gamesound ); - fprintf( f, "dolpath = %s\n ", Settings.dolpath ); - fprintf( f, "ogg_path = %s\n ", Settings.ogg_path ); - fprintf( f, "wiilight = %d\n ", Settings.wiilight ); - fprintf( f, "gameDisplay = %d\n ", Settings.gameDisplay ); - fprintf( f, "update_path = %s\n ", Settings.update_path ); - fprintf( f, "theme_downloadpath = %s\n ", Settings.theme_downloadpath ); - fprintf( f, "homebrewapps_path = %s\n ", Settings.homebrewapps_path ); - fprintf( f, "Cheatcodespath = %s\n ", Settings.Cheatcodespath ); - fprintf( f, "BcaCodepath = %s\n ", Settings.BcaCodepath ); - fprintf( f, "WipCodepath = %s\n ", Settings.WipCodepath ); - fprintf( f, "titlesOverride = %d\n ", Settings.titlesOverride ); - //fprintf(f, "db_url = %s\n ", Settings.db_url); - //fprintf(f, "db_JPtoEN = %d\n ", Settings.db_JPtoEN); - //fprintf(f, "db_language = %d\n ", Settings.language); - fprintf( f, "patchcountrystrings = %d\n ", Settings.patchcountrystrings ); - fprintf( f, "screensaver = %d\n ", Settings.screensaver ); - fprintf( f, "musicloopmode = %d\n ", Settings.musicloopmode ); - fprintf( f, "error002 = %d\n ", Settings.error002 ); - fprintf( f, "autonetwork = %d\n ", Settings.autonetwork ); - fprintf( f, "discart = %d\n ", Settings.discart ); - fprintf( f, "partition = %d\n ", Settings.partition ); - fprintf( f, "marknewtitles = %d\n ", Settings.marknewtitles ); - fprintf( f, "fatInstallToDir = %d\n ", Settings.FatInstallToDir ); - fprintf( f, "partitions = %d\n ", Settings.partitions_to_install ); - fprintf( f, "fullcopy = %d\n ", Settings.fullcopy ); - fprintf( f, "beta_upgrades = %d\n ", Settings.beta_upgrades ); - fprintf( f, "returnTo = %s\n ", Settings.returnTo ); - fclose( f ); - return true; -} - void game_set( char *name, char *val ) { // sample line: @@ -1973,42 +1314,6 @@ bool CFG_reset_all_playcounters() return true; } -#if 0 -bool cfg_load_global() -{ - char GXGlobal_cfg[26]; - sprintf( GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice ); - //Default values defined by dev team - Settings.video = discdefault; - Settings.vpatch = off; - Settings.language = ConsoleLangDefault; - Settings.ocarina = off; - Settings.xflip = off; - Settings.qboot = off; - Settings.wsprompt = off; - Settings.keyset = us; - Settings.hddinfo = hr12; - Settings.gameDisplay = list; - Settings.sinfo = ( ( THEME.show_id ) ? GameID : Neither ); - Settings.rumble = RumbleOn; - if ( THEME.show_region ) - { - Settings.sinfo = ( ( Settings.sinfo == GameID ) ? Both : GameRegion ); - } - Settings.volume = 80; - Settings.sfxvolume = 80; - Settings.gamesoundvolume = 80; - - Settings.titlesOverride = 1; - Settings.partition = -1; - char * empty = ""; - snprintf( Settings.db_url, sizeof( Settings.db_url ), empty ); - snprintf( Settings.db_language, sizeof( Settings.db_language ), empty ); - Settings.db_JPtoEN = 0; - return cfg_parsefile( GXGlobal_cfg, &global_cfg_set ); -} -#endif - struct Game_CFG* CFG_get_game_opt( const u8 *id ) { @@ -2084,100 +1389,24 @@ bool CFG_forget_game_num( u8 *id ) } -void CFG_Load( void ) +void CFG_LoadTheme( bool wide, const char * theme_path ) { -// GUI should be stopped at the time of calling CFG_Load() to prevent default settings from having any effect - char pathname[200]; -// bool ret = false; + WideScreen = wide; - //set app path -// chdir_app(argv[0]); - - CFG_Default( -1 ); // set defaults non forced - - snprintf( pathname, sizeof( pathname ), "%s/config/GXGlobal.cfg", bootDevice ); - - cfg_parsefile( pathname, &widescreen_set ); //first set widescreen - cfg_parsefile( pathname, &path_set ); //then set config and layout options + CFG_DefaultTheme(); // set defaults non forced WorkAroundIconSet = 0; WorkAroundBarOffset = 100; // set Workaroundstuff to defaults CLEAR_wCOORD_FLAGS; - snprintf( pathname, sizeof( pathname ), "%sGXtheme.cfg", CFG.theme_path ); + snprintf( pathname, sizeof( pathname ), "%sGXtheme.cfg", theme_path); cfg_parsefile( pathname, &theme_set ); //finally set theme information - // set GUI language, use Wii's language setting if language is set to default - int wiilang; - bool langisdefault = false; - wiilang = CONF_GetLanguage(); - if ( !strcmp( "notset", Settings.language_path ) ) - { - snprintf( Settings.language_path, sizeof( Settings.language_path ), "%s%s.lang", Settings.languagefiles_path, map_get_name( map_language, wiilang + 1 ) ); // + 1 because because CONF_LANG starts at 0 - if ( !checkfile( Settings.language_path ) ) - { - sprintf( Settings.language_path, "notset" ); - } - gettextLoadLanguage( Settings.language_path ); - langisdefault = true; - } - snprintf( pathname, sizeof( pathname ), Settings.language_path ); - gettextLoadLanguage( pathname ); - -// cfg_parsefile(pathname, &language_set); - snprintf( pathname, sizeof( pathname ), "%s/config/GXGameSettings.cfg", bootDevice ); cfg_parsefile( pathname, &parental_set ); // load per-game settings cfg_load_games(); cfg_load_game_num(); - - Global_Default(); //global default depends on theme information - CFG_LoadGlobal(); - - // use GUI language for the database (Settings.db_language is used for game info/titles and covers) - char * languagefile; - languagefile = strrchr( Settings.language_path, '/' ) + 1; - int mainlangid = -1; - int i; - if ( strcmp( "notset", Settings.language_path ) ) - { - for ( i = 0; map_language[i].name != NULL; i++ ) - { - if ( strstr( languagefile, map_language[i].name ) != NULL ) - { - mainlangid = i - 1; // - 1 because CONF_LANG starts at 0 - break; - } - } - } - else - { - mainlangid = wiilang; - } - GetLanguageToLangCode( &mainlangid, Settings.db_language ); - - // set language code for countries that don't have a language setting on the Wii - if ( !strcmp( Settings.db_language, "" ) ) - { - if ( strstr( languagefile, "portuguese" ) != NULL ) - strcpy( Settings.db_language, "PT" ); - } - if ( CONF_GetArea() == CONF_AREA_AUS ) - strcpy( Settings.db_language, "AU" ); - - // if GUI language is set to default Settings.language_path needs to remain "notset" (if the detected setting was kept detection wouldn't work next time) - if ( langisdefault ) - sprintf( Settings.language_path, "notset" ); - - Settings.godmode = ( Settings.parental.enabled == 0 && ( Settings.parentalcontrol == 0 || strlen( Settings.unlockCode ) == 0 ) ) ? 1 : 0; -} - -void CFG_LoadGlobal( void ) -{ - char GXGlobal_cfg[26]; - sprintf( GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice ); - cfg_parsefile( GXGlobal_cfg, &global_cfg_set ); } void CFG_Cleanup( void ) @@ -2197,45 +1426,3 @@ void CFG_Cleanup( void ) num_title = 0; } - -/* map language id (or Wii language settting if langid is set to -1) to language code. CONF_LANG_JAPANESE = 0, not 1 */ -void GetLanguageToLangCode( int *langid, char *langcode ) -{ - - if ( langid < 0 ) - *langid = CONF_GetLanguage(); - - switch ( *langid ) - { - case CONF_LANG_JAPANESE: - sprintf( langcode, "JA" ); - break; - case CONF_LANG_ENGLISH: - sprintf( langcode, "EN" ); - break; - case CONF_LANG_GERMAN: - sprintf( langcode, "DE" ); - break; - case CONF_LANG_FRENCH: - sprintf( langcode, "FR" ); - break; - case CONF_LANG_SPANISH: - sprintf( langcode, "ES" ); - break; - case CONF_LANG_ITALIAN: - sprintf( langcode, "IT" ); - break; - case CONF_LANG_DUTCH: - sprintf( langcode, "NL" ); - break; - case CONF_LANG_SIMP_CHINESE: - sprintf( langcode, "ZHCN" ); // People's Republic of China - break; - case CONF_LANG_TRAD_CHINESE: - sprintf( langcode, "ZHTW" ); // Taiwan - break; - case CONF_LANG_KOREAN: - sprintf( langcode, "KO" ); - break; - } -} diff --git a/source/settings/cfg.h b/source/settings/cfg.h index 1ac780e0..d0cd0c8d 100644 --- a/source/settings/cfg.h +++ b/source/settings/cfg.h @@ -43,14 +43,6 @@ extern "C" #define CFG_ALIGN_MIDDLE 5 extern char bootDevice[10]; -//extern char *cfg_path; - - struct CFG - { - short widescreen; - char theme_path[100]; - }; - struct THEME { @@ -190,7 +182,6 @@ extern "C" short gamecarousel_lock_y; }; - extern struct CFG CFG; extern struct THEME THEME; extern u8 ocarinaChoice; extern u16 playcnt; @@ -216,6 +207,20 @@ extern "C" extern char alternatedname[40]; extern u8 returnToLoaderGV; + enum { + ConsoleLangDefault = 0, + jap, + eng, + ger, + fren, + esp, + it, + dut, + schin, + tchin, + kor, + settings_language_max // always the last entry + }; struct Game_CFG { @@ -232,7 +237,7 @@ extern "C" u32 alternatedolstart; u8 patchcountrystrings; char alternatedolname[40]; - u8 returnTo; + u8 returnTo; }; struct Game_NUM { @@ -242,8 +247,8 @@ extern "C" }; - void CFG_Default( int widescreen ); // -1 = non forced mode - void CFG_Load( void ); + void CFG_DefaultTheme(); // -1 = non forced mode + void CFG_LoadTheme( bool widescreen, const char * theme_path ); struct Game_CFG* CFG_get_game_opt( const u8 *id ); struct Game_NUM* CFG_get_game_num( const u8 *id ); bool CFG_save_game_opt( u8 *id ); @@ -252,22 +257,6 @@ extern "C" bool CFG_forget_game_opt( u8 *id ); bool CFG_forget_game_num( u8 *id ); - - enum { - ConsoleLangDefault = 0, - jap, - eng, - ger, - fren, - esp, - it, - dut, - schin, - tchin, - kor, - settings_language_max // always the last entry - }; - enum { systemdefault = 0, discdefault, @@ -283,12 +272,6 @@ extern "C" on, settings_off_on_max // always the last entry }; - enum { - //off=0, - //on, - anti = 2, - settings_error002_max // always the last entry - }; enum { wiilight_off = 0, @@ -305,22 +288,6 @@ extern "C" settings_sinfo_max // always the last entry }; - enum { - i249 = 0, - i222, - i223, - i250, - settings_ios_max // always the last entry - }; - - enum { - ios249 = 0, - ios222, - ios223, - ios250, - settings_cios_max // always the last entry - }; - enum { hr12 = 0, hr24, @@ -393,86 +360,6 @@ extern "C" install_to_name_gameid, settings_installdir_max // always the last entry }; - struct SParental - { - u8 enabled; - u8 rating; - u8 pin[4]; - u8 question; - wchar_t answer[32]; // IS WCHAR! - }; - struct SSettings - { - u8 video; - u8 language; - u8 ocarina; - u8 vpatch; - int ios; - u8 sinfo; - u8 hddinfo; - u8 rumble; - u8 xflip; - int volume; - int sfxvolume; - int gamesoundvolume; - u8 tooltips; - char unlockCode[20]; - u8 parentalcontrol; - u8 cios; - u8 qboot; - u8 wsprompt; - u8 keyset; - u8 sort; - u8 fave; - u8 wiilight; - u8 gameDisplay; - u8 patchcountrystrings; - u8 screensaver; - u8 partition; - u8 musicloopmode; - short godmode; - char covers_path[100]; - char covers2d_path[100]; - char theme_path[100]; - char wtheme_path[100]; - char theme_downloadpath[100]; - char disc_path[100]; - char titlestxt_path[100]; - char language_path[100]; - char languagefiles_path[100]; - char ogg_path[250]; - char dolpath[150]; - char update_path[150]; - char homebrewapps_path[150]; - char selected_homebrew[200]; - char Cheatcodespath[100]; - char TxtCheatcodespath[100]; - char BcaCodepath[100]; - char WipCodepath[100]; - short error002; - u8 titlesOverride; // db_titles - char db_url[200]; - char db_language[20]; - u8 db_JPtoEN; - u8 gridRows; - u8 autonetwork; - u8 discart; - short gamesound; - u8 marknewtitles; - u8 FatInstallToDir; - u8 partitions_to_install; - u8 fullcopy; - u8 beta_upgrades; - struct SParental parental; - char returnTo[ 20 ]; - }; - extern struct SSettings Settings; - - void CFG_LoadGlobal( void ); - bool cfg_save_global( void ); - - void GetLanguageToLangCode( int *langid, char *langcode ); - bool OpenXMLDatabase( char* xmlfilepath, char* argdblang, bool argJPtoEN, bool openfile, bool loadtitles, bool freemem ); char *get_title( struct discHdr *header ); char *cfg_get_title( u8 *id ) ; diff --git a/source/settings/newtitles.cpp b/source/settings/newtitles.cpp index bbeba941..ea0226db 100644 --- a/source/settings/newtitles.cpp +++ b/source/settings/newtitles.cpp @@ -1,7 +1,7 @@ #include #include -#include "cfg.h" +#include "CSettings.h" #include "newtitles.h" #define NEW_SECONDS 24 * 60 * 60 diff --git a/source/sys.cpp b/source/sys.cpp index 4177ef76..75246eaf 100644 --- a/source/sys.cpp +++ b/source/sys.cpp @@ -350,28 +350,28 @@ int LoadAppCIOS() USBDevice_deInit();// unmount USB for reloading IOS USBStorage2_Deinit(); - if ( Settings.cios == ios222 && IOS_GetVersion() != 222 ) + if ( Settings.cios == 222 && IOS_GetVersion() != 222 ) { printf( "\n\tReloading IOS to config setting (222)..." ); ret = IOS_ReloadIOSsafe( 222 ); printf( "%d", ret ); if ( ret < 0 ) { - Settings.cios = ios249; - IOS_ReloadIOSsafe( 249 ); + Settings.cios = 249; + IOS_ReloadIOSsafe( Settings.cios ); } } - if ( ( Settings.cios == ios249 && IOS_GetVersion() != 249 ) - || ( Settings.cios == ios250 && IOS_GetVersion() != 250 ) ) + if ( ( Settings.cios == 249 && IOS_GetVersion() != 249 ) + || ( Settings.cios == 250 && IOS_GetVersion() != 250 ) ) { - printf( "\n\tReloading IOS to config setting (%d)...", ( Settings.cios == ios249 ) ? 249 : 250 ); - ret = IOS_ReloadIOSsafe( ( Settings.cios == ios249 ) ? 249 : 250 ); + printf( "\n\tReloading IOS to config setting (%d)...", ( Settings.cios == 249 ) ? 249 : 250 ); + ret = IOS_ReloadIOSsafe( ( Settings.cios == 249 ) ? 249 : 250 ); printf( "%d", ret ); if ( ret < 0 ) { - Settings.cios = ios222; - ret = IOS_ReloadIOSsafe( 222 ); + Settings.cios = 222; + ret = IOS_ReloadIOSsafe( Settings.cios ); } } diff --git a/source/themes/Theme_Downloader.cpp b/source/themes/Theme_Downloader.cpp index d1f179f9..e26feea1 100644 --- a/source/themes/Theme_Downloader.cpp +++ b/source/themes/Theme_Downloader.cpp @@ -121,7 +121,7 @@ int DownloadTheme( const char *url, const char *title ) if ( choice ) { char real_themepath[1024]; - sprintf( real_themepath, "%s", CFG.theme_path ); + sprintf( real_themepath, "%s", Settings.theme_path ); if ( SearchFile( path, "GXtheme.cfg", real_themepath ) == true ) { char *ptr = strrchr( real_themepath, '/' ); @@ -130,10 +130,9 @@ int DownloadTheme( const char *url, const char *title ) ptr++; ptr[0] = '\0'; } - snprintf( CFG.theme_path, sizeof( CFG.theme_path ), "%s", real_themepath ); - cfg_save_global(); - CFG_Load(); - CFG_LoadGlobal(); + snprintf( Settings.theme_path, sizeof( Settings.theme_path ), "%s", real_themepath ); + Settings.Save(); + Settings.Load(); result = 2; } else @@ -159,9 +158,9 @@ static int Theme_Prompt( const char *title, const char *author, GuiImageData *th // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%stheme_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%stheme_dialogue_box.png", Settings.theme_path ); GuiImageData dialogBox( imgPath, theme_dialogue_box_png ); GuiImage dialogBoxImg( &dialogBox ); @@ -198,8 +197,8 @@ static int Theme_Prompt( const char *title, const char *author, GuiImageData *th GuiImage downloadBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - downloadBtnTxt.SetWidescreen( CFG.widescreen ); - downloadBtnImg.SetWidescreen( CFG.widescreen ); + downloadBtnTxt.SetWidescreen( Settings.widescreen ); + downloadBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton downloadBtn( &downloadBtnImg, &downloadBtnImg, ALIGN_RIGHT, ALIGN_TOP, -5, 170, &trigA, &btnSoundOver, btnClick2, 1 ); downloadBtn.SetLabel( &downloadBtnTxt ); @@ -210,8 +209,8 @@ static int Theme_Prompt( const char *title, const char *author, GuiImageData *th GuiImage backBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - backBtnTxt.SetWidescreen( CFG.widescreen ); - backBtnImg.SetWidescreen( CFG.widescreen ); + backBtnTxt.SetWidescreen( Settings.widescreen ); + backBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton backBtn( &backBtnImg, &backBtnImg, ALIGN_RIGHT, ALIGN_TOP, -5, 220, &trigA, &btnSoundOver, btnClick2, 1 ); backBtn.SetLabel( &backBtnTxt ); @@ -303,25 +302,25 @@ int Theme_Downloader() /*** Image Variables ***/ char imgPath[150]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%stheme_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%stheme_box.png", Settings.theme_path ); GuiImageData theme_box_Data( imgPath, theme_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%ssettings_background.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%ssettings_background.png", Settings.theme_path ); GuiImageData bgData( imgPath, settings_background_png ); - snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_left.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_left.png", Settings.theme_path ); GuiImageData arrow_left( imgPath, startgame_arrow_left_png ); - snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_right.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sstartgame_arrow_right.png", Settings.theme_path ); GuiImageData arrow_right( imgPath, startgame_arrow_right_png ); - snprintf( imgPath, sizeof( imgPath ), "%sWifi_btn.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sWifi_btn.png", Settings.theme_path ); GuiImageData wifiImgData( imgPath, Wifi_btn_png ); - snprintf( imgPath, sizeof( imgPath ), "%spageindicator.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%spageindicator.png", Settings.theme_path ); GuiImageData PageindicatorImgData( imgPath, pageindicator_png ); GuiImage background( &bgData ); @@ -382,8 +381,8 @@ int Theme_Downloader() GuiImage backBtnImg( &btnOutline ); if ( Settings.wsprompt == yes ) { - backBtnTxt.SetWidescreen( CFG.widescreen ); - backBtnImg.SetWidescreen( CFG.widescreen ); + backBtnTxt.SetWidescreen( Settings.widescreen ); + backBtnImg.SetWidescreen( Settings.widescreen ); } GuiButton backBtn( &backBtnImg, &backBtnImg, 2, 3, -180, 400, &trigA, &btnSoundOver, btnClick2, 1 ); backBtn.SetLabel( &backBtnTxt ); @@ -431,7 +430,7 @@ int Theme_Downloader() GuiImage wifiImg( &wifiImgData ); if ( Settings.wsprompt == yes ) { - wifiImg.SetWidescreen( CFG.widescreen ); + wifiImg.SetWidescreen( Settings.widescreen ); } GuiButton wifiBtn( wifiImg.GetWidth(), wifiImg.GetHeight() ); wifiBtn.SetImage( &wifiImg ); diff --git a/source/usbloader/GameList.cpp b/source/usbloader/GameList.cpp index 6a91c17c..f86fcba6 100644 --- a/source/usbloader/GameList.cpp +++ b/source/usbloader/GameList.cpp @@ -26,7 +26,7 @@ #include #include "usbloader/wbfs.h" #include "settings/newtitles.h" -#include "settings/cfg.h" +#include "settings/CSettings.h" #include "xml/xml.h" #include "FreeTypeGX.h" #include "GameList.h" @@ -140,12 +140,12 @@ int GameList::FilterList( const wchar_t * gameFilter ) continue; /* Other parental control method */ - if ( Settings.parentalcontrol == 0 && Settings.godmode == 0 && Settings.parental.enabled == 1 ) + if ( Settings.parentalcontrol == 0 && Settings.godmode == 0 && Settings.Parental.enabled == 1 ) { // Check game rating in WiiTDB, since the default Wii parental control setting is enabled s32 rating = GetRatingForGame( ( char * ) header->id ); - if ( ( rating != -1 && rating > Settings.parental.rating ) || - ( rating == -1 && get_pegi_block( header ) > Settings.parental.rating ) ) + if ( ( rating != -1 && rating > Settings.Parental.rating ) || + ( rating == -1 && get_pegi_block( header ) > Settings.Parental.rating ) ) { continue; } diff --git a/source/usbloader/apploader.c b/source/usbloader/apploader.c index a06626c1..ac4a6ea4 100644 --- a/source/usbloader/apploader.c +++ b/source/usbloader/apploader.c @@ -34,7 +34,7 @@ static u8 *appldr = ( u8 * )0x81200000; /* Variables */ static u32 buffer[0x20] ATTRIBUTE_ALIGN( 32 ); -void gamepatches( void * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch, u8 cheat ) +void gamepatches( u8 * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch, u8 cheat ) { VideoModePatcher( dst, len, videoSelected ); @@ -59,7 +59,7 @@ void gamepatches( void * dst, int len, u8 videoSelected, u8 patchcountrystring, Anti_002_fix( dst, len ); } -s32 Apploader_Run( entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset, u32 returnTo ) +s32 Apploader_Run( entry_point *entry, char * dolpath, u8 cheat, u8 videoSelected, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset, u32 returnTo ) { app_entry appldr_entry; app_init appldr_init; @@ -143,7 +143,7 @@ s32 Apploader_Run( entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u void *dolbuffer = NULL; int dollen = 0; - bool dolloaded = Load_Dol( &dolbuffer, &dollen, Settings.dolpath, videoSelected, patchcountrystring, vipatch, cheat ); + bool dolloaded = Load_Dol( &dolbuffer, &dollen, dolpath, videoSelected, patchcountrystring, vipatch, cheat ); if ( dolloaded ) { *entry = ( entry_point ) load_dol_image( dolbuffer ); diff --git a/source/usbloader/apploader.h b/source/usbloader/apploader.h index b8d266d1..8f6e4711 100644 --- a/source/usbloader/apploader.h +++ b/source/usbloader/apploader.h @@ -10,8 +10,8 @@ extern "C" typedef void ( *entry_point )( void ); /* Prototypes */ -s32 Apploader_Run( entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset, u32 returnTo ); -void gamepatches( void * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch, u8 cheat ); +s32 Apploader_Run( entry_point *entry, char * dolpath, u8 cheat, u8 videoSelected, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset, u32 returnTo ); +void gamepatches( u8 * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch, u8 cheat ); #ifdef __cplusplus } diff --git a/source/usbloader/disc.c b/source/usbloader/disc.c index 4bd0d386..5d974523 100644 --- a/source/usbloader/disc.c +++ b/source/usbloader/disc.c @@ -296,7 +296,7 @@ s32 Disc_IsWii( void ) return 0; } -s32 Disc_BootPartition( u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset, u32 returnTo ) +s32 Disc_BootPartition( u64 offset, char * dolpath, u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset, u32 returnTo ) { gprintf("booting partition IOS %u v%u\n", IOS_GetVersion(), IOS_GetRevision() ); entry_point p_entry; @@ -321,7 +321,7 @@ s32 Disc_BootPartition( u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 p PoPPatch(); /* Run apploader */ - ret = Apploader_Run( &p_entry, cheat, videoselected, vipatch, patchcountrystring, error002fix, alternatedol, alternatedoloffset, returnTo ); + ret = Apploader_Run( &p_entry, dolpath, cheat, videoselected, vipatch, patchcountrystring, error002fix, alternatedol, alternatedoloffset, returnTo ); if ( ret < 0 ) return ret; @@ -398,7 +398,7 @@ s32 Disc_BootPartition( u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 p return 0; } -s32 Disc_WiiBoot( u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset, u32 returnTo ) +s32 Disc_WiiBoot( char * dolpath, u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset, u32 returnTo ) { u64 offset; s32 ret; @@ -409,7 +409,7 @@ s32 Disc_WiiBoot( u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, return ret; /* Boot partition */ - return Disc_BootPartition( offset, videoselected, cheat, vipatch, patchcountrystring, error002fix, alternatedol, alternatedoloffset, returnTo ); + return Disc_BootPartition( offset, dolpath, videoselected, cheat, vipatch, patchcountrystring, error002fix, alternatedol, alternatedoloffset, returnTo ); } diff --git a/source/usbloader/disc.h b/source/usbloader/disc.h index 1adfcc32..9c964f58 100644 --- a/source/usbloader/disc.h +++ b/source/usbloader/disc.h @@ -50,8 +50,8 @@ extern "C" s32 Disc_SetUSB( const u8 * ); s32 Disc_ReadHeader( void * ); s32 Disc_IsWii( void ); - s32 Disc_BootPartition( u64, u8, u8, u8, u8, u8, u8, u32, u32 returnTo ); - s32 Disc_WiiBoot( u8, u8, u8, u8, u8, u8, u32, u32 returnTo ); + s32 Disc_BootPartition( u64, char *, u8, u8, u8, u8, u8, u8, u32, u32 returnTo ); + s32 Disc_WiiBoot( char *, u8, u8, u8, u8, u8, u8, u32, u32 returnTo ); s32 __Disc_FindPartition( u64 *outbuf ); void PatchCountryStrings( void *Address, int Size ); s32 __Disc_FindPartition( u64 *outbuf ); diff --git a/source/usbloader/wbfs/wbfs_fat.cpp b/source/usbloader/wbfs/wbfs_fat.cpp index a5cc4e0b..2e891d07 100644 --- a/source/usbloader/wbfs/wbfs_fat.cpp +++ b/source/usbloader/wbfs/wbfs_fat.cpp @@ -11,7 +11,7 @@ #include #include -#include "settings/cfg.h" +#include "settings/CSettings.h" #include "usbloader/disc.h" #include "fatmounter.h" #include "wbfs_fat.h" diff --git a/source/usbloader/wbfs/wbfs_wbfs.cpp b/source/usbloader/wbfs/wbfs_wbfs.cpp index 3b8b5613..b6c73734 100644 --- a/source/usbloader/wbfs/wbfs_wbfs.cpp +++ b/source/usbloader/wbfs/wbfs_wbfs.cpp @@ -1,6 +1,6 @@ #include "wbfs_wbfs.h" #include "prompts/ProgressWindow.h" -#include "settings/cfg.h" +#include "settings/CSettings.h" #include "wbfs_rw.h" extern u32 sector_size; diff --git a/source/wad/wad.cpp b/source/wad/wad.cpp index 6e562c15..69150965 100644 --- a/source/wad/wad.cpp +++ b/source/wad/wad.cpp @@ -133,9 +133,9 @@ s32 Wad_Install( FILE *fp ) // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", Settings.theme_path ); GuiImageData dialogBox( imgPath, dialogue_box_png ); GuiTrigger trigA; trigA.SetSimpleTrigger( -1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A ); @@ -143,38 +143,38 @@ s32 Wad_Install( FILE *fp ) GuiImage dialogBoxImg( &dialogBox ); if ( Settings.wsprompt == yes ) { - dialogBoxImg.SetWidescreen( CFG.widescreen ); + dialogBoxImg.SetWidescreen( Settings.widescreen ); } GuiText btn1Txt( tr( "OK" ), 22, THEME.prompttext ); GuiImage btn1Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn1Txt.SetWidescreen( CFG.widescreen ); - btn1Img.SetWidescreen( CFG.widescreen ); + btn1Txt.SetWidescreen( Settings.widescreen ); + btn1Img.SetWidescreen( Settings.widescreen ); } GuiButton btn1( &btn1Img, &btn1Img, 2, 4, 0, -35, &trigA, &btnSoundOver, btnClick2, 1 ); btn1.SetLabel( &btn1Txt ); btn1.SetState( STATE_SELECTED ); - snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_outline.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_outline.png", Settings.theme_path ); GuiImageData progressbarOutline( imgPath, progressbar_outline_png ); GuiImage progressbarOutlineImg( &progressbarOutline ); if ( Settings.wsprompt == yes ) { - progressbarOutlineImg.SetWidescreen( CFG.widescreen ); + progressbarOutlineImg.SetWidescreen( Settings.widescreen ); } progressbarOutlineImg.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); progressbarOutlineImg.SetPosition( 25, 50 ); - snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_empty.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sprogressbar_empty.png", Settings.theme_path ); GuiImageData progressbarEmpty( imgPath, progressbar_empty_png ); GuiImage progressbarEmptyImg( &progressbarEmpty ); progressbarEmptyImg.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); progressbarEmptyImg.SetPosition( 25, 50 ); progressbarEmptyImg.SetTile( 100 ); - snprintf( imgPath, sizeof( imgPath ), "%sprogressbar.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sprogressbar.png", Settings.theme_path ); GuiImageData progressbar( imgPath, progressbar_png ); GuiImage progressbarImg( &progressbar ); progressbarImg.SetAlignment( ALIGN_LEFT, ALIGN_MIDDLE ); @@ -213,7 +213,7 @@ s32 Wad_Install( FILE *fp ) prTxt.SetPosition( 0, 50 ); - if ( ( Settings.wsprompt == yes ) && ( CFG.widescreen ) ) /////////////adjust for widescreen + if ( ( Settings.wsprompt == yes ) && ( Settings.widescreen ) ) /////////////adjust for widescreen { progressbarOutlineImg.SetAlignment( ALIGN_CENTRE, ALIGN_MIDDLE ); progressbarOutlineImg.SetPosition( 0, 50 ); @@ -391,7 +391,7 @@ s32 Wad_Install( FILE *fp ) //msg4Txt.SetText(imgPath); prTxt.SetTextf( "%i%%", 100*( cnt*len + idx ) / ( tmd_data->num_contents*len ) ); - if ( ( Settings.wsprompt == yes ) && ( CFG.widescreen ) ) + if ( ( Settings.wsprompt == yes ) && ( Settings.widescreen ) ) { progressbarImg.SetTile( 78*( cnt*len + idx ) / ( tmd_data->num_contents*len ) ); } @@ -480,9 +480,9 @@ s32 Wad_Uninstall( FILE *fp ) // GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume); char imgPath[100]; - snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sbutton_dialogue_box.png", Settings.theme_path ); GuiImageData btnOutline( imgPath, button_dialogue_box_png ); - snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", CFG.theme_path ); + snprintf( imgPath, sizeof( imgPath ), "%sdialogue_box.png", Settings.theme_path ); GuiImageData dialogBox( imgPath, dialogue_box_png ); GuiTrigger trigA; trigA.SetSimpleTrigger( -1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A ); @@ -490,15 +490,15 @@ s32 Wad_Uninstall( FILE *fp ) GuiImage dialogBoxImg( &dialogBox ); if ( Settings.wsprompt == yes ) { - dialogBoxImg.SetWidescreen( CFG.widescreen ); + dialogBoxImg.SetWidescreen( Settings.widescreen ); } GuiText btn1Txt( tr( "OK" ), 22, THEME.prompttext ); GuiImage btn1Img( &btnOutline ); if ( Settings.wsprompt == yes ) { - btn1Txt.SetWidescreen( CFG.widescreen ); - btn1Img.SetWidescreen( CFG.widescreen ); + btn1Txt.SetWidescreen( Settings.widescreen ); + btn1Img.SetWidescreen( Settings.widescreen ); } GuiButton btn1( &btn1Img, &btn1Img, 2, 4, 0, -55, &trigA, &btnSoundOver, btnClick2, 1 ); btn1.SetLabel( &btn1Txt ); @@ -532,7 +532,7 @@ s32 Wad_Uninstall( FILE *fp ) - if ( ( Settings.wsprompt == yes ) && ( CFG.widescreen ) ) /////////////adjust for widescreen + if ( ( Settings.wsprompt == yes ) && ( Settings.widescreen ) ) /////////////adjust for widescreen { msg1Txt.SetPosition( 70, 95 ); diff --git a/source/xml/xml.c b/source/xml/xml.cpp similarity index 98% rename from source/xml/xml.c rename to source/xml/xml.cpp index 6d6b4836..7b4a94d6 100644 --- a/source/xml/xml.c +++ b/source/xml/xml.cpp @@ -6,16 +6,14 @@ Load game information from XML - Lustar #include #include "unzip/unzip.h" -#include "settings/cfg.h" +#include "settings/CSettings.h" #include "xml/xml.h" -//#include "cfg.h" -//#include "xml.h" -extern struct SSettings Settings; // for loader GX +extern "C" { extern void title_set( char *id, char *title ); extern char* trimcopy( char *dest, char *src, int size ); extern char game_partition[6]; - +} /* config */ static bool xmldebug = false; @@ -111,8 +109,8 @@ void CloseXMLDatabase() } -void GetTextFromNode( mxml_node_t *currentnode, mxml_node_t *topnode, char *nodename, - char *attributename, char *value, int descend, char *dest, int destsize ) +void GetTextFromNode( mxml_node_t *currentnode, mxml_node_t *topnode, const char *nodename, + const char *attributename, char *value, int descend, char *dest, int destsize ) { *element_text = 0; nodefound = mxmlFindElement( currentnode, topnode, nodename, attributename, value, descend ); @@ -180,7 +178,7 @@ bool OpenXMLFile( char *filename ) return false; } - char * zipfilebuffer = malloc( zipfilebuffersize ); + char * zipfilebuffer = (char *) malloc( zipfilebuffersize ); memset( zipfilebuffer, 0, zipfilebuffersize ); if ( zipfilebuffer == NULL ) { @@ -235,7 +233,7 @@ char *GetLangSettingFromGame( char *gameid ) /* convert language text into ISO 639 two-letter language code (+ZHTW/ZHCN) */ -char *ConvertLangTextToCode( char *languagetxt ) +const char *ConvertLangTextToCode( char *languagetxt ) { // do not convert if languagetext seems to be a language code (can be 2 or 4 letters) if ( strlen( languagetxt ) <= 4 ) @@ -268,7 +266,7 @@ char ConvertRatingToIndex( char *ratingtext ) return type; } -void ConvertRating( char *ratingvalue, char *fromrating, char *torating, char *destvalue, int destsize ) +void ConvertRating( char *ratingvalue, char *fromrating, const char *torating, char *destvalue, int destsize ) { if ( !strcmp( fromrating, torating ) ) { @@ -281,7 +279,7 @@ void ConvertRating( char *ratingvalue, char *fromrating, char *torating, char *d int desttype = -1; type = ConvertRatingToIndex( fromrating ); - desttype = ConvertRatingToIndex( torating ); + desttype = ConvertRatingToIndex( (char *) torating ); if ( type == -1 || desttype == -1 ) return; @@ -289,7 +287,7 @@ void ConvertRating( char *ratingvalue, char *fromrating, char *torating, char *d /* the list is ordered to pick the most likely value first: */ /* EC and AO are less likely to be used so they are moved down to only be picked up when converting ESRB to PEGI or CERO */ /* the conversion can never be perfect because ratings can differ between regions for the same game */ - char ratingtable[12][3][4] = + char ratingtable[12][3][5] = { {{"A"}, {"E"}, {"3"}}, {{"A"}, {"E"}, {"4"}}, diff --git a/source/xml/xml.h b/source/xml/xml.h index 1b2b3065..89428550 100644 --- a/source/xml/xml.h +++ b/source/xml/xml.h @@ -5,15 +5,10 @@ #include -#ifdef __cplusplus -extern "C" -{ -#endif - // open database, close database, load info for a game - bool OpenXMLDatabase( char* xmlfilepath, char* argdblang, bool argJPtoEN, bool openfile, bool loadtitles, bool keepopen ); - void CloseXMLDatabase(); - bool LoadGameInfoFromXML( char* gameid, char* langcode ); +bool OpenXMLDatabase( char* xmlfilepath, char* argdblang, bool argJPtoEN, bool openfile, bool loadtitles, bool keepopen ); +void CloseXMLDatabase(); +bool LoadGameInfoFromXML( char* gameid, char* langcode ); #define XML_ELEMMAX 15 #define XML_SYNOPSISLEN 4000 @@ -61,18 +56,14 @@ extern "C" bool OpenXMLFile( char* filename ); void LoadTitlesFromXML( char *langcode, bool forcejptoen ); void GetPublisherFromGameid( char *idtxt, char *dest, int destsize ); - char *ConvertLangTextToCode( char *langtext ); - void ConvertRating( char *ratingvalue, char *fromrating, char *torating, char *destvalue, int destsize ); + const char *ConvertLangTextToCode( char *langtext ); + void ConvertRating( char *ratingvalue, char *fromrating, const char *torating, char *destvalue, int destsize ); void PrintGameInfo( bool showfullinfo ); char *MemInfo(); - void GetTextFromNode( mxml_node_t *currentnode, mxml_node_t *topnode, char *nodename, - char *attributename, char *value, int descend, char *dest, int destsize ); + void GetTextFromNode( mxml_node_t *currentnode, mxml_node_t *topnode, const char *nodename, + const char *attributename, char *value, int descend, char *dest, int destsize ); int GetRatingForGame( char *gameid ); char * get_nodetext( mxml_node_t *node, char *buffer, int buflen ); -#ifdef __cplusplus -} -#endif - #endif