*Some fixes.

*Instant change of Language now
This commit is contained in:
dimok321 2009-05-16 19:12:36 +00:00
parent 5a535a61a6
commit 250fe45e81
5 changed files with 49 additions and 88 deletions

View File

@ -7,10 +7,7 @@
#include <ogcsys.h>
#include "cfg.h"
#include "language.h"
//#include "language.c"
extern void language_set();
extern void lang_default();
extern char* strcopy();
struct SSettings Settings;
//struct SSettings2 Settings2;
@ -450,7 +447,7 @@ void cfg_set(char *name, char *val)
return;
}
if (CFG.widescreen && strcmp(name, "wtheme_path") == 0) { // if in 16:9
strcopy(CFG.theme_path, val, sizeof(CFG.theme_path));
return;
@ -478,10 +475,10 @@ void cfg_set(char *name, char *val)
strcopy(CFG.unlockCode, val, sizeof(CFG.unlockCode));
return;
}
/*if (strcmp(name, "lang_path") == 0) {
strcopy(, val, sizeof(CFG.unlockCode));
return;
@ -649,24 +646,24 @@ void theme_set(char *name, char *val)
THEME.pagesize = x;
}
}
else if (strcmp(cfg_name, "batteryUnused") == 0) {
short x;
if (sscanf(val, "%hd", &x) == 1) {
THEME.batteryUnused = x;
}
}
else if (strcmp(cfg_name, "maxcharacters") == 0) {
short x;
if (sscanf(val, "%hd", &x) == 1) {
THEME.maxcharacters = x;
}
}
cfg_bool("show_id", &THEME.showID);
cfg_bool("show_tooltip", &THEME.showToolTip);
cfg_bool("show_hddinfo", &THEME.showHDD);
@ -1145,7 +1142,7 @@ bool CFG_forget_game_opt(u8 *id)
return cfg_save_games();
}
void CFG_Load(int argc, char **argv)
void CFG_Load()
{
char pathname[200];
// bool ret = false;
@ -1162,7 +1159,7 @@ void CFG_Load(int argc, char **argv)
snprintf(pathname, sizeof(pathname), "%stheme.txt", CFG.theme_path);
cfg_parsefile(pathname, &theme_set); //finally set console information
snprintf(pathname, sizeof(pathname), CFG.language_path);
cfg_parsefile(pathname, &language_set);
@ -1179,46 +1176,6 @@ void CFG_Load(int argc, char **argv)
// load per-game settings
cfg_load_games();
// cfg_parsearg(argc, argv);
}
void CFG_ReLoad()
{
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
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();
// cfg_parsearg(argc, argv);
}

View File

@ -159,8 +159,7 @@ struct Game_CFG
void CFG_Default(int widescreen); // -1 = non forced mode
void CFG_Load(int argc, char **argv);
void CFG_ReLoad();
void CFG_Load();
void lang_defualt();
struct Game_CFG* CFG_get_game_opt(u8 *id);
bool CFG_save_game_opt(u8 *id);

View File

@ -12,18 +12,18 @@ extern "C"
struct LANGUAGE
{
char t3Covers[10];
char AppLanguage[10];
char t3Covers[20];
char AppLanguage[20];
char Areyousure[15];
char AutoPatch[15];
char Back[10];
char Back[15];
char BacktoHBCorWiiMenu[25];
char BacktoLoader[20];
char BacktoWiiMenu[20];
char BootStandard[20];
char Both[8];
char Cantcreatedirectory[25];
char Cancel[10];
char Cancel[20];
char Cantbeformated[30];
char Cantdelete[25];
char ClicktoDownloadCovers[30];
@ -115,10 +115,10 @@ struct LANGUAGE
char Notenoughfreespace[50];
char notset[30];
char of[10];
char OFF[10];
char OFF[15];
char OfficialSite[30];
char ok[8];
char ON[10];
char ON[15];
char Parentalcontrol[25];
char Partition[20];
char Password[20];
@ -126,7 +126,7 @@ struct LANGUAGE
char Passwordhasbeenchanged[50];
char Passwordchange[30];
char PowerofftheWii[30];
char Prev[10];
char Prev[20];
char PromptsButtons[30];
char ReloadSD[20];
char RenameGameonWBFS[30];
@ -144,7 +144,7 @@ struct LANGUAGE
char secondsleft[20];
char SelectthePartition[25];
char youwanttoformat[20];
char settings[15];
char settings[25];
char ShutdowntoIdle[25];
char ShutdownSystem[25];
char Success[15];
@ -155,10 +155,10 @@ struct LANGUAGE
char ThemePath[20];
char ThemepathChanged[30];
char Themepathchange[30];
char Try[10];
char Try[20];
char Tooltips[15];
char Timeleft[15];
char Unlock[10];
char Unlock[20];
char Uninstall[15];
char USBLoaderisprotected[40];
char USBDevicenotfound[40];
@ -170,7 +170,7 @@ struct LANGUAGE
char WidescreenFix[40];
char WiiMenu[15];
char WrongPassword[30];
char Yes[10];
char Yes[20];
char YoudonthavecIOS[30];
char Japanese[20];
char German[20];
@ -184,9 +184,12 @@ struct LANGUAGE
char Korean[20];
};
extern struct LANGUAGE LANGUAGE;
char* strcopy(char *dest, char *src, int size);
void lang_default();
void language_set(char *name, char *val);
#ifdef __cplusplus
}
#endif

View File

@ -31,7 +31,7 @@
#include "video2.h"
#include "wpad.h"
#include "cfg.h"
#include "language.c"
#include "language.h"
/* Constants */
@ -111,10 +111,10 @@ main(int argc, char *argv[])
SDCard_Init();
lang_default();
CFG_Load(argc, argv);
CFG_Load();
DefaultSettings();
SDCard_deInit();

