*Moved everything from config.txt to global_settings.cfg

*Added cover/discimage/theme path edit through global settings
*Changed if no password is set, you are always godmode (even after reloading GUI). If you have password set: the unlock is only till you leave.
This commit is contained in:
dimok321 2009-05-09 22:37:14 +00:00
parent 1e665c8bcb
commit 7e02aeb63f
4 changed files with 136 additions and 20 deletions

File diff suppressed because one or more lines are too long

View File

@ -195,7 +195,7 @@ void CFG_Default(int widescreen) // -1 = non forced Mode
snprintf(CFG.theme_path, sizeof(CFG.theme_path), "SD:/theme/"); snprintf(CFG.theme_path, sizeof(CFG.theme_path), "SD:/theme/");
} }
snprintf(CFG.covers_path, sizeof(CFG.covers_path), "SD:/images/"); //default image path snprintf(CFG.covers_path, sizeof(CFG.covers_path), "SD:/images/"); //default image path
snprintf(CFG.disc_path, sizeof(CFG.disc_path), "SD:/images/disc/");//default path for disc images snprintf(CFG.disc_path, sizeof(CFG.disc_path), "SD:/images/disc/");//default path for disc images
snprintf(CFG.unlockCode, sizeof(CFG.unlockCode), "ab121b"); // default passwore snprintf(CFG.unlockCode, sizeof(CFG.unlockCode), "ab121b"); // default passwore
@ -204,7 +204,7 @@ void CFG_Default(int widescreen) // -1 = non forced Mode
CFG.godmode = 0; CFG.godmode = 0;
CFG.xflip = 0; CFG.xflip = 0;
CFG.wsprompt = 0; CFG.wsprompt = 0;
//all alignments are left top here //all alignments are left top here
THEME.selection_x = 200; THEME.selection_x = 200;
THEME.selection_y = 40; THEME.selection_y = 40;
@ -416,7 +416,7 @@ void cfg_set(char *name, char *val)
cfg_map("home", "reboot", &CFG.home, CFG_HOME_REBOOT); cfg_map("home", "reboot", &CFG.home, CFG_HOME_REBOOT);
cfg_int("simple", &CFG.simple, 3); cfg_int("simple", &CFG.simple, 3);
*/ */
// if these are defined in txt file, use them. otherwise use defaults // if these are defined in txt file, use them. otherwise use defaults
if (!CFG.widescreen &&(strcmp(name, "theme_path") == 0)) {// if in 4:3 if (!CFG.widescreen &&(strcmp(name, "theme_path") == 0)) {// if in 4:3
@ -591,7 +591,7 @@ void theme_set(char *name, char *val)
THEME.info_b = z; THEME.info_b = z;
} }
} }
else if (strcmp(cfg_name, "gametext_color") == 0) { else if (strcmp(cfg_name, "gametext_color") == 0) {
short x,y,z; short x,y,z;
if (sscanf(val, "%hd,%hd, %hd", &x, &y, &z) == 3) { if (sscanf(val, "%hd,%hd, %hd", &x, &y, &z) == 3) {
@ -607,7 +607,7 @@ void theme_set(char *name, char *val)
THEME.pagesize = x; THEME.pagesize = x;
} }
} }
cfg_bool("show_id", &THEME.showID); cfg_bool("show_id", &THEME.showID);
cfg_bool("show_tooltip", &THEME.showToolTip); cfg_bool("show_tooltip", &THEME.showToolTip);
cfg_bool("show_hddinfo", &THEME.showHDD); cfg_bool("show_hddinfo", &THEME.showHDD);
@ -909,7 +909,19 @@ bool cfg_save_global()// save global settings
fprintf(f, "cios = %d\n ", Settings.cios); fprintf(f, "cios = %d\n ", Settings.cios);
fprintf(f, "xflip = %d\n ", Settings.xflip); fprintf(f, "xflip = %d\n ", Settings.xflip);
fprintf(f, "qboot = %d\n ", Settings.qboot); fprintf(f, "qboot = %d\n ", Settings.qboot);
fprintf(f, "wsprompt = %d\n ", Settings.wsprompt); fprintf(f, "parentalcontrol = %d\n ", CFG.parentalcontrol);
fprintf(f, "cover_path = %s\n ", CFG.covers_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 ", CFG.disc_path);
if(!strcmp("", Settings.unlockCode)) {
fprintf(f, "godmode = %d\n ", CFG.godmode);
} else {
fprintf(f, "godmode = %d\n ", 0);
}
fclose(f); fclose(f);
return true; return true;
} }
@ -972,7 +984,7 @@ void game_set(char *name, char *val)
game->parentalcontrol = opt_c; game->parentalcontrol = opt_c;
} }
} }
} }
// next opt // next opt
if (np) p = np + 1; else p = NULL; if (np) p = np + 1; else p = NULL;
@ -1082,7 +1094,7 @@ void CFG_Load(int argc, char **argv)
CFG_Default(-1); // set defaults non forced CFG_Default(-1); // set defaults non forced
snprintf(pathname, sizeof(pathname), "SD:/config/config.txt"); snprintf(pathname, sizeof(pathname), "SD:/config/global_settings.cfg");
cfg_parsefile(pathname, &widescreen_set); //first set widescreen cfg_parsefile(pathname, &widescreen_set); //first set widescreen
cfg_parsefile(pathname, &cfg_set); //then set config and layout options cfg_parsefile(pathname, &cfg_set); //then set config and layout options

