From d31a034d18093a3ddcab31b755f29a848c240dec Mon Sep 17 00:00:00 2001 From: giantpune Date: Thu, 11 Jun 2009 08:13:08 +0000 Subject: [PATCH] fixed some code dumps from the coverwall and the xml stuff. --- gui.pnproj | 2 +- source/Settings.cpp | 61 +++-- source/cfg.c | 27 +- source/cfg.h | 2 + source/gameinfo.cpp | 440 +++++++++++++++--------------- source/getentries.cpp | 1 + source/language.c | 2 + source/language.h | 1 + source/libwiigui/gui_gamegrid.cpp | 269 +++++++++--------- source/video.cpp | 1 + source/xml.c | 60 ++-- source/xml.h | 3 +- 12 files changed, 467 insertions(+), 402 deletions(-) diff --git a/gui.pnproj b/gui.pnproj index 524278b7..0ca2944a 100644 --- a/gui.pnproj +++ b/gui.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/Settings.cpp b/source/Settings.cpp index 85c648e8..fd169282 100644 --- a/source/Settings.cpp +++ b/source/Settings.cpp @@ -13,6 +13,8 @@ #include "getentries.h" #include "SettingsPrompts.h" +#define MAXOPTIONS 11 + /*** Extern functions ***/ extern void ResumeGui(); extern void HaltGui(); @@ -225,7 +227,7 @@ int MenuSettings() MainButton4.SetEffectGrow(); MainButton4.SetTrigger(&trigA); - customOptionList options2(10); + customOptionList options2(MAXOPTIONS); GuiCustomOptionBrowser optionBrowser2(396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, 0, 150); optionBrowser2.SetPosition(0, 90); optionBrowser2.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); @@ -461,6 +463,7 @@ int MenuSettings() w.Remove(&MainButton4); titleTxt.SetText(LANGUAGE.GUISettings); exit = false; + for(int i = 0; i <= MAXOPTIONS; i++) options2.SetName(i, NULL); options2.SetName(0, "%s",LANGUAGE.AppLanguage); options2.SetName(1, "%s",LANGUAGE.Display); options2.SetName(2, "%s",LANGUAGE.Clock); @@ -471,7 +474,8 @@ int MenuSettings() options2.SetName(7, "%s",LANGUAGE.Wiilight); options2.SetName(8, "%s",LANGUAGE.Rumble); options2.SetName(9, "%s",LANGUAGE.Unicodefix); - for(int i = 0; i < 10; i++) options2.SetValue(i, NULL); + options2.SetName(10, "%s",LANGUAGE.XMLTitles); + for(int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL); optionBrowser2.SetScrollbar(1); w.Append(&optionBrowser2); optionBrowser2.SetClickable(true); @@ -509,7 +513,8 @@ int MenuSettings() Settings.rumble = 0; //RUMBLE if ( Settings.unicodefix > 2 ) Settings.unicodefix = 0; - + if(Settings.titlesOverride >= 2) + Settings.titlesOverride = 0; if(!strcmp("notset", Settings.language_path)) options2.SetValue(0, "%s", LANGUAGE.Default); else @@ -552,11 +557,14 @@ int MenuSettings() else if (Settings.unicodefix == 1) options2.SetValue(9,"%s",LANGUAGE.TChinese); else if (Settings.unicodefix == 2) options2.SetValue(9,"%s",LANGUAGE.SChinese); - if(backBtn.GetState() == STATE_CLICKED) + if (Settings.titlesOverride == 0) options2.SetValue(10,"%s",LANGUAGE.OFF); + else if (Settings.titlesOverride == 1) options2.SetValue(10,"%s",LANGUAGE.ON); + + if(backBtn.GetState() == STATE_CLICKED) { backBtn.ResetState(); exit = true; - break; + break; } if(shutdown == 1) @@ -657,6 +665,16 @@ int MenuSettings() case 9: Settings.unicodefix++; break; + case 10: + //HaltGui(); this isn't done on the fly yet. you have to restart the loader for it to take effect + Settings.titlesOverride++; + //if(isInserted(bootDevice)) { + //cfg_save_global(); + //} + //CFG_Load(); + //__Menu_GetEntries(); + //ResumeGui(); + break; } } optionBrowser2.SetEffect(EFFECT_FADE, -20); @@ -686,6 +704,7 @@ int MenuSettings() w.Remove(&MainButton4); titleTxt.SetText(LANGUAGE.Gameload); exit = false; + for(int i = 0; i <= MAXOPTIONS; i++) options2.SetName(i, NULL); options2.SetName(0, "%s",LANGUAGE.VideoMode); options2.SetName(1, "%s",LANGUAGE.VIDTVPatch); options2.SetName(2, "%s",LANGUAGE.Language); @@ -693,10 +712,7 @@ int MenuSettings() options2.SetName(4, "Ocarina"); options2.SetName(5,"%s", LANGUAGE.BootStandard); options2.SetName(6, "%s",LANGUAGE.QuickBoot); - options2.SetName(7, NULL); - options2.SetName(8, NULL); - options2.SetName(9, NULL); - for(int i = 0; i < 10; i++) options2.SetValue(i, NULL); + for(int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL); w.Append(&optionBrowser2); optionBrowser2.SetClickable(true); ResumeGui(); @@ -849,17 +865,11 @@ int MenuSettings() w.Remove(&MainButton4); titleTxt.SetText(LANGUAGE.Parentalcontrol); exit = false; + for(int i = 0; i <= MAXOPTIONS; i++) options2.SetName(i, NULL); options2.SetName(0, "Console"); options2.SetName(1, "%s", LANGUAGE.Password); options2.SetName(2, "%s",LANGUAGE.Controllevel); - options2.SetName(3, NULL); - options2.SetName(4, NULL); - options2.SetName(5, NULL); - options2.SetName(6, NULL); - options2.SetName(7, NULL); - options2.SetName(8, NULL); - options2.SetName(9, NULL); - for(int i = 0; i < 10; i++) options2.SetValue(i, NULL); + for(int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL); w.Append(&optionBrowser2); optionBrowser2.SetClickable(true); ResumeGui(); @@ -1016,17 +1026,11 @@ int MenuSettings() w.Remove(&MainButton4); titleTxt.SetText(LANGUAGE.Sound); exit = false; + for(int i = 0; i <= MAXOPTIONS; i++) options2.SetName(i, NULL); options2.SetName(0, "%s",LANGUAGE.Backgroundmusic); options2.SetName(1, "%s",LANGUAGE.Volume); options2.SetName(2, "%s",LANGUAGE.SFXVolume); - options2.SetName(3, NULL); - options2.SetName(4, NULL); - options2.SetName(5, NULL); - options2.SetName(6, NULL); - options2.SetName(7, NULL); - options2.SetName(8, NULL); - options2.SetName(9, NULL); - for(int i = 0; i < 10; i++) options2.SetValue(i, NULL); + for(int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL); w.Append(&optionBrowser2); optionBrowser2.SetClickable(true); ResumeGui(); @@ -1164,6 +1168,7 @@ int MenuSettings() w.Remove(&MainButton4); titleTxt.SetText(LANGUAGE.Custompaths); exit = false; + for(int i = 0; i <= MAXOPTIONS; i++) options2.SetName(i, NULL); if(Settings.godmode) options2.SetName(0, "%s", LANGUAGE.CoverPath); options2.SetName(1, "%s", LANGUAGE.DiscimagePath); @@ -1171,11 +1176,7 @@ int MenuSettings() options2.SetName(3, "%s", LANGUAGE.Titlestxtpath); options2.SetName(4, "%s", LANGUAGE.Updatepath); options2.SetName(5, "%s", LANGUAGE.Cheatcodespath); - options2.SetName(6, NULL); - options2.SetName(7, NULL); - options2.SetName(8, NULL); - options2.SetName(9, NULL); - for(int i = 0; i < 10; i++) options2.SetValue(i, NULL); + for(int i = 0; i <= MAXOPTIONS; i++) options2.SetValue(i, NULL); w.Append(&optionBrowser2); optionBrowser2.SetClickable(true); ResumeGui(); diff --git a/source/cfg.c b/source/cfg.c index f3f88505..59f6c6a6 100644 --- a/source/cfg.c +++ b/source/cfg.c @@ -355,6 +355,7 @@ void Global_Default(void) Settings.unicodefix = 0; Settings.wiilight = 1; Settings.patchcountrystrings = 0; + Settings.titlesOverride = 0; } @@ -980,6 +981,13 @@ void global_cfg_set(char *name, char *val) } return; } + else if (strcmp(name, "titlesOverride") == 0) { + int i; + if (sscanf(val, "%d", &i) == 1) { + Settings.titlesOverride = i; + } + return; + } else if (strcmp(name, "gameDisplay") == 0) { int i; if (sscanf(val, "%d", &i) == 1) { @@ -1216,6 +1224,7 @@ bool cfg_save_global()// save global settings fprintf(f, "gameDisplay = %d\n ", Settings.gameDisplay); fprintf(f, "update_path = %s\n ", Settings.update_path); fprintf(f, "Cheatcodespath = %s\n ", Settings.Cheatcodespath); + fprintf(f, "titlesOverride = %d\n ", Settings.titlesOverride); fprintf(f, "patchcountrystrings = %d\n ", Settings.patchcountrystrings); fclose(f); return true; @@ -1492,6 +1501,7 @@ bool cfg_load_global() } Settings.volume = 80; Settings.sfxvolume = 80; + Settings.titlesOverride = 0; return cfg_parsefile(GXGlobal_cfg, &global_cfg_set); } @@ -1551,6 +1561,16 @@ bool CFG_forget_game_opt(u8 *id) return cfg_save_games(); } +void CFG_LoadXml() +{ + char pathname[200]; + /* load renamed titles from proper names and game info XML, needs to be after cfg_load_games - Lustar */ + snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.xml"); + OpenXMLFile(pathname); + LoadTitlesFromXML("English", false); // options can be added to set force title language to any language and force Japanese title to English + + } + void CFG_Load(void) { char pathname[200]; @@ -1582,11 +1602,8 @@ void CFG_Load(void) cfg_load_games(); cfg_load_game_num(); - /* load renamed titles from proper names and game info XML, needs to be after cfg_load_games - Lustar */ - //snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.zip"); - //OpenXMLFile(pathname); - //LoadTitlesFromXML("English", false); // options can be added to set force title language to any language and force Japanese title to English - + if (Settings.titlesOverride==1)CFG_LoadXml(); + Global_Default(); //global default depends on theme information CFG_LoadGlobal(); diff --git a/source/cfg.h b/source/cfg.h index 41fa5ff4..11356506 100644 --- a/source/cfg.h +++ b/source/cfg.h @@ -329,10 +329,12 @@ struct SSettings { char ogg_path[150]; char update_path[150]; char Cheatcodespath[100]; + int titlesOverride; }; void CFG_LoadGlobal(void); bool cfg_save_global(void); +void CFG_LoadXml(); //Astidof - End of modification char *get_title(struct discHdr *header); diff --git a/source/gameinfo.cpp b/source/gameinfo.cpp index 0840ebe4..51075be3 100644 --- a/source/gameinfo.cpp +++ b/source/gameinfo.cpp @@ -20,61 +20,6 @@ #include "xml.h" -GuiText * debugTxt = NULL; - -int cnt; -GuiImageData * playersImgData = NULL; -GuiImage * playersImg = NULL; - -GuiImageData * wifiplayersImgData = NULL; -GuiImage * wifiplayersImg = NULL; -GuiImage * ratingImg = NULL; - -GuiImage * classiccontrollerImg; -GuiImage * nunchuckImg; -GuiImage * guitarImg; -GuiImage * drumsImg; -GuiImage * dancepadImg; -GuiImage * motionplusImg; -GuiImage * wheelImg; -GuiImage * balanceboardImg; -GuiImage * microphoneImg; -GuiImage * gcImg; -GuiImage * dialogBoxImg1; -GuiImage * dialogBoxImg2; -GuiImage * dialogBoxImg3; -GuiImage * dialogBoxImg4; -GuiImage * dialogBoxImg11; -GuiImage * dialogBoxImg22; -GuiImage * dialogBoxImg33; -GuiImage * dialogBoxImg44; -GuiImage * coverImg; -GuiImage * coverImg2; - -GuiImageData * classiccontrollerImgData = NULL; -GuiImageData * nunchuckImgData = NULL; -GuiImageData * guitarImgData = NULL; -GuiImageData * drumsImgData = NULL; -GuiImageData * motionplusImgData = NULL; -GuiImageData * wheelImgData = NULL; -GuiImageData * balanceboardImgData = NULL; -GuiImageData * dancepadImgData = NULL; -GuiImageData * microphoneImgData = NULL; -GuiImageData * gamecubeImgData = NULL; -GuiImageData * ratingImgData = NULL; -GuiImageData * cover = NULL; - -GuiText * releasedTxt = NULL; -GuiText * publisherTxt = NULL; -GuiText * developerTxt = NULL; -GuiText * titleTxt = NULL; -GuiText * synopsisTxt = NULL; -GuiText * genreTxt = NULL; -GuiText * betaTxt = NULL; -GuiText * beta1Txt = NULL; -GuiText ** wifiTxt = NULL; - - /*** Extern variables ***/ extern GuiWindow * mainWindow; extern GuiSound * bgMusic; @@ -85,61 +30,6 @@ extern u8 reset; extern void ResumeGui(); extern void HaltGui(); -void eatADick() -{ -// use this to display variables on the window GuiText * debugTxt = NULL; - -playersImgData = NULL; -playersImg = NULL; - -wifiplayersImgData = NULL; -wifiplayersImg = NULL; -ratingImg = NULL; - -classiccontrollerImg = NULL; -nunchuckImg = NULL; -guitarImg = NULL; -drumsImg = NULL; -dancepadImg = NULL; -motionplusImg = NULL; -wheelImg = NULL; -balanceboardImg = NULL; -microphoneImg = NULL; -gcImg = NULL; -dialogBoxImg1 = NULL; -dialogBoxImg2 = NULL; -dialogBoxImg3 = NULL; -dialogBoxImg4 = NULL; -dialogBoxImg11 = NULL; -dialogBoxImg22 = NULL; -dialogBoxImg33 = NULL; -dialogBoxImg44 = NULL; -coverImg = NULL; -coverImg2 = NULL; - -classiccontrollerImgData = NULL; -nunchuckImgData = NULL; -guitarImgData = NULL; -drumsImgData = NULL; -motionplusImgData = NULL; -wheelImgData = NULL; -balanceboardImgData = NULL; -dancepadImgData = NULL; -microphoneImgData = NULL; -gamecubeImgData = NULL; -ratingImgData = NULL; -cover = NULL; - -releasedTxt = NULL; -publisherTxt = NULL; -developerTxt = NULL; -titleTxt = NULL; -synopsisTxt = NULL; -genreTxt = NULL; -betaTxt = NULL; -beta1Txt = NULL; -} - /**************************************************************************** * gameinfo @@ -147,6 +37,19 @@ beta1Txt = NULL; int showGameInfo(char *ID, u8 *headerID) { + u8 nodata=1; + //load the xml shit + char pathname[100]; + snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.zip"); + bool fileexists = OpenXMLFile(pathname); + if(!fileexists) { + snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.xml"); + fileexists = OpenXMLFile(pathname); + } + if(fileexists) { + snprintf(pathname, sizeof(pathname), "English"); + if (Settings.titlesOverride==1)LoadTitlesFromXML(pathname, false); // options can be added to set force title language to any language and force Japanese title to English + int choice = -1; //int i = 0; int y = 0, y1 = 32; @@ -164,6 +67,58 @@ showGameInfo(char *ID, u8 *headerID) int newline=1; u8 page =1; + // GuiText * debugTxt = NULL; + + GuiImageData * playersImgData = NULL; + GuiImage * playersImg = NULL; + + GuiImageData * wifiplayersImgData = NULL; + GuiImage * wifiplayersImg = NULL; + GuiImage * ratingImg = NULL; + + GuiImage * classiccontrollerImg = NULL; + GuiImage * nunchuckImg = NULL; + GuiImage * guitarImg = NULL; + GuiImage * drumsImg = NULL; + GuiImage * dancepadImg = NULL; + GuiImage * motionplusImg = NULL; + GuiImage * wheelImg = NULL; + GuiImage * balanceboardImg = NULL; + GuiImage * microphoneImg = NULL; + GuiImage * gcImg = NULL; + GuiImage * dialogBoxImg1 = NULL; + GuiImage * dialogBoxImg2 = NULL; + GuiImage * dialogBoxImg3 = NULL; + GuiImage * dialogBoxImg4 = NULL; + GuiImage * dialogBoxImg11 = NULL; + GuiImage * dialogBoxImg22 = NULL; + GuiImage * dialogBoxImg33 = NULL; + GuiImage * dialogBoxImg44 = NULL; + GuiImage * coverImg = NULL; + GuiImage * coverImg2 = NULL; + + GuiImageData * classiccontrollerImgData = NULL; + GuiImageData * nunchuckImgData = NULL; + GuiImageData * guitarImgData = NULL; + GuiImageData * drumsImgData = NULL; + GuiImageData * motionplusImgData = NULL; + GuiImageData * wheelImgData = NULL; + GuiImageData * balanceboardImgData = NULL; + GuiImageData * dancepadImgData = NULL; + GuiImageData * microphoneImgData = NULL; + GuiImageData * gamecubeImgData = NULL; + GuiImageData * ratingImgData = NULL; + GuiImageData * cover = NULL; + + GuiText * releasedTxt = NULL; + GuiText * publisherTxt = NULL; + GuiText * developerTxt = NULL; + GuiText * titleTxt = NULL; + GuiText * synopsisTxt = NULL; + GuiText * genreTxt = NULL; + GuiText * betaTxt = NULL; + GuiText * beta1Txt = NULL; + GuiWindow gameinfoWindow(600,308); gameinfoWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); gameinfoWindow.SetPosition(0, -50); @@ -190,31 +145,23 @@ showGameInfo(char *ID, u8 *headerID) GuiImageData dialogBox3(imgPath, gameinfo2_png); snprintf(imgPath, sizeof(imgPath), "%sgameinfo2a_png.png", CFG.theme_path); GuiImageData dialogBox4(imgPath, gameinfo2a_png); - + GuiTrigger trigA; trigA.SetButtonOnlyTrigger(-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); - + GuiButton backBtn(0,0); backBtn.SetPosition(-20,-20); backBtn.SetTrigger(&trigB); gameinfoWindow.Append(&backBtn); - + GuiButton nextBtn(0,0); nextBtn.SetPosition(20,20); nextBtn.SetTrigger(&trigA); gameinfoWindow.Append(&nextBtn); - - //load the xml shit - char pathname[100]; - snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.zip"); - OpenXMLFile(pathname); - snprintf(pathname, sizeof(pathname), "English"); - LoadTitlesFromXML(pathname, false); // options can be added to set force title language to any language and force Japanese title to English - /*struct Game_CFG *game_cfg = NULL; int opt_lang; char langtexttmp[11][22] = @@ -235,95 +182,95 @@ showGameInfo(char *ID, u8 *headerID) } else { opt_lang = Settings.language; }*/ - LoadGameInfoFromXML(ID,pathname); + if (LoadGameInfoFromXML(ID,pathname))nodata=0; //LoadGameInfoFromXML(ID,langtexttmp[opt_lang]); char linebuf[1000] = ""; char linebuf2[100] = ""; - + // set images for required input for (int i=0;strcmp(gameinfo.accessories_required[i+1],"") != 0;i++) { if (strcmp(gameinfo.accessories_required[i+1],"nunchuk")==0) {nunchuckImgData = new GuiImageData(nunchuckR_png);nunchuk=1;} - else + else nunchuckImgData = new GuiImageData(nunchuck_png); - + if (strcmp(gameinfo.accessories_required[i+1],"classiccontroller")==0) {classiccontrollerImgData = new GuiImageData(classiccontrollerR_png);classiccontroller=1;} - else + else classiccontrollerImgData = new GuiImageData(classiccontroller_png); - + if (strcmp(gameinfo.accessories_required[i+1],"guitar")==0) {guitarImgData = new GuiImageData(guitarR_png);guitar=1;} - else + else guitarImgData = new GuiImageData(guitar_png); - + if (strcmp(gameinfo.accessories_required[i+1],"gamecube")==0) {gamecubeImgData = new GuiImageData(gcncontrollerR_png);gamecube=1;} - else + else gamecubeImgData = new GuiImageData(gcncontroller_png); - + if (strcmp(gameinfo.accessories_required[i+1],"wheel")==0) {wheelImgData = new GuiImageData(wheelR_png);wheel=1;} - else + else wheelImgData = new GuiImageData(wheel_png); - + if (strcmp(gameinfo.accessories_required[i+1],"motionplus")==0) {motionplusImgData = new GuiImageData(motionplusR_png);motionplus=1;} - else + else motionplusImgData = new GuiImageData(motionplus_png); - + if (strcmp(gameinfo.accessories_required[i+1],"drums")==0) {drumsImgData = new GuiImageData(drumsR_png);drums=1;} - else + else drumsImgData = new GuiImageData(drums_png); - + if (strcmp(gameinfo.accessories_required[i+1],"microphone")==0) {microphoneImgData = new GuiImageData(microphoneR_png);microphone=1;} - else + else microphoneImgData = new GuiImageData(microphone_png); - + if (strcmp(gameinfo.accessories_required[i+1],"balanceboard")==0) {balanceboardImgData = new GuiImageData(balanceboardR_png);balanceboard=1;} - else + else balanceboardImgData = new GuiImageData(balanceboard_png); - + if (strcmp(gameinfo.accessories_required[i+1],"dancepad")==0) {dancepadImgData = new GuiImageData(dancepadR_png);dancepad=1;} - else + else dancepadImgData = new GuiImageData(dancepad_png); - + } for (int i=0;strcmp(gameinfo.accessories[i+1],"") != 0;i++) { - + if (strcmp(gameinfo.accessories_required[i],"classiccontroller")==0) classiccontroller=1; - + if (strcmp(gameinfo.accessories[i+1],"nunchuk")==0) {nunchuk=1;} - + if (strcmp(gameinfo.accessories[i+1],"guitar")==0) guitar=1; - + if (strcmp(gameinfo.accessories_required[i],"drums")==0) drums=1; - + if (strcmp(gameinfo.accessories_required[i],"dancepad")==0) dancepad=1; - + if (strcmp(gameinfo.accessories_required[i],"motionplus")==0) motionplus=1; - + if (strcmp(gameinfo.accessories_required[i],"wheel")==0) wheel=1; - + if (strcmp(gameinfo.accessories_required[i],"balanceboard")==0) balanceboard=1; - + if (strcmp(gameinfo.accessories_required[i],"microphone")==0) microphone=1; - + if (strcmp(gameinfo.accessories_required[i],"gamecube")==0) gamecube=1; } @@ -334,20 +281,20 @@ showGameInfo(char *ID, u8 *headerID) dialogBoxImg1 = new GuiImage(&dialogBox1); dialogBoxImg1->SetAlignment(0,3); dialogBoxImg1->SetPosition(-9,0); - + dialogBoxImg2 = new GuiImage(&dialogBox2); dialogBoxImg2->SetAlignment(0,3); dialogBoxImg2->SetPosition(145,0); - + dialogBoxImg3 = new GuiImage(&dialogBox3); dialogBoxImg3->SetAlignment(0,3); dialogBoxImg3->SetPosition(301,0); - + dialogBoxImg4 = new GuiImage(&dialogBox4); dialogBoxImg4->SetAlignment(0,3); dialogBoxImg4->SetPosition(457,0); - + gameinfoWindow.Append(dialogBoxImg1); gameinfoWindow.Append(dialogBoxImg2); gameinfoWindow.Append(dialogBoxImg3); @@ -368,7 +315,7 @@ showGameInfo(char *ID, u8 *headerID) coverImg->SetWidescreen(CFG.widescreen); coverImg->SetPosition(15,30); gameinfoWindow.Append(coverImg); - + // # of players if (strcmp(gameinfo.players,"") != 0) { playersImgData = new GuiImageData(Wiimote1_png); @@ -376,7 +323,7 @@ showGameInfo(char *ID, u8 *headerID) playersImgData= new GuiImageData(Wiimote2_png);} if (atoi(gameinfo.players)>2){ playersImgData= new GuiImageData(Wiimote4_png);} - + playersImg = new GuiImage(playersImgData); playersImg->SetWidescreen(CFG.widescreen); playersImg->SetPosition(intputX , inputY); @@ -384,7 +331,7 @@ showGameInfo(char *ID, u8 *headerID) gameinfoWindow.Append(playersImg); intputX += (CFG.widescreen ? playersImg->GetWidth() * .8 : playersImg->GetWidth())+5; } - + //draw the inupt types for this game if (nunchuk==1){ nunchuckImg = new GuiImage(nunchuckImgData); @@ -393,7 +340,7 @@ showGameInfo(char *ID, u8 *headerID) nunchuckImg->SetAlignment(0,4); gameinfoWindow.Append(nunchuckImg); intputX += (CFG.widescreen ? nunchuckImg->GetWidth() * .8 : nunchuckImg->GetWidth())+5;} - + if (classiccontroller==1){ classiccontrollerImg = new GuiImage(classiccontrollerImgData); classiccontrollerImg->SetWidescreen(CFG.widescreen); @@ -401,7 +348,7 @@ showGameInfo(char *ID, u8 *headerID) classiccontrollerImg->SetAlignment(0,4); gameinfoWindow.Append(classiccontrollerImg); intputX += (CFG.widescreen ? classiccontrollerImg->GetWidth() * .8 : classiccontrollerImg->GetWidth())+5;} - + if (gamecube==1){ gcImg = new GuiImage(gamecubeImgData); gcImg->SetWidescreen(CFG.widescreen); @@ -409,7 +356,7 @@ showGameInfo(char *ID, u8 *headerID) gcImg->SetAlignment(0,4); gameinfoWindow.Append(gcImg); intputX += (CFG.widescreen ? gcImg->GetWidth() * .8 : gcImg->GetWidth())+5;} - + if (wheel==1){ wheelImg = new GuiImage(wheelImgData); wheelImg->SetWidescreen(CFG.widescreen); @@ -417,7 +364,7 @@ showGameInfo(char *ID, u8 *headerID) wheelImg->SetAlignment(0,4); gameinfoWindow.Append(wheelImg); intputX += (CFG.widescreen ? wheelImg->GetWidth() * .8 : wheelImg->GetWidth())+5;} - + if (guitar==1){ guitarImg = new GuiImage(guitarImgData); guitarImg->SetWidescreen(CFG.widescreen); @@ -425,7 +372,7 @@ showGameInfo(char *ID, u8 *headerID) guitarImg->SetAlignment(0,4); gameinfoWindow.Append(guitarImg); intputX += (CFG.widescreen ? guitarImg->GetWidth() * .8 : guitarImg->GetWidth())+5;} - + if (drums==1){ drumsImg = new GuiImage(drumsImgData); drumsImg->SetWidescreen(CFG.widescreen); @@ -433,7 +380,7 @@ showGameInfo(char *ID, u8 *headerID) drumsImg->SetAlignment(0,4); gameinfoWindow.Append(drumsImg); intputX += (CFG.widescreen ? drumsImg->GetWidth() * .8 : drumsImg->GetWidth())+5;} - + if (microphone==1){ microphoneImg = new GuiImage(microphoneImgData); microphoneImg->SetWidescreen(CFG.widescreen); @@ -441,7 +388,7 @@ showGameInfo(char *ID, u8 *headerID) microphoneImg->SetAlignment(0,4); gameinfoWindow.Append(microphoneImg); intputX += (CFG.widescreen ? microphoneImg->GetWidth() * .8 : microphoneImg->GetWidth())+5;} - + if (dancepad==1){ dancepadImg = new GuiImage(dancepadImgData); dancepadImg->SetWidescreen(CFG.widescreen); @@ -449,7 +396,7 @@ showGameInfo(char *ID, u8 *headerID) dancepadImg->SetAlignment(0,4); gameinfoWindow.Append(dancepadImg); intputX += (CFG.widescreen ? dancepadImg->GetWidth() * .8 : dancepadImg->GetWidth())+5;} - + if (motionplus==1){ motionplusImg = new GuiImage(motionplusImgData); motionplusImg->SetWidescreen(CFG.widescreen); @@ -458,20 +405,18 @@ showGameInfo(char *ID, u8 *headerID) gameinfoWindow.Append(motionplusImg); intputX += (CFG.widescreen ? motionplusImg->GetWidth() * .8 : motionplusImg->GetWidth())+5;} - - - + + + // # online players - if (strcmp(gameinfo.wifiplayers,"") != 0) { + if ((strcmp(gameinfo.wifiplayers,"") != 0) && (strcmp(gameinfo.wifiplayers,"0") != 0)){ wifiplayersImgData = new GuiImageData(wifi1_png); if (atoi(gameinfo.wifiplayers)>1){ wifiplayersImgData= new GuiImageData(wifi2_png);} if (atoi(gameinfo.wifiplayers)>2){ wifiplayersImgData= new GuiImageData(wifi4_png);} - if (atoi(gameinfo.wifiplayers)>4){ wifiplayersImgData= new GuiImageData(wifi8_png);} - wifiplayersImg = new GuiImage(wifiplayersImgData); wifiplayersImg->SetWidescreen(CFG.widescreen); wifiplayersImg->SetPosition(intputX , inputY); @@ -480,23 +425,23 @@ showGameInfo(char *ID, u8 *headerID) intputX += (CFG.widescreen ? wifiplayersImg->GetWidth() * .8 : wifiplayersImg->GetWidth())+5; } - // ratings - if (strcmp(gameinfo.ratingtype,"") !=0){ + // ratings + if (strcmp(gameinfo.ratingtype,"") !=0){ if (strcmp(gameinfo.ratingtype,"ESRB")==0) { if (strcmp(gameinfo.ratingvalueESRB,"EC")==0) ratingImgData = new GuiImageData(esrb_ec_png); - else if (strcmp(gameinfo.ratingvalueESRB,"E")==0) + else if (strcmp(gameinfo.ratingvalueESRB,"E")==0) ratingImgData = new GuiImageData(esrb_e_png); else if (strcmp(gameinfo.ratingvalueESRB,"E10+")==0) ratingImgData = new GuiImageData(esrb_eten_png); - else if (strcmp(gameinfo.ratingvalueESRB,"T")==0) + else if (strcmp(gameinfo.ratingvalueESRB,"T")==0) ratingImgData = new GuiImageData(esrb_t_png); - else if (strcmp(gameinfo.ratingvalueESRB,"M")==0) + else if (strcmp(gameinfo.ratingvalueESRB,"M")==0) ratingImgData = new GuiImageData(esrb_m_png); else if (strcmp(gameinfo.ratingvalueESRB,"AO")==0) ratingImgData = new GuiImageData(esrb_ao_png); else {ratingImgData = new GuiImageData(norating_png);} - } //there are 2 values here cause some countries are stupid and + } //there are 2 values here cause some countries are stupid and else if (strcmp(gameinfo.ratingtype,"PEGI")==0) {//can't use the same as everybody else if ((strcmp(gameinfo.ratingvaluePEGI,"3")==0)||(strcmp(gameinfo.ratingvaluePEGI,"4")==0)) ratingImgData = new GuiImageData(pegi_3_png); @@ -510,7 +455,7 @@ showGameInfo(char *ID, u8 *headerID) ratingImgData = new GuiImageData(pegi_18_png); else {ratingImgData = new GuiImageData(norating_png);} } - + else if (strcmp(gameinfo.ratingtype,"CERO")==0) { if (strcmp(gameinfo.ratingvalueCERO,"A")==0) ratingImgData = new GuiImageData(cero_a_png); @@ -533,30 +478,30 @@ showGameInfo(char *ID, u8 *headerID) ratingImg->SetAlignment(1,4); gameinfoWindow.Append(ratingImg); intputX += (CFG.widescreen ? ratingImg->GetWidth() * .8 : ratingImg->GetWidth())+5; - + } - -//////////debugging line + +//////////debugging line /* snprintf(linebuf, sizeof(linebuf), "%s %s %s %s %i %s",gameinfo.ratingtype ,gameinfo.ratingvalueESRB,gameinfo.ratingvaluePEGI,gameinfo.ratingvalueCERO, ass,LANGUAGE.released); - + for (int i=0;strcmp(gameinfo.accessories_required[i+1],"") != 0;i++) { snprintf(linebuf, sizeof(linebuf), "%s %s",linebuf, gameinfo.accessories_required[i+1]); } - + debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255}); debugTxt->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); debugTxt->SetPosition(0,0); gameinfoWindow.Append(debugTxt);*/ - + if (strcmp(gameinfo.title,"") != 0) {snprintf(linebuf, sizeof(linebuf), "%s",gameinfo.title); titleTxt = new GuiText(linebuf, 22, (GXColor){0,0,0, 255}); if (titleTxt->GetWidth()>300)titleTxt->SetFontSize(18); titleTxt->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt->SetPosition(txtXOffset,12+y); y+=24; gameinfoWindow.Append(titleTxt);} - - - + + + //date snprintf(linebuf2, sizeof(linebuf2), " "); if (strcmp(gameinfo.day,"") != 0) @@ -601,9 +546,9 @@ debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255}); snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, LANGUAGE.december); break; } - } - if (strcmp(gameinfo.year,"") != 0)newline=1; - {snprintf(linebuf, sizeof(linebuf), "%s : %s%s", LANGUAGE.released, linebuf2, gameinfo.year); + } + if (strcmp(gameinfo.year,"") != 0){newline=1; + snprintf(linebuf, sizeof(linebuf), "%s : %s%s", LANGUAGE.released, linebuf2, gameinfo.year); releasedTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255}); if (releasedTxt->GetWidth()>300) newline=2; releasedTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); releasedTxt->SetPosition(-17,12+y); y+=(20 * newline);newline=1; @@ -615,7 +560,7 @@ debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255}); if (genreTxt->GetWidth()>300) newline=2; genreTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); genreTxt->SetPosition(205,12+y1); y1+=(25 * newline);newline=1; gameinfoWindow.Append(genreTxt);} - + //developer if (strcmp(gameinfo.developer,"") != 0 && strcmp(gameinfo.developer,gameinfo.publisher) != 0) {snprintf(linebuf, sizeof(linebuf), "%s %s", LANGUAGE.developedby, gameinfo.developer); @@ -633,58 +578,58 @@ debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255}); publisherTxt->SetMaxWidth(250,GuiText::WRAP); publisherTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); publisherTxt->SetPosition(-17,12+y); y+=(20 * newline);newline=1; gameinfoWindow.Append(publisherTxt);} - + //don't bother us txt snprintf(linebuf, sizeof(linebuf), "Don't bother the USB Loader GX Team about errors in this file."); betaTxt = new GuiText(linebuf, 14, (GXColor){0,0,0, 255}); - betaTxt->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); betaTxt->SetPosition(-17,-20);// + betaTxt->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); betaTxt->SetPosition(-17,-20);// gameinfoWindow.Append(betaTxt); snprintf(linebuf, sizeof(linebuf), "A site will be available in the near nuture to submit changes."); beta1Txt = new GuiText(linebuf, 14, (GXColor){0,0,0, 255}); beta1Txt->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); beta1Txt->SetPosition(-17,-10); gameinfoWindow.Append(beta1Txt); - + // WiFi Shit commented out cause it has a code dump in it still /*if (strcmp(gameinfo.wififeatures[0],"") != 0){ snprintf(linebuf, sizeof(linebuf), "%s:",LANGUAGE.wififeatures); - wifiTxt[0] = new GuiText(linebuf, 16, (GXColor){0,0,0, 255}); - wifiTxt[0]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); wifiTxt[0]->SetPosition(205,12+y); y+=(20 * newline); - gameinfoWindow.Append(wifiTxt[0]);} - for (int i=1;strcmp(gameinfo.wififeatures[i],"") != 0;i++) + wifiTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255}); + wifiTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); wifiTxt->SetPosition(205,12+y); y+=(20 * newline); + gameinfoWindow.Append(wifiTxt);} + for (int i=1;strcmp(gameinfo.wififeatures[i],"") != 0;i++) { snprintf(linebuf, sizeof(linebuf), "%s",gameinfo.wififeatures[i]); wifiTxt[i] = new GuiText(linebuf, 16, (GXColor){0,0,0, 255}); wifiTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); wifiTxt[i]->SetPosition(210,12+y); y+=(20 * newline); gameinfoWindow.Append(wifiTxt[i]);}*/ - + //synopsis if (strcmp(gameinfo.synopsis,"") != 0) {snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.synopsis); synopsisTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255}); synopsisTxt->SetMaxWidth(350,GuiText::WRAP); - synopsisTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); synopsisTxt->SetPosition(0,0); + synopsisTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); synopsisTxt->SetPosition(0,0); dialogBoxImg11 = new GuiImage(&dialogBox1); dialogBoxImg11->SetAlignment(0,3); dialogBoxImg11->SetPosition(-9,0); - + dialogBoxImg22 = new GuiImage(&dialogBox2); dialogBoxImg22->SetAlignment(0,3); dialogBoxImg22->SetPosition(145,0); - + dialogBoxImg33 = new GuiImage(&dialogBox3); dialogBoxImg33->SetAlignment(0,3); dialogBoxImg33->SetPosition(301,0); - + dialogBoxImg44 = new GuiImage(&dialogBox4); dialogBoxImg44->SetAlignment(0,3); dialogBoxImg44->SetPosition(457,0); - + gameinfoWindow2.Append(dialogBoxImg11); gameinfoWindow2.Append(dialogBoxImg22); gameinfoWindow2.Append(dialogBoxImg33); gameinfoWindow2.Append(dialogBoxImg44); - + txtWindow.Append(synopsisTxt); coverImg2 = new GuiImage(cover); coverImg2->SetWidescreen(CFG.widescreen); @@ -693,7 +638,7 @@ debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255}); gameinfoWindow2.Append(&txtWindow); } - + gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50); HaltGui(); @@ -701,7 +646,7 @@ debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255}); mainWindow->Append(&gameinfoWindow); mainWindow->ChangeFocus(&gameinfoWindow); ResumeGui(); - + while(choice == -1) { VIDEO_WaitVSync(); @@ -712,23 +657,23 @@ debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255}); } if(reset == 1) Sys_Reboot(); - - + + if ((backBtn.GetState()==STATE_CLICKED)||(backBtn.GetState()==STATE_HELD)){ choice=1; synopsisTxt = NULL; break;} - + else if (((nextBtn.GetState()==STATE_CLICKED)||(nextBtn.GetState()==STATE_HELD))&& (strcmp(gameinfo.synopsis,"") != 0)){ - + if (page==1){ nextBtn.ResetState(); HaltGui(); gameinfoWindow.SetVisible(false); gameinfoWindow2.SetVisible(true); coverImg->SetPosition(15,30); - + backBtn.SetClickable(false); gameinfoWindow2.Append(&nextBtn); mainWindow->Append(&gameinfoWindow2); @@ -756,7 +701,64 @@ debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255}); HaltGui(); mainWindow->Remove(&gameinfoWindow); mainWindow->SetState(STATE_DEFAULT); - eatADick(); + +// use this to display variables on the window GuiText * debugTxt = NULL; + delete playersImgData; + delete playersImg; + + delete wifiplayersImgData; + delete wifiplayersImg; + delete ratingImg; + + delete classiccontrollerImg; + delete nunchuckImg; + delete guitarImg; + delete drumsImg; + delete dancepadImg; + delete motionplusImg; + delete wheelImg; + delete balanceboardImg; + delete microphoneImg; + delete gcImg; + delete dialogBoxImg1; + delete dialogBoxImg2; + delete dialogBoxImg3; + delete dialogBoxImg4; + delete dialogBoxImg11; + delete dialogBoxImg22; + delete dialogBoxImg33; + delete dialogBoxImg44; + delete coverImg; + delete coverImg2; + + delete classiccontrollerImgData; + delete nunchuckImgData; + delete guitarImgData; + delete drumsImgData; + delete motionplusImgData; + delete wheelImgData; + delete balanceboardImgData; + delete dancepadImgData; + delete microphoneImgData; + delete gamecubeImgData; + delete ratingImgData; + delete cover; + + delete releasedTxt; + delete publisherTxt; + delete developerTxt; + delete titleTxt; + delete synopsisTxt; + delete genreTxt; + delete betaTxt; + delete beta1Txt; + if (nodata==0)FreeXMLMemory(); + //void FreeXMLDeletePart(); + /* + nodeid + nodefound + */ + ResumeGui();} else { gameinfoWindow2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50); @@ -765,6 +767,12 @@ debugTxt = new GuiText(linebuf, 18, (GXColor){0,0,0, 255}); mainWindow->Remove(&gameinfoWindow2); mainWindow->SetState(STATE_DEFAULT); ResumeGui();} + //FreeXMLMemory(); return choice; + + /* File not found */ + } else { + return -1; + } } diff --git a/source/getentries.cpp b/source/getentries.cpp index 9c441502..23c12ea0 100644 --- a/source/getentries.cpp +++ b/source/getentries.cpp @@ -5,6 +5,7 @@ #include "main.h" + struct discHdr * gameList; u32 gameCnt; s32 gameSelected, gameStart; diff --git a/source/language.c b/source/language.c index eea117b2..a1ecdfab 100644 --- a/source/language.c +++ b/source/language.c @@ -273,6 +273,8 @@ snprintf(LANGUAGE.december, sizeof(LANGUAGE.december), "Dec"); snprintf(LANGUAGE.developedby, sizeof(LANGUAGE.developedby), "Developed by"); snprintf(LANGUAGE.publishedby, sizeof(LANGUAGE.publishedby), "Published by"); snprintf(LANGUAGE.wififeatures, sizeof(LANGUAGE.wififeatures), "WiFi Features"); +snprintf(LANGUAGE.XMLTitles, sizeof(LANGUAGE.XMLTitles), "Titles from XML"); + }; diff --git a/source/language.h b/source/language.h index d3120f0b..1c5b8f24 100644 --- a/source/language.h +++ b/source/language.h @@ -26,6 +26,7 @@ struct LANGUAGE char october[15]; char november[15]; char december[15]; + char XMLTitles[15]; char wififeatures[20]; diff --git a/source/libwiigui/gui_gamegrid.cpp b/source/libwiigui/gui_gamegrid.cpp index 4899ac00..598485f4 100644 --- a/source/libwiigui/gui_gamegrid.cpp +++ b/source/libwiigui/gui_gamegrid.cpp @@ -773,6 +773,17 @@ void GuiGameGrid::Update(GuiTrigger * t) if (goback==1)mover2= (mover2<0? mover2+1:mover2-1); if (mover2==0)goback=0; + /*u16 buttons = ButtonsHold(); + if(buttons & WPAD_BUTTON_B) { + int x = t->wpad.ir.x; + int center = this->GetWidth()/2; + if (xcenter)goRight=12; + usleep(xDraw();} + //return; + }*/ + // navigation if(!focus || gameCnt <= pagesize || (game[bob[0]]->GetEffect() && game[bob[pagesize-1]]->GetEffect())) @@ -1047,6 +1058,7 @@ void GuiGameGrid::Update(GuiTrigger * t) if (goRight>0){ if (mover<11){ + //int offset1 = listOffset-1, offset2 = listOffset-2; for (int i=1; i<(rows+1); i++){ @@ -1288,8 +1300,8 @@ void GuiGameGrid::Update(GuiTrigger * t) } if (btnRowUp->GetState() == STATE_CLICKED) { - if (rows==1)this->ChangeRows(2); - else if (rows==2)this->ChangeRows(3); + if ((rows==1)&&(gameCnt>=16))this->ChangeRows(2); + else if ((rows==2)&&(gameCnt>=42))this->ChangeRows(3); btnRowUp->ResetState(); return; } @@ -1316,7 +1328,7 @@ void GuiGameGrid::Reload(struct discHdr * l, int count) delete cover[i]; } - delete [] bob; + //delete [] bob; delete [] game; delete [] coverImg; delete [] cover; @@ -1330,24 +1342,27 @@ void GuiGameGrid::Reload(struct discHdr * l, int count) focus = 1; // allow focus firstPic = 0; clickedItem = -1; - speed = SHIFT_SPEED; + gameCnt=count; + //speed = SHIFT_SPEED; char imgPath[100]; - if ((count<42)&&(rows==3))rows=2; - if ((count<16)&&(rows==2))rows=1; - + if (count<42)rows=2; + if (count<16)rows=1; + //rows=1; if (rows==1)pagesize = 6; else if (rows==2)pagesize = 16; else if (rows==3)pagesize = 42; - //gameIndex = new int[pagesize]; + game = new GuiButton * [pagesize]; - bob = new int[pagesize]; + //bob = new int[pagesize]; coverImg = new GuiImage * [gameCnt]; cover = new GuiImageData * [gameCnt]; for(int i=0; iSetPosition(-70,74); - game[1]->SetPosition(88,74); - game[2]->SetPosition(239,74); - game[3]->SetPosition(390,74); - game[4]->SetPosition(550,74); + game[bob[0]]->SetPosition(-70,74); + game[bob[1]]->SetPosition(88,74); + game[bob[2]]->SetPosition(239,74); + game[bob[3]]->SetPosition(390,74); + game[bob[4]]->SetPosition(550,74); - game[0]->SetSkew(-10,-44,10,-26,10,26,-10,44); - game[1]->SetSkew(-6,-22,6,-14,6,14,-6,22); - game[2]->SetSkew(0,-11,0,-11,0,11,0,11); - game[3]->SetSkew(-6,-14,6,-22,6,22,-6,14); - game[4]->SetSkew(-10,-26,10,-44,10,44,-10,26); + game[bob[0]]->SetSkew(-10,-44,10,-26,10,26,-10,44); + game[bob[1]]->SetSkew(-6,-22,6,-14,6,14,-6,22); + game[bob[2]]->SetSkew(0,-11,0,-11,0,11,0,11); + game[bob[3]]->SetSkew(-6,-14,6,-22,6,22,-6,14); + game[bob[4]]->SetSkew(-10,-26,10,-44,10,44,-10,26); } else if (rows ==2) { - game[0]->SetPosition(3,50); - game[1]->SetPosition(3,193); - game[2]->SetPosition(97,50); - game[3]->SetPosition(97,193); - game[4]->SetPosition(187,50); - game[5]->SetPosition(187,193); - game[6]->SetPosition(272,50); - game[7]->SetPosition(272,193); - game[8]->SetPosition(358,50); - game[9]->SetPosition(358,193); - game[10]->SetPosition(449,50); - game[11]->SetPosition(449,193); - game[12]->SetPosition(545,50); - game[13]->SetPosition(545,193); - game[14]->SetPosition(700,0); - game[15]->SetPosition(700,0); + game[bob[0]]->SetPosition(3,50); + game[bob[1]]->SetPosition(3,193); + game[bob[2]]->SetPosition(97,50); + game[bob[3]]->SetPosition(97,193); + game[bob[4]]->SetPosition(187,50); + game[bob[5]]->SetPosition(187,193); + game[bob[6]]->SetPosition(272,50); + game[bob[7]]->SetPosition(272,193); + game[bob[8]]->SetPosition(358,50); + game[bob[9]]->SetPosition(358,193); + game[bob[10]]->SetPosition(449,50); + game[bob[11]]->SetPosition(449,193); + game[bob[12]]->SetPosition(545,50); + game[bob[13]]->SetPosition(545,193); + game[bob[14]]->SetPosition(700,0); + game[bob[15]]->SetPosition(700,0); - game[0]->SetSkew(-4.5,-49,4.5,-27,4.5,0,-4.5,0); - game[1]->SetSkew(-4.5,0,4.5,0,4.5,27,-4.5,49); - game[2]->SetSkew(-4,-22,4,-14,4,0,-4,0); - game[3]->SetSkew(-4,0,4,0,4,14,-4,22); - game[4]->SetSkew(0,-9,0,-5,0,0,0,0); - game[5]->SetSkew(0,0,0,0,0,5,0,9); - game[6]->SetSkew(0,0,0,0,0,0,0,0); - game[7]->SetSkew(0,0,0,0,0,0,0,0); - game[8]->SetSkew(0,-5,0,-9,0,0,0,0); - game[9]->SetSkew(0,0,0,0,0,9,0,5); - game[10]->SetSkew(-4,-14,4,-22,4,0,-4,0); - game[11]->SetSkew(-4,0,4,0,4,22,-4,14); - game[12]->SetSkew(-4.5,-27,4.5,-49,4.5,0,-4.5,0); - game[13]->SetSkew(-4.5,0,4.5,0,4.5,49,-4.5,27); + game[bob[0]]->SetSkew(-4.5,-49,4.5,-27,4.5,0,-4.5,0); + game[bob[1]]->SetSkew(-4.5,0,4.5,0,4.5,27,-4.5,49); + game[bob[2]]->SetSkew(-4,-22,4,-14,4,0,-4,0); + game[bob[3]]->SetSkew(-4,0,4,0,4,14,-4,22); + game[bob[4]]->SetSkew(0,-9,0,-5,0,0,0,0); + game[bob[5]]->SetSkew(0,0,0,0,0,5,0,9); + game[bob[6]]->SetSkew(0,0,0,0,0,0,0,0); + game[bob[7]]->SetSkew(0,0,0,0,0,0,0,0); + game[bob[8]]->SetSkew(0,-5,0,-9,0,0,0,0); + game[bob[9]]->SetSkew(0,0,0,0,0,9,0,5); + game[bob[10]]->SetSkew(-4,-14,4,-22,4,0,-4,0); + game[bob[11]]->SetSkew(-4,0,4,0,4,22,-4,14); + game[bob[12]]->SetSkew(-4.5,-27,4.5,-49,4.5,0,-4.5,0); + game[bob[13]]->SetSkew(-4.5,0,4.5,0,4.5,49,-4.5,27); } else if (rows==3) { - game[0]->SetPosition(13,58); - game[1]->SetPosition(13,153); - game[2]->SetPosition(13,250); + game[bob[0]]->SetPosition(13,58); + game[bob[1]]->SetPosition(13,153); + game[bob[2]]->SetPosition(13,250); - game[3]->SetPosition(68,67); - game[4]->SetPosition(68,153); - game[5]->SetPosition(68,239); + game[bob[3]]->SetPosition(68,67); + game[bob[4]]->SetPosition(68,153); + game[bob[5]]->SetPosition(68,239); - game[6]->SetPosition(120,74); - game[7]->SetPosition(120,153); - game[8]->SetPosition(120,232); + game[bob[6]]->SetPosition(120,74); + game[bob[7]]->SetPosition(120,153); + game[bob[8]]->SetPosition(120,232); - game[9]->SetPosition(170,78); - game[10]->SetPosition(170,153); - game[11]->SetPosition(170,228); + game[bob[9]]->SetPosition(170,78); + game[bob[10]]->SetPosition(170,153); + game[bob[11]]->SetPosition(170,228); - game[12]->SetPosition(214,80); - game[13]->SetPosition(214,153); - game[14]->SetPosition(214,226); + game[bob[12]]->SetPosition(214,80); + game[bob[13]]->SetPosition(214,153); + game[bob[14]]->SetPosition(214,226); - game[15]->SetPosition(258,81); - game[16]->SetPosition(258,153); - game[17]->SetPosition(258,224); + game[bob[15]]->SetPosition(258,81); + game[bob[16]]->SetPosition(258,153); + game[bob[17]]->SetPosition(258,224); - game[18]->SetPosition(302,81); - game[19]->SetPosition(302,153); - game[20]->SetPosition(302,223); + game[bob[18]]->SetPosition(302,81); + game[bob[19]]->SetPosition(302,153); + game[bob[20]]->SetPosition(302,223); - game[21]->SetPosition(346,81); - game[22]->SetPosition(346,153); - game[23]->SetPosition(346,223); + game[bob[21]]->SetPosition(346,81); + game[bob[22]]->SetPosition(346,153); + game[bob[23]]->SetPosition(346,223); - game[24]->SetPosition(390,80); - game[25]->SetPosition(390,153); - game[26]->SetPosition(390,225); + game[bob[24]]->SetPosition(390,80); + game[bob[25]]->SetPosition(390,153); + game[bob[26]]->SetPosition(390,225); - game[27]->SetPosition(434,77); - game[28]->SetPosition(434,153); - game[29]->SetPosition(434,227); + game[bob[27]]->SetPosition(434,77); + game[bob[28]]->SetPosition(434,153); + game[bob[29]]->SetPosition(434,227); - game[30]->SetPosition(484,73); - game[31]->SetPosition(484,153); - game[32]->SetPosition(484,231); + game[bob[30]]->SetPosition(484,73); + game[bob[31]]->SetPosition(484,153); + game[bob[32]]->SetPosition(484,231); - game[33]->SetPosition(537,67); - game[34]->SetPosition(537,153); - game[35]->SetPosition(537,239); + game[bob[33]]->SetPosition(537,67); + game[bob[34]]->SetPosition(537,153); + game[bob[35]]->SetPosition(537,239); - game[36]->SetPosition(591,58); - game[37]->SetPosition(591,153); - game[38]->SetPosition(591,250); + game[bob[36]]->SetPosition(591,58); + game[bob[37]]->SetPosition(591,153); + game[bob[38]]->SetPosition(591,250); - game[0]->SetSkew(-38,-110,15,-42,15,65,-38,32); - game[1]->SetSkew(-38,-75,15,-48,15,45,-38,72); - game[2]->SetSkew(-38,-52,15,-70,15,27,-38,100); + game[bob[0]]->SetSkew(-38,-110,15,-42,15,65,-38,32); + game[bob[1]]->SetSkew(-38,-75,15,-48,15,45,-38,72); + game[bob[2]]->SetSkew(-38,-52,15,-70,15,27,-38,100); - game[3]->SetSkew(-38,-70,15,-24,15,40,-38,27); - game[4]->SetSkew(-38,-50,15,-35,15,40,-38,50); - game[5]->SetSkew(-38,-34,15,-47,15,24,-38,58); + game[bob[3]]->SetSkew(-38,-70,15,-24,15,40,-38,27); + game[bob[4]]->SetSkew(-38,-50,15,-35,15,40,-38,50); + game[bob[5]]->SetSkew(-38,-34,15,-47,15,24,-38,58); - game[6]->SetSkew(-27,-55,19,-22,19,30,-27,22); - game[7]->SetSkew(-27,-40,19,-30,19,30,-27,40); - game[8]->SetSkew(-27,-20,19,-30,19,20,-27,50); + game[bob[6]]->SetSkew(-27,-55,19,-22,19,30,-27,22); + game[bob[7]]->SetSkew(-27,-40,19,-30,19,30,-27,40); + game[bob[8]]->SetSkew(-27,-20,19,-30,19,20,-27,50); - game[9]->SetSkew(-19,-28,0,-17,0,15,-19,10); - game[10]->SetSkew(-19,-30,0,-20,0,12,-19,30); - game[11]->SetSkew(-19,-15,0,-20,0,10,-19,24); + game[bob[9]]->SetSkew(-19,-28,0,-17,0,15,-19,10); + game[bob[10]]->SetSkew(-19,-30,0,-20,0,12,-19,30); + game[bob[11]]->SetSkew(-19,-15,0,-20,0,10,-19,24); - game[12]->SetSkew(-10,-20,3,-13,3,14,-10,10); - game[13]->SetSkew(-10,-20,3,-18,3,18,-10,20); - game[14]->SetSkew(-10,-10,3,-10,3,0,-10,10); + game[bob[12]]->SetSkew(-10,-20,3,-13,3,14,-10,10); + game[bob[13]]->SetSkew(-10,-20,3,-18,3,18,-10,20); + game[bob[14]]->SetSkew(-10,-10,3,-10,3,0,-10,10); - game[15]->SetSkew(-10,-15,3,-12,3,13,-10,13); - game[16]->SetSkew(-10,-17,3,-10,3,10,-10,17); - game[17]->SetSkew(-10,-10,3,-15,3,10,-10,10); + game[bob[15]]->SetSkew(-10,-15,3,-12,3,13,-10,13); + game[bob[16]]->SetSkew(-10,-17,3,-10,3,10,-10,17); + game[bob[17]]->SetSkew(-10,-10,3,-15,3,10,-10,10); - game[18]->SetSkew(-10,-10,3,-10,3,14,-10,14); - game[19]->SetSkew(-10,-10,3,-10,3,10,-10,10);//middle - game[20]->SetSkew(-10,-10,3,-10,3,10,-10,10); + game[bob[18]]->SetSkew(-10,-10,3,-10,3,14,-10,14); + game[bob[19]]->SetSkew(-10,-10,3,-10,3,10,-10,10);//middle + game[bob[20]]->SetSkew(-10,-10,3,-10,3,10,-10,10); - game[21]->SetSkew(-14,-10,4,-20,3,10,-14,10); - game[22]->SetSkew(-14,-10,4,-17,3,17,-14,10); - game[23]->SetSkew(-14,-10,4,-10,3,10,-14,10); + game[bob[21]]->SetSkew(-14,-10,4,-20,3,10,-14,10); + game[bob[22]]->SetSkew(-14,-10,4,-17,3,17,-14,10); + game[bob[23]]->SetSkew(-14,-10,4,-10,3,10,-14,10); - game[24]->SetSkew(-10,-13,3,-20,3,14,-10,10); - game[25]->SetSkew(-10,-18,3,-20,3,20,-10,18); - game[26]->SetSkew(-10,-10,3,-10,3,20,-10,5); + game[bob[24]]->SetSkew(-10,-13,3,-20,3,14,-10,10); + game[bob[25]]->SetSkew(-10,-18,3,-20,3,20,-10,18); + game[bob[26]]->SetSkew(-10,-10,3,-10,3,20,-10,5); - game[27]->SetSkew(-19,-17,0,-28,0,10,-19,15); - game[28]->SetSkew(-19,-20,0,-30,0,30,-19,12); - game[29]->SetSkew(-19,-20,0,-15,0,30,-19,10); + game[bob[27]]->SetSkew(-19,-17,0,-28,0,10,-19,15); + game[bob[28]]->SetSkew(-19,-20,0,-30,0,30,-19,12); + game[bob[29]]->SetSkew(-19,-20,0,-15,0,30,-19,10); - game[30]->SetSkew(-27,-22,19,-55,19,22,-27,30); - game[31]->SetSkew(-27,-30,19,-40,19,40,-27,30); - game[32]->SetSkew(-27,-30,19,-20,19,55,-27,20); + game[bob[30]]->SetSkew(-27,-22,19,-55,19,22,-27,30); + game[bob[31]]->SetSkew(-27,-30,19,-40,19,40,-27,30); + game[bob[32]]->SetSkew(-27,-30,19,-20,19,55,-27,20); - game[33]->SetSkew(-38,-24,15,-70,15,27,-38,40); - game[34]->SetSkew(-38,-35,15,-50,15,50,-38,40); - game[35]->SetSkew(-38,-47,15,-34,15,58,-38,24); + game[bob[33]]->SetSkew(-38,-24,15,-70,15,27,-38,40); + game[bob[34]]->SetSkew(-38,-35,15,-50,15,50,-38,40); + game[bob[35]]->SetSkew(-38,-47,15,-34,15,58,-38,24); - game[36]->SetSkew(-38,-42,15,-110,15,32,-38,60); - game[37]->SetSkew(-38,-48,15,-75,15,70,-38,45); - game[38]->SetSkew(-38,-70,15,-52,15,100,-38,27); + game[bob[36]]->SetSkew(-38,-42,15,-110,15,32,-38,60); + game[bob[37]]->SetSkew(-38,-48,15,-75,15,70,-38,45); + game[bob[38]]->SetSkew(-38,-70,15,-52,15,100,-38,27); } diff --git a/source/video.cpp b/source/video.cpp index 52750f52..d2a7553b 100644 --- a/source/video.cpp +++ b/source/video.cpp @@ -298,6 +298,7 @@ void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, u8 data[] GX_SetVtxDesc (GX_VA_TEX0, GX_NONE); } + /**************************************************************************** * Menu_DrawRectangle * diff --git a/source/xml.c b/source/xml.c index a19637dc..b21691e7 100644 --- a/source/xml.c +++ b/source/xml.c @@ -11,12 +11,12 @@ Load game information from XML - Lustar #include "unzip/unzip.h" -bool xmldebug = false; +static bool xmldebug = false; extern struct SSettings Settings; // for loader GX -char langlist[11][22] = +static char langlist[11][22] = {{"Console Default"}, {"Japanese"}, {"English"}, @@ -29,7 +29,7 @@ char langlist[11][22] = {"T. Chinese"}, {"Korean"}}; -char langcodes[11][22] = +static char langcodes[11][22] = {{""}, {"JA"}, {"EN"}, @@ -42,18 +42,30 @@ char langcodes[11][22] = {"ZH"}, {"KO"}}; -char element_text[5000]; +static char element_text[5000]; -mxml_node_t *nodetree; -mxml_node_t *nodedata; -mxml_node_t *nodeid; -mxml_node_t *nodeidtmp; -mxml_node_t *nodefound; -mxml_index_t *nodeindex; -mxml_index_t *nodeindextmp; +static mxml_node_t *nodetree=NULL; +static mxml_node_t *nodedata=NULL; +static mxml_node_t *nodeid=NULL; +static mxml_node_t *nodeidtmp=NULL; +static mxml_node_t *nodefound=NULL; +static mxml_index_t *nodeindex=NULL; +static mxml_index_t *nodeindextmp=NULL; int xmlloadtime = 0; +void FreeXMLDeletePart() +{ + /* free memory */ + mxmlIndexDelete(nodeindex); + mxmlIndexDelete(nodeindextmp); + mxmlDelete(nodeid); + mxmlDelete(nodeidtmp); + mxmlDelete(nodefound); + mxmlDelete(nodedata); + mxmlDelete(nodetree); +} + /* get_text() taken as is from mini-mxml example mxmldoc.c */ /* get_text() - Get the text for a node. */ @@ -255,9 +267,10 @@ void ConvertRating(char *ratingvalue, char *fromrating, char *torating, char *de void LoadTitlesFromXML(char *langtxt, bool forcejptoen) /* langtxt: set to "English","French","German", to force language for all titles, or "" to load title depending on each game's setting */ /* forcejptoen: set to true to load English title instead of Japanese title when game is set to Japanese */ -{ +{ + if (nodeindex == NULL) - return; + return ; bool forcelang = false; if (strcmp(langtxt,"")) @@ -305,11 +318,13 @@ void LoadTitlesFromXML(char *langtxt, bool forcejptoen) /* load title from nodes */ nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", "EN", MXML_NO_DESCEND); - if (nodefound != NULL) { + if (nodefound != NULL){// &&(Settings.titlesOverride==1)){ GetTextFromNode(nodefound, nodedata, "title", NULL, NULL, MXML_DESCEND, title_text_EN); + } nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", langcode, MXML_NO_DESCEND); if (nodefound != NULL) { + GetTextFromNode(nodefound, nodedata, "title", NULL, NULL, MXML_DESCEND, title_text); } /* fall back to English title if prefered language was not found */ @@ -355,12 +370,12 @@ void GetPublisherFromGameid(char *idtxt, char *dest) } -void LoadGameInfoFromXML(char* gameid, char* langtxt) +bool LoadGameInfoFromXML(char* gameid, char* langtxt) /* gameid: full game id */ /* langcode: "English","French","German" */ -{ +{ bool exist=false; if (nodeindex == NULL) - return; + return exist; /* convert language text into ISO 639 two-letter language codes */ char langcode[100] = ""; @@ -375,7 +390,7 @@ void LoadGameInfoFromXML(char* gameid, char* langtxt) /* search for game matching gameid */ while (strcmp(element_text,gameid) != 0) - { + { exist=true; nodeid = mxmlIndexFind(nodeindex,"id", NULL); if (nodeid != NULL) { get_text(nodeid, element_text, sizeof(element_text)); @@ -411,12 +426,13 @@ void LoadGameInfoFromXML(char* gameid, char* langtxt) /* text from child elements */ nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", "EN", MXML_NO_DESCEND); if (nodefound != NULL) { + //if (Settings.titlesOverride==1) GetTextFromNode(nodefound, nodedata, "title", NULL, NULL, MXML_DESCEND, gameinfo.title_EN); GetTextFromNode(nodefound, nodedata, "synopsis", NULL, NULL, MXML_DESCEND, gameinfo.synopsis_EN); } nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", langcode, MXML_NO_DESCEND); if (nodefound != NULL) { - GetTextFromNode(nodefound, nodedata, "title", NULL, NULL, MXML_DESCEND, gameinfo.title); + //GetTextFromNode(nodefound, nodedata, "title", NULL, NULL, MXML_DESCEND, gameinfo.title); GetTextFromNode(nodefound, nodedata, "synopsis", NULL, NULL, MXML_DESCEND, gameinfo.synopsis); } // fall back to English title and synopsis if prefered language was not found @@ -509,10 +525,10 @@ void LoadGameInfoFromXML(char* gameid, char* langtxt) ConvertRating(gameinfo.ratingvalue, gameinfo.ratingtype, "PEGI",gameinfo.ratingvaluePEGI); //PrintGameInfo(); - - } else { + exist=true; + } else {exist=false; /*game not found */ - } + }return exist; } diff --git a/source/xml.h b/source/xml.h index d75f943f..e8fed447 100644 --- a/source/xml.h +++ b/source/xml.h @@ -50,13 +50,14 @@ struct gameXMLinfo gameinfo; struct gameXMLinfo gameinfo_reset; bool OpenXMLFile(char* filename); -void LoadGameInfoFromXML(char* gameid, char* langcode); +bool LoadGameInfoFromXML(char* gameid, char* langcode); void LoadTitlesFromXML(char *langcode, bool forcejptoen); void GetPublisherFromGameid(char *idtxt, char *dest); char *ConvertLangTextToCode(char *langtext); void ConvertRating(char *ratingvalue, char *fromrating, char *torating, char *destvalue); void PrintGameInfo(bool showfullinfo); void FreeXMLMemory(); +void FreeXMLDeletePart(); void title_set(char *id, char *title);