Change themes right when theme path is altered. Not really tested, but it should work.

This commit is contained in:
giantpune 2009-05-11 13:57:19 +00:00
parent 2a2eeeebbc
commit d332a4be15
4 changed files with 83 additions and 0 deletions

View File

@ -1141,6 +1141,40 @@ void CFG_Load(int argc, char **argv)
cfg_load_games(); cfg_load_games();
// cfg_parsearg(argc, argv);
}
void CFG_Load1()
{
char pathname[200];
// bool ret = false;
//set app path
// chdir_app(argv[0]);
CFG_Default(-1); // set defaults non forced
snprintf(pathname, sizeof(pathname), "SD:/config/global_settings.cfg");
cfg_parsefile(pathname, &widescreen_set); //first set widescreen
cfg_parsefile(pathname, &cfg_set); //then set config and layout options
snprintf(pathname, sizeof(pathname), "%stheme.txt", CFG.theme_path);
cfg_parsefile(pathname, &theme_set); //finally set console information
// if (!ret)
// {
// cfg_parsefile("SD:/config.txt", &widescreen_set);
// cfg_parsefile("SD:/config.txt", &cfg_set);
// cfg_parsefile("SD:/config.txt", &console_set);
// }
snprintf(pathname, sizeof(pathname), "SD:/config/titles.txt");
cfg_parsetitlefile(pathname, &title_set);
// load per-game settings
cfg_load_games();
// cfg_parsearg(argc, argv); // cfg_parsearg(argc, argv);
} }

View File

@ -153,6 +153,7 @@ struct Game_CFG
void CFG_Default(int widescreen); // -1 = non forced mode void CFG_Default(int widescreen); // -1 = non forced mode
void CFG_Load(int argc, char **argv); void CFG_Load(int argc, char **argv);
void CFG_Load1();
struct Game_CFG* CFG_get_game_opt(u8 *id); struct Game_CFG* CFG_get_game_opt(u8 *id);
bool CFG_save_game_opt(u8 *id); bool CFG_save_game_opt(u8 *id);
bool CFG_forget_game_opt(u8 *id); bool CFG_forget_game_opt(u8 *id);

View File

@ -46,6 +46,7 @@ FreeTypeGX *fontClock=0;
int ExitRequested = 0; int ExitRequested = 0;
bool netcheck = false; bool netcheck = false;
/*Networking - Forsaekn*/ /*Networking - Forsaekn*/
int Net_Init(char *ip){ int Net_Init(char *ip){
@ -108,6 +109,8 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
s32 ret2; s32 ret2;
__io_wiisd.startup(); __io_wiisd.startup();

View File

@ -49,6 +49,11 @@ static GuiImageData * cover = NULL;
//char GamesHDD[320][14]; //char GamesHDD[320][14];
static GuiButton * settingsBtn = NULL;
static GuiButton * homeBtn = NULL;
static GuiButton * poweroffBtn = NULL;
static GuiButton * installBtn = NULL;
static struct discHdr *gameList = NULL; static struct discHdr *gameList = NULL;
static GuiImageData * pointer[4]; static GuiImageData * pointer[4];
static GuiImage * bgImg = NULL; static GuiImage * bgImg = NULL;
@ -3748,6 +3753,46 @@ static int MenuSettings()
strncpy(CFG.theme_path, entered, sizeof(CFG.theme_path)); strncpy(CFG.theme_path, entered, sizeof(CFG.theme_path));
WindowPrompt("Themepath Changed",0,"OK",0,0,0); WindowPrompt("Themepath Changed",0,"OK",0,0,0);
cfg_save_global(); cfg_save_global();
mainWindow->Remove(bgImg);
CFG_Load1();
CFG_LoadGlobal();
menu = MENU_SETTINGS;
#ifdef HW_RVL
snprintf(imgPath, sizeof(imgPath), "%splayer1_point.png", CFG.theme_path);
pointer[0] = new GuiImageData(imgPath, player1_point_png);
snprintf(imgPath, sizeof(imgPath), "%splayer2_point.png", CFG.theme_path);
pointer[1] = new GuiImageData(imgPath, player2_point_png);
snprintf(imgPath, sizeof(imgPath), "%splayer3_point.png", CFG.theme_path);
pointer[2] = new GuiImageData(imgPath, player3_point_png);
snprintf(imgPath, sizeof(imgPath), "%splayer4_point.png", CFG.theme_path);
pointer[3] = new GuiImageData(imgPath, player4_point_png);
#endif
if (CFG.widescreen)
snprintf(imgPath, sizeof(imgPath), "%swbackground.png", CFG.theme_path);
else
snprintf(imgPath, sizeof(imgPath), "%sbackground.png", CFG.theme_path);
background = new GuiImageData(imgPath, CFG.widescreen? wbackground_png : background_png);
bgImg = new GuiImage(background);
mainWindow->Append(bgImg);
mainWindow->Append(&w);
w.Append(&settingsbackgroundbtn);
w.Append(&titleTxt);
w.Append(&backBtn);
w.Append(&lockBtn);
w.Append(btnLogo);
mainWindow->Append(&optionBrowser2);
mainWindow->Append(&page1Btn);
mainWindow->Append(&page2Btn);
w.Append(&backBtn);
w.Append(&lockBtn);
//installBtn->SetPosition(THEME.install_x, THEME.install_y);
//poweroffBtn->SetPosition(THEME.power_x, THEME.power_y);
////homeBtn->SetPosition(THEME.home_x, THEME.home_y);
//settingsBtn->SetPosition(THEME.setting_x, THEME.setting_y);
} }
} }
else else