mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-19 17:59:16 +01:00
Several small fixes + enabled displaying titles from database in main list and game info screen. The titles now change to the language that is set in the Game Info settings and individual game settings will override it. All titles default to English if the preferred language is not available for a game.
This commit is contained in:
parent
bc8084fe75
commit
1efc9d1f89
@ -1264,6 +1264,7 @@ static int MenuDiscList()
|
|||||||
mainWindow->Remove(&w);
|
mainWindow->Remove(&w);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
int settret = GameSettings(header);
|
int settret = GameSettings(header);
|
||||||
|
menu = MENU_DISCLIST; // refresh titles (needed if the language setting has changed)
|
||||||
HaltGui();
|
HaltGui();
|
||||||
if (Settings.gameDisplay==list) mainWindow->Append(gameBrowser);
|
if (Settings.gameDisplay==list) mainWindow->Append(gameBrowser);
|
||||||
else if (Settings.gameDisplay==grid) mainWindow->Append(gameGrid);
|
else if (Settings.gameDisplay==grid) mainWindow->Append(gameGrid);
|
||||||
|
@ -36,17 +36,16 @@ int
|
|||||||
showGameInfo(char *ID, u8 *headerID)
|
showGameInfo(char *ID, u8 *headerID)
|
||||||
{
|
{
|
||||||
u8 nodata=1;
|
u8 nodata=1;
|
||||||
//load the xml shit
|
//load the xml shit
|
||||||
char pathname[100];
|
char pathname[100];
|
||||||
snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.zip");
|
snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.zip");
|
||||||
|
// database should always be zipped, while it may be convenient detecting and loading from .xml may lead to confusion:
|
||||||
bool fileexists = OpenXMLFile(pathname);
|
bool fileexists = OpenXMLFile(pathname);
|
||||||
if(!fileexists) {
|
if(!fileexists) {
|
||||||
snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.xml");
|
snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.xml");
|
||||||
fileexists = OpenXMLFile(pathname);
|
fileexists = OpenXMLFile(pathname);
|
||||||
}
|
}
|
||||||
if(fileexists) {
|
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 choice = -1;
|
||||||
//int i = 0;
|
//int i = 0;
|
||||||
@ -116,7 +115,7 @@ showGameInfo(char *ID, u8 *headerID)
|
|||||||
GuiText * genreTxt = NULL;
|
GuiText * genreTxt = NULL;
|
||||||
GuiText * betaTxt = NULL;
|
GuiText * betaTxt = NULL;
|
||||||
GuiText * beta1Txt = NULL;
|
GuiText * beta1Txt = NULL;
|
||||||
// GuiText ** wifiTxt = NULL;
|
GuiText ** wifiTxt = NULL;
|
||||||
|
|
||||||
GuiWindow gameinfoWindow(600,308);
|
GuiWindow gameinfoWindow(600,308);
|
||||||
gameinfoWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
gameinfoWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||||
@ -161,7 +160,7 @@ showGameInfo(char *ID, u8 *headerID)
|
|||||||
nextBtn.SetTrigger(&trigA);
|
nextBtn.SetTrigger(&trigA);
|
||||||
gameinfoWindow.Append(&nextBtn);
|
gameinfoWindow.Append(&nextBtn);
|
||||||
|
|
||||||
/*struct Game_CFG *game_cfg = NULL;
|
struct Game_CFG *game_cfg = NULL;
|
||||||
int opt_lang;
|
int opt_lang;
|
||||||
char langtexttmp[11][22] =
|
char langtexttmp[11][22] =
|
||||||
{{"Console Default"},
|
{{"Console Default"},
|
||||||
@ -175,14 +174,13 @@ showGameInfo(char *ID, u8 *headerID)
|
|||||||
{"S. Chinese"},
|
{"S. Chinese"},
|
||||||
{"T. Chinese"},
|
{"T. Chinese"},
|
||||||
{"Korean"}};
|
{"Korean"}};
|
||||||
game_cfg = CFG_get_game_opt(headerID);
|
game_cfg = CFG_get_game_opt((u8*)ID);
|
||||||
if (game_cfg) {
|
if (game_cfg) {
|
||||||
opt_lang = game_cfg->language;
|
opt_lang = game_cfg->language;
|
||||||
} else {
|
} else {
|
||||||
opt_lang = Settings.language;
|
opt_lang = Settings.language;
|
||||||
}*/
|
}
|
||||||
if (LoadGameInfoFromXML(ID,pathname))nodata=0;
|
if (LoadGameInfoFromXML(ID,langtexttmp[opt_lang]))nodata=0;
|
||||||
//LoadGameInfoFromXML(ID,langtexttmp[opt_lang]);
|
|
||||||
char linebuf[1000] = "";
|
char linebuf[1000] = "";
|
||||||
char linebuf2[100] = "";
|
char linebuf2[100] = "";
|
||||||
|
|
||||||
@ -504,8 +502,6 @@ showGameInfo(char *ID, u8 *headerID)
|
|||||||
titleTxt->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt->SetPosition(txtXOffset,12+y); y+=24;
|
titleTxt->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt->SetPosition(txtXOffset,12+y); y+=24;
|
||||||
gameinfoWindow.Append(titleTxt);}
|
gameinfoWindow.Append(titleTxt);}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//date
|
//date
|
||||||
snprintf(linebuf2, sizeof(linebuf2), " ");
|
snprintf(linebuf2, sizeof(linebuf2), " ");
|
||||||
if (strcmp(gameinfo.day,"") != 0)
|
if (strcmp(gameinfo.day,"") != 0)
|
||||||
@ -593,21 +589,22 @@ showGameInfo(char *ID, u8 *headerID)
|
|||||||
beta1Txt->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); beta1Txt->SetPosition(-17,-10);
|
beta1Txt->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); beta1Txt->SetPosition(-17,-10);
|
||||||
gameinfoWindow.Append(beta1Txt);
|
gameinfoWindow.Append(beta1Txt);
|
||||||
|
|
||||||
// WiFi Shit commented out cause it has a code dump in it still
|
wifiTxt = new GuiText * [gameinfo.wifiCnt + 1];
|
||||||
// wifiTxt = new GuiText * [gameinfo.wifiCnt];
|
int wifiY=0;
|
||||||
// int wifiY=0;
|
for (int i=1;i<=gameinfo.wifiCnt;i++)
|
||||||
/*for (int i=gameinfo.wifiCnt;strcmp(gameinfo.wififeatures[i],"") != 0;i--)
|
{
|
||||||
{
|
snprintf(linebuf, sizeof(linebuf), "%s",gameinfo.wififeatures[i]);
|
||||||
snprintf(linebuf, sizeof(linebuf), "%s",gameinfo.wififeatures[i]);
|
wifiTxt[i] = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
|
||||||
wifiTxt[i] = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
|
wifiTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); wifiTxt[i]->SetPosition(215,200+wifiY); wifiY-=(20 * newline);
|
||||||
wifiTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); wifiTxt[i]->SetPosition(215,200+wifiY); wifiY-=(20 * newline);
|
gameinfoWindow.Append(wifiTxt[i]);
|
||||||
gameinfoWindow.Append(wifiTxt[i]);}*/
|
}
|
||||||
|
|
||||||
/*if (strcmp(gameinfo.wififeatures[1],"") != 0){
|
if (strcmp(gameinfo.wififeatures[1],"") != 0){
|
||||||
snprintf(linebuf, sizeof(linebuf), "%s:",LANGUAGE.wififeatures);
|
snprintf(linebuf, sizeof(linebuf), "%s:",LANGUAGE.wififeatures);
|
||||||
wifiTxt[0] = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
|
wifiTxt[0] = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
|
||||||
wifiTxt[0]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); wifiTxt[0]->SetPosition(205,200+wifiY); //wifiY+=(20 * newline);
|
wifiTxt[0]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); wifiTxt[0]->SetPosition(205,200+wifiY); //wifiY+=(20 * newline);
|
||||||
gameinfoWindow.Append(wifiTxt[0]);}*/
|
gameinfoWindow.Append(wifiTxt[0]);
|
||||||
|
}
|
||||||
//synopsis
|
//synopsis
|
||||||
if (strcmp(gameinfo.synopsis,"") != 0)
|
if (strcmp(gameinfo.synopsis,"") != 0)
|
||||||
{snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.synopsis);
|
{snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.synopsis);
|
||||||
@ -758,19 +755,13 @@ showGameInfo(char *ID, u8 *headerID)
|
|||||||
delete genreTxt;
|
delete genreTxt;
|
||||||
delete betaTxt;
|
delete betaTxt;
|
||||||
delete beta1Txt;
|
delete beta1Txt;
|
||||||
/*if (gameinfo.wifiCnt>0){
|
if (gameinfo.wifiCnt>0){
|
||||||
for(int i=0; i<gameinfo.wifiCnt; i++)
|
for(int i=1; i<=gameinfo.wifiCnt; i++)
|
||||||
{
|
{
|
||||||
delete wifiTxt[i];
|
delete wifiTxt[i];
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
if (nodata==0)FreeXMLMemory();
|
if (nodata==0)FreeXMLMemory();
|
||||||
//void FreeXMLDeletePart();
|
|
||||||
/*
|
|
||||||
nodeid
|
|
||||||
<dimok> nodefound
|
|
||||||
*/
|
|
||||||
|
|
||||||
ResumeGui();}
|
ResumeGui();}
|
||||||
else {
|
else {
|
||||||
gameinfoWindow2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
|
gameinfoWindow2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
|
||||||
@ -779,7 +770,7 @@ showGameInfo(char *ID, u8 *headerID)
|
|||||||
mainWindow->Remove(&gameinfoWindow2);
|
mainWindow->Remove(&gameinfoWindow2);
|
||||||
mainWindow->SetState(STATE_DEFAULT);
|
mainWindow->SetState(STATE_DEFAULT);
|
||||||
ResumeGui();}
|
ResumeGui();}
|
||||||
//FreeXMLMemory();
|
FreeXMLMemory();
|
||||||
return choice;
|
return choice;
|
||||||
|
|
||||||
/* File not found */
|
/* File not found */
|
||||||
|
@ -38,6 +38,10 @@ int MenuSettings()
|
|||||||
int choice = 0;
|
int choice = 0;
|
||||||
bool exit = false;
|
bool exit = false;
|
||||||
|
|
||||||
|
// backup game language setting
|
||||||
|
int opt_lang = 0;
|
||||||
|
opt_lang = Settings.language;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
FADE,
|
FADE,
|
||||||
LEFT,
|
LEFT,
|
||||||
@ -1628,9 +1632,20 @@ int MenuSettings()
|
|||||||
w.SetEffect(EFFECT_FADE, -20);
|
w.SetEffect(EFFECT_FADE, -20);
|
||||||
while(w.GetEffect()>0) usleep(50);
|
while(w.GetEffect()>0) usleep(50);
|
||||||
|
|
||||||
|
|
||||||
|
// if language has changed, reload titles
|
||||||
|
int opt_langnew = 0;
|
||||||
|
opt_langnew = Settings.language;
|
||||||
|
if (Settings.titlesOverride==1 && opt_lang != opt_langnew) {
|
||||||
|
CFG_LoadXml(true, true, false); // open file, reload titles, do not keep in memory
|
||||||
|
menu = MENU_DISCLIST;
|
||||||
|
}
|
||||||
|
|
||||||
HaltGui();
|
HaltGui();
|
||||||
|
|
||||||
mainWindow->RemoveAll();
|
mainWindow->RemoveAll();
|
||||||
mainWindow->Append(bgImg);
|
mainWindow->Append(bgImg);
|
||||||
|
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
@ -1767,6 +1782,8 @@ int GameSettings(struct discHdr * header)
|
|||||||
fix002 = off;
|
fix002 = off;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int opt_lang = languageChoice; // backup language setting
|
||||||
|
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
|
|
||||||
while(!exit)
|
while(!exit)
|
||||||
@ -1868,6 +1885,14 @@ int GameSettings(struct discHdr * header)
|
|||||||
if(isInserted(bootDevice)) {
|
if(isInserted(bootDevice)) {
|
||||||
if (CFG_save_game_opt(header->id))
|
if (CFG_save_game_opt(header->id))
|
||||||
{
|
{
|
||||||
|
// if language has changed, reload titles
|
||||||
|
int opt_langnew = 0;
|
||||||
|
game_cfg = CFG_get_game_opt(header->id);
|
||||||
|
if (game_cfg) opt_langnew = game_cfg->language;
|
||||||
|
if (Settings.titlesOverride==1 && opt_lang != opt_langnew) {
|
||||||
|
CFG_LoadXml(true, true, false); // open file, reload titles, do not keep in memory
|
||||||
|
}
|
||||||
|
// titles are refreshed in menu.cpp as soon as this function returns
|
||||||
WindowPrompt(LANGUAGE.SuccessfullySaved, 0, LANGUAGE.ok, 0,0,0);
|
WindowPrompt(LANGUAGE.SuccessfullySaved, 0, LANGUAGE.ok, 0,0,0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -10,5 +10,4 @@
|
|||||||
|
|
||||||
int MenuSettings();
|
int MenuSettings();
|
||||||
int GameSettings(struct discHdr * header);
|
int GameSettings(struct discHdr * header);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1564,15 +1564,17 @@ bool CFG_forget_game_opt(u8 *id)
|
|||||||
return cfg_save_games();
|
return cfg_save_games();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFG_LoadXml()
|
void CFG_LoadXml(bool openfile, bool loadtitles, bool freemem)
|
||||||
{
|
{
|
||||||
char pathname[200];
|
|
||||||
/* load renamed titles from proper names and game info XML, needs to be after cfg_load_games - Lustar */
|
/* 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");
|
char pathname[200];
|
||||||
OpenXMLFile(pathname);
|
snprintf(pathname, sizeof(pathname), "%s%s", Settings.titlestxt_path, "wiitdb.zip");
|
||||||
LoadTitlesFromXML("English", false); // options can be added to set force title language to any language and force Japanese title to English
|
if (openfile) OpenXMLFile(pathname);
|
||||||
|
char forcedlanguage[100] = "";
|
||||||
}
|
if (loadtitles) LoadTitlesFromXML(forcedlanguage, true); // options can be added to set force title language to any language and force Japanese title to English
|
||||||
|
// true = force english for al Japanese tiles, this should be set to true as long as Japanese titles are not displayed properly
|
||||||
|
if (freemem) FreeXMLMemory(); // free memory as soon as titles are loaded, the file will need to be loaded again if needed
|
||||||
|
}
|
||||||
|
|
||||||
void CFG_Load(void)
|
void CFG_Load(void)
|
||||||
{
|
{
|
||||||
@ -1595,9 +1597,6 @@ void CFG_Load(void)
|
|||||||
snprintf(pathname, sizeof(pathname), Settings.language_path);
|
snprintf(pathname, sizeof(pathname), Settings.language_path);
|
||||||
cfg_parsefile(pathname, &language_set);
|
cfg_parsefile(pathname, &language_set);
|
||||||
|
|
||||||
snprintf(pathname, sizeof(pathname), "%stitles.txt", Settings.titlestxt_path);
|
|
||||||
cfg_parsefile(pathname, &title_set);
|
|
||||||
|
|
||||||
snprintf(pathname, sizeof(pathname), "%s/config/GXGameSettings.cfg", bootDevice);
|
snprintf(pathname, sizeof(pathname), "%s/config/GXGameSettings.cfg", bootDevice);
|
||||||
cfg_parsefile(pathname, &parental_set);
|
cfg_parsefile(pathname, &parental_set);
|
||||||
|
|
||||||
@ -1605,11 +1604,15 @@ void CFG_Load(void)
|
|||||||
cfg_load_games();
|
cfg_load_games();
|
||||||
cfg_load_game_num();
|
cfg_load_game_num();
|
||||||
|
|
||||||
if (Settings.titlesOverride==1)CFG_LoadXml();
|
|
||||||
|
|
||||||
Global_Default(); //global default depends on theme information
|
Global_Default(); //global default depends on theme information
|
||||||
CFG_LoadGlobal();
|
CFG_LoadGlobal();
|
||||||
|
|
||||||
|
if (Settings.titlesOverride==1) CFG_LoadXml(true, true, false); // load titles, do not keep in memory
|
||||||
|
|
||||||
|
// loaded after database to override database titles with custom titles
|
||||||
|
snprintf(pathname, sizeof(pathname), "%stitles.txt", Settings.titlestxt_path);
|
||||||
|
cfg_parsefile(pathname, &title_set);
|
||||||
|
|
||||||
// cfg_parsearg(argc, argv);
|
// cfg_parsearg(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ struct SSettings {
|
|||||||
|
|
||||||
void CFG_LoadGlobal(void);
|
void CFG_LoadGlobal(void);
|
||||||
bool cfg_save_global(void);
|
bool cfg_save_global(void);
|
||||||
void CFG_LoadXml();
|
void CFG_LoadXml(bool openfile, bool loadtitles, bool freemem);
|
||||||
//Astidof - End of modification
|
//Astidof - End of modification
|
||||||
|
|
||||||
char *get_title(struct discHdr *header);
|
char *get_title(struct discHdr *header);
|
||||||
|
@ -4,17 +4,19 @@ Load game information from XML - Lustar
|
|||||||
- MiniZip adapted by Tantric
|
- MiniZip adapted by Tantric
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <malloc.h>
|
||||||
#include <mxml.h>
|
#include <mxml.h>
|
||||||
|
#include "unzip/unzip.h"
|
||||||
#include "settings/cfg.h"
|
#include "settings/cfg.h"
|
||||||
#include "xml/xml.h"
|
#include "xml/xml.h"
|
||||||
#include "unzip/unzip.h"
|
//#include "cfg.h"
|
||||||
|
//#include "xml.h"
|
||||||
|
|
||||||
|
|
||||||
|
bool xml_loaded = false;
|
||||||
static bool xmldebug = false;
|
static bool xmldebug = false;
|
||||||
|
|
||||||
extern struct SSettings Settings; // for loader GX
|
extern struct SSettings Settings; // for loader GX
|
||||||
|
|
||||||
|
|
||||||
static char langlist[11][22] =
|
static char langlist[11][22] =
|
||||||
{{"Console Default"},
|
{{"Console Default"},
|
||||||
{"Japanese"},
|
{"Japanese"},
|
||||||
@ -53,17 +55,6 @@ static mxml_index_t *nodeindextmp=NULL;
|
|||||||
|
|
||||||
int xmlloadtime = 0;
|
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() taken as is from mini-mxml example mxmldoc.c */
|
||||||
@ -123,10 +114,7 @@ void GetTextFromNode(mxml_node_t *currentnode, mxml_node_t *topnode, char *noden
|
|||||||
|
|
||||||
bool OpenXMLFile(char *filename)
|
bool OpenXMLFile(char *filename)
|
||||||
{
|
{
|
||||||
mxml_node_t *nodetree;
|
// if (xmldebug) dbg_time1();
|
||||||
|
|
||||||
// if (xmldebug)
|
|
||||||
// dbg_time1();
|
|
||||||
|
|
||||||
char* strresult = strstr(filename,".zip");
|
char* strresult = strstr(filename,".zip");
|
||||||
if (strresult == NULL) {
|
if (strresult == NULL) {
|
||||||
@ -149,9 +137,13 @@ bool OpenXMLFile(char *filename)
|
|||||||
unz_file_info zipfileinfo;
|
unz_file_info zipfileinfo;
|
||||||
unzGetCurrentFileInfo(unzfile, &zipfileinfo, NULL, 0, NULL, 0, NULL, 0);
|
unzGetCurrentFileInfo(unzfile, &zipfileinfo, NULL, 0, NULL, 0, NULL, 0);
|
||||||
int zipfilebuffersize = zipfileinfo.uncompressed_size;
|
int zipfilebuffersize = zipfileinfo.uncompressed_size;
|
||||||
char * zipfilebuffer = (char *) calloc(1,zipfilebuffersize);
|
char * zipfilebuffer = malloc(zipfilebuffersize);
|
||||||
if (zipfilebuffer == NULL)
|
memset(zipfilebuffer, 0, zipfilebuffersize);
|
||||||
|
if (zipfilebuffer == NULL) {
|
||||||
|
unzCloseCurrentFile(unzfile);
|
||||||
|
unzClose(unzfile);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
unzReadCurrentFile(unzfile, zipfilebuffer, zipfilebuffersize);
|
unzReadCurrentFile(unzfile, zipfilebuffer, zipfilebuffersize);
|
||||||
unzCloseCurrentFile(unzfile);
|
unzCloseCurrentFile(unzfile);
|
||||||
@ -175,6 +167,7 @@ bool OpenXMLFile(char *filename)
|
|||||||
} else {
|
} else {
|
||||||
//if (xmldebug);
|
//if (xmldebug);
|
||||||
// xmlloadtime = dbg_time2(NULL);
|
// xmlloadtime = dbg_time2(NULL);
|
||||||
|
xml_loaded = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,13 +176,15 @@ bool OpenXMLFile(char *filename)
|
|||||||
void FreeXMLMemory()
|
void FreeXMLMemory()
|
||||||
{
|
{
|
||||||
/* free memory */
|
/* free memory */
|
||||||
mxmlIndexDelete(nodeindex);
|
if (xml_loaded) {
|
||||||
mxmlIndexDelete(nodeindextmp);
|
mxmlIndexDelete(nodeindex);
|
||||||
mxmlDelete(nodeid);
|
mxmlIndexDelete(nodeindextmp);
|
||||||
mxmlDelete(nodeidtmp);
|
mxmlDelete(nodeidtmp);
|
||||||
mxmlDelete(nodefound);
|
mxmlDelete(nodefound);
|
||||||
mxmlDelete(nodedata);
|
mxmlDelete(nodedata);
|
||||||
mxmlDelete(nodetree);
|
mxmlDelete(nodetree);
|
||||||
|
xml_loaded = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -284,7 +279,6 @@ void LoadTitlesFromXML(char *langtxt, bool forcejptoen)
|
|||||||
char id_text[10];
|
char id_text[10];
|
||||||
char title_text[500] = "";
|
char title_text[500] = "";
|
||||||
char title_text_EN[500] = "";
|
char title_text_EN[500] = "";
|
||||||
|
|
||||||
/* 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)
|
||||||
{
|
{
|
||||||
@ -304,8 +298,8 @@ void LoadTitlesFromXML(char *langtxt, bool forcejptoen)
|
|||||||
if (game_cfg) {
|
if (game_cfg) {
|
||||||
opt_lang = game_cfg->language;
|
opt_lang = game_cfg->language;
|
||||||
} else {
|
} else {
|
||||||
// opt_lang = CFG.language; // for config loader
|
//opt_lang = CFG.language; // for Configurable Loader
|
||||||
opt_lang = Settings.language; // for loader GX
|
opt_lang = Settings.language; // for Loader GX
|
||||||
}
|
}
|
||||||
strcpy(langcode,ConvertLangTextToCode(langlist[opt_lang]));
|
strcpy(langcode,ConvertLangTextToCode(langlist[opt_lang]));
|
||||||
}
|
}
|
||||||
@ -373,7 +367,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
/* langcode: "English","French","German" */
|
/* langcode: "English","French","German" */
|
||||||
{
|
{
|
||||||
bool exist=false;
|
bool exist=false;
|
||||||
if (nodeindex == NULL)
|
if (nodeindex == NULL || nodedata == NULL)
|
||||||
return exist;
|
return exist;
|
||||||
|
|
||||||
/* convert language text into ISO 639 two-letter language codes */
|
/* convert language text into ISO 639 two-letter language codes */
|
||||||
@ -428,13 +422,12 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
/* text from child elements */
|
/* text from child elements */
|
||||||
nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", "EN", MXML_NO_DESCEND);
|
nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", "EN", MXML_NO_DESCEND);
|
||||||
if (nodefound != NULL) {
|
if (nodefound != NULL) {
|
||||||
//if (Settings.titlesOverride==1)
|
|
||||||
GetTextFromNode(nodefound, nodedata, "title", NULL, NULL, MXML_DESCEND, gameinfo.title_EN);
|
GetTextFromNode(nodefound, nodedata, "title", NULL, NULL, MXML_DESCEND, gameinfo.title_EN);
|
||||||
GetTextFromNode(nodefound, nodedata, "synopsis", NULL, NULL, MXML_DESCEND, gameinfo.synopsis_EN);
|
GetTextFromNode(nodefound, nodedata, "synopsis", NULL, NULL, MXML_DESCEND, gameinfo.synopsis_EN);
|
||||||
}
|
}
|
||||||
nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", langcode, MXML_NO_DESCEND);
|
nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", langcode, MXML_NO_DESCEND);
|
||||||
if (nodefound != NULL) {
|
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);
|
GetTextFromNode(nodefound, nodedata, "synopsis", NULL, NULL, MXML_DESCEND, gameinfo.synopsis);
|
||||||
}
|
}
|
||||||
// fall back to English title and synopsis if prefered language was not found
|
// fall back to English title and synopsis if prefered language was not found
|
||||||
@ -480,7 +473,7 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
|
|
||||||
nodefound = mxmlFindElement(nodeid, nodedata, "rating", NULL, NULL, MXML_NO_DESCEND);
|
nodefound = mxmlFindElement(nodeid, nodedata, "rating", NULL, NULL, MXML_NO_DESCEND);
|
||||||
if (nodefound != NULL) {
|
if (nodefound != NULL) {
|
||||||
int incr = 0;
|
gameinfo.descriptorCnt=0;
|
||||||
nodeindextmp = mxmlIndexNew(nodefound,"descriptor", NULL);
|
nodeindextmp = mxmlIndexNew(nodefound,"descriptor", NULL);
|
||||||
nodeidtmp = mxmlIndexReset(nodeindextmp);
|
nodeidtmp = mxmlIndexReset(nodeindextmp);
|
||||||
|
|
||||||
@ -488,8 +481,8 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
{
|
{
|
||||||
nodeidtmp = mxmlIndexFind(nodeindextmp,"descriptor", NULL);
|
nodeidtmp = mxmlIndexFind(nodeindextmp,"descriptor", NULL);
|
||||||
if (nodeidtmp != NULL) {
|
if (nodeidtmp != NULL) {
|
||||||
++incr;
|
++gameinfo.descriptorCnt;
|
||||||
GetTextFromNode(nodeidtmp, nodedata, "descriptor", NULL, NULL, MXML_DESCEND, gameinfo.ratingdescriptors[incr]);
|
GetTextFromNode(nodeidtmp, nodedata, "descriptor", NULL, NULL, MXML_DESCEND, gameinfo.ratingdescriptors[gameinfo.descriptorCnt]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -497,8 +490,6 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
GetTextFromNode(nodeid, nodedata, "input", "players", NULL, MXML_NO_DESCEND, gameinfo.players);
|
GetTextFromNode(nodeid, nodedata, "input", "players", NULL, MXML_NO_DESCEND, gameinfo.players);
|
||||||
nodefound = mxmlFindElement(nodeid, nodedata, "input", NULL, NULL, MXML_NO_DESCEND);
|
nodefound = mxmlFindElement(nodeid, nodedata, "input", NULL, NULL, MXML_NO_DESCEND);
|
||||||
if (nodefound != NULL) {
|
if (nodefound != NULL) {
|
||||||
//int incr = 0;
|
|
||||||
//int incrreq = 0;
|
|
||||||
gameinfo.accessoryCnt=0;
|
gameinfo.accessoryCnt=0;
|
||||||
gameinfo.accessoryReqCnt=0;
|
gameinfo.accessoryReqCnt=0;
|
||||||
|
|
||||||
@ -513,7 +504,6 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
++gameinfo.accessoryReqCnt;
|
++gameinfo.accessoryReqCnt;
|
||||||
strcpy(gameinfo.accessories_required[gameinfo.accessoryReqCnt],mxmlElementGetAttr(nodeidtmp, "type"));
|
strcpy(gameinfo.accessories_required[gameinfo.accessoryReqCnt],mxmlElementGetAttr(nodeidtmp, "type"));
|
||||||
} else {
|
} else {
|
||||||
//++incr;
|
|
||||||
++gameinfo.accessoryCnt;
|
++gameinfo.accessoryCnt;
|
||||||
strcpy(gameinfo.accessories[gameinfo.accessoryCnt],mxmlElementGetAttr(nodeidtmp, "type"));
|
strcpy(gameinfo.accessories[gameinfo.accessoryCnt],mxmlElementGetAttr(nodeidtmp, "type"));
|
||||||
}
|
}
|
||||||
@ -527,9 +517,11 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
ConvertRating(gameinfo.ratingvalue, gameinfo.ratingtype, "PEGI",gameinfo.ratingvaluePEGI);
|
ConvertRating(gameinfo.ratingvalue, gameinfo.ratingtype, "PEGI",gameinfo.ratingvaluePEGI);
|
||||||
|
|
||||||
//PrintGameInfo();
|
//PrintGameInfo();
|
||||||
exist=true;
|
|
||||||
} else {exist=false;
|
exist=true;
|
||||||
|
} else {
|
||||||
/*game not found */
|
/*game not found */
|
||||||
|
exist=false;
|
||||||
}return exist;
|
}return exist;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -590,9 +582,9 @@ void PrintGameInfo(bool showfullinfo)
|
|||||||
char linebuf[1000] = "";
|
char linebuf[1000] = "";
|
||||||
|
|
||||||
if (xmldebug) {
|
if (xmldebug) {
|
||||||
char xmltime[100];
|
//char xmltime[100];
|
||||||
sprintf(xmltime,"%d",xmlloadtime);
|
//sprintf(xmltime,"%d",xmlloadtime);
|
||||||
printf("xml load time: %s\n",xmltime);
|
//printf("xml load time: %s\n",xmltime);
|
||||||
/*
|
/*
|
||||||
printf("xml forcelang: %s\n",CFG.db_lang);
|
printf("xml forcelang: %s\n",CFG.db_lang);
|
||||||
printf("xml url: %s\n",CFG.db_url);
|
printf("xml url: %s\n",CFG.db_url);
|
||||||
@ -601,6 +593,18 @@ void PrintGameInfo(bool showfullinfo)
|
|||||||
sprintf(xmljptoen,"%d",CFG.db_JPtoEN);
|
sprintf(xmljptoen,"%d",CFG.db_JPtoEN);
|
||||||
printf("xml JPtoEN: %s\n",xmljptoen);
|
printf("xml JPtoEN: %s\n",xmljptoen);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// guidebug
|
||||||
|
struct mallinfo mymallinfo = mallinfo();
|
||||||
|
char memtotal[100];
|
||||||
|
char memused[100];
|
||||||
|
char memnotinuse[100];
|
||||||
|
char memcanbefreed[100];
|
||||||
|
sprintf(memtotal,"%d",mymallinfo.arena/1024);
|
||||||
|
sprintf(memused,"%d",mymallinfo.uordblks/1024);
|
||||||
|
sprintf(memnotinuse,"%d",mymallinfo.fordblks/1024);
|
||||||
|
sprintf(memcanbefreed,"%d",mymallinfo.keepcost/1024);
|
||||||
|
printf("allocated:%sKB used:%sKB notused:%sKB canbefreed:%s", memtotal, memused, memnotinuse, memcanbefreed);
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("%s: ",gameidfull);
|
//printf("%s: ",gameidfull);
|
||||||
|
@ -41,6 +41,7 @@ struct gameXMLinfo
|
|||||||
char iso_crc[10];
|
char iso_crc[10];
|
||||||
char iso_md5[50];
|
char iso_md5[50];
|
||||||
char iso_sha1[50];
|
char iso_sha1[50];
|
||||||
|
int descriptorCnt;
|
||||||
int accessoryCnt;
|
int accessoryCnt;
|
||||||
int accessoryReqCnt;
|
int accessoryReqCnt;
|
||||||
int wifiCnt;
|
int wifiCnt;
|
||||||
@ -58,7 +59,6 @@ char *ConvertLangTextToCode(char *langtext);
|
|||||||
void ConvertRating(char *ratingvalue, char *fromrating, char *torating, char *destvalue);
|
void ConvertRating(char *ratingvalue, char *fromrating, char *torating, char *destvalue);
|
||||||
void PrintGameInfo(bool showfullinfo);
|
void PrintGameInfo(bool showfullinfo);
|
||||||
void FreeXMLMemory();
|
void FreeXMLMemory();
|
||||||
void FreeXMLDeletePart();
|
|
||||||
|
|
||||||
void title_set(char *id, char *title);
|
void title_set(char *id, char *title);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user