When updating, the downloaded wiitdb.zip will now only contain the game descriptions for the language the Wii is configured to.

This commit is contained in:
lustar.mii 2009-07-17 13:00:56 +00:00
parent d17df2be50
commit e5efd8f221
4 changed files with 81 additions and 70 deletions

View File

@ -1908,42 +1908,9 @@ ProgressDownloadWindow(int choice2)
} }
} }
// get Wii's language setting
char sysLanguage[3]; char sysLanguage[3];
switch(CONF_GetLanguage()){ GetLanguageToLangCode(sysLanguage);
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;
}
//int server = 1; //int server = 1;
while (i < cntMissFiles) while (i < cntMissFiles)
@ -1989,6 +1956,7 @@ ProgressDownloadWindow(int choice2)
break; break;
case 'D': case 'D':
case 'F': case 'F':
case 'I':
case 'P': case 'P':
case 'X': case 'X':
case 'Y': case 'Y':
@ -2036,6 +2004,7 @@ ProgressDownloadWindow(int choice2)
break; break;
case 'D': case 'D':
case 'F': case 'F':
case 'I':
case 'P': case 'P':
case 'X': case 'X':
case 'Y': case 'Y':
@ -2081,6 +2050,7 @@ ProgressDownloadWindow(int choice2)
break; break;
case 'D': case 'D':
case 'F': case 'F':
case 'I':
case 'P': case 'P':
case 'X': case 'X':
case 'Y': 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 //make the URL to get XML based on our games
char XMLurl[2032]; char XMLurl[2040];
char filename[10]; char filename[10];
//strncat (XMLurl, "http://wiitdb.com/wiitdb.zip?ID=", 32); snprintf(XMLurl,sizeof(XMLurl),"http://wiitdb.com/wiitdb.zip?LANG=%s?ID=",sysLanguage);
strcpy (XMLurl, "http://wiitdb.com/wiitdb.zip?ID=");
unsigned int i; unsigned int i;
for (i = 0; i < gameCnt ; i++) for (i = 0; i < gameCnt ; i++) {
{ struct discHdr* header = &gameList[i];
struct discHdr* header = &gameList[i]; if (i<500) {
if (i<500){ snprintf(filename,sizeof(filename),"%c%c%c", header->id[1], header->id[2], header->id[3]);
snprintf (filename,sizeof(filename),"%c%c%c", header->id[1], header->id[2], header->id[3]); strncat(XMLurl, filename,3 );
strncat (XMLurl, filename,3 ); if ((i!=gameCnt-1)&&(i<500))
strncat(XMLurl, ",",1);
if ((i!=gameCnt-1)&&(i<500)) }
strncat (XMLurl, ",",1);
}
} }
if(IsNetworkInit() && ret >= 0) { 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 //make the URL to get XML based on our games
char XMLurl[2032]; char XMLurl[2040];
char filename[10]; char filename[10];
//strncat (XMLurl, "http://wiitdb.com/wiitdb.zip?ID=", 32); snprintf(XMLurl,sizeof(XMLurl),"http://wiitdb.com/wiitdb.zip?LANG=%s?ID=",sysLanguage);
strcpy (XMLurl, "http://wiitdb.com/wiitdb.zip?ID=");
unsigned int i; unsigned int i;
for (i = 0; i < gameCnt ; i++) for (i = 0; i < gameCnt ; i++) {
{ struct discHdr* header = &gameList[i];
struct discHdr* header = &gameList[i]; if (i<500) {
if (i<500){ snprintf(filename,sizeof(filename),"%c%c%c", header->id[1], header->id[2], header->id[3]);
snprintf (filename,sizeof(filename),"%c%c%c", header->id[1], header->id[2], header->id[3]); strncat(XMLurl, filename,3 );
strncat (XMLurl, filename,3 ); if ((i!=gameCnt-1)&&(i<500))
strncat(XMLurl, ",",1);
if ((i!=gameCnt-1)&&(i<500)) }
strncat (XMLurl, ",",1);
}
} }
char dolpath[150]; 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 // 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); snprintf(dolpath, sizeof(dolpath), "%sULNR.wad", Settings.covers_path);
@ -2955,3 +2924,45 @@ char * GetMissingFiles()
{ {
return (char *) missingFiles; 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;
}
}

View File

@ -27,5 +27,6 @@ int ProgressUpdateWindow();
char * GetMissingFiles(); char * GetMissingFiles();
int WindowScreensaver(); int WindowScreensaver();
int CodeDownload(const char *id); int CodeDownload(const char *id);
void GetLanguageToLangCode(char *langcode);
#endif #endif

View File

@ -286,8 +286,8 @@ void LoadTitlesFromXML(char *langtxt, bool forcejptoen)
nodeid = mxmlIndexReset(nodeindex); nodeid = mxmlIndexReset(nodeindex);
*element_text = 0; *element_text = 0;
char id_text[10]; char id_text[10];
char title_text[100] = ""; char title_text[200] = "";
char title_text_EN[100] = ""; char title_text_EN[200] = "";
/* search index of id elements, load all id/titles text */ /* search index of id elements, load all id/titles text */
while (nodeid != NULL) 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] == 'J') strlcpy(gameinfo.region,"NTSC-J",sizeof(gameinfo.region));
if (gameid[3] == 'K') strlcpy(gameinfo.region,"NTSC-K",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] == '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? if (gameid[3] == 'X') strlcpy(gameinfo.region,"PAL-X",sizeof(gameinfo.region));
// the following codes do not exist and should only appear on modified game IDs
if (gameid[3] == 'D') strlcpy(gameinfo.region,"PAL",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] == 'G') strlcpy(gameinfo.region,"PAL",sizeof(gameinfo.region));
if (gameid[3] == 'F') strlcpy(gameinfo.region,"PAL",sizeof(gameinfo.region)); if (gameid[3] == 'F') strlcpy(gameinfo.region,"PAL",sizeof(gameinfo.region));

View File

@ -21,9 +21,9 @@ struct gameXMLinfo
char id[7]; char id[7];
char version[50]; char version[50];
char region[7]; char region[7];
char title[100]; char title[200];
char synopsis[3000]; char synopsis[3000];
char title_EN[100]; char title_EN[200];
char synopsis_EN[3000]; char synopsis_EN[3000];
char locales[XML_ELEMMAX+1][3]; char locales[XML_ELEMMAX+1][3];
int localeCnt; int localeCnt;