View File

@ -62,7 +62,7 @@ struct CFG
short parentalcontrol; short parentalcontrol;
short maxcharacters; short maxcharacters;
short godmode; short godmode;
short xflip; short xflip;
short wsprompt; short wsprompt;
char unlockCode[20]; char unlockCode[20];
char covers_path[100]; char covers_path[100];

View File

@ -3233,7 +3233,11 @@ static int MenuSettings()
GuiTrigger trigL; GuiTrigger trigL;
trigL.SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT); trigL.SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
GuiTrigger trigR; GuiTrigger trigR;
trigL.SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT); trigR.SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
GuiTrigger trigMinus;
trigMinus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0);
GuiTrigger trigPlus;
trigPlus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0);
GuiText titleTxt("Settings", 28, (GXColor){0, 0, 0, 255}); GuiText titleTxt("Settings", 28, (GXColor){0, 0, 0, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
@ -3271,6 +3275,7 @@ static int MenuSettings()
page1Btn.SetSoundClick(&btnClick); page1Btn.SetSoundClick(&btnClick);
page1Btn.SetTrigger(&trigA); page1Btn.SetTrigger(&trigA);
page1Btn.SetTrigger(&trigL); page1Btn.SetTrigger(&trigL);
page1Btn.SetTrigger(&trigMinus);
GuiTooltip page1BtnTT("Go to Page 1"); GuiTooltip page1BtnTT("Go to Page 1");
if (Settings.wsprompt == yes) if (Settings.wsprompt == yes)
@ -3289,6 +3294,7 @@ static int MenuSettings()
page2Btn.SetSoundClick(&btnClick); page2Btn.SetSoundClick(&btnClick);
page2Btn.SetTrigger(&trigA); page2Btn.SetTrigger(&trigA);
page2Btn.SetTrigger(&trigR); page2Btn.SetTrigger(&trigR);
page2Btn.SetTrigger(&trigPlus);
GuiTooltip page2BtnTT("Go to Page 2"); GuiTooltip page2BtnTT("Go to Page 2");
if (Settings.wsprompt == yes) if (Settings.wsprompt == yes)
@ -3381,10 +3387,10 @@ static int MenuSettings()
sprintf(options2.name[2], "Flip X"); sprintf(options2.name[2], "Flip X");
sprintf(options2.name[3], "Quick Boot"); sprintf(options2.name[3], "Quick Boot");
sprintf(options2.name[4], "Prompts & Buttons"); sprintf(options2.name[4], "Prompts & Buttons");
sprintf(options2.name[5], " "); sprintf(options2.name[5], "Parentalcontrol");
sprintf(options2.name[6], " "); sprintf(options2.name[6], "Cover Path");
sprintf(options2.name[7], " "); sprintf(options2.name[7], "Discimage Path");
sprintf(options2.name[8], " "); sprintf(options2.name[8], "Theme Path");
} }
while(menu == MENU_NONE) while(menu == MENU_NONE)
@ -3508,6 +3514,8 @@ static int MenuSettings()
Settings.qboot = 0; Settings.qboot = 0;
if ( Settings.wsprompt > 1 ) if ( Settings.wsprompt > 1 )
Settings.wsprompt = 0; Settings.wsprompt = 0;
if (CFG.parentalcontrol > 3 )
CFG.parentalcontrol = 0;
if ( CFG.godmode != 1) sprintf(options2.value[0], "********"); if ( CFG.godmode != 1) sprintf(options2.value[0], "********");
@ -3526,11 +3534,20 @@ static int MenuSettings()
if (Settings.wsprompt == no) sprintf (options2.value[4],"Normal"); if (Settings.wsprompt == no) sprintf (options2.value[4],"Normal");
else if (Settings.wsprompt == yes) sprintf (options2.value[4],"Widescreen Fix"); else if (Settings.wsprompt == yes) sprintf (options2.value[4],"Widescreen Fix");
sprintf (options2.value[5]," "); if (CFG.godmode != 1) sprintf(options2.value[5], "********");
sprintf (options2.value[6]," "); else if(CFG.parentalcontrol == 0) sprintf(options2.value[5], "0");
sprintf (options2.value[7]," "); else if(CFG.parentalcontrol == 1) sprintf(options2.value[5], "1");
sprintf (options2.value[8]," "); else if(CFG.parentalcontrol == 2) sprintf(options2.value[5], "2");
else if(CFG.parentalcontrol == 3) sprintf(options2.value[5], "3");
if (CFG.godmode != 1) sprintf(options2.value[6], "********");
else sprintf(options2.value[6], CFG.covers_path);
if (CFG.godmode != 1) sprintf(options2.value[7], "********");
else sprintf(options2.value[7], CFG.disc_path);
if (CFG.godmode != 1) sprintf(options2.value[8], "********");
else sprintf(options2.value[8], CFG.theme_path);
ret = optionBrowser2.GetClickedOption(); ret = optionBrowser2.GetClickedOption();
@ -3548,9 +3565,9 @@ static int MenuSettings()
char entered[20] = ""; char entered[20] = "";
strncpy(entered, Settings.unlockCode, sizeof(entered)); strncpy(entered, Settings.unlockCode, sizeof(entered));
int result = OnScreenKeyboard(entered, 20); int result = OnScreenKeyboard(entered, 20);
mainWindow->Append(&optionBrowser2);
mainWindow->Append(&page1Btn); mainWindow->Append(&page1Btn);
mainWindow->Append(&page2Btn); mainWindow->Append(&page2Btn);
mainWindow->Append(&optionBrowser2);
w.Append(&backBtn); w.Append(&backBtn);
w.Append(&lockBtn); w.Append(&lockBtn);
if ( result == 1 ) if ( result == 1 )
@ -3577,6 +3594,93 @@ static int MenuSettings()
case 4: case 4:
Settings.wsprompt++; Settings.wsprompt++;
break; break;
case 5:
CFG.parentalcontrol++;
break;
case 6:
if ( CFG.godmode == 1)
{
mainWindow->Remove(&optionBrowser2);
mainWindow->Remove(&page1Btn);
mainWindow->Remove(&page2Btn);
w.Remove(&backBtn);
w.Remove(&lockBtn);
char entered[20] = "";
strncpy(entered, CFG.covers_path, sizeof(entered));
int result = OnScreenKeyboard(entered, 20);
mainWindow->Append(&optionBrowser2);
mainWindow->Append(&page1Btn);
mainWindow->Append(&page2Btn);
w.Append(&backBtn);
w.Append(&lockBtn);
if ( result == 1 )
{
strncpy(CFG.covers_path, entered, sizeof(CFG.covers_path));
WindowPrompt("Coverpath Changed",0,"OK",0,0,0);
cfg_save_global();
}
}
else
{
WindowPrompt("Coverpath change","Console should be unlocked to modify it.","OK",0,0,0);
}
break;
case 7:
if ( CFG.godmode == 1)
{
mainWindow->Remove(&optionBrowser2);
mainWindow->Remove(&page1Btn);
mainWindow->Remove(&page2Btn);
w.Remove(&backBtn);
w.Remove(&lockBtn);
char entered[20] = "";
strncpy(entered, CFG.disc_path, sizeof(entered));
int result = OnScreenKeyboard(entered, 20);
mainWindow->Append(&optionBrowser2);
mainWindow->Append(&page1Btn);
mainWindow->Append(&page2Btn);
w.Append(&backBtn);
w.Append(&lockBtn);
if ( result == 1 )
{
strncpy(CFG.disc_path, entered, sizeof(CFG.disc_path));
WindowPrompt("Discpath Changed",0,"OK",0,0,0);
cfg_save_global();
}
}
else
{
WindowPrompt("Discpath change","Console should be unlocked to modify it.","OK",0,0,0);
}
break;
case 8:
if ( CFG.godmode == 1)
{
mainWindow->Remove(&optionBrowser2);
mainWindow->Remove(&page1Btn);
mainWindow->Remove(&page2Btn);
w.Remove(&backBtn);
w.Remove(&lockBtn);
char entered[20] = "";
strncpy(entered, CFG.theme_path, sizeof(entered));
int result = OnScreenKeyboard(entered, 20);
mainWindow->Append(&optionBrowser2);
mainWindow->Append(&page1Btn);
mainWindow->Append(&page2Btn);
w.Append(&backBtn);
w.Append(&lockBtn);
if ( result == 1 )
{
strncpy(CFG.theme_path, entered, sizeof(CFG.theme_path));
WindowPrompt("Themepath Changed",0,"OK",0,0,0);
cfg_save_global();
}
}
else
{
WindowPrompt("Themepath change","Console should be unlocked to modify it.","OK",0,0,0);
}
break;
} }
} }