From c1f16850f9399988019a17402359a755fd1de06d Mon Sep 17 00:00:00 2001 From: "lustar.mii" Date: Mon, 7 Sep 2009 01:47:13 +0000 Subject: [PATCH] When wiitdb.zip is updated the file is now checked and titles/infos are reloaded. Made browser theme friendly (changes by virale in issue 905). Fixed alt-dol for SSX Blur (issue 865, thanks LoudBob11). Australian covers may be able to be downloaded now. --- gui.pnproj | 2 +- gui.pnps | 2 +- source/libwiigui/gui_filebrowser.cpp | 21 ++++++++---- source/prompts/DiscBrowser.cpp | 6 ++-- source/prompts/PromptWindows.cpp | 51 ++++++++++++++++++++-------- source/prompts/gameinfo.cpp | 11 +++--- source/settings/cfg.c | 6 ++-- 7 files changed, 67 insertions(+), 32 deletions(-) diff --git a/gui.pnproj b/gui.pnproj index dc46785d..d2cb4a7f 100644 --- a/gui.pnproj +++ b/gui.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/gui.pnps b/gui.pnps index 328767aa..bc181528 100644 --- a/gui.pnps +++ b/gui.pnps @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/libwiigui/gui_filebrowser.cpp b/source/libwiigui/gui_filebrowser.cpp index dadb1a40..5b6b3b20 100644 --- a/source/libwiigui/gui_filebrowser.cpp +++ b/source/libwiigui/gui_filebrowser.cpp @@ -10,6 +10,8 @@ #include "gui.h" #include "prompts/filebrowser.h" +#include "../settings/cfg.h" + #define FILEBROWSERSIZE 8 /** @@ -34,26 +36,33 @@ GuiFileBrowser::GuiFileBrowser(int w, int h) btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, SOUND_PCM); btnSoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, SOUND_PCM); - bgFileSelection = new GuiImageData(bg_browser_png); + char imgPath[100]; + snprintf(imgPath, sizeof(imgPath), "%sbg_browser.png", CFG.theme_path); + bgFileSelection = new GuiImageData(imgPath, bg_browser_png); bgFileSelectionImg = new GuiImage(bgFileSelection); bgFileSelectionImg->SetParent(this); bgFileSelectionImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - bgFileSelectionEntry = new GuiImageData(bg_browser_selection_png); + snprintf(imgPath, sizeof(imgPath), "%sbg_browser_selection.png", CFG.theme_path); + bgFileSelectionEntry = new GuiImageData(imgPath, bg_browser_selection_png); fileFolder = new GuiImageData(folder_png); - scrollbar = new GuiImageData(scrollbar_png); + snprintf(imgPath, sizeof(imgPath), "%sscrollbar.png", CFG.theme_path); + scrollbar = new GuiImageData(imgPath, scrollbar_png); scrollbarImg = new GuiImage(scrollbar); scrollbarImg->SetParent(this); scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); scrollbarImg->SetPosition(0, 2); scrollbarImg->SetSkew(0,0,0,0,0,-30,0,-30); - arrowDown = new GuiImageData(scrollbar_arrowdown_png); + snprintf(imgPath, sizeof(imgPath), "%sscrollbar_arrowdown.png", CFG.theme_path); + arrowDown = new GuiImageData(imgPath, scrollbar_arrowdown_png); arrowDownImg = new GuiImage(arrowDown); - arrowUp = new GuiImageData(scrollbar_arrowup_png); + snprintf(imgPath, sizeof(imgPath), "%sscrollbar_arrowup.png", CFG.theme_path); + arrowUp = new GuiImageData(imgPath, scrollbar_arrowup_png); arrowUpImg = new GuiImage(arrowUp); - scrollbarBox = new GuiImageData(scrollbar_box_png); + snprintf(imgPath, sizeof(imgPath), "%sscrollbar_box.png", CFG.theme_path); + scrollbarBox = new GuiImageData(imgPath, scrollbar_box_png); scrollbarBoxImg = new GuiImage(scrollbarBox); arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight()); diff --git a/source/prompts/DiscBrowser.cpp b/source/prompts/DiscBrowser.cpp index d1d3daaa..c09f2e5a 100644 --- a/source/prompts/DiscBrowser.cpp +++ b/source/prompts/DiscBrowser.cpp @@ -244,9 +244,9 @@ int autoSelectDol(const char *id) { if (strcmp(id,"REDP41") == 0) return 1957;//from isostar if (strcmp(id,"REDE41") == 0) return 1957;//starstremr - if (strcmp(id,"RSXP69") == 0) return 337;//from isostar - if (strcmp(id,"RSXE69") == 0) return 337;//starstremr - + if (strcmp(id,"RSXP69") == 0) return 377;//previous value was 337 + if (strcmp(id,"RSXE69") == 0) return 377;//previous value was 337 + if (strcmp(id,"RNBX69") == 0) return 964;//from isostar if (strcmp(id,"RNFP69") == 0) return 1079;//from isostar diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index a1adbd81..a892b01a 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -2015,7 +2015,7 @@ ProgressDownloadWindow(int choice2) { if (cntMissFiles - i>1)msgTxt.SetTextf("%i %s", cntMissFiles - i, tr("files left")); else msgTxt.SetTextf("%i %s", cntMissFiles - i, tr("file left")); - msg2Txt.SetTextf("%s", missingFiles[i]); + msg2Txt.SetTextf("http://wiitdb.com : %s", missingFiles[i]); //download boxart image @@ -2591,14 +2591,26 @@ int ProgressUpdateWindow() { free(file.data); } msgTxt.SetTextf("%s", tr("Updating WiiTDB.zip")); + char wiitdbpath[200]; + char wiitdbpathtmp[200]; file = downloadfile(XMLurl); if (file.data != NULL) { - sprintf(xmliconpath, "%swiitdb.zip", Settings.titlestxt_path); - subfoldercreate(xmliconpath); - pfile = fopen(xmliconpath, "wb"); - fwrite(file.data,1,file.size,pfile); - fclose(pfile); - free(file.data); + subfoldercreate(Settings.titlestxt_path); + snprintf(wiitdbpath, sizeof(wiitdbpath), "%swiitdb.zip", Settings.titlestxt_path); + snprintf(wiitdbpathtmp, sizeof(wiitdbpathtmp), "%swiitmp.zip", Settings.titlestxt_path); + rename(wiitdbpath,wiitdbpathtmp); + pfile = fopen(wiitdbpath, "wb"); + fwrite(file.data,1,file.size,pfile); + fclose(pfile); + free(file.data); + CloseXMLDatabase(); + if (OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride==1?true:false, true)) { // open file, reload titles, keep in memory + remove(wiitdbpathtmp); + } else { + remove(wiitdbpath); + rename(wiitdbpathtmp,wiitdbpath); + OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride==1?true:false, true); // open file, reload titles, keep in memory + } } msgTxt.SetTextf("%s", tr("Updating Language Files:")); updateLanguageFiles(); @@ -2616,16 +2628,27 @@ int ProgressUpdateWindow() { } } else if(updatemode == 2) { - char wiitdbpath[200]; msgTxt.SetTextf("%s", tr("Updating WiiTDB.zip")); + char wiitdbpath[200]; + char wiitdbpathtmp[200]; struct block file = downloadfile(XMLurl); if (file.data != NULL) { - snprintf(wiitdbpath, sizeof(wiitdbpath), "%swiitdb.zip", Settings.titlestxt_path); - subfoldercreate(wiitdbpath); - FILE *pfile = fopen(wiitdbpath, "wb"); - fwrite(file.data,1,file.size,pfile); - fclose(pfile); - free(file.data); + subfoldercreate(Settings.titlestxt_path); + snprintf(wiitdbpath, sizeof(wiitdbpath), "%swiitdb.zip", Settings.titlestxt_path); + snprintf(wiitdbpathtmp, sizeof(wiitdbpathtmp), "%swiitmp.zip", Settings.titlestxt_path); + rename(wiitdbpath,wiitdbpathtmp); + FILE *pfile = fopen(wiitdbpath, "wb"); + fwrite(file.data,1,file.size,pfile); + fclose(pfile); + free(file.data); + CloseXMLDatabase(); + if (OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride==1?true:false, true)) { // open file, reload titles, keep in memory + remove(wiitdbpathtmp); + } else { + remove(wiitdbpath); + rename(wiitdbpathtmp,wiitdbpath); + OpenXMLDatabase(Settings.titlestxt_path, Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride==1?true:false, true); // open file, reload titles, keep in memory + } } ret = 1; } else if(updatemode == 3) { diff --git a/source/prompts/gameinfo.cpp b/source/prompts/gameinfo.cpp index ee1c6f15..1ab9e4ca 100644 --- a/source/prompts/gameinfo.cpp +++ b/source/prompts/gameinfo.cpp @@ -761,15 +761,16 @@ int showGameInfo(char *ID) { } //don't bother us txt - snprintf(linebuf, sizeof(linebuf), tr("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); + snprintf(linebuf, sizeof(linebuf), "http://wiitdb.com"); + //snprintf(linebuf, sizeof(linebuf), tr("Don't bother the USB Loader GX Team about errors in this file.")); + betaTxt = new GuiText(linebuf, 17, (GXColor) {0,0,0, 255}); + betaTxt->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); + betaTxt->SetPosition(40,-15); gameinfoWindow.Append(betaTxt); snprintf(linebuf, sizeof(linebuf), tr("If you don't have WiFi, press 1 to get an URL to get your WiiTDB.zip")); beta1Txt = new GuiText(linebuf, 14, (GXColor) {0,0,0, 255}); beta1Txt->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); - beta1Txt->SetPosition(-17,-10); + beta1Txt->SetPosition(-17,-15); gameinfoWindow.Append(beta1Txt); gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 100); diff --git a/source/settings/cfg.c b/source/settings/cfg.c index f4f38399..b1e81cf3 100644 --- a/source/settings/cfg.c +++ b/source/settings/cfg.c @@ -1709,12 +1709,14 @@ void CFG_Load(void) { } GetLanguageToLangCode(&mainlangid, Settings.db_language); - // set language code for languages that are not available on the Wii + // set language code for countries that don't have a language setting on the Wii if (!strcmp(Settings.db_language,"")) { if (strstr(languagefile, "portuguese") != NULL) strcpy(Settings.db_language,"PT"); } - + if (CONF_GetArea() == CONF_AREA_AUS) + strcpy(Settings.db_language,"AU"); + // open database if needed, load titles if needed OpenXMLDatabase(Settings.titlestxt_path,Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride==1?true:false, true);