Optimized and Refactored some codes. Did not do any test on it so it might break the settings feature. Please report on issues if any settings feature is broken

This commit is contained in:
hungyip 2009-06-04 01:04:23 +00:00
parent 8576f4d5a0
commit 3887824fde
6 changed files with 287 additions and 428 deletions

View File

@ -7,37 +7,17 @@
#include <ogcsys.h> #include <ogcsys.h>
#include "cfg.h" #include "cfg.h"
#include "language.h" #include "language.h"
/*<<<<<<< .mine
//#include "language.c"
extern void language_set();
extern void lang_default();
extern void language_set();
extern char* strcopy();
=======
>>>>>>> .r348*/
struct SSettings Settings; struct SSettings Settings;
//struct SSettings2 Settings2;
char *cfg_path = "SD:/apps/usbloader/"; char *cfg_path = "SD:/apps/usbloader/";
//char *setting_path = "SD:/apps/usbloader/GXGameSettings.cfg";
char current_path[100]; char current_path[100];
/* configurable fields */ /* configurable fields */
/* default */
//int ENTRIES_PER_PAGE = 12;
//int MAX_CHARACTERS = 37;
//int CONSOLE_XCOORD = 260;
//int CONSOLE_YCOORD = 30;
//int CONSOLE_WIDTH = 340;
//int CONSOLE_HEIGHT = 290;
//int CONSOLE_FG_COLOR = 15;
//int CONSOLE_BG_COLOR = 0;
//int COVER_XCOORD = 28;
//int COVER_YCOORD = 105;
//define variables //define variables
struct CFG CFG; struct CFG CFG;
@ -245,20 +225,16 @@ 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 if (widescreen == -1)
snprintf(CFG.disc_path, sizeof(CFG.disc_path), "SD:/images/disc/"); {
snprintf(CFG.titlestxt_path, sizeof(CFG.titlestxt_path), "SD:/config/");//default path for disc images snprintf(Settings.covers_path, sizeof(Settings.covers_path), "SD:/images/"); //default image path
snprintf(CFG.unlockCode, sizeof(CFG.unlockCode), "ab121b"); // default password snprintf(Settings.disc_path, sizeof(Settings.disc_path), "SD:/images/disc/");
snprintf(CFG.language_path, sizeof(CFG.language_path), "SD:/config/language/"); snprintf(Settings.titlestxt_path, sizeof(Settings.titlestxt_path), "SD:/config/");//default path for disc images
snprintf(CFG.oggload_path, sizeof(CFG.oggload_path), "SD:/config/backgroundmusic/"); snprintf(Settings.unlockCode, sizeof(Settings.unlockCode), "ab121b"); // default password
snprintf(CFG.update_path, sizeof(CFG.update_path), "SD:/apps/usbloader_gx/"); snprintf(Settings.language_path, sizeof(Settings.language_path), "SD:/config/language/");
sprintf(CFG.ogg_path, "notset"); snprintf(Settings.oggload_path, sizeof(Settings.oggload_path), "SD:/config/backgroundmusic/");
snprintf(Settings.update_path, sizeof(Settings.update_path), "SD:/apps/usbloader_gx/");
CFG.parentalcontrol = 0; sprintf(Settings.ogg_path, "notset");
// CFG.maxcharacters = 38;
CFG.godmode = 0;
CFG.xflip = 0;
CFG.wsprompt = 0;
//all alignments are left top here //all alignments are left top here
THEME.selection_x = 200; THEME.selection_x = 200;
@ -344,8 +320,32 @@ void CFG_Default(int widescreen) // -1 = non forced Mode
THEME.count_y = 13; THEME.count_y = 13;
THEME.sortBarOffset = 100; THEME.sortBarOffset = 100;
} }
}
void Global_Default(void)
{
Settings.video = discdefault;
Settings.vpatch = off;
Settings.language = ConsoleLangDefault;
Settings.ocarina = off;
Settings.hddinfo = hr12;
Settings.sinfo = ((THEME.showID) ? GameID : Neither);
Settings.rumble = RumbleOn;
if (THEME.showRegion)
{
Settings.sinfo = ((Settings.sinfo == GameID) ? Both : GameRegion);
}
Settings.volume = v80;
Settings.tooltips = TooltipsOn;
snprintf(Settings.unlockCode, sizeof(Settings.unlockCode), "ab121b");
Settings.parentalcontrol = 0;
Settings.cios = ios249;
Settings.xflip = no;
Settings.qboot = no;
Settings.unicodefix = 0;
Settings.wiilight = 1;
Settings.patchcountrystrings = 0;
}
char *cfg_get_title(u8 *id) char *cfg_get_title(u8 *id)
@ -442,61 +442,14 @@ void widescreen_set(char *name, char *val)
short widescreen; short widescreen;
if (cfg_bool("widescreen", &widescreen) && CFG.widescreen != widescreen) if (cfg_bool("widescreen", &widescreen) && CFG.widescreen != widescreen)
CFG_Default(widescreen); //reset default when forced an other Screenmode CFG_Default(widescreen); //reset default when forced an other Screenmode
/*
if (cfg_bool("widescreen", &CFG.widescreen)) //reset default
{
if (CFG.widescreen) {
// snprintf(CFG.covers_path, sizeof(CFG.covers_path), "SD:/wimages/");
snprintf(CFG.theme_path, sizeof(CFG.theme_path), "SD:/wtheme/");
}
else
{
// snprintf(CFG.covers_path, sizeof(CFG.covers_path), "SD:/images/");
snprintf(CFG.theme_path, sizeof(CFG.theme_path), "SD:/theme/");
}
}
*/
} }
void cfg_set(char *name, char *val) void path_set(char *name, char *val)
{ {
cfg_name = name; cfg_name = name;
cfg_val = val; cfg_val = val;
/*
if (!CFG.widescreen &&(strcmp(name, "images_path") == 0)) {
strcopy(CFG.images_path, val, sizeof(CFG.images_path));
snprintf(bg_path, sizeof(bg_path), "%sbg.png", CFG.images_path); //reset path
return;
}
if (CFG.widescreen && strcmp(name, "wimages_path") == 0) {
strcopy(CFG.images_path, val, sizeof(CFG.images_path));
snprintf(bg_path, sizeof(bg_path), "%swbg.png", CFG.images_path); //reset path
return;
}
if (cfg_map_auto("video", map_video, &CFG.video))
return;
if (cfg_map_auto("language", map_language, &CFG.language))
return;
if (cfg_map_auto("layout", map_layout, &CFG.layout)) {
cfg_layout();
}
cfg_bool("ocarina", &CFG.ocarina);
cfg_bool("covers", &CFG.covers);
cfg_bool("download", &CFG.download);
cfg_bool("savesettings", &CFG.savesettings);
cfg_bool("installdownload", &CFG.installdownload);
cfg_bool("hidesettingmenu", &CFG.hidesettingmenu);
cfg_map("home", "exit", &CFG.home, CFG_HOME_EXIT);
cfg_map("home", "reboot", &CFG.home, CFG_HOME_REBOOT);
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
@ -505,49 +458,43 @@ void cfg_set(char *name, char *val)
return; return;
} }
if (CFG.widescreen && strcmp(name, "wtheme_path") == 0) { // if in 16:9 if (CFG.widescreen && strcmp(name, "wtheme_path") == 0) { // if in 16:9
strcopy(CFG.theme_path, val, sizeof(CFG.theme_path)); strcopy(CFG.theme_path, val, sizeof(CFG.theme_path));
return; return;
} }
if (strcmp(name, "cover_path") == 0) { if (strcmp(name, "cover_path") == 0) {
strcopy(CFG.covers_path, val, sizeof(CFG.covers_path)); strcopy(Settings.covers_path, val, sizeof(Settings.covers_path));
return; return;
} }
if (strcmp(name, "disc_path") == 0) { if (strcmp(name, "disc_path") == 0) {
strcopy(CFG.disc_path, val, sizeof(CFG.disc_path)); strcopy(Settings.disc_path, val, sizeof(Settings.disc_path));
return; return;
} }
if (strcmp(name, "titlestxt_path") == 0) { if (strcmp(name, "titlestxt_path") == 0) {
strcopy(CFG.titlestxt_path, val, sizeof(CFG.titlestxt_path)); strcopy(Settings.titlestxt_path, val, sizeof(Settings.titlestxt_path));
return; return;
} }
if (strcmp(name, "language_path") == 0) { if (strcmp(name, "language_path") == 0) {
strcopy(CFG.language_path, val, sizeof(CFG.language_path)); strcopy(Settings.language_path, val, sizeof(Settings.language_path));
return; return;
} }
if (strcmp(name, "update_path") == 0) { if (strcmp(name, "update_path") == 0) {
strcopy(CFG.update_path, val, sizeof(CFG.update_path)); strcopy(Settings.update_path, val, sizeof(Settings.update_path));
return; return;
} }
if (strcmp(name, "oggload_path") == 0) { if (strcmp(name, "oggload_path") == 0) {
strcopy(CFG.oggload_path, val, sizeof(CFG.oggload_path)); strcopy(Settings.oggload_path, val, sizeof(Settings.oggload_path));
return; return;
} }
if (strcmp(name, "ogg_path") == 0) { if (strcmp(name, "ogg_path") == 0) {
strcopy(CFG.ogg_path, val, sizeof(CFG.ogg_path)); strcopy(Settings.ogg_path, val, sizeof(Settings.ogg_path));
return; return;
} }
cfg_int("parentalcontrol", &CFG.parentalcontrol, 4);
cfg_bool("godmode", &CFG.godmode);
if (strcmp(name, "unlock_code") == 0) {
strcopy(CFG.unlockCode, val, sizeof(CFG.unlockCode));
return; return;
}
} }
@ -1015,6 +962,10 @@ void global_cfg_set(char *name, char *val)
} }
return; return;
} }
cfg_bool("godmode", &Settings.godmode);
return;
} }
// split line to part1 delimiter part2 // split line to part1 delimiter part2
@ -1213,26 +1164,26 @@ bool cfg_save_global()// save global settings
fprintf(f, "qboot = %d\n ", Settings.qboot); fprintf(f, "qboot = %d\n ", Settings.qboot);
fprintf(f, "unicodefix = %d\n ", Settings.unicodefix); fprintf(f, "unicodefix = %d\n ", Settings.unicodefix);
fprintf(f, "wsprompt = %d\n", Settings.wsprompt); fprintf(f, "wsprompt = %d\n", Settings.wsprompt);
fprintf(f, "parentalcontrol = %d\n ", CFG.parentalcontrol); fprintf(f, "parentalcontrol = %d\n ", Settings.parentalcontrol);
fprintf(f, "cover_path = %s\n ", CFG.covers_path); fprintf(f, "cover_path = %s\n ", Settings.covers_path);
if(CFG.widescreen) { if(CFG.widescreen) {
fprintf(f, "wtheme_path = %s\n ", CFG.theme_path); fprintf(f, "wtheme_path = %s\n ", CFG.theme_path);
} else { } else {
fprintf(f, "theme_path = %s\n ", CFG.theme_path); fprintf(f, "theme_path = %s\n ", CFG.theme_path);
} }
fprintf(f, "disc_path = %s\n ", CFG.disc_path); fprintf(f, "disc_path = %s\n ", Settings.disc_path);
fprintf(f, "language_path = %s\n ", CFG.language_path); fprintf(f, "language_path = %s\n ", Settings.language_path);
fprintf(f, "oggload_path = %s\n ", CFG.oggload_path); fprintf(f, "oggload_path = %s\n ", Settings.oggload_path);
fprintf(f, "titlestxt_path = %s\n ", CFG.titlestxt_path); fprintf(f, "titlestxt_path = %s\n ", Settings.titlestxt_path);
if(!strcmp("", Settings.unlockCode)) { if(!strcmp("", Settings.unlockCode)) {
fprintf(f, "godmode = %d\n ", CFG.godmode); fprintf(f, "godmode = %d\n ", Settings.godmode);
} else { } else {
fprintf(f, "godmode = %d\n ", 0); fprintf(f, "godmode = %d\n ", 0);
} }
fprintf(f, "ogg_path = %s\n ", CFG.ogg_path); fprintf(f, "ogg_path = %s\n ", Settings.ogg_path);
fprintf(f, "wiilight = %d\n ", Settings.wiilight); fprintf(f, "wiilight = %d\n ", Settings.wiilight);
fprintf(f, "gameDisplay = %d\n ", Settings.gameDisplay); fprintf(f, "gameDisplay = %d\n ", Settings.gameDisplay);
fprintf(f, "update_path = %s\n ", CFG.update_path); fprintf(f, "update_path = %s\n ", Settings.update_path);
fprintf(f, "patchcountrystrings = %d\n ", Settings.patchcountrystrings); fprintf(f, "patchcountrystrings = %d\n ", Settings.patchcountrystrings);
fclose(f); fclose(f);
return true; return true;
@ -1560,22 +1511,15 @@ void CFG_Load(void)
snprintf(pathname, sizeof(pathname), "SD:/config/GXGlobal.cfg"); snprintf(pathname, sizeof(pathname), "SD:/config/GXGlobal.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, &path_set); //then set config and layout options
snprintf(pathname, sizeof(pathname), "%sGXtheme.cfg", CFG.theme_path); snprintf(pathname, sizeof(pathname), "%sGXtheme.cfg", CFG.theme_path);
cfg_parsefile(pathname, &theme_set); //finally set console information cfg_parsefile(pathname, &theme_set); //finally set theme information
snprintf(pathname, sizeof(pathname), CFG.language_path); snprintf(pathname, sizeof(pathname), Settings.language_path);
cfg_parsefile(pathname, &language_set); cfg_parsefile(pathname, &language_set);
// if (!ret) snprintf(pathname, sizeof(pathname), "%stitles.txt", Settings.titlestxt_path);
// {
// 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), "%stitles.txt", CFG.titlestxt_path);
cfg_parsefile(pathname, &title_set); cfg_parsefile(pathname, &title_set);
cfg_parsefile("SD:/config/GXGameSettings.cfg", &parental_set); cfg_parsefile("SD:/config/GXGameSettings.cfg", &parental_set);
@ -1584,48 +1528,12 @@ void CFG_Load(void)
cfg_load_games(); cfg_load_games();
cfg_load_game_num(); cfg_load_game_num();
// cfg_parsearg(argc, argv); Global_Default(); //global default depends on theme information
} CFG_LoadGlobal();
/*
<<<<<<< .mine
//set app path
// chdir_app(argv[0]);
CFG_Default(-1); // set defaults non forced
snprintf(pathname, sizeof(pathname), "SD:/config/GXGlobal.cfg");
cfg_parsefile(pathname, &widescreen_set); //first set widescreen
cfg_parsefile(pathname, &cfg_set); //then set config and layout options
snprintf(pathname, sizeof(pathname), "%sGXtheme.cfg", CFG.theme_path);
cfg_parsefile(pathname, &theme_set); //finally set console information
snprintf(pathname, sizeof(pathname), "%slanguage.txt",CFG.language_path);
cfg_parsefile(pathname, &language_set);
// 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();
lang_default();
language_set();
// cfg_parsearg(argc, argv); // cfg_parsearg(argc, argv);
} }
=======
>>>>>>> .r348*/
void CFG_LoadGlobal(void) void CFG_LoadGlobal(void)
{ {
cfg_parsefile("SD:/config/GXGlobal.cfg", &global_cfg_set); cfg_parsefile("SD:/config/GXGlobal.cfg", &global_cfg_set);

View File

@ -42,38 +42,11 @@ extern "C"
#define CFG_ALIGN_MIDDLE 5 #define CFG_ALIGN_MIDDLE 5
extern char *cfg_path; extern char *cfg_path;
//extern char *cfg_images_path;
struct CFG struct CFG
{ {
// char *background;
// short covers;
// short simple;
// short video;
// short language;
// short ocarina;
// short vipatch;
// short home;
// short download;
// short installdownload;
// short hidesettingmenu;
// short savesettings;
short widescreen; short widescreen;
short parentalcontrol;
// short maxcharacters;
short godmode;
short xflip;
short wsprompt;
char unlockCode[20];
char covers_path[100];
char theme_path[100]; char theme_path[100];
char disc_path[100];
char titlestxt_path[100];
char language_path[100];
char oggload_path[100];
char ogg_path[150];
char update_path[150];
short keyset;
}; };
@ -355,6 +328,16 @@ struct SSettings {
int wiilight; int wiilight;
int gameDisplay; int gameDisplay;
int patchcountrystrings; int patchcountrystrings;
short godmode;
char covers_path[100];
char theme_path[100];
char wtheme_path[100];
char disc_path[100];
char titlestxt_path[100];
char language_path[100];
char oggload_path[100];
char ogg_path[150];
char update_path[150];
}; };
void CFG_LoadGlobal(void); void CFG_LoadGlobal(void);

View File

@ -115,15 +115,15 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int count, co
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]); snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); //Load full id image snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull); //Load full id image
cover[i] = new GuiImageData(imgPath,0); cover[i] = new GuiImageData(imgPath,0);
if (!cover[i]->GetImage()) { if (!cover[i]->GetImage()) {
delete cover[i]; delete cover[i];
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); //Load short id image snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID); //Load short id image
cover[i] = new GuiImageData(imgPath, 0); cover[i] = new GuiImageData(imgPath, 0);
if (!cover[i]->GetImage()) { if (!cover[i]->GetImage()) {
delete cover[i]; delete cover[i];
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); //Load no image snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path); //Load no image
cover[i] = new GuiImageData(imgPath, nocover_png); cover[i] = new GuiImageData(imgPath, nocover_png);
} }
} }
@ -458,15 +458,15 @@ void GuiGameCarousel::Reload(struct discHdr * l, int count)
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]); snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); //Load full id image snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull); //Load full id image
cover[i] = new GuiImageData(imgPath,0); cover[i] = new GuiImageData(imgPath,0);
if (!cover[i]->GetImage()) { if (!cover[i]->GetImage()) {
delete cover[i]; delete cover[i];
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); //Load short id image snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID); //Load short id image
cover[i] = new GuiImageData(imgPath, 0); cover[i] = new GuiImageData(imgPath, 0);
if (!cover[i]->GetImage()) { if (!cover[i]->GetImage()) {
delete cover[i]; delete cover[i];
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); //Load no image snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path); //Load no image
cover[i] = new GuiImageData(imgPath, nocover_png); cover[i] = new GuiImageData(imgPath, nocover_png);
} }
} }

