From e5efd8f221b18bd511e38a58e5ce1e9ac18031c9 Mon Sep 17 00:00:00 2001 From: "lustar.mii" Date: Fri, 17 Jul 2009 13:00:56 +0000 Subject: [PATCH] When updating, the downloaded wiitdb.zip will now only contain the game descriptions for the language the Wii is configured to. --- source/prompts/PromptWindows.cpp | 139 +++++++++++++++++-------------- source/prompts/PromptWindows.h | 1 + source/xml/xml.c | 7 +- source/xml/xml.h | 4 +- 4 files changed, 81 insertions(+), 70 deletions(-) diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index 5922aef0..6e821bc8 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -1908,42 +1908,9 @@ ProgressDownloadWindow(int choice2) } } + // get Wii's language setting char sysLanguage[3]; - switch(CONF_GetLanguage()){ - case CONF_LANG_JAPANESE: - sprintf(sysLanguage, "JA"); - break; - case CONF_LANG_ENGLISH: - sprintf(sysLanguage, "EN"); - break; - case CONF_LANG_GERMAN: - sprintf(sysLanguage, "DE"); - break; - case CONF_LANG_FRENCH: - sprintf(sysLanguage, "FR"); - break; - case CONF_LANG_SPANISH: - sprintf(sysLanguage, "ES"); - break; - case CONF_LANG_ITALIAN: - sprintf(sysLanguage, "IT"); - break; - case CONF_LANG_DUTCH: - sprintf(sysLanguage, "NL"); - break; -/* case CONF_LANG_PORTUGUESE: - sprintf(sysLanguage, "PO"); - break;*/ - case CONF_LANG_SIMP_CHINESE: - sprintf(sysLanguage, "EN"); // default to EN for chinese - break; - case CONF_LANG_TRAD_CHINESE: - sprintf(sysLanguage, "EN"); // default to EN for chinese - break; - case CONF_LANG_KOREAN: - sprintf(sysLanguage, "KO"); - break; - } + GetLanguageToLangCode(sysLanguage); //int server = 1; while (i < cntMissFiles) @@ -1989,6 +1956,7 @@ ProgressDownloadWindow(int choice2) break; case 'D': case 'F': + case 'I': case 'P': case 'X': case 'Y': @@ -2036,6 +2004,7 @@ ProgressDownloadWindow(int choice2) break; case 'D': case 'F': + case 'I': case 'P': case 'X': case 'Y': @@ -2081,6 +2050,7 @@ ProgressDownloadWindow(int choice2) break; case 'D': case 'F': + case 'I': case 'P': case 'X': case 'Y': @@ -2364,23 +2334,23 @@ int ProgressUpdateWindow() } } - + // get Wii's language setting + char sysLanguage[3]; + GetLanguageToLangCode(sysLanguage); + //make the URL to get XML based on our games - char XMLurl[2032]; + char XMLurl[2040]; char filename[10]; - //strncat (XMLurl, "http://wiitdb.com/wiitdb.zip?ID=", 32); - strcpy (XMLurl, "http://wiitdb.com/wiitdb.zip?ID="); + snprintf(XMLurl,sizeof(XMLurl),"http://wiitdb.com/wiitdb.zip?LANG=%s?ID=",sysLanguage); unsigned int i; - for (i = 0; i < gameCnt ; i++) - { - struct discHdr* header = &gameList[i]; - if (i<500){ - snprintf (filename,sizeof(filename),"%c%c%c", header->id[1], header->id[2], header->id[3]); - strncat (XMLurl, filename,3 ); - - if ((i!=gameCnt-1)&&(i<500)) - strncat (XMLurl, ",",1); - } + for (i = 0; i < gameCnt ; i++) { + struct discHdr* header = &gameList[i]; + if (i<500) { + snprintf(filename,sizeof(filename),"%c%c%c", header->id[1], header->id[2], header->id[3]); + strncat(XMLurl, filename,3 ); + if ((i!=gameCnt-1)&&(i<500)) + strncat(XMLurl, ",",1); + } } if(IsNetworkInit() && ret >= 0) { @@ -2624,26 +2594,25 @@ int ProgressUpdateWindow() } } - + // get Wii's language setting + char sysLanguage[3]; + GetLanguageToLangCode(sysLanguage); + //make the URL to get XML based on our games - char XMLurl[2032]; + char XMLurl[2040]; char filename[10]; - //strncat (XMLurl, "http://wiitdb.com/wiitdb.zip?ID=", 32); - strcpy (XMLurl, "http://wiitdb.com/wiitdb.zip?ID="); + snprintf(XMLurl,sizeof(XMLurl),"http://wiitdb.com/wiitdb.zip?LANG=%s?ID=",sysLanguage); unsigned int i; - for (i = 0; i < gameCnt ; i++) - { - struct discHdr* header = &gameList[i]; - if (i<500){ - snprintf (filename,sizeof(filename),"%c%c%c", header->id[1], header->id[2], header->id[3]); - strncat (XMLurl, filename,3 ); - - if ((i!=gameCnt-1)&&(i<500)) - strncat (XMLurl, ",",1); - } + for (i = 0; i < gameCnt ; i++) { + struct discHdr* header = &gameList[i]; + if (i<500) { + snprintf(filename,sizeof(filename),"%c%c%c", header->id[1], header->id[2], header->id[3]); + strncat(XMLurl, filename,3 ); + if ((i!=gameCnt-1)&&(i<500)) + strncat(XMLurl, ",",1); + } } - char dolpath[150]; // char dolpathsuccess[150];//use coverspath as a folder for the update wad so we dont make a new folder and have to delete it snprintf(dolpath, sizeof(dolpath), "%sULNR.wad", Settings.covers_path); @@ -2955,3 +2924,45 @@ char * GetMissingFiles() { return (char *) missingFiles; } + + + +/* get the language setting from the Wii settings and return a language code */ +void GetLanguageToLangCode(char *langcode) { + + switch(CONF_GetLanguage()){ + case CONF_LANG_JAPANESE: + sprintf(langcode, "JA"); + break; + case CONF_LANG_ENGLISH: + sprintf(langcode, "EN"); + break; + case CONF_LANG_GERMAN: + sprintf(langcode, "DE"); + break; + case CONF_LANG_FRENCH: + sprintf(langcode, "FR"); + break; + case CONF_LANG_SPANISH: + sprintf(langcode, "ES"); + break; + case CONF_LANG_ITALIAN: + sprintf(langcode, "IT"); + break; + case CONF_LANG_DUTCH: + sprintf(langcode, "NL"); + break; +/* case CONF_LANG_PORTUGUESE: + sprintf(langcode, "PO"); + break;*/ + case CONF_LANG_SIMP_CHINESE: + sprintf(langcode, "EN"); // default to EN for chinese + break; + case CONF_LANG_TRAD_CHINESE: + sprintf(langcode, "EN"); // default to EN for chinese + break; + case CONF_LANG_KOREAN: + sprintf(langcode, "KO"); + break; + } +} diff --git a/source/prompts/PromptWindows.h b/source/prompts/PromptWindows.h index 33663049..b98c6f09 100644 --- a/source/prompts/PromptWindows.h +++ b/source/prompts/PromptWindows.h @@ -27,5 +27,6 @@ int ProgressUpdateWindow(); char * GetMissingFiles(); int WindowScreensaver(); int CodeDownload(const char *id); +void GetLanguageToLangCode(char *langcode); #endif diff --git a/source/xml/xml.c b/source/xml/xml.c index 1e7df063..e129bfab 100644 --- a/source/xml/xml.c +++ b/source/xml/xml.c @@ -286,8 +286,8 @@ void LoadTitlesFromXML(char *langtxt, bool forcejptoen) nodeid = mxmlIndexReset(nodeindex); *element_text = 0; char id_text[10]; - char title_text[100] = ""; - char title_text_EN[100] = ""; + char title_text[200] = ""; + char title_text_EN[200] = ""; /* search index of id elements, load all id/titles text */ while (nodeid != NULL) @@ -576,8 +576,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt) if (gameid[3] == 'J') strlcpy(gameinfo.region,"NTSC-J",sizeof(gameinfo.region)); if (gameid[3] == 'K') strlcpy(gameinfo.region,"NTSC-K",sizeof(gameinfo.region)); if (gameid[3] == 'P') strlcpy(gameinfo.region,"PAL",sizeof(gameinfo.region)); - if (gameid[3] == 'X') strlcpy(gameinfo.region,"PAL-X",sizeof(gameinfo.region)); // does X appear in any original game ID? - // the following codes do not exist and should only appear on modified game IDs + if (gameid[3] == 'X') strlcpy(gameinfo.region,"PAL-X",sizeof(gameinfo.region)); if (gameid[3] == 'D') strlcpy(gameinfo.region,"PAL",sizeof(gameinfo.region)); if (gameid[3] == 'G') strlcpy(gameinfo.region,"PAL",sizeof(gameinfo.region)); if (gameid[3] == 'F') strlcpy(gameinfo.region,"PAL",sizeof(gameinfo.region)); diff --git a/source/xml/xml.h b/source/xml/xml.h index e6a84ac9..82a909ef 100644 --- a/source/xml/xml.h +++ b/source/xml/xml.h @@ -21,9 +21,9 @@ struct gameXMLinfo char id[7]; char version[50]; char region[7]; - char title[100]; + char title[200]; char synopsis[3000]; - char title_EN[100]; + char title_EN[200]; char synopsis_EN[3000]; char locales[XML_ELEMMAX+1][3]; int localeCnt;