2009-10-01 01:10:58 +02:00
|
|
|
#include <gccore.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "language/gettext.h"
|
2010-12-18 14:20:45 +01:00
|
|
|
#include "language/UpdateLanguage.h"
|
2009-10-01 01:10:58 +02:00
|
|
|
#include "prompts/PromptWindows.h"
|
|
|
|
#include "prompts/ProgressWindow.h"
|
|
|
|
#include "libwiigui/gui.h"
|
|
|
|
#include "libwiigui/gui_customoptionbrowser.h"
|
2010-09-19 22:25:12 +02:00
|
|
|
#include "settings/CSettings.h"
|
2011-01-07 23:42:03 +01:00
|
|
|
#include "settings/GameTitles.h"
|
2010-09-24 19:58:56 +02:00
|
|
|
#include "themes/CTheme.h"
|
2009-10-01 01:10:58 +02:00
|
|
|
#include "network/URL_List.h"
|
2010-09-25 08:54:27 +02:00
|
|
|
#include "FileOperations/fileops.h"
|
|
|
|
#include "FileOperations/DirList.h"
|
2009-10-01 01:10:58 +02:00
|
|
|
#include "main.h"
|
2010-02-15 00:22:52 +01:00
|
|
|
#include "prompts/filebrowser.h"
|
2009-10-01 01:10:58 +02:00
|
|
|
#include "sys.h"
|
2010-02-15 00:22:52 +01:00
|
|
|
#include "menu/menus.h"
|
2010-01-19 11:48:50 +01:00
|
|
|
|
|
|
|
/*** Extern variables ***/
|
|
|
|
extern u8 shutdown;
|
|
|
|
extern u8 reset;
|
|
|
|
|
2009-10-01 01:10:58 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* MenuOGG
|
|
|
|
***************************************************************************/
|
2010-02-15 00:22:52 +01:00
|
|
|
bool MenuBackgroundMusic()
|
|
|
|
{
|
|
|
|
bool ret = false;
|
|
|
|
char entered[1024];
|
|
|
|
int result = -1;
|
2010-09-19 01:16:05 +02:00
|
|
|
snprintf( entered, sizeof( entered ), "%s", Settings.ogg_path );
|
2010-02-15 00:22:52 +01:00
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
if ( strcmp( entered, "" ) == 0 )
|
2010-02-15 00:22:52 +01:00
|
|
|
{
|
2010-10-27 16:45:27 +02:00
|
|
|
sprintf( entered, "%s", Settings.BootDevice );
|
2010-01-19 11:48:50 +01:00
|
|
|
}
|
2010-02-15 00:22:52 +01:00
|
|
|
else
|
|
|
|
{
|
2010-09-19 01:16:05 +02:00
|
|
|
char * pathptr = strrchr( entered, '/' );
|
|
|
|
if ( pathptr )
|
2010-02-15 00:22:52 +01:00
|
|
|
{
|
|
|
|
pathptr++;
|
2010-09-19 01:16:05 +02:00
|
|
|
int choice = WindowPrompt( tr( "Playing Music:" ), pathptr, tr( "Play Previous" ), tr( "Play Next" ), tr( "Change Play Path" ), tr( "Cancel" ) );
|
|
|
|
if ( choice == 1 )
|
2010-02-15 00:22:52 +01:00
|
|
|
{
|
|
|
|
return bgMusic->PlayPrevious();
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-09-19 01:16:05 +02:00
|
|
|
else if ( choice == 2 )
|
2010-02-15 00:22:52 +01:00
|
|
|
{
|
|
|
|
return bgMusic->PlayNext();
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-09-19 01:16:05 +02:00
|
|
|
else if ( choice == 3 )
|
2010-02-15 00:22:52 +01:00
|
|
|
{
|
|
|
|
pathptr[0] = 0;
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-02-15 00:22:52 +01:00
|
|
|
else
|
|
|
|
return true;
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-02-15 00:22:52 +01:00
|
|
|
else
|
2010-10-27 16:45:27 +02:00
|
|
|
sprintf( entered, "%s", Settings.BootDevice );
|
2010-02-15 00:22:52 +01:00
|
|
|
}
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
result = BrowseDevice( entered, sizeof( entered ), FB_DEFAULT );
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
if ( result )
|
2010-02-15 00:22:52 +01:00
|
|
|
{
|
2010-09-19 01:16:05 +02:00
|
|
|
if ( !bgMusic->Load( entered ) )
|
2010-02-15 00:22:52 +01:00
|
|
|
{
|
2010-09-19 01:16:05 +02:00
|
|
|
WindowPrompt( tr( "Not supported format!" ), tr( "Loading standard music." ), tr( "OK" ) );
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-02-15 00:22:52 +01:00
|
|
|
else
|
|
|
|
ret = true;
|
|
|
|
bgMusic->Play();
|
2010-09-19 01:16:05 +02:00
|
|
|
bgMusic->SetVolume( Settings.volume );
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
|
|
|
|
2010-02-15 00:22:52 +01:00
|
|
|
return ret;
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* MenuLanguageSelect
|
|
|
|
***************************************************************************/
|
2010-09-19 01:16:05 +02:00
|
|
|
int MenuLanguageSelect()
|
|
|
|
{
|
2009-10-01 01:10:58 +02:00
|
|
|
int cnt = 0;
|
|
|
|
int ret = 0, choice = 0;
|
|
|
|
int returnhere = 0;
|
2011-01-06 19:59:45 +01:00
|
|
|
char OldLangCode[10];
|
|
|
|
snprintf(OldLangCode, sizeof(OldLangCode), Settings.db_language);
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-09-26 10:33:43 +02:00
|
|
|
GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
|
|
|
|
GuiImageData settingsbg(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));
|
2009-10-01 01:10:58 +02:00
|
|
|
|
|
|
|
GuiTrigger trigA;
|
2010-09-19 01:16:05 +02:00
|
|
|
trigA.SetSimpleTrigger( -1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A );
|
2009-10-01 01:10:58 +02:00
|
|
|
GuiTrigger trigB;
|
2010-09-19 01:16:05 +02:00
|
|
|
trigB.SetButtonOnlyTrigger( -1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B );
|
2009-10-01 01:10:58 +02:00
|
|
|
|
|
|
|
char fullpath[100];
|
2010-12-18 14:20:45 +01:00
|
|
|
DirList Dir(Settings.languagefiles_path, ".lang");
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-11-07 21:31:45 +01:00
|
|
|
if ( !strcmp( "", Settings.language_path ) )
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-11-07 21:31:45 +01:00
|
|
|
sprintf( fullpath, "%s", tr( "Default" ) );
|
2010-09-19 01:16:05 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprintf( fullpath, "%s", Settings.languagefiles_path );
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
GuiText titleTxt( fullpath, 24, ( GXColor ) {0, 0, 0, 255} );
|
|
|
|
titleTxt.SetAlignment( ALIGN_CENTRE, ALIGN_MIDDLE );
|
|
|
|
titleTxt.SetPosition( 0, 0 );
|
|
|
|
GuiButton pathBtn( 300, 50 );
|
|
|
|
pathBtn.SetAlignment( ALIGN_CENTRE, ALIGN_TOP );
|
|
|
|
pathBtn.SetPosition( 0, 28 );
|
|
|
|
pathBtn.SetLabel( &titleTxt );
|
2010-11-13 23:34:53 +01:00
|
|
|
pathBtn.SetSoundOver( btnSoundOver );
|
|
|
|
pathBtn.SetSoundClick( btnSoundClick2 );
|
2010-09-19 01:16:05 +02:00
|
|
|
pathBtn.SetTrigger( &trigA );
|
2009-10-01 01:10:58 +02:00
|
|
|
pathBtn.SetEffectGrow();
|
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
GuiImage oggmenubackground( &settingsbg );
|
|
|
|
oggmenubackground.SetAlignment( ALIGN_LEFT, ALIGN_TOP );
|
|
|
|
oggmenubackground.SetPosition( 0, 0 );
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-12-26 18:02:14 +01:00
|
|
|
GuiText backBtnTxt( tr( "Back" ) , 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
|
2010-09-19 01:16:05 +02:00
|
|
|
backBtnTxt.SetMaxWidth( btnOutline.GetWidth() - 30 );
|
|
|
|
GuiImage backBtnImg( &btnOutline );
|
2010-10-27 16:45:27 +02:00
|
|
|
if ( Settings.wsprompt == ON )
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-09-19 22:25:12 +02:00
|
|
|
backBtnTxt.SetWidescreen( Settings.widescreen );
|
|
|
|
backBtnImg.SetWidescreen( Settings.widescreen );
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-09-19 01:16:05 +02:00
|
|
|
GuiButton backBtn( btnOutline.GetWidth(), btnOutline.GetHeight() );
|
|
|
|
backBtn.SetAlignment( ALIGN_CENTRE, ALIGN_TOP );
|
|
|
|
backBtn.SetPosition( -190, 400 );
|
|
|
|
backBtn.SetLabel( &backBtnTxt );
|
|
|
|
backBtn.SetImage( &backBtnImg );
|
2010-11-13 23:34:53 +01:00
|
|
|
backBtn.SetSoundOver( btnSoundOver );
|
|
|
|
backBtn.SetSoundClick( btnSoundClick2 );
|
2010-09-19 01:16:05 +02:00
|
|
|
backBtn.SetTrigger( &trigA );
|
|
|
|
backBtn.SetTrigger( &trigB );
|
2009-10-01 01:10:58 +02:00
|
|
|
backBtn.SetEffectGrow();
|
|
|
|
|
2010-12-26 18:02:14 +01:00
|
|
|
GuiText defaultBtnTxt( tr( "Default" ) , 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
|
2010-09-19 01:16:05 +02:00
|
|
|
defaultBtnTxt.SetMaxWidth( btnOutline.GetWidth() - 30 );
|
|
|
|
GuiImage defaultBtnImg( &btnOutline );
|
2010-10-27 16:45:27 +02:00
|
|
|
if ( Settings.wsprompt == ON )
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-09-19 22:25:12 +02:00
|
|
|
defaultBtnTxt.SetWidescreen( Settings.widescreen );
|
|
|
|
defaultBtnImg.SetWidescreen( Settings.widescreen );
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-09-19 01:16:05 +02:00
|
|
|
GuiButton defaultBtn( btnOutline.GetWidth(), btnOutline.GetHeight() );
|
|
|
|
defaultBtn.SetAlignment( ALIGN_CENTRE, ALIGN_TOP );
|
|
|
|
defaultBtn.SetPosition( 190, 400 );
|
|
|
|
defaultBtn.SetLabel( &defaultBtnTxt );
|
|
|
|
defaultBtn.SetImage( &defaultBtnImg );
|
2010-11-13 23:34:53 +01:00
|
|
|
defaultBtn.SetSoundOver( btnSoundOver );
|
|
|
|
defaultBtn.SetSoundClick( btnSoundClick2 );
|
2010-09-19 01:16:05 +02:00
|
|
|
defaultBtn.SetTrigger( &trigA );
|
2009-10-01 01:10:58 +02:00
|
|
|
defaultBtn.SetEffectGrow();
|
|
|
|
|
2010-12-26 18:02:14 +01:00
|
|
|
GuiText updateBtnTxt( tr( "Update Files" ) , 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
|
2010-09-19 01:16:05 +02:00
|
|
|
updateBtnTxt.SetMaxWidth( btnOutline.GetWidth() - 30 );
|
|
|
|
GuiImage updateBtnImg( &btnOutline );
|
2010-10-27 16:45:27 +02:00
|
|
|
if ( Settings.wsprompt == ON )
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-09-19 22:25:12 +02:00
|
|
|
updateBtnTxt.SetWidescreen( Settings.widescreen );
|
|
|
|
updateBtnImg.SetWidescreen( Settings.widescreen );
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-09-19 01:16:05 +02:00
|
|
|
GuiButton updateBtn( btnOutline.GetWidth(), btnOutline.GetHeight() );
|
|
|
|
updateBtn.SetAlignment( ALIGN_CENTRE, ALIGN_TOP );
|
|
|
|
updateBtn.SetPosition( 0, 400 );
|
|
|
|
updateBtn.SetLabel( &updateBtnTxt );
|
|
|
|
updateBtn.SetImage( &updateBtnImg );
|
2010-11-13 23:34:53 +01:00
|
|
|
updateBtn.SetSoundOver( btnSoundOver );
|
|
|
|
updateBtn.SetSoundClick( btnSoundClick2 );
|
2010-09-19 01:16:05 +02:00
|
|
|
updateBtn.SetTrigger( &trigA );
|
2009-10-01 01:10:58 +02:00
|
|
|
updateBtn.SetEffectGrow();
|
|
|
|
|
2010-10-31 10:30:53 +01:00
|
|
|
OptionList options2;
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-09-25 08:54:27 +02:00
|
|
|
for ( cnt = 0; cnt < Dir.GetFilecount(); cnt++ )
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2009-10-01 01:10:58 +02:00
|
|
|
char filename[64];
|
2010-09-25 08:54:27 +02:00
|
|
|
strlcpy( filename, Dir.GetFilename( cnt ), sizeof( filename ) );
|
2010-09-19 01:16:05 +02:00
|
|
|
char *dot = strchr( filename, '.' );
|
|
|
|
if ( dot ) *dot = '\0';
|
|
|
|
options2.SetName( cnt, "%s", filename );
|
|
|
|
options2.SetValue( cnt, NULL );
|
2009-10-01 01:10:58 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-11-14 16:19:42 +01:00
|
|
|
GuiCustomOptionBrowser optionBrowser4( 396, 280, &options2, "bg_options_settings.png");
|
2010-09-19 01:16:05 +02:00
|
|
|
optionBrowser4.SetPosition( 0, 90 );
|
|
|
|
optionBrowser4.SetAlignment( ALIGN_CENTRE, ALIGN_TOP );
|
2009-10-01 01:10:58 +02:00
|
|
|
|
|
|
|
HaltGui();
|
2010-09-19 01:16:05 +02:00
|
|
|
GuiWindow w( screenwidth, screenheight );
|
|
|
|
w.Append( &oggmenubackground );
|
|
|
|
w.Append( &pathBtn );
|
|
|
|
w.Append( &backBtn );
|
|
|
|
w.Append( &defaultBtn );
|
|
|
|
w.Append( &updateBtn );
|
|
|
|
w.Append( &optionBrowser4 );
|
|
|
|
mainWindow->Append( &w );
|
|
|
|
|
|
|
|
w.SetEffect( EFFECT_FADE, 20 );
|
2009-10-01 01:10:58 +02:00
|
|
|
ResumeGui();
|
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
while ( w.GetEffect() > 0 ) usleep( 50 );
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
while ( !returnhere )
|
|
|
|
{
|
2010-12-26 18:02:14 +01:00
|
|
|
usleep(100);
|
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
if ( shutdown == 1 )
|
2010-01-19 11:48:50 +01:00
|
|
|
Sys_Shutdown();
|
2010-09-19 01:16:05 +02:00
|
|
|
else if ( reset == 1 )
|
2010-01-19 11:48:50 +01:00
|
|
|
Sys_Reboot();
|
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
else if ( backBtn.GetState() == STATE_CLICKED )
|
|
|
|
{
|
2009-10-01 01:10:58 +02:00
|
|
|
backBtn.ResetState();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
else if ( defaultBtn.GetState() == STATE_CLICKED )
|
|
|
|
{
|
|
|
|
choice = WindowPrompt( tr( "Loading standard language." ), 0, tr( "OK" ), tr( "Cancel" ) );
|
|
|
|
if ( choice == 1 )
|
|
|
|
{
|
2010-12-29 11:22:11 +01:00
|
|
|
Settings.LoadLanguage(NULL, CONSOLE_DEFAULT);
|
2010-09-19 22:25:12 +02:00
|
|
|
Settings.Save();
|
2009-10-01 01:10:58 +02:00
|
|
|
returnhere = 2;
|
|
|
|
}
|
|
|
|
defaultBtn.ResetState();
|
2010-09-19 01:16:05 +02:00
|
|
|
//optionBrowser4.SetFocus(1); // commented out to prevent crash
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
else if ( updateBtn.GetState() == STATE_CLICKED )
|
|
|
|
{
|
|
|
|
choice = WindowPrompt( tr( "Update all Language Files" ), tr( "Do you wish to update/download all language files?" ), tr( "OK" ), tr( "Cancel" ) );
|
|
|
|
if ( choice == 1 )
|
|
|
|
{
|
2010-12-18 14:20:45 +01:00
|
|
|
if (IsNetworkInit() || NetworkInitPrompt())
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-12-18 14:20:45 +01:00
|
|
|
if(DownloadAllLanguageFiles() > 0)
|
|
|
|
WindowPrompt(tr("Update successfull"), 0, tr("OK"));
|
2009-10-01 01:10:58 +02:00
|
|
|
returnhere = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-09-19 01:16:05 +02:00
|
|
|
updateBtn.ResetState();
|
|
|
|
//optionBrowser4.SetFocus(1); // commented out to prevent crash
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
else if ( pathBtn.GetState() == STATE_CLICKED )
|
|
|
|
{
|
|
|
|
w.Remove( &optionBrowser4 );
|
|
|
|
w.Remove( &backBtn );
|
|
|
|
w.Remove( &pathBtn );
|
|
|
|
w.Remove( &defaultBtn );
|
2009-10-01 01:10:58 +02:00
|
|
|
char entered[43] = "";
|
2010-09-19 01:16:05 +02:00
|
|
|
strlcpy( entered, Settings.languagefiles_path, sizeof( entered ) );
|
|
|
|
int result = OnScreenKeyboard( entered, 43, 0 );
|
|
|
|
w.Append( &optionBrowser4 );
|
|
|
|
w.Append( &pathBtn );
|
|
|
|
w.Append( &backBtn );
|
|
|
|
w.Append( &defaultBtn );
|
2010-12-28 18:02:10 +01:00
|
|
|
if (result == 1)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-12-28 18:02:10 +01:00
|
|
|
if (entered[strlen(entered)-1] != '/')
|
|
|
|
strcat (entered, "/");
|
|
|
|
snprintf(Settings.languagefiles_path, sizeof(Settings.languagefiles_path), entered);
|
|
|
|
WindowPrompt(tr("Languagepath changed."), 0, tr("OK"));
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-09-25 08:54:27 +02:00
|
|
|
if ( Dir.GetFilecount() > 0 )
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
|
|
|
optionBrowser4.SetFocus( 1 );
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
|
|
|
pathBtn.ResetState();
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = optionBrowser4.GetClickedOption();
|
|
|
|
|
2010-12-28 18:02:10 +01:00
|
|
|
if (ret >= 0)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
|
|
|
choice = WindowPrompt( tr( "Do you want to change language?" ), 0, tr( "Yes" ), tr( "Cancel" ) );
|
2010-12-28 18:02:10 +01:00
|
|
|
if (choice == 1)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-11-07 21:31:45 +01:00
|
|
|
char newLangPath[150];
|
2010-12-28 18:02:10 +01:00
|
|
|
snprintf(Settings.languagefiles_path, sizeof( Settings.languagefiles_path ), "%s", Dir.GetFilepath(ret));
|
2010-12-18 14:20:45 +01:00
|
|
|
char * ptr = strrchr(Settings.languagefiles_path, '/');
|
|
|
|
if(ptr) ptr[1] = 0;
|
2010-12-28 18:02:10 +01:00
|
|
|
snprintf(newLangPath, sizeof(newLangPath), "%s", Dir.GetFilepath(ret));
|
|
|
|
if (!CheckFile(newLangPath))
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-12-28 18:02:10 +01:00
|
|
|
WindowPrompt(tr("File not found."), tr("Loading standard language."), tr("OK"));
|
2010-12-29 11:22:11 +01:00
|
|
|
Settings.LoadLanguage(NULL, CONSOLE_DEFAULT);
|
2010-09-19 01:16:05 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-11-07 21:31:45 +01:00
|
|
|
Settings.LoadLanguage(newLangPath);
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-11-07 21:31:45 +01:00
|
|
|
Settings.Save();
|
|
|
|
returnhere = 2;
|
|
|
|
break;
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
2010-09-19 01:16:05 +02:00
|
|
|
optionBrowser4.SetFocus( 1 );
|
2009-10-01 01:10:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-01-06 19:59:45 +01:00
|
|
|
//! Reload game list in new language
|
|
|
|
if(strcmp(Settings.db_language, OldLangCode) != 0)
|
|
|
|
{
|
|
|
|
GameTitles.LoadTitlesFromWiiTDB(Settings.titlestxt_path);
|
|
|
|
}
|
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
w.SetEffect( EFFECT_FADE, -20 );
|
|
|
|
while ( w.GetEffect() > 0 ) usleep( 50 );
|
2009-10-01 01:10:58 +02:00
|
|
|
|
|
|
|
HaltGui();
|
2010-09-19 01:16:05 +02:00
|
|
|
mainWindow->Remove( &w );
|
2009-10-01 01:10:58 +02:00
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
return returnhere;
|
|
|
|
}
|
|
|
|
|
2010-12-26 18:02:14 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* MenuThemeSelect
|
|
|
|
***************************************************************************/
|
|
|
|
int MenuThemeSelect()
|
|
|
|
{
|
|
|
|
int cnt = 0;
|
|
|
|
int ret = 0, choice = 0;
|
|
|
|
int returnVal = 0;
|
|
|
|
|
|
|
|
GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
|
|
|
|
GuiImageData settingsbg(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));
|
|
|
|
|
|
|
|
GuiTrigger trigA;
|
|
|
|
trigA.SetSimpleTrigger( -1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A );
|
|
|
|
GuiTrigger trigB;
|
|
|
|
trigB.SetButtonOnlyTrigger( -1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B );
|
|
|
|
|
2010-12-31 00:49:22 +01:00
|
|
|
GuiText titleTxt(Settings.theme_path, 24, ( GXColor ) {0, 0, 0, 255} );
|
2010-12-26 18:02:14 +01:00
|
|
|
titleTxt.SetAlignment( ALIGN_CENTRE, ALIGN_MIDDLE );
|
|
|
|
titleTxt.SetPosition( 0, 0 );
|
|
|
|
GuiButton pathBtn( 300, 50 );
|
|
|
|
pathBtn.SetAlignment( ALIGN_CENTRE, ALIGN_TOP );
|
|
|
|
pathBtn.SetPosition( 0, 28 );
|
|
|
|
pathBtn.SetLabel( &titleTxt );
|
|
|
|
pathBtn.SetSoundOver( btnSoundOver );
|
|
|
|
pathBtn.SetSoundClick( btnSoundClick2 );
|
|
|
|
pathBtn.SetTrigger( &trigA );
|
|
|
|
pathBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiImage backgroundImg( &settingsbg );
|
|
|
|
backgroundImg.SetAlignment( ALIGN_LEFT, ALIGN_TOP );
|
|
|
|
backgroundImg.SetPosition( 0, 0 );
|
|
|
|
|
|
|
|
GuiText backBtnTxt( tr( "Back" ) , 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
|
|
|
|
backBtnTxt.SetMaxWidth( btnOutline.GetWidth() - 30 );
|
|
|
|
GuiImage backBtnImg( &btnOutline );
|
|
|
|
if ( Settings.wsprompt == ON )
|
|
|
|
{
|
|
|
|
backBtnTxt.SetWidescreen( Settings.widescreen );
|
|
|
|
backBtnImg.SetWidescreen( Settings.widescreen );
|
|
|
|
}
|
|
|
|
GuiButton backBtn( btnOutline.GetWidth(), btnOutline.GetHeight() );
|
|
|
|
backBtn.SetAlignment( ALIGN_CENTRE, ALIGN_TOP );
|
|
|
|
backBtn.SetPosition( -190, 400 );
|
|
|
|
backBtn.SetLabel( &backBtnTxt );
|
|
|
|
backBtn.SetImage( &backBtnImg );
|
|
|
|
backBtn.SetSoundOver( btnSoundOver );
|
|
|
|
backBtn.SetSoundClick( btnSoundClick2 );
|
|
|
|
backBtn.SetTrigger( &trigA );
|
|
|
|
backBtn.SetTrigger( &trigB );
|
|
|
|
backBtn.SetEffectGrow();
|
|
|
|
|
|
|
|
GuiText defaultBtnTxt( tr( "Default" ) , 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
|
|
|
|
defaultBtnTxt.SetMaxWidth( btnOutline.GetWidth() - 30 );
|
|
|
|
GuiImage defaultBtnImg( &btnOutline );
|
|
|
|
if ( Settings.wsprompt == ON )
|
|
|
|
{
|
|
|
|
defaultBtnTxt.SetWidescreen( Settings.widescreen );
|
|
|
|
defaultBtnImg.SetWidescreen( Settings.widescreen );
|
|
|
|
}
|
|
|
|
GuiButton defaultBtn( btnOutline.GetWidth(), btnOutline.GetHeight() );
|
|
|
|
defaultBtn.SetAlignment( ALIGN_CENTRE, ALIGN_TOP );
|
2011-01-09 11:45:29 +01:00
|
|
|
defaultBtn.SetPosition( 0, 400 );
|
2010-12-26 18:02:14 +01:00
|
|
|
defaultBtn.SetLabel( &defaultBtnTxt );
|
|
|
|
defaultBtn.SetImage( &defaultBtnImg );
|
|
|
|
defaultBtn.SetSoundOver( btnSoundOver );
|
|
|
|
defaultBtn.SetSoundClick( btnSoundClick2 );
|
|
|
|
defaultBtn.SetTrigger( &trigA );
|
|
|
|
defaultBtn.SetEffectGrow();
|
|
|
|
|
2010-12-31 00:49:22 +01:00
|
|
|
DirList * Dir = new DirList(Settings.theme_path, ".them");
|
2010-12-26 18:02:14 +01:00
|
|
|
OptionList options2;
|
|
|
|
|
|
|
|
for ( cnt = 0; cnt < Dir->GetFilecount(); cnt++ )
|
|
|
|
{
|
|
|
|
char filename[64];
|
|
|
|
strlcpy( filename, Dir->GetFilename( cnt ), sizeof( filename ) );
|
|
|
|
char *dot = strchr( filename, '.' );
|
|
|
|
if ( dot ) *dot = '\0';
|
|
|
|
options2.SetName( cnt, "%s", filename );
|
|
|
|
options2.SetValue( cnt, NULL );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
GuiCustomOptionBrowser optionBrowser4( 396, 280, &options2, "bg_options_settings.png");
|
|
|
|
optionBrowser4.SetPosition( 0, 90 );
|
|
|
|
optionBrowser4.SetAlignment( ALIGN_CENTRE, ALIGN_TOP );
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
GuiWindow w( screenwidth, screenheight );
|
|
|
|
w.Append( &backgroundImg );
|
|
|
|
w.Append( &pathBtn );
|
|
|
|
w.Append( &backBtn );
|
2011-01-09 11:45:29 +01:00
|
|
|
w.Append( &defaultBtn );
|
2010-12-26 18:02:14 +01:00
|
|
|
w.Append( &optionBrowser4 );
|
|
|
|
mainWindow->Append( &w );
|
|
|
|
|
|
|
|
w.SetEffect( EFFECT_FADE, 20 );
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
while ( w.GetEffect() > 0 ) usleep(100);
|
|
|
|
|
|
|
|
while (returnVal == 0)
|
|
|
|
{
|
|
|
|
usleep(100);
|
|
|
|
|
|
|
|
if (shutdown)
|
|
|
|
Sys_Shutdown();
|
|
|
|
else if (reset)
|
|
|
|
Sys_Reboot();
|
|
|
|
|
|
|
|
else if ( backBtn.GetState() == STATE_CLICKED )
|
|
|
|
break;
|
|
|
|
|
|
|
|
else if ( defaultBtn.GetState() == STATE_CLICKED )
|
|
|
|
{
|
2011-01-09 11:45:29 +01:00
|
|
|
choice = WindowPrompt(0, tr( "Do you want to load the default theme?" ), tr( "OK" ), tr( "Cancel" ) );
|
2010-12-26 18:02:14 +01:00
|
|
|
if ( choice == 1 )
|
|
|
|
{
|
2011-01-09 11:45:29 +01:00
|
|
|
HaltGui();
|
2010-12-26 18:02:14 +01:00
|
|
|
Theme::SetDefault();
|
2011-01-09 11:45:29 +01:00
|
|
|
Theme::Reload();
|
|
|
|
ResumeGui();
|
2010-12-26 18:02:14 +01:00
|
|
|
Settings.Save();
|
|
|
|
returnVal = 1;
|
|
|
|
}
|
|
|
|
defaultBtn.ResetState();
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ( pathBtn.GetState() == STATE_CLICKED )
|
|
|
|
{
|
|
|
|
w.Remove( &optionBrowser4 );
|
|
|
|
w.Remove( &backBtn );
|
|
|
|
w.Remove( &pathBtn );
|
|
|
|
w.Remove( &defaultBtn );
|
2010-12-31 00:49:22 +01:00
|
|
|
int result = BrowseDevice(Settings.theme_path, sizeof(Settings.theme_path), FB_DEFAULT, noFILES);
|
2010-12-26 18:02:14 +01:00
|
|
|
w.Append( &optionBrowser4 );
|
|
|
|
w.Append( &pathBtn );
|
|
|
|
w.Append( &backBtn );
|
|
|
|
w.Append( &defaultBtn );
|
|
|
|
if (result == 1)
|
|
|
|
{
|
2010-12-31 00:49:22 +01:00
|
|
|
if (Settings.theme_path[strlen(Settings.theme_path)-1] != '/')
|
|
|
|
strcat(Settings.theme_path, "/");
|
2010-12-26 18:02:14 +01:00
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
delete Dir;
|
2010-12-31 00:49:22 +01:00
|
|
|
Dir = new DirList(Settings.theme_path, ".them");
|
2010-12-26 18:02:14 +01:00
|
|
|
options2.ClearList();
|
|
|
|
for ( cnt = 0; cnt < Dir->GetFilecount(); cnt++ )
|
|
|
|
{
|
|
|
|
char filename[64];
|
|
|
|
strlcpy( filename, Dir->GetFilename( cnt ), sizeof( filename ) );
|
|
|
|
char *dot = strchr( filename, '.' );
|
|
|
|
if ( dot ) *dot = '\0';
|
|
|
|
options2.SetName( cnt, "%s", filename );
|
|
|
|
options2.SetValue( cnt, NULL );
|
|
|
|
}
|
2010-12-31 00:49:22 +01:00
|
|
|
titleTxt.SetText(Settings.theme_path);
|
2010-12-26 18:02:14 +01:00
|
|
|
ResumeGui();
|
|
|
|
WindowPrompt( tr( "Theme path is changed." ), 0, tr( "OK" ) );
|
|
|
|
}
|
|
|
|
pathBtn.ResetState();
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = optionBrowser4.GetClickedOption();
|
|
|
|
|
|
|
|
if (ret >= 0 && ret < Dir->GetFilecount())
|
|
|
|
{
|
|
|
|
choice = WindowPrompt( tr( "Do you want to load this theme?" ), Dir->GetFilename(ret), tr( "Yes" ), tr( "Cancel" ) );
|
|
|
|
if ( choice == 1 )
|
|
|
|
{
|
2010-12-31 00:49:22 +01:00
|
|
|
snprintf(Settings.theme, sizeof( Settings.theme ), "%s", Dir->GetFilepath(ret));
|
|
|
|
if ( !CheckFile( Settings.theme ) )
|
2010-12-26 18:02:14 +01:00
|
|
|
{
|
|
|
|
WindowPrompt( tr( "File not found." ), tr( "Loading default theme." ), tr( "OK" ) );
|
2011-01-09 11:45:29 +01:00
|
|
|
HaltGui();
|
2010-12-26 18:02:14 +01:00
|
|
|
Theme::SetDefault();
|
2011-01-09 11:45:29 +01:00
|
|
|
Theme::Reload();
|
|
|
|
ResumeGui();
|
2010-12-26 18:02:14 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-12-28 18:02:10 +01:00
|
|
|
HaltGui();
|
2010-12-31 00:49:22 +01:00
|
|
|
Theme::Load(Settings.theme);
|
2011-01-09 11:45:29 +01:00
|
|
|
Theme::Reload();
|
2010-12-28 18:02:10 +01:00
|
|
|
ResumeGui();
|
2010-12-26 18:02:14 +01:00
|
|
|
}
|
|
|
|
Settings.Save();
|
|
|
|
returnVal = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
optionBrowser4.SetFocus( 1 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
w.SetEffect( EFFECT_FADE, -20 );
|
|
|
|
while ( w.GetEffect() > 0 ) usleep(100);
|
|
|
|
|
|
|
|
HaltGui();
|
|
|
|
mainWindow->Remove( &w );
|
|
|
|
ResumeGui();
|
|
|
|
|
|
|
|
delete Dir;
|
|
|
|
|
|
|
|
return returnVal;
|
|
|
|
}
|
|
|
|
|