View File

@ -103,19 +103,19 @@ GuiGameGrid::GuiGameGrid(int w, int h, struct discHdr * l, int gameCnt, const ch
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]); snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull);
cover[i] = new GuiImageData(imgPath,0); //load short id cover[i] = new GuiImageData(imgPath,0); //load short id
if (!cover[i]->GetImage()) //if could not load the short id image if (!cover[i]->GetImage()) //if could not load the short id image
{ {
delete cover[i]; delete cover[i];
cover[i] = NULL; cover[i] = NULL;
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID);
cover[i] = new GuiImageData(imgPath, 0); //load full id image cover[i] = new GuiImageData(imgPath, 0); //load full id image
if (!cover[i]->GetImage()) if (!cover[i]->GetImage())
{ {
delete cover[i]; delete cover[i];
cover[i] = NULL; cover[i] = NULL;
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path);
cover[i] = new GuiImageData(imgPath, nocover_png); //load no image cover[i] = new GuiImageData(imgPath, nocover_png); //load no image
} }
} }
@ -364,19 +364,19 @@ void GuiGameGrid::Update(GuiTrigger * t)
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]); snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull);
cover[i] = new GuiImageData(imgPath,0); //load short id cover[i] = new GuiImageData(imgPath,0); //load short id
if (!cover[i]->GetImage()) //if could not load the short id image if (!cover[i]->GetImage()) //if could not load the short id image
{ {
delete cover[i]; delete cover[i];
cover[i] = NULL; cover[i] = NULL;
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID);
cover[i] = new GuiImageData(imgPath, 0); //load full id image cover[i] = new GuiImageData(imgPath, 0); //load full id image
if (!cover[i]->GetImage()) if (!cover[i]->GetImage())
{ {
delete cover[i]; delete cover[i];
cover[i] = NULL; cover[i] = NULL;
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path);
cover[i] = new GuiImageData(imgPath, nocover_png); //load no image cover[i] = new GuiImageData(imgPath, nocover_png); //load no image
} }
} }
@ -421,19 +421,19 @@ void GuiGameGrid::Update(GuiTrigger * t)
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]); snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull);
cover[i] = new GuiImageData(imgPath,0); //load short id cover[i] = new GuiImageData(imgPath,0); //load short id
if (!cover[i]->GetImage()) //if could not load the short id image if (!cover[i]->GetImage()) //if could not load the short id image
{ {
delete cover[i]; delete cover[i];
cover[i] = NULL; cover[i] = NULL;
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID);
cover[i] = new GuiImageData(imgPath, 0); //load full id image cover[i] = new GuiImageData(imgPath, 0); //load full id image
if (!cover[i]->GetImage()) if (!cover[i]->GetImage())
{ {
delete cover[i]; delete cover[i];
cover[i] = NULL; cover[i] = NULL;
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path);
cover[i] = new GuiImageData(imgPath, nocover_png); //load no image cover[i] = new GuiImageData(imgPath, nocover_png); //load no image
} }
} }
@ -497,19 +497,19 @@ void GuiGameGrid::Reload(struct discHdr * l, int count)
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]); snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull);
cover[i] = new GuiImageData(imgPath,0); //load short id cover[i] = new GuiImageData(imgPath,0); //load short id
if (!cover[i]->GetImage()) //if could not load the short id image if (!cover[i]->GetImage()) //if could not load the short id image
{ {
delete cover[i]; delete cover[i];
cover[i] = NULL; cover[i] = NULL;
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID);
cover[i] = new GuiImageData(imgPath, 0); //load full id image cover[i] = new GuiImageData(imgPath, 0); //load full id image
if (!cover[i]->GetImage()) if (!cover[i]->GetImage())
{ {
delete cover[i]; delete cover[i];
cover[i] = NULL; cover[i] = NULL;
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path);
cover[i] = new GuiImageData(imgPath, nocover_png); //load no image cover[i] = new GuiImageData(imgPath, nocover_png); //load no image
} }
} }

