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 int
showGameInfo(char *ID, u8 *headerID) showGameInfo(char *ID, u8 *headerID)
{ {
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");
@ -180,7 +179,7 @@ showGameInfo(char *ID, u8 *headerID)
} else { } else {
opt_lang = Settings.language; opt_lang = Settings.language;
} }
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] = "";
@ -606,8 +605,8 @@ showGameInfo(char *ID, u8 *headerID)
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);
synopsisTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255}); synopsisTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
synopsisTxt->SetMaxWidth(350,GuiText::WRAP); synopsisTxt->SetMaxWidth(350,GuiText::WRAP);
synopsisTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); synopsisTxt->SetPosition(0,0); synopsisTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); synopsisTxt->SetPosition(0,0);
@ -641,8 +640,6 @@ showGameInfo(char *ID, u8 *headerID)
gameinfoWindow2.Append(&txtWindow); gameinfoWindow2.Append(&txtWindow);
} }
gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50); gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50);
HaltGui(); HaltGui();
mainWindow->SetState(STATE_DISABLED); mainWindow->SetState(STATE_DISABLED);
@ -761,16 +758,17 @@ showGameInfo(char *ID, u8 *headerID)
delete wifiTxt[i]; delete wifiTxt[i];
} }
} }
if (nodata==0)FreeXMLMemory(); FreeXMLMemory();
ResumeGui();} ResumeGui();
else { } else {
gameinfoWindow2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50); gameinfoWindow2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
while(gameinfoWindow2.GetEffect() > 0) usleep(50); while(gameinfoWindow2.GetEffect() > 0) usleep(50);
HaltGui(); HaltGui();
mainWindow->Remove(&gameinfoWindow2); mainWindow->Remove(&gameinfoWindow2);
mainWindow->SetState(STATE_DEFAULT); mainWindow->SetState(STATE_DEFAULT);
ResumeGui();}
FreeXMLMemory(); FreeXMLMemory();
ResumeGui();
}
return choice; return choice;
/* File not found */ /* 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 *nodeindex=NULL;
static mxml_index_t *nodeindextmp=NULL; static mxml_index_t *nodeindextmp=NULL;
int xmlloadtime = 0; int xmlloadtime = 0;
/* get_text() taken as is from mini-mxml example mxmldoc.c */ /* get_text() taken as is from mini-mxml example mxmldoc.c */
/* get_text() - Get the text for a node. */ /* get_text() - Get the text for a node. */
static char *get_text(mxml_node_t *node, char *buffer, int buflen); 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) 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"); char* strresult = strstr(filename,".zip");
if (strresult == NULL) { if (strresult == NULL) {
@ -165,8 +172,7 @@ bool OpenXMLFile(char *filename)
if (nodedata == NULL) { if (nodedata == NULL) {
return false; return false;
} else { } else {
//if (xmldebug); //if (xmldebug) xmlloadtime = dbg_time2(NULL);
// xmlloadtime = dbg_time2(NULL);
xml_loaded = true; xml_loaded = true;
return true; return true;
} }
@ -179,6 +185,7 @@ void FreeXMLMemory()
if (xml_loaded) { if (xml_loaded) {
mxmlIndexDelete(nodeindex); mxmlIndexDelete(nodeindex);
mxmlIndexDelete(nodeindextmp); mxmlIndexDelete(nodeindextmp);
mxmlDelete(nodeid);
mxmlDelete(nodeidtmp); mxmlDelete(nodeidtmp);
mxmlDelete(nodefound); mxmlDelete(nodefound);
mxmlDelete(nodedata); mxmlDelete(nodedata);
@ -384,12 +391,14 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
/* search for game matching gameid */ /* search for game matching gameid */
while (1) while (1)
{ {
exist=true;
nodeid = mxmlIndexFind(nodeindex,"id", NULL); nodeid = mxmlIndexFind(nodeindex,"id", NULL);
if (nodeid != NULL) { if (nodeid != NULL) {
get_text(nodeid, element_text, sizeof(element_text)); get_text(nodeid, element_text, sizeof(element_text));
if (!strcmp(element_text,gameid)) if (!strcmp(element_text,gameid)) {
exist=true;
break; break;
}
} else { } else {
break; break;
} }