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] = "";
@ -507,7 +506,7 @@ showGameInfo(char *ID, u8 *headerID)
if (strcmp(gameinfo.day,"") != 0) if (strcmp(gameinfo.day,"") != 0)
{snprintf(linebuf2, sizeof(linebuf2), "%s ", gameinfo.day);} {snprintf(linebuf2, sizeof(linebuf2), "%s ", gameinfo.day);}
if (strcmp(gameinfo.month,"") != 0){ if (strcmp(gameinfo.month,"") != 0){
switch (atoi(gameinfo.month)) switch (atoi(gameinfo.month))
{ {
case 1: case 1:
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, LANGUAGE.january); snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, LANGUAGE.january);
@ -606,42 +605,40 @@ 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);
dialogBoxImg11 = new GuiImage(&dialogBox1); dialogBoxImg11 = new GuiImage(&dialogBox1);
dialogBoxImg11->SetAlignment(0,3); dialogBoxImg11->SetAlignment(0,3);
dialogBoxImg11->SetPosition(-9,0); dialogBoxImg11->SetPosition(-9,0);
dialogBoxImg22 = new GuiImage(&dialogBox2); dialogBoxImg22 = new GuiImage(&dialogBox2);
dialogBoxImg22->SetAlignment(0,3); dialogBoxImg22->SetAlignment(0,3);
dialogBoxImg22->SetPosition(145,0); dialogBoxImg22->SetPosition(145,0);
dialogBoxImg33 = new GuiImage(&dialogBox3); dialogBoxImg33 = new GuiImage(&dialogBox3);
dialogBoxImg33->SetAlignment(0,3); dialogBoxImg33->SetAlignment(0,3);
dialogBoxImg33->SetPosition(301,0); dialogBoxImg33->SetPosition(301,0);
dialogBoxImg44 = new GuiImage(&dialogBox4); dialogBoxImg44 = new GuiImage(&dialogBox4);
dialogBoxImg44->SetAlignment(0,3); dialogBoxImg44->SetAlignment(0,3);
dialogBoxImg44->SetPosition(457,0); dialogBoxImg44->SetPosition(457,0);
gameinfoWindow2.Append(dialogBoxImg11); gameinfoWindow2.Append(dialogBoxImg11);
gameinfoWindow2.Append(dialogBoxImg22); gameinfoWindow2.Append(dialogBoxImg22);
gameinfoWindow2.Append(dialogBoxImg33); gameinfoWindow2.Append(dialogBoxImg33);
gameinfoWindow2.Append(dialogBoxImg44); gameinfoWindow2.Append(dialogBoxImg44);
txtWindow.Append(synopsisTxt);
coverImg2 = new GuiImage(cover);
coverImg2->SetWidescreen(CFG.widescreen);
coverImg2->SetPosition(15,30);
gameinfoWindow2.Append(coverImg2);
gameinfoWindow2.Append(&txtWindow);
}
txtWindow.Append(synopsisTxt);
coverImg2 = new GuiImage(cover);
coverImg2->SetWidescreen(CFG.widescreen);
coverImg2->SetPosition(15,30);
gameinfoWindow2.Append(coverImg2);
gameinfoWindow2.Append(&txtWindow);
}
gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50); gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50);
HaltGui(); HaltGui();
@ -697,80 +694,81 @@ showGameInfo(char *ID, u8 *headerID)
} }
nextBtn.ResetState(); nextBtn.ResetState();
} }
} }
if (page==1){ if (page==1){
gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50); gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
while(gameinfoWindow.GetEffect() > 0) usleep(50); while(gameinfoWindow.GetEffect() > 0) usleep(50);
HaltGui(); HaltGui();
mainWindow->Remove(&gameinfoWindow); mainWindow->Remove(&gameinfoWindow);
mainWindow->SetState(STATE_DEFAULT); mainWindow->SetState(STATE_DEFAULT);
delete playersImgData; delete playersImgData;
delete playersImg; delete playersImg;
delete wifiplayersImgData; delete wifiplayersImgData;
delete wifiplayersImg; delete wifiplayersImg;
delete ratingImg; delete ratingImg;
delete classiccontrollerImg; delete classiccontrollerImg;
delete nunchuckImg; delete nunchuckImg;
delete guitarImg; delete guitarImg;
delete drumsImg; delete drumsImg;
delete dancepadImg; delete dancepadImg;
delete motionplusImg; delete motionplusImg;
delete wheelImg; delete wheelImg;
delete balanceboardImg; delete balanceboardImg;
delete microphoneImg; delete microphoneImg;
delete gcImg; delete gcImg;
delete dialogBoxImg1; delete dialogBoxImg1;
delete dialogBoxImg2; delete dialogBoxImg2;
delete dialogBoxImg3; delete dialogBoxImg3;
delete dialogBoxImg4; delete dialogBoxImg4;
delete dialogBoxImg11; delete dialogBoxImg11;
delete dialogBoxImg22; delete dialogBoxImg22;
delete dialogBoxImg33; delete dialogBoxImg33;
delete dialogBoxImg44; delete dialogBoxImg44;
delete coverImg; delete coverImg;
delete coverImg2; delete coverImg2;
delete classiccontrollerImgData; delete classiccontrollerImgData;
delete nunchuckImgData; delete nunchuckImgData;
delete guitarImgData; delete guitarImgData;
delete drumsImgData; delete drumsImgData;
delete motionplusImgData; delete motionplusImgData;
delete wheelImgData; delete wheelImgData;
delete balanceboardImgData; delete balanceboardImgData;
delete dancepadImgData; delete dancepadImgData;
delete microphoneImgData; delete microphoneImgData;
delete gamecubeImgData; delete gamecubeImgData;
delete ratingImgData; delete ratingImgData;
delete cover; delete cover;
delete releasedTxt; delete releasedTxt;
delete publisherTxt; delete publisherTxt;
delete developerTxt; delete developerTxt;
delete titleTxt; delete titleTxt;
delete synopsisTxt; delete synopsisTxt;
delete genreTxt; delete genreTxt;
delete betaTxt; delete betaTxt;
delete beta1Txt; delete beta1Txt;
if (gameinfo.wifiCnt>0){ if (gameinfo.wifiCnt>0){
for(int i=1; i<=gameinfo.wifiCnt; i++) for(int i=1; i<=gameinfo.wifiCnt; i++)
{ {
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;
} }