View File

@ -63,34 +63,6 @@ int Net_Init(char *ip){
return TRUE; return TRUE;
} }
void
DefaultSettings()
{
Settings.video = discdefault;
Settings.vpatch = off;
Settings.language = ConsoleLangDefault;
Settings.ocarina = off;
Settings.hddinfo = hr12;
Settings.sinfo = ((THEME.showID) ? GameID : Neither);
Settings.rumble = RumbleOn;
if (THEME.showRegion)
{
Settings.sinfo = ((Settings.sinfo == GameID) ? Both : GameRegion);
}
Settings.volume = v80;
Settings.tooltips = TooltipsOn;
snprintf(Settings.unlockCode, sizeof(Settings.unlockCode), "ab121b");
Settings.parentalcontrol = 0;
Settings.cios = ios249;
Settings.xflip = no;
Settings.qboot = no;
Settings.unicodefix = 0;
Settings.wiilight = 1;
Settings.patchcountrystrings = 0;
CFG_LoadGlobal();
}
// check for libfat.a from 1. Jun 2009 // check for libfat.a from 1. Jun 2009
extern int LibFat4USB_Loader_GX; extern int LibFat4USB_Loader_GX;
int fatCheck = LibFat4USB_Loader_GX; // remove when libfat newer than 1. Jun 2009 int fatCheck = LibFat4USB_Loader_GX; // remove when libfat newer than 1. Jun 2009
@ -105,9 +77,6 @@ main(int argc, char *argv[])
lang_default(); lang_default();
CFG_Load(); CFG_Load();
DefaultSettings();
SDCard_deInit();// unmount SD for reloading IOS SDCard_deInit();// unmount SD for reloading IOS
/* Load Custom IOS */ /* Load Custom IOS */

View File

