Fixed the reason for the fix I broke in my last batch of fixes.

This commit is contained in:
lustar.mii 2009-06-14 04:59:32 +00:00
parent 1efc9d1f89
commit 6396c7099f
2 changed files with 110 additions and 103 deletions

View File

@ -35,7 +35,6 @@ extern void HaltGui();
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");
@ -180,7 +179,7 @@ showGameInfo(char *ID, u8 *headerID)
} else {
opt_lang = Settings.language;
}
if (LoadGameInfoFromXML(ID,langtexttmp[opt_lang]))nodata=0;
LoadGameInfoFromXML(ID,langtexttmp[opt_lang]);
char linebuf[1000] = "";
char linebuf2[100] = "";
@ -606,8 +605,8 @@ showGameInfo(char *ID, u8 *headerID)
gameinfoWindow.Append(wifiTxt[0]);
}
//synopsis
if (strcmp(gameinfo.synopsis,"") != 0)
{snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.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);
@ -641,8 +640,6 @@ showGameInfo(char *ID, u8 *headerID)
gameinfoWindow2.Append(&txtWindow);
}
gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50);
HaltGui();
mainWindow->SetState(STATE_DISABLED);
@ -761,16 +758,17 @@ showGameInfo(char *ID, u8 *headerID)
delete wifiTxt[i];
}
}
if (nodata==0)FreeXMLMemory();
ResumeGui();}
else {
FreeXMLMemory();
ResumeGui();
} else {
gameinfoWindow2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
while(gameinfoWindow2.GetEffect() > 0) usleep(50);
HaltGui();
mainWindow->Remove(&gameinfoWindow2);
mainWindow->SetState(STATE_DEFAULT);
ResumeGui();}
FreeXMLMemory();
ResumeGui();
}
return choice;
/* File not found */

View File

@ -53,10 +53,9 @@ static mxml_node_t *nodefound=NULL;
static mxml_index_t *nodeindex=NULL;
static mxml_index_t *nodeindextmp=NULL;
int xmlloadtime = 0;
/* get_text() taken as is from mini-mxml example mxmldoc.c */
/* get_text() - Get the text for a node. */
static char *get_text(mxml_node_t *node, char *buffer, int buflen);
@ -114,7 +113,15 @@ void GetTextFromNode(mxml_node_t *currentnode, mxml_node_t *topnode, char *noden
bool OpenXMLFile(char *filename)
{
// if (xmldebug) dbg_time1();
//if (xmldebug) dbg_time1();
nodeid=NULL;
nodedata=NULL;
nodetree=NULL;
nodeidtmp=NULL;
nodefound=NULL;
nodeindex=NULL;
nodeindextmp=NULL;
char* strresult = strstr(filename,".zip");
if (strresult == NULL) {
@ -165,8 +172,7 @@ bool OpenXMLFile(char *filename)
if (nodedata == NULL) {
return false;
} else {
//if (xmldebug);
// xmlloadtime = dbg_time2(NULL);
//if (xmldebug) xmlloadtime = dbg_time2(NULL);
xml_loaded = true;
return true;
}
@ -179,6 +185,7 @@ void FreeXMLMemory()
if (xml_loaded) {
mxmlIndexDelete(nodeindex);
mxmlIndexDelete(nodeindextmp);
mxmlDelete(nodeid);
mxmlDelete(nodeidtmp);
mxmlDelete(nodefound);
mxmlDelete(nodedata);
@ -384,12 +391,14 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
/* search for game matching gameid */
while (1)
{
exist=true;
nodeid = mxmlIndexFind(nodeindex,"id", NULL);
if (nodeid != NULL) {
get_text(nodeid, element_text, sizeof(element_text));
if (!strcmp(element_text,gameid))
if (!strcmp(element_text,gameid)) {
exist=true;
break;
}
} else {
break;
}