View File

@ -216,7 +216,7 @@ static void WindowCredits(void * ptr)
txt[i] = new GuiText(": http://code.google.com/p/usbloader-gui/", 20, (GXColor){255, 255, 255, 255});
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(50,y); i++; //y+=28;
txt[i] = new GuiText(LANGUAGE.OfficialSite, 20, (GXColor){255, 255, 255, 255});
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(-180,y); i++; y+=28;
@ -269,7 +269,7 @@ static void WindowCredits(void * ptr)
txt[i] = new GuiText(LANGUAGE.Specialthanksto);
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(-50,y);
i++;
txt[i] = new GuiText(":");
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(30,y+3);
i++;
@ -284,7 +284,7 @@ static void WindowCredits(void * ptr)
txt[i] = new GuiText(LANGUAGE.For);
txt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); txt[i]->SetPosition(130,y);
i++;
y+=22;
txt[i] = new GuiText("Tantric libwiigui");
@ -1999,7 +1999,7 @@ static int MenuInstall()
//GuiImageData batteryRed(battery_red_png);
//GuiImageData batteryBar(battery_bar_png);
char imgPath[100];
snprintf(imgPath, sizeof(imgPath), "%sbattery.png", CFG.theme_path);
GuiImageData battery(imgPath, battery_png);
snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", CFG.theme_path);
@ -2022,7 +2022,7 @@ static int MenuInstall()
sprintf(txt, "P%d", i+1);
else
sprintf(txt, "P%d", i+1);
batteryTxt[i] = new GuiText(txt, 22, (GXColor){THEME.info_r, THEME.info_g, THEME.info_b, 255});
batteryTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
batteryImg[i] = new GuiImage(&battery);
@ -2282,7 +2282,7 @@ static int MenuDiscList()
GuiImageData btnhomeOver(imgPath, menu_button_over_png);
snprintf(imgPath, sizeof(imgPath), "%sSDcard.png", CFG.theme_path);
GuiImageData btnsdcard(imgPath, sdcard_png);
snprintf(imgPath, sizeof(imgPath), "%sbattery.png", CFG.theme_path);
GuiImageData battery(imgPath, battery_png);
snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", CFG.theme_path);
@ -3943,7 +3943,7 @@ static int MenuSettings()
}
/////load new theme//////////////
mainWindow->Remove(bgImg);
CFG_ReLoad();
CFG_Load();
CFG_LoadGlobal();
menu = MENU_SETTINGS;
#ifdef HW_RVL
@ -3992,7 +3992,7 @@ static int MenuSettings()
}
if (pageToDisplay == 3){
sprintf(options2.value[0], " ");
if (strlen(CFG.language_path) < (9 + 3)) {
sprintf(cfgtext, "%s", CFG.language_path);
} else {
@ -4001,7 +4001,7 @@ static int MenuSettings()
strncat(cfgtext, "...", 3);
}
sprintf(options2.value[1], "%s", cfgtext);
sprintf(options2.value[2], " ");
sprintf(options2.value[3], " ");
sprintf(options2.value[4], " ");
@ -4019,7 +4019,7 @@ static int MenuSettings()
pageToDisplay = 0;
break;
/////
case 1: // language file path
if ( CFG.godmode == 1)
{
@ -4044,13 +4044,15 @@ static int MenuSettings()
{ strncpy(CFG.language_path, entered, sizeof(CFG.language_path));
if(isSdInserted() == 1) {
cfg_save_global();
//CFG_ReLoad();
//CFG_LoadGlobal();
CFG_ReLoad();
lang_default();
CFG_Load();
menu = MENU_SETTINGS;
pageToDisplay = 0;
} else {
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0);
}
}
}
else
@ -4058,7 +4060,7 @@ static int MenuSettings()
WindowPrompt(LANGUAGE.Langchange,LANGUAGE.Consoleshouldbeunlockedtomodifyit,LANGUAGE.ok,0,0,0);
}
break;
}