@ -358,10 +358,10 @@ void WindowCredits()
} }
ResumeGui(); ResumeGui();
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) { if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
bgMusic->Play(); bgMusic->Play();
} else { } else {
bgMusic->PlayOggFile(CFG.ogg_path); bgMusic->PlayOggFile(Settings.ogg_path);
} }
bgMusic->SetPlayTime(thetimeofbg); bgMusic->SetPlayTime(thetimeofbg);
SetVolumeOgg(255*(vol/100.0)); SetVolumeOgg(255*(vol/100.0));
@ -1000,7 +1000,7 @@ int GameWindowPrompt()
nameBtn.SetSoundClick(&btnClick); nameBtn.SetSoundClick(&btnClick);
nameBtn.SetToolTip(&nameBtnTT,24,-30, ALIGN_LEFT); nameBtn.SetToolTip(&nameBtnTT,24,-30, ALIGN_LEFT);
if (CFG.godmode == 1){ if (Settings.godmode == 1){
nameBtn.SetTrigger(&trigA); nameBtn.SetTrigger(&trigA);
nameBtn.SetEffectGrow(); nameBtn.SetEffectGrow();
} }
@ -1042,7 +1042,7 @@ int GameWindowPrompt()
btn2Img.SetWidescreen(CFG.widescreen); btn2Img.SetWidescreen(CFG.widescreen);
} }
GuiButton btn2(&btn2Img,&btn2Img, 1, 5, 0, 0, &trigA, &btnSoundOver, &btnClick,1); GuiButton btn2(&btn2Img,&btn2Img, 1, 5, 0, 0, &trigA, &btnSoundOver, &btnClick,1);
if (CFG.godmode == 1) if (Settings.godmode == 1)
{ {
btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
btn2.SetPosition(-50, -40); btn2.SetPosition(-50, -40);
@ -1104,7 +1104,7 @@ int GameWindowPrompt()
promptWindow.Append(&btnFavorite); promptWindow.Append(&btnFavorite);
//check if unlocked //check if unlocked
if (CFG.godmode == 1) if (Settings.godmode == 1)
{ {
promptWindow.Append(&btn3); promptWindow.Append(&btn3);
} }
@ -1145,13 +1145,13 @@ int GameWindowPrompt()
if (diskCover) if (diskCover)
delete diskCover; delete diskCover;
snprintf(imgPath,sizeof(imgPath),"%s%s.png", CFG.disc_path, IDFull); //changed to current full id snprintf(imgPath,sizeof(imgPath),"%s%s.png", Settings.disc_path, IDFull); //changed to current full id
diskCover = new GuiImageData(imgPath,0); diskCover = new GuiImageData(imgPath,0);
if (!diskCover->GetImage()) if (!diskCover->GetImage())
{ {
delete diskCover; delete diskCover;
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.disc_path, ID); //changed to current id snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.disc_path, ID); //changed to current id
diskCover = new GuiImageData(imgPath, 0); diskCover = new GuiImageData(imgPath, 0);
@ -1159,12 +1159,12 @@ int GameWindowPrompt()
{ snprintf (ID,sizeof(ID),"%c%c%c%c", header->id[0], header->id[1], header->id[2], header->id[3]); { snprintf (ID,sizeof(ID),"%c%c%c%c", header->id[0], header->id[1], header->id[2], header->id[3]);
delete diskCover; delete diskCover;
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.disc_path, ID); //changed to current id snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.disc_path, ID); //changed to current id
diskCover = new GuiImageData(imgPath, 0); diskCover = new GuiImageData(imgPath, 0);
if (!diskCover->GetImage()) if (!diskCover->GetImage())
{ {
delete diskCover; delete diskCover;
snprintf(imgPath, sizeof(imgPath), "%snodisc.png", CFG.disc_path); //changed to nodisc.png snprintf(imgPath, sizeof(imgPath), "%snodisc.png", Settings.disc_path); //changed to nodisc.png
diskCover = new GuiImageData(imgPath,nodisc_png); diskCover = new GuiImageData(imgPath,nodisc_png);
} }
} }
@ -1723,10 +1723,10 @@ int NetworkInitPromp(int choice2)
if (choice2 != 3) { if (choice2 != 3) {
snprintf (filename,sizeof(filename),"%c%c%c.png", header->id[0], header->id[1], header->id[2]); snprintf (filename,sizeof(filename),"%c%c%c.png", header->id[0], header->id[1], header->id[2]);
found2 = findfile(filename, CFG.covers_path); found2 = findfile(filename, Settings.covers_path);
snprintf(filename,sizeof(filename),"%c%c%c%c%c%c.png",header->id[0], header->id[1], header->id[2], snprintf(filename,sizeof(filename),"%c%c%c%c%c%c.png",header->id[0], header->id[1], header->id[2],
header->id[3], header->id[4], header->id[5]); //full id header->id[3], header->id[4], header->id[5]); //full id
found1 = findfile(filename, CFG.covers_path); found1 = findfile(filename, Settings.covers_path);
if (!found1 && !found2) //if could not find any image if (!found1 && !found2) //if could not find any image
{ {
snprintf(missingFiles[cntMissFiles],11,"%s",filename); snprintf(missingFiles[cntMissFiles],11,"%s",filename);
@ -1735,10 +1735,10 @@ int NetworkInitPromp(int choice2)
} }
else if (choice2 == 3) { else if (choice2 == 3) {
snprintf (filename,sizeof(filename),"%c%c%c.png", header->id[0], header->id[1], header->id[2]); snprintf (filename,sizeof(filename),"%c%c%c.png", header->id[0], header->id[1], header->id[2]);
found2 = findfile(filename, CFG.disc_path); found2 = findfile(filename, Settings.disc_path);
snprintf(filename,sizeof(filename),"%c%c%c%c%c%c.png",header->id[0], header->id[1], header->id[2], snprintf(filename,sizeof(filename),"%c%c%c%c%c%c.png",header->id[0], header->id[1], header->id[2],
header->id[3], header->id[4], header->id[5]); //full id header->id[3], header->id[4], header->id[5]); //full id
found1 = findfile(filename,CFG.disc_path); found1 = findfile(filename,Settings.disc_path);
if (!found1 && !found2) if (!found1 && !found2)
{ {
snprintf(missingFiles[cntMissFiles],11,"%s",filename); snprintf(missingFiles[cntMissFiles],11,"%s",filename);
@ -2039,9 +2039,9 @@ ProgressDownloadWindow(int choice2)
//check if directory exist and if not create one //check if directory exist and if not create one
struct stat st; struct stat st;
if(stat(CFG.covers_path, &st) != 0) { if(stat(Settings.covers_path, &st) != 0) {
char dircovers[100]; char dircovers[100];
snprintf(dircovers,strlen(CFG.covers_path),"%s",CFG.covers_path); snprintf(dircovers,strlen(Settings.covers_path),"%s",Settings.covers_path);
if (mkdir(dircovers, 0777) == -1) { if (mkdir(dircovers, 0777) == -1) {
if(subfoldercheck(dircovers) != 1) { if(subfoldercheck(dircovers) != 1) {
WindowPrompt(LANGUAGE.Error,LANGUAGE.Cantcreatedirectory,LANGUAGE.ok,0,0,0); WindowPrompt(LANGUAGE.Error,LANGUAGE.Cantcreatedirectory,LANGUAGE.ok,0,0,0);
@ -2049,9 +2049,9 @@ ProgressDownloadWindow(int choice2)
} }
} }
} }
if(stat(CFG.disc_path,&st) != 0) { if(stat(Settings.disc_path,&st) != 0) {
char dirdiscs[100]; char dirdiscs[100];
snprintf(dirdiscs,strlen(CFG.disc_path),"%s",CFG.disc_path); snprintf(dirdiscs,strlen(Settings.disc_path),"%s",Settings.disc_path);
if (mkdir(dirdiscs, 0777) == -1) { if (mkdir(dirdiscs, 0777) == -1) {
if(subfoldercheck(dirdiscs) != 1) { if(subfoldercheck(dirdiscs) != 1) {
WindowPrompt(LANGUAGE.Error,LANGUAGE.Cantcreatedirectory,LANGUAGE.ok,0,0,0); WindowPrompt(LANGUAGE.Error,LANGUAGE.Cantcreatedirectory,LANGUAGE.ok,0,0,0);
@ -2085,17 +2085,17 @@ ProgressDownloadWindow(int choice2)
if (choice2 == 2) if (choice2 == 2)
{ {
sprintf(URLFile,"http://www.theotherzone.com/wii/3d/176/248/%s",missingFiles[i]); // For 3D Covers sprintf(URLFile,"http://www.theotherzone.com/wii/3d/176/248/%s",missingFiles[i]); // For 3D Covers
sprintf(imgPath,"%s%s", CFG.covers_path, missingFiles[i]); sprintf(imgPath,"%s%s", Settings.covers_path, missingFiles[i]);
} }
if(choice2 == 3) if(choice2 == 3)
{ {
sprintf(URLFile,"http://www.theotherzone.com/wii/diskart/160/160/%s",missingFiles[i]); sprintf(URLFile,"http://www.theotherzone.com/wii/diskart/160/160/%s",missingFiles[i]);
sprintf(imgPath,"%s%s", CFG.disc_path, missingFiles[i]); sprintf(imgPath,"%s%s", Settings.disc_path, missingFiles[i]);
} }
if(choice2 == 1) if(choice2 == 1)
{ {
sprintf(URLFile,"http://www.theotherzone.com/wii/resize/160/224/%s",missingFiles[i]); sprintf(URLFile,"http://www.theotherzone.com/wii/resize/160/224/%s",missingFiles[i]);
sprintf(imgPath,"%s%s", CFG.covers_path, missingFiles[i]); sprintf(imgPath,"%s%s", Settings.covers_path, missingFiles[i]);
} }
struct block file = downloadfile(URLFile);//reject known bad images struct block file = downloadfile(URLFile);//reject known bad images
@ -2132,15 +2132,15 @@ ProgressDownloadWindow(int choice2)
char URLFile[100]; char URLFile[100];
if (choice2 == 2) { if (choice2 == 2) {
sprintf(URLFile,"http://www.theotherzone.com/wii/3d/176/248/%s",missingFiles[0]); // For 3D Covers sprintf(URLFile,"http://www.theotherzone.com/wii/3d/176/248/%s",missingFiles[0]); // For 3D Covers
sprintf(imgPath,"%s%s", CFG.covers_path, missingFiles[0]); sprintf(imgPath,"%s%s", Settings.covers_path, missingFiles[0]);
} }
if(choice2 == 3) { if(choice2 == 3) {
sprintf(URLFile,"http://www.theotherzone.com/wii/diskart/160/160/%s",missingFiles[0]); sprintf(URLFile,"http://www.theotherzone.com/wii/diskart/160/160/%s",missingFiles[0]);
sprintf(imgPath,"%s%s", CFG.disc_path, missingFiles[0]); sprintf(imgPath,"%s%s", Settings.disc_path, missingFiles[0]);
} }
if(choice2 == 1) { if(choice2 == 1) {
sprintf(URLFile,"http://www.theotherzone.com/wii/resize/160/224/%s",missingFiles[0]); sprintf(URLFile,"http://www.theotherzone.com/wii/resize/160/224/%s",missingFiles[0]);
sprintf(imgPath,"%s%s", CFG.covers_path, missingFiles[0]); sprintf(imgPath,"%s%s", Settings.covers_path, missingFiles[0]);
} }
struct block file = downloadfile(URLFile); struct block file = downloadfile(URLFile);
@ -2277,9 +2277,9 @@ ProgressUpdateWindow()
ResumeGui(); ResumeGui();
struct stat st; struct stat st;
if(stat(CFG.update_path, &st) != 0) { if(stat(Settings.update_path, &st) != 0) {
char dir[100]; char dir[100];
snprintf(dir,strlen(CFG.update_path),"%s",CFG.update_path); snprintf(dir,strlen(Settings.update_path),"%s",Settings.update_path);
if (mkdir(dir, 0777) == -1) { if (mkdir(dir, 0777) == -1) {
if(subfoldercheck(dir) != 1) { if(subfoldercheck(dir) != 1) {
WindowPrompt(LANGUAGE.Error,LANGUAGE.Cantcreatedirectory,LANGUAGE.ok,0,0,0); WindowPrompt(LANGUAGE.Error,LANGUAGE.Cantcreatedirectory,LANGUAGE.ok,0,0,0);
@ -2291,8 +2291,8 @@ ProgressUpdateWindow()
char dolpath[150]; char dolpath[150];
char dolpathsuccess[150]; char dolpathsuccess[150];
snprintf(dolpath, sizeof(dolpath), "%sbootnew.dol", CFG.update_path); snprintf(dolpath, sizeof(dolpath), "%sbootnew.dol", Settings.update_path);
snprintf(dolpathsuccess, sizeof(dolpathsuccess), "%sboot.dol", CFG.update_path); snprintf(dolpathsuccess, sizeof(dolpathsuccess), "%sboot.dol", Settings.update_path);
while (!IP && !(ret < 0)) { while (!IP && !(ret < 0)) {
@ -2419,7 +2419,7 @@ ProgressUpdateWindow()
char xmliconpath[150]; char xmliconpath[150];
file = downloadfile("http://www.techjawa.com/usbloadergx/meta.file"); file = downloadfile("http://www.techjawa.com/usbloadergx/meta.file");
if(file.data != NULL){ if(file.data != NULL){
sprintf(xmliconpath, "%smeta.xml", CFG.update_path); sprintf(xmliconpath, "%smeta.xml", Settings.update_path);
pfile = fopen(xmliconpath, "wb"); pfile = fopen(xmliconpath, "wb");
fwrite(file.data,1,file.size,pfile); fwrite(file.data,1,file.size,pfile);
fclose(pfile); fclose(pfile);
@ -2427,7 +2427,7 @@ ProgressUpdateWindow()
} }
file = downloadfile("http://www.techjawa.com/usbloadergx/icon.png"); file = downloadfile("http://www.techjawa.com/usbloadergx/icon.png");
if(file.data != NULL){ if(file.data != NULL){
sprintf(xmliconpath, "%sicon.png", CFG.update_path); sprintf(xmliconpath, "%sicon.png", Settings.update_path);
pfile = fopen(xmliconpath, "wb"); pfile = fopen(xmliconpath, "wb");
fwrite(file.data,1,file.size,pfile); fwrite(file.data,1,file.size,pfile);
fclose(pfile); fclose(pfile);
@ -2667,13 +2667,13 @@ s32 __Menu_GetEntries(void)
cnt = cnt2; cnt = cnt2;
} }
if (CFG.parentalcontrol && !CFG.godmode) { if (Settings.parentalcontrol && !Settings.godmode) {
u32 cnt2 = 0; u32 cnt2 = 0;
for (u32 i = 0; i < cnt; i++) for (u32 i = 0; i < cnt; i++)
{ {
header = &buffer[i]; header = &buffer[i];
if (get_block(header) < CFG.parentalcontrol) { if (get_block(header) < Settings.parentalcontrol) {
buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr)); buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr));
if (!buffer2) if (!buffer2)
{ {
@ -3261,7 +3261,7 @@ static int MenuDiscList()
DownloadBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP); DownloadBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
DownloadBtn.SetPosition(THEME.cover_x,THEME.cover_y); DownloadBtn.SetPosition(THEME.cover_x,THEME.cover_y);
if (CFG.godmode == 1) if (Settings.godmode == 1)
{//only make the button have trigger & tooltip if in godmode {//only make the button have trigger & tooltip if in godmode
DownloadBtn.SetSoundOver(&btnSoundOver); DownloadBtn.SetSoundOver(&btnSoundOver);
DownloadBtn.SetTrigger(&trigA); DownloadBtn.SetTrigger(&trigA);
@ -3312,7 +3312,7 @@ static int MenuDiscList()
w.Append(&sdcardBtn); w.Append(&sdcardBtn);
w.Append(&poweroffBtn); w.Append(&poweroffBtn);
if (CFG.godmode) if (Settings.godmode)
w.Append(&installBtn); w.Append(&installBtn);
w.Append(&homeBtn); w.Append(&homeBtn);
w.Append(&settingsBtn); w.Append(&settingsBtn);
@ -3402,10 +3402,10 @@ static int MenuDiscList()
s32 thetimeofbg = bgMusic->GetPlayTime(); s32 thetimeofbg = bgMusic->GetPlayTime();
bgMusic->Stop(); bgMusic->Stop();
choice = WindowExitPrompt(LANGUAGE.ExitUSBISOLoader,0, LANGUAGE.BacktoLoader,LANGUAGE.WiiMenu,LANGUAGE.Back,0); choice = WindowExitPrompt(LANGUAGE.ExitUSBISOLoader,0, LANGUAGE.BacktoLoader,LANGUAGE.WiiMenu,LANGUAGE.Back,0);
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) { if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
bgMusic->Play(); bgMusic->Play();
} else { } else {
bgMusic->PlayOggFile(CFG.ogg_path); bgMusic->PlayOggFile(Settings.ogg_path);
} }
bgMusic->SetPlayTime(thetimeofbg); bgMusic->SetPlayTime(thetimeofbg);
SetVolumeOgg(255*(vol/100.0)); SetVolumeOgg(255*(vol/100.0));
@ -3875,17 +3875,17 @@ static int MenuDiscList()
cover = NULL; cover = NULL;
} }
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull);
cover = new GuiImageData(imgPath,0); //load short id cover = new GuiImageData(imgPath,0); //load short id
if (!cover->GetImage()) //if could not load the short id image if (!cover->GetImage()) //if could not load the short id image
{ {
delete cover; delete cover;
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID);
cover = new GuiImageData(imgPath, 0); //load full id image cover = new GuiImageData(imgPath, 0); //load full id image
if (!cover->GetImage()) if (!cover->GetImage())
{ {
delete cover; delete cover;
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path);
cover = new GuiImageData(imgPath, nocover_png); //load no image cover = new GuiImageData(imgPath, nocover_png); //load no image
} }
} }
@ -4507,7 +4507,7 @@ static int MenuSettings()
page3Btn.SetTrigger(2, &trigPlus); page3Btn.SetTrigger(2, &trigPlus);
const char * text = LANGUAGE.Unlock; const char * text = LANGUAGE.Unlock;
if (CFG.godmode == 1) if (Settings.godmode == 1)
text = LANGUAGE.Lock; text = LANGUAGE.Lock;
GuiText lockBtnTxt(text, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); GuiText lockBtnTxt(text, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
lockBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); lockBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
@ -4772,15 +4772,15 @@ 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 ) if (Settings.parentalcontrol > 3 )
CFG.parentalcontrol = 0; Settings.parentalcontrol = 0;
if ( CFG.godmode != 1) options2.SetValue(0, "********"); if ( Settings.godmode != 1) options2.SetValue(0, "********");
else if (!strcmp("", Settings.unlockCode)) options2.SetValue(0, "%s",LANGUAGE.notset); else if (!strcmp("", Settings.unlockCode)) options2.SetValue(0, "%s",LANGUAGE.notset);
else options2.SetValue(0, Settings.unlockCode); else options2.SetValue(0, Settings.unlockCode);
if (CFG.godmode != 1) options2.SetValue(1, "********"); if (Settings.godmode != 1) options2.SetValue(1, "********");
else if (Settings.cios == ios249) options2.SetValue(1,"cIOS 249"); else if (Settings.cios == ios249) options2.SetValue(1,"cIOS 249");
else if (Settings.cios == ios222) options2.SetValue(1,"cIOS 222"); else if (Settings.cios == ios222) options2.SetValue(1,"cIOS 222");
@ -4796,14 +4796,14 @@ static int MenuSettings()
if (Settings.wsprompt == no) options2.SetValue(4,"%s",LANGUAGE.Normal); if (Settings.wsprompt == no) options2.SetValue(4,"%s",LANGUAGE.Normal);
else if (Settings.wsprompt == yes) options2.SetValue(4,"%s",LANGUAGE.WidescreenFix); else if (Settings.wsprompt == yes) options2.SetValue(4,"%s",LANGUAGE.WidescreenFix);
if (CFG.godmode != 1) options2.SetValue(5, "********"); if (Settings.godmode != 1) options2.SetValue(5, "********");
else if(CFG.parentalcontrol == 0) options2.SetValue(5, "0"); else if(Settings.parentalcontrol == 0) options2.SetValue(5, "0");
else if(CFG.parentalcontrol == 1) options2.SetValue(5, "1"); else if(Settings.parentalcontrol == 1) options2.SetValue(5, "1");
else if(CFG.parentalcontrol == 2) options2.SetValue(5, "2"); else if(Settings.parentalcontrol == 2) options2.SetValue(5, "2");
else if(CFG.parentalcontrol == 3) options2.SetValue(5, "3"); else if(Settings.parentalcontrol == 3) options2.SetValue(5, "3");
options2.SetValue(6, "%s", CFG.covers_path); options2.SetValue(6, "%s", Settings.covers_path);
options2.SetValue(7, "%s", CFG.disc_path); options2.SetValue(7, "%s", Settings.disc_path);
options2.SetValue(8, "%s", CFG.theme_path); options2.SetValue(8, "%s", CFG.theme_path);
ret = optionBrowser2.GetClickedOption(); ret = optionBrowser2.GetClickedOption();
@ -4812,7 +4812,7 @@ static int MenuSettings()
{ {
case 0: // Modify Password case 0: // Modify Password
if ( CFG.godmode == 1) if ( Settings.godmode == 1)
{ {
mainWindow->Remove(&optionBrowser2); mainWindow->Remove(&optionBrowser2);
mainWindow->Remove(&page1Btn); mainWindow->Remove(&page1Btn);
@ -4845,7 +4845,7 @@ static int MenuSettings()
} }
break; break;
case 1: case 1:
if ( CFG.godmode == 1) if ( Settings.godmode == 1)
Settings.cios++; Settings.cios++;
break; break;
case 2: case 2:
@ -4858,11 +4858,11 @@ static int MenuSettings()
Settings.wsprompt++; Settings.wsprompt++;
break; break;
case 5: case 5:
if ( CFG.godmode == 1) if ( Settings.godmode == 1)
CFG.parentalcontrol++; Settings.parentalcontrol++;
break; break;
case 6: case 6:
if ( CFG.godmode == 1) if ( Settings.godmode == 1)
{ {
mainWindow->Remove(&optionBrowser2); mainWindow->Remove(&optionBrowser2);
mainWindow->Remove(&page1Btn); mainWindow->Remove(&page1Btn);
@ -4873,7 +4873,7 @@ static int MenuSettings()
w.Remove(&lockBtn); w.Remove(&lockBtn);
w.Remove(&updateBtn); w.Remove(&updateBtn);
char entered[43] = ""; char entered[43] = "";
strncpy(entered, CFG.covers_path, sizeof(entered)); strncpy(entered, Settings.covers_path, sizeof(entered));
int result = OnScreenKeyboard(entered,43,4); int result = OnScreenKeyboard(entered,43,4);
mainWindow->Append(&optionBrowser2); mainWindow->Append(&optionBrowser2);
mainWindow->Append(&page1Btn); mainWindow->Append(&page1Btn);
@ -4888,7 +4888,7 @@ static int MenuSettings()
int len = (strlen(entered)-1); int len = (strlen(entered)-1);
if(entered[len] !='/') if(entered[len] !='/')
strncat (entered, "/", 1); strncat (entered, "/", 1);
strncpy(CFG.covers_path, entered, sizeof(CFG.covers_path)); strncpy(Settings.covers_path, entered, sizeof(Settings.covers_path));
WindowPrompt(LANGUAGE.CoverpathChanged,0,LANGUAGE.ok,0,0,0); WindowPrompt(LANGUAGE.CoverpathChanged,0,LANGUAGE.ok,0,0,0);
if(!isSdInserted()) { if(!isSdInserted()) {
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0); WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0);
@ -4901,7 +4901,7 @@ static int MenuSettings()
} }
break; break;
case 7: case 7:
if ( CFG.godmode == 1) if ( Settings.godmode == 1)
{ {
mainWindow->Remove(&optionBrowser2); mainWindow->Remove(&optionBrowser2);
mainWindow->Remove(&page1Btn); mainWindow->Remove(&page1Btn);
@ -4912,7 +4912,7 @@ static int MenuSettings()
w.Remove(&lockBtn); w.Remove(&lockBtn);
w.Remove(&updateBtn); w.Remove(&updateBtn);
char entered[43] = ""; char entered[43] = "";
strncpy(entered, CFG.disc_path, sizeof(entered)); strncpy(entered, Settings.disc_path, sizeof(entered));
int result = OnScreenKeyboard(entered, 43,4); int result = OnScreenKeyboard(entered, 43,4);
mainWindow->Append(&optionBrowser2); mainWindow->Append(&optionBrowser2);
mainWindow->Append(&page1Btn); mainWindow->Append(&page1Btn);
@ -4927,7 +4927,7 @@ static int MenuSettings()
int len = (strlen(entered)-1); int len = (strlen(entered)-1);
if(entered[len] !='/') if(entered[len] !='/')
strncat (entered, "/", 1); strncat (entered, "/", 1);
strncpy(CFG.disc_path, entered, sizeof(CFG.disc_path)); strncpy(Settings.disc_path, entered, sizeof(Settings.disc_path));
WindowPrompt(LANGUAGE.DiscpathChanged,0,LANGUAGE.ok,0,0,0); WindowPrompt(LANGUAGE.DiscpathChanged,0,LANGUAGE.ok,0,0,0);
if(!isSdInserted()) { if(!isSdInserted()) {
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0); WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0);
@ -4940,7 +4940,7 @@ static int MenuSettings()
} }
break; break;
case 8: case 8:
if ( CFG.godmode == 1) if ( Settings.godmode == 1)
{ {
mainWindow->Remove(&optionBrowser2); mainWindow->Remove(&optionBrowser2);
mainWindow->Remove(&page1Btn); mainWindow->Remove(&page1Btn);
@ -5034,9 +5034,9 @@ static int MenuSettings()
if ( Settings.patchcountrystrings > 1) if ( Settings.patchcountrystrings > 1)
Settings.patchcountrystrings = 0; Settings.patchcountrystrings = 0;
options2.SetValue(0, "%s", CFG.titlestxt_path); options2.SetValue(0, "%s", Settings.titlestxt_path);
options2.SetValue(1, "%s", CFG.language_path); options2.SetValue(1, "%s", Settings.language_path);
if (Settings.keyset == us) options2.SetValue(2,"QWERTY"); if (Settings.keyset == us) options2.SetValue(2,"QWERTY");
else if (Settings.keyset == dvorak) options2.SetValue(2,"DVORAK"); else if (Settings.keyset == dvorak) options2.SetValue(2,"DVORAK");
@ -5047,16 +5047,16 @@ static int MenuSettings()
else if (Settings.unicodefix == 1) options2.SetValue(3,"%s",LANGUAGE.TChinese); else if (Settings.unicodefix == 1) options2.SetValue(3,"%s",LANGUAGE.TChinese);
else if (Settings.unicodefix == 2) options2.SetValue(3,"%s",LANGUAGE.SChinese); else if (Settings.unicodefix == 2) options2.SetValue(3,"%s",LANGUAGE.SChinese);
if(!strcmp("notset", CFG.ogg_path) || !strcmp("",CFG.oggload_path)) if(!strcmp("notset", Settings.ogg_path) || !strcmp("",Settings.oggload_path))
options2.SetValue(4, "%s", LANGUAGE.Standard); options2.SetValue(4, "%s", LANGUAGE.Standard);
else else
options2.SetValue(4, "%s", CFG.ogg_path); options2.SetValue(4, "%s", Settings.ogg_path);
if (Settings.wiilight == 0) options2.SetValue(5,"%s",LANGUAGE.OFF); if (Settings.wiilight == 0) options2.SetValue(5,"%s",LANGUAGE.OFF);
else if (Settings.wiilight == 1) options2.SetValue(5,"%s",LANGUAGE.ON); else if (Settings.wiilight == 1) options2.SetValue(5,"%s",LANGUAGE.ON);
else if (Settings.wiilight == 2) options2.SetValue(5,"%s",LANGUAGE.OnlyInstall); else if (Settings.wiilight == 2) options2.SetValue(5,"%s",LANGUAGE.OnlyInstall);
options2.SetValue(6, "%s", CFG.update_path); options2.SetValue(6, "%s", Settings.update_path);
if (Settings.patchcountrystrings == 0) options2.SetValue(7,"%s",LANGUAGE.OFF); if (Settings.patchcountrystrings == 0) options2.SetValue(7,"%s",LANGUAGE.OFF);
else if (Settings.patchcountrystrings == 1) options2.SetValue(7,"%s",LANGUAGE.ON); else if (Settings.patchcountrystrings == 1) options2.SetValue(7,"%s",LANGUAGE.ON);
@ -5068,7 +5068,7 @@ static int MenuSettings()
switch(ret) switch(ret)
{ {
case 0: case 0:
if ( CFG.godmode == 1) if ( Settings.godmode == 1)
{ {
mainWindow->Remove(&optionBrowser2); mainWindow->Remove(&optionBrowser2);
mainWindow->Remove(&page1Btn); mainWindow->Remove(&page1Btn);
@ -5079,7 +5079,7 @@ static int MenuSettings()
w.Remove(&lockBtn); w.Remove(&lockBtn);
w.Remove(&updateBtn); w.Remove(&updateBtn);
char entered[43] = ""; char entered[43] = "";
strncpy(entered, CFG.titlestxt_path, sizeof(entered)); strncpy(entered, Settings.titlestxt_path, sizeof(entered));
int result = OnScreenKeyboard(entered,43,4); int result = OnScreenKeyboard(entered,43,4);
mainWindow->Append(&optionBrowser2); mainWindow->Append(&optionBrowser2);
mainWindow->Append(&page1Btn); mainWindow->Append(&page1Btn);
@ -5094,7 +5094,7 @@ static int MenuSettings()
int len = (strlen(entered)-1); int len = (strlen(entered)-1);
if(entered[len] !='/') if(entered[len] !='/')
strncat (entered, "/", 1); strncat (entered, "/", 1);
strncpy(CFG.titlestxt_path, entered, sizeof(CFG.titlestxt_path)); strncpy(Settings.titlestxt_path, entered, sizeof(Settings.titlestxt_path));
WindowPrompt(LANGUAGE.TitlestxtpathChanged,0,LANGUAGE.ok,0,0,0); WindowPrompt(LANGUAGE.TitlestxtpathChanged,0,LANGUAGE.ok,0,0,0);
if(isSdInserted()) { if(isSdInserted()) {
cfg_save_global(); cfg_save_global();
@ -5110,7 +5110,7 @@ static int MenuSettings()
} }
break; break;
case 1: // language file path case 1: // language file path
if ( CFG.godmode == 1) if ( Settings.godmode == 1)
{ {
mainWindow->Remove(&optionBrowser2); mainWindow->Remove(&optionBrowser2);
mainWindow->Remove(&page1Btn); mainWindow->Remove(&page1Btn);
@ -5121,7 +5121,7 @@ static int MenuSettings()
w.Remove(&lockBtn); w.Remove(&lockBtn);
w.Remove(&updateBtn); w.Remove(&updateBtn);
char entered[40] = ""; char entered[40] = "";
strncpy(entered, CFG.language_path, sizeof(entered)); strncpy(entered, Settings.language_path, sizeof(entered));
int result = OnScreenKeyboard(entered, 40,0); int result = OnScreenKeyboard(entered, 40,0);
mainWindow->Append(&optionBrowser2); mainWindow->Append(&optionBrowser2);
mainWindow->Append(&tabBtn); mainWindow->Append(&tabBtn);
@ -5132,10 +5132,10 @@ static int MenuSettings()
w.Append(&lockBtn); w.Append(&lockBtn);
w.Append(&updateBtn); w.Append(&updateBtn);
if ( result == 1 ) if ( result == 1 )
{ strncpy(CFG.language_path, entered, sizeof(CFG.language_path)); { strncpy(Settings.language_path, entered, sizeof(Settings.language_path));
if(isSdInserted()) { if(isSdInserted()) {
cfg_save_global(); cfg_save_global();
if(!checkfile(CFG.language_path)) { if(!checkfile(Settings.language_path)) {
WindowPrompt(LANGUAGE.Filenotfound,LANGUAGE.Loadingstandardlanguage,LANGUAGE.ok,0,0,0); WindowPrompt(LANGUAGE.Filenotfound,LANGUAGE.Loadingstandardlanguage,LANGUAGE.ok,0,0,0);
} }
lang_default(); lang_default();
@ -5174,7 +5174,7 @@ static int MenuSettings()
Settings.patchcountrystrings++; Settings.patchcountrystrings++;
break; break;
case 6: case 6:
if ( CFG.godmode == 1) if ( Settings.godmode == 1)
{ {
mainWindow->Remove(&optionBrowser2); mainWindow->Remove(&optionBrowser2);
mainWindow->Remove(&page1Btn); mainWindow->Remove(&page1Btn);
@ -5185,7 +5185,7 @@ static int MenuSettings()
w.Remove(&lockBtn); w.Remove(&lockBtn);
w.Remove(&updateBtn); w.Remove(&updateBtn);
char entered[43] = ""; char entered[43] = "";
strncpy(entered, CFG.update_path, sizeof(entered)); strncpy(entered, Settings.update_path, sizeof(entered));
int result = OnScreenKeyboard(entered,43,4); int result = OnScreenKeyboard(entered,43,4);
mainWindow->Append(&optionBrowser2); mainWindow->Append(&optionBrowser2);
mainWindow->Append(&page1Btn); mainWindow->Append(&page1Btn);
@ -5200,7 +5200,7 @@ static int MenuSettings()
int len = (strlen(entered)-1); int len = (strlen(entered)-1);
if(entered[len] !='/') if(entered[len] !='/')
strncat (entered, "/", 1); strncat (entered, "/", 1);
strncpy(CFG.update_path, entered, sizeof(CFG.update_path)); strncpy(Settings.update_path, entered, sizeof(Settings.update_path));
WindowPrompt(LANGUAGE.Updatepathchanged,0,LANGUAGE.ok,0,0,0); WindowPrompt(LANGUAGE.Updatepathchanged,0,LANGUAGE.ok,0,0,0);
} }
} }
@ -5215,7 +5215,6 @@ static int MenuSettings()
remove("SD:/config/GXGlobal.cfg"); remove("SD:/config/GXGlobal.cfg");
lang_default(); lang_default();
CFG_Load(); CFG_Load();
DefaultSettings();
menu = MENU_SETTINGS; menu = MENU_SETTINGS;
pageToDisplay = 0; pageToDisplay = 0;
} }
@ -5267,7 +5266,7 @@ static int MenuSettings()
} }
if(updateBtn.GetState() == STATE_CLICKED) { if(updateBtn.GetState() == STATE_CLICKED) {
if(isSdInserted() && CFG.godmode) { if(isSdInserted() && Settings.godmode) {
mainWindow->Remove(&optionBrowser2); mainWindow->Remove(&optionBrowser2);
mainWindow->Remove(&page1Btn); mainWindow->Remove(&page1Btn);
mainWindow->Remove(&page2Btn); mainWindow->Remove(&page2Btn);
@ -5323,9 +5322,9 @@ static int MenuSettings()
{ {
if (!strcmp("", Settings.unlockCode)) if (!strcmp("", Settings.unlockCode))
{ {
CFG.godmode = !CFG.godmode; Settings.godmode = !Settings.godmode;
} }
else if ( CFG.godmode == 0 ) else if ( Settings.godmode == 0 )
{ {
//password check to unlock Install,Delete and Format //password check to unlock Install,Delete and Format
mainWindow->Remove(&optionBrowser2); mainWindow->Remove(&optionBrowser2);
@ -5350,9 +5349,9 @@ static int MenuSettings()
if ( result == 1 ) { if ( result == 1 ) {
if (!strcmp(entered, Settings.unlockCode)) //if password correct if (!strcmp(entered, Settings.unlockCode)) //if password correct
{ {
if (CFG.godmode == 0) { if (Settings.godmode == 0) {
WindowPrompt(LANGUAGE.CorrectPassword,LANGUAGE.InstallRenameandDeleteareunlocked,LANGUAGE.ok,0,0,0); WindowPrompt(LANGUAGE.CorrectPassword,LANGUAGE.InstallRenameandDeleteareunlocked,LANGUAGE.ok,0,0,0);
CFG.godmode = 1; Settings.godmode = 1;
__Menu_GetEntries(); __Menu_GetEntries();
menu = MENU_DISCLIST; menu = MENU_DISCLIST;
} }
@ -5368,12 +5367,12 @@ static int MenuSettings()
int choice = WindowPrompt (LANGUAGE.LockConsole,LANGUAGE.Areyousure,LANGUAGE.Yes,LANGUAGE.No,0,0); int choice = WindowPrompt (LANGUAGE.LockConsole,LANGUAGE.Areyousure,LANGUAGE.Yes,LANGUAGE.No,0,0);
if(choice == 1) { if(choice == 1) {
WindowPrompt(LANGUAGE.ConsoleLocked,LANGUAGE.USBLoaderisprotected,LANGUAGE.ok,0,0,0); WindowPrompt(LANGUAGE.ConsoleLocked,LANGUAGE.USBLoaderisprotected,LANGUAGE.ok,0,0,0);
CFG.godmode = 0; Settings.godmode = 0;
__Menu_GetEntries(); __Menu_GetEntries();
menu = MENU_DISCLIST; menu = MENU_DISCLIST;
} }
} }
if ( CFG.godmode == 1) if ( Settings.godmode == 1)
{ {
lockBtnTxt.SetText(LANGUAGE.Lock); lockBtnTxt.SetText(LANGUAGE.Lock);
} }
@ -5390,13 +5389,13 @@ static int MenuSettings()
s32 thetimeofbg = bgMusic->GetPlayTime(); s32 thetimeofbg = bgMusic->GetPlayTime();
bgMusic->Stop(); bgMusic->Stop();
choice = WindowExitPrompt(LANGUAGE.ExitUSBISOLoader,0, LANGUAGE.BacktoLoader,LANGUAGE.WiiMenu,LANGUAGE.Back,0); choice = WindowExitPrompt(LANGUAGE.ExitUSBISOLoader,0, LANGUAGE.BacktoLoader,LANGUAGE.WiiMenu,LANGUAGE.Back,0);
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path))
{ {
bgMusic->Play(); bgMusic->Play();
} }
else else
{ {
bgMusic->PlayOggFile(CFG.ogg_path); bgMusic->PlayOggFile(Settings.ogg_path);
} }
bgMusic->SetPlayTime(thetimeofbg); bgMusic->SetPlayTime(thetimeofbg);
SetVolumeOgg(255*(vol/100.0)); SetVolumeOgg(255*(vol/100.0));
@ -5414,7 +5413,7 @@ static int MenuSettings()
homo.ResetState(); homo.ResetState();
} }
} }
if(CFG.godmode) { if(Settings.godmode) {
updateBtn.SetVisible(true); updateBtn.SetVisible(true);
updateBtn.SetClickable(true); updateBtn.SetClickable(true);
} else { } else {
@ -5872,15 +5871,15 @@ int MenuOGG()
char fullpath[150]; char fullpath[150];
char shortpath[35]; char shortpath[35];
int countoggs = GetFiles(CFG.oggload_path); int countoggs = GetFiles(Settings.oggload_path);
if(!strcmp("", CFG.oggload_path)) { if(!strcmp("", Settings.oggload_path)) {
sprintf(shortpath, "%s", LANGUAGE.Standard); sprintf(shortpath, "%s", LANGUAGE.Standard);
} else if (strlen(CFG.oggload_path) < (27 + 3)) { } else if (strlen(Settings.oggload_path) < (27 + 3)) {
sprintf(shortpath, "%s", CFG.oggload_path); sprintf(shortpath, "%s", Settings.oggload_path);
} }
else { else {
strncpy(shortpath, CFG.oggload_path, 27); strncpy(shortpath, Settings.oggload_path, 27);
shortpath[27] = '\0'; shortpath[27] = '\0';
strncat(shortpath, "...", 3); strncat(shortpath, "...", 3);
} }
@ -6016,10 +6015,10 @@ int MenuOGG()
if (backBtn.GetState() == STATE_CLICKED) { if (backBtn.GetState() == STATE_CLICKED) {
if(nothingchanged == 1 && countoggs > 0) { if(nothingchanged == 1 && countoggs > 0) {
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) { if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
bgMusic->Play(); bgMusic->Play();
} else { } else {
bgMusic->PlayOggFile(CFG.ogg_path); bgMusic->PlayOggFile(Settings.ogg_path);
} }
} }
menu = MENU_SETTINGS; menu = MENU_SETTINGS;
@ -6035,7 +6034,7 @@ int MenuOGG()
w.Remove(&prevBtn); w.Remove(&prevBtn);
w.Remove(&stopBtn); w.Remove(&stopBtn);
char entered[43] = ""; char entered[43] = "";
strncpy(entered, CFG.oggload_path, sizeof(entered)); strncpy(entered, Settings.oggload_path, sizeof(entered));
int result = OnScreenKeyboard(entered,43,0); int result = OnScreenKeyboard(entered,43,0);
mainWindow->Append(&optionBrowser4); mainWindow->Append(&optionBrowser4);
w.Append(&pathBtn); w.Append(&pathBtn);
@ -6048,11 +6047,11 @@ int MenuOGG()
int len = (strlen(entered)-1); int len = (strlen(entered)-1);
if(entered[len] !='/') if(entered[len] !='/')
strncat (entered, "/", 1); strncat (entered, "/", 1);
strncpy(CFG.oggload_path, entered, sizeof(CFG.oggload_path)); strncpy(Settings.oggload_path, entered, sizeof(Settings.oggload_path));
WindowPrompt(LANGUAGE.Backgroundmusicpath,0,LANGUAGE.ok,0,0,0); WindowPrompt(LANGUAGE.Backgroundmusicpath,0,LANGUAGE.ok,0,0,0);
if(isSdInserted()) { if(isSdInserted()) {
if(!strcmp("", CFG.oggload_path)) { if(!strcmp("", Settings.oggload_path)) {
sprintf(CFG.ogg_path, "notset"); sprintf(Settings.ogg_path, "notset");
bgMusic->Play(); bgMusic->Play();
} }
cfg_save_global(); cfg_save_global();
@ -6073,15 +6072,15 @@ int MenuOGG()
if(ret>=0) { if(ret>=0) {
choice = WindowPrompt(LANGUAGE.Setasbackgroundmusic,alldirfiles[ret],LANGUAGE.Yes,LANGUAGE.No,0,0); choice = WindowPrompt(LANGUAGE.Setasbackgroundmusic,alldirfiles[ret],LANGUAGE.Yes,LANGUAGE.No,0,0);
if(choice == 1) { if(choice == 1) {
snprintf(fullpath,150,"%s%s",CFG.oggload_path,alldirfiles[ret]); snprintf(fullpath,150,"%s%s",Settings.oggload_path,alldirfiles[ret]);
choice = bgMusic->PlayOggFile(fullpath); choice = bgMusic->PlayOggFile(fullpath);
if(choice < 0) { if(choice < 0) {
WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0); WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0);
sprintf(CFG.ogg_path, "notset"); sprintf(Settings.ogg_path, "notset");
bgMusic->Play(); bgMusic->Play();
SetVolumeOgg(255*(vol/100.0)); SetVolumeOgg(255*(vol/100.0));
} else { } else {
snprintf(CFG.ogg_path, sizeof(CFG.ogg_path), "%s", fullpath); snprintf(Settings.ogg_path, sizeof(Settings.ogg_path), "%s", fullpath);
cfg_save_global(); cfg_save_global();
SetVolumeOgg(255*(vol/100.0)); SetVolumeOgg(255*(vol/100.0));
nothingchanged = 0; nothingchanged = 0;
@ -6094,14 +6093,14 @@ int MenuOGG()
if(countoggs > 0) { if(countoggs > 0) {
ret = optionBrowser4.GetSelectedOption(); ret = optionBrowser4.GetSelectedOption();
songPlaying=ret; songPlaying=ret;
snprintf(fullpath, 150,"%s%s", CFG.oggload_path,alldirfiles[ret]); snprintf(fullpath, 150,"%s%s", Settings.oggload_path,alldirfiles[ret]);
choice = bgMusic->PlayOggFile(fullpath); choice = bgMusic->PlayOggFile(fullpath);
if(choice < 0) { if(choice < 0) {
WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0); WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0);
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) { if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
bgMusic->Play(); bgMusic->Play();
} else { } else {
bgMusic->PlayOggFile(CFG.ogg_path); bgMusic->PlayOggFile(Settings.ogg_path);
} }
} }
SetVolumeOgg(255*(vol/100.0)); SetVolumeOgg(255*(vol/100.0));
@ -6116,14 +6115,14 @@ int MenuOGG()
if(countoggs > 0) { if(countoggs > 0) {
songPlaying++; songPlaying++;
if (songPlaying>(countoggs - 1)){songPlaying=0;} if (songPlaying>(countoggs - 1)){songPlaying=0;}
snprintf(fullpath,150,"%s%s", CFG.oggload_path,alldirfiles[songPlaying]); snprintf(fullpath,150,"%s%s", Settings.oggload_path,alldirfiles[songPlaying]);
choice = bgMusic->PlayOggFile(fullpath); choice = bgMusic->PlayOggFile(fullpath);
if(choice < 0) { if(choice < 0) {
WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0); WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0);
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) { if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
bgMusic->Play(); bgMusic->Play();
} else { } else {
bgMusic->PlayOggFile(CFG.ogg_path); bgMusic->PlayOggFile(Settings.ogg_path);
} }
} }
nothingchanged = 1; nothingchanged = 1;
@ -6136,14 +6135,14 @@ int MenuOGG()
if(countoggs > 0) { if(countoggs > 0) {
songPlaying--; songPlaying--;
if (songPlaying<0){songPlaying=(countoggs - 1);} if (songPlaying<0){songPlaying=(countoggs - 1);}
snprintf(fullpath,150,"%s%s", CFG.oggload_path,alldirfiles[songPlaying]); snprintf(fullpath,150,"%s%s", Settings.oggload_path,alldirfiles[songPlaying]);
choice = bgMusic->PlayOggFile(fullpath); choice = bgMusic->PlayOggFile(fullpath);
if(choice < 0) { if(choice < 0) {
WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0); WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0);
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) { if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
bgMusic->Play(); bgMusic->Play();
} else { } else {
bgMusic->PlayOggFile(CFG.ogg_path); bgMusic->PlayOggFile(Settings.ogg_path);
} }
} }
nothingchanged = 1; nothingchanged = 1;
@ -6211,10 +6210,10 @@ int MainMenu(int menu)
bgMusic->SetVolume(vol); bgMusic->SetVolume(vol);
bgMusic->SetLoop(1); //loop music bgMusic->SetLoop(1); //loop music
// startup music // startup music
if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) { if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
bgMusic->Play(); bgMusic->Play();
} else { } else {
bgMusic->PlayOggFile(CFG.ogg_path); bgMusic->PlayOggFile(Settings.ogg_path);
} }
while(currentMenu != MENU_EXIT) while(currentMenu != MENU_EXIT)