mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-12-23 18:31:56 +01:00
split Genre display on several lines on the Game Info page.
This commit is contained in:
parent
6396c7099f
commit
9a4fd8e680
@ -185,94 +185,90 @@ showGameInfo(char *ID, u8 *headerID)
|
|||||||
|
|
||||||
// set images for required input
|
// set images for required input
|
||||||
for (int i=1;strcmp(gameinfo.accessories_required[i],"") != 0;i++)
|
for (int i=1;strcmp(gameinfo.accessories_required[i],"") != 0;i++)
|
||||||
{
|
{
|
||||||
if (strcmp(gameinfo.accessories_required[i],"nunchuk")==0)
|
if (strcmp(gameinfo.accessories_required[i],"nunchuk")==0)
|
||||||
{nunchuckImgData = new GuiImageData(nunchuckR_png);nunchuk=1;}
|
{nunchuckImgData = new GuiImageData(nunchuckR_png);nunchuk=1;}
|
||||||
else
|
else
|
||||||
nunchuckImgData = new GuiImageData(nunchuck_png);
|
nunchuckImgData = new GuiImageData(nunchuck_png);
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories_required[i],"classiccontroller")==0)
|
if (strcmp(gameinfo.accessories_required[i],"classiccontroller")==0)
|
||||||
{classiccontrollerImgData = new GuiImageData(classiccontrollerR_png);classiccontroller=1;}
|
{classiccontrollerImgData = new GuiImageData(classiccontrollerR_png);classiccontroller=1;}
|
||||||
else
|
else
|
||||||
classiccontrollerImgData = new GuiImageData(classiccontroller_png);
|
classiccontrollerImgData = new GuiImageData(classiccontroller_png);
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories_required[i],"guitar")==0)
|
if (strcmp(gameinfo.accessories_required[i],"guitar")==0)
|
||||||
{guitarImgData = new GuiImageData(guitarR_png);guitar=1;}
|
{guitarImgData = new GuiImageData(guitarR_png);guitar=1;}
|
||||||
else
|
else
|
||||||
guitarImgData = new GuiImageData(guitar_png);
|
guitarImgData = new GuiImageData(guitar_png);
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories_required[i],"gamecube")==0)
|
if (strcmp(gameinfo.accessories_required[i],"gamecube")==0)
|
||||||
{gamecubeImgData = new GuiImageData(gcncontrollerR_png);gamecube=1;}
|
{gamecubeImgData = new GuiImageData(gcncontrollerR_png);gamecube=1;}
|
||||||
else
|
else
|
||||||
gamecubeImgData = new GuiImageData(gcncontroller_png);
|
gamecubeImgData = new GuiImageData(gcncontroller_png);
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories_required[i],"wheel")==0)
|
if (strcmp(gameinfo.accessories_required[i],"wheel")==0)
|
||||||
{wheelImgData = new GuiImageData(wheelR_png);wheel=1;}
|
{wheelImgData = new GuiImageData(wheelR_png);wheel=1;}
|
||||||
else
|
else
|
||||||
wheelImgData = new GuiImageData(wheel_png);
|
wheelImgData = new GuiImageData(wheel_png);
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories_required[i],"motionplus")==0)
|
if (strcmp(gameinfo.accessories_required[i],"motionplus")==0)
|
||||||
{motionplusImgData = new GuiImageData(motionplusR_png);motionplus=1;}
|
{motionplusImgData = new GuiImageData(motionplusR_png);motionplus=1;}
|
||||||
else
|
else
|
||||||
motionplusImgData = new GuiImageData(motionplus_png);
|
motionplusImgData = new GuiImageData(motionplus_png);
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories_required[i],"drums")==0)
|
if (strcmp(gameinfo.accessories_required[i],"drums")==0)
|
||||||
{drumsImgData = new GuiImageData(drumsR_png);drums=1;}
|
{drumsImgData = new GuiImageData(drumsR_png);drums=1;}
|
||||||
else
|
else
|
||||||
drumsImgData = new GuiImageData(drums_png);
|
drumsImgData = new GuiImageData(drums_png);
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories_required[i],"microphone")==0)
|
if (strcmp(gameinfo.accessories_required[i],"microphone")==0)
|
||||||
{microphoneImgData = new GuiImageData(microphoneR_png);microphone=1;}
|
{microphoneImgData = new GuiImageData(microphoneR_png);microphone=1;}
|
||||||
else
|
else
|
||||||
microphoneImgData = new GuiImageData(microphone_png);
|
microphoneImgData = new GuiImageData(microphone_png);
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories_required[i],"balanceboard")==0)
|
if (strcmp(gameinfo.accessories_required[i],"balanceboard")==0)
|
||||||
{balanceboardImgData = new GuiImageData(balanceboardR_png);balanceboard=1;}
|
{balanceboardImgData = new GuiImageData(balanceboardR_png);balanceboard=1;}
|
||||||
else
|
else
|
||||||
balanceboardImgData = new GuiImageData(balanceboard_png);
|
balanceboardImgData = new GuiImageData(balanceboard_png);
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories_required[i],"dancepad")==0)
|
if (strcmp(gameinfo.accessories_required[i],"dancepad")==0)
|
||||||
{dancepadImgData = new GuiImageData(dancepadR_png);dancepad=1;}
|
{dancepadImgData = new GuiImageData(dancepadR_png);dancepad=1;}
|
||||||
else
|
else
|
||||||
dancepadImgData = new GuiImageData(dancepad_png);
|
dancepadImgData = new GuiImageData(dancepad_png);
|
||||||
|
|
||||||
}
|
|
||||||
for (int i=1;strcmp(gameinfo.accessories[i],"") != 0;i++)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories[i],"classiccontroller")==0)
|
|
||||||
classiccontroller=1;
|
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories[i],"nunchuk")==0)
|
|
||||||
{nunchuk=1;}
|
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories[i],"guitar")==0)
|
|
||||||
guitar=1;
|
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories[i],"drums")==0)
|
|
||||||
drums=1;
|
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories[i],"dancepad")==0)
|
|
||||||
dancepad=1;
|
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories[i],"motionplus")==0)
|
|
||||||
motionplus=1;
|
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories[i],"wheel")==0)
|
|
||||||
wheel=1;
|
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories[i],"balanceboard")==0)
|
|
||||||
balanceboard=1;
|
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories[i],"microphone")==0)
|
|
||||||
microphone=1;
|
|
||||||
|
|
||||||
if (strcmp(gameinfo.accessories[i],"gamecube")==0)
|
|
||||||
gamecube=1;
|
|
||||||
}
|
}
|
||||||
|
for (int i=1;strcmp(gameinfo.accessories[i],"") != 0;i++)
|
||||||
|
{
|
||||||
|
if (strcmp(gameinfo.accessories[i],"classiccontroller")==0)
|
||||||
|
classiccontroller=1;
|
||||||
|
|
||||||
|
if (strcmp(gameinfo.accessories[i],"nunchuk")==0)
|
||||||
|
{nunchuk=1;}
|
||||||
|
|
||||||
|
if (strcmp(gameinfo.accessories[i],"guitar")==0)
|
||||||
|
guitar=1;
|
||||||
|
|
||||||
|
if (strcmp(gameinfo.accessories[i],"drums")==0)
|
||||||
|
drums=1;
|
||||||
|
|
||||||
|
if (strcmp(gameinfo.accessories[i],"dancepad")==0)
|
||||||
|
dancepad=1;
|
||||||
|
|
||||||
|
if (strcmp(gameinfo.accessories[i],"motionplus")==0)
|
||||||
|
motionplus=1;
|
||||||
|
|
||||||
|
if (strcmp(gameinfo.accessories[i],"wheel")==0)
|
||||||
|
wheel=1;
|
||||||
|
|
||||||
|
if (strcmp(gameinfo.accessories[i],"balanceboard")==0)
|
||||||
|
balanceboard=1;
|
||||||
|
|
||||||
|
if (strcmp(gameinfo.accessories[i],"microphone")==0)
|
||||||
|
microphone=1;
|
||||||
|
|
||||||
|
if (strcmp(gameinfo.accessories[i],"gamecube")==0)
|
||||||
|
gamecube=1;
|
||||||
|
}
|
||||||
|
|
||||||
dialogBoxImg1 = new GuiImage(&dialogBox1);
|
dialogBoxImg1 = new GuiImage(&dialogBox1);
|
||||||
dialogBoxImg1->SetAlignment(0,3);
|
dialogBoxImg1->SetAlignment(0,3);
|
||||||
@ -326,7 +322,7 @@ showGameInfo(char *ID, u8 *headerID)
|
|||||||
playersImg->SetAlignment(0,4);
|
playersImg->SetAlignment(0,4);
|
||||||
gameinfoWindow.Append(playersImg);
|
gameinfoWindow.Append(playersImg);
|
||||||
intputX += (CFG.widescreen ? playersImg->GetWidth() * .8 : playersImg->GetWidth())+5;
|
intputX += (CFG.widescreen ? playersImg->GetWidth() * .8 : playersImg->GetWidth())+5;
|
||||||
}
|
}
|
||||||
|
|
||||||
//draw the inupt types for this game
|
//draw the inupt types for this game
|
||||||
if (nunchuk==1){
|
if (nunchuk==1){
|
||||||
@ -425,7 +421,7 @@ showGameInfo(char *ID, u8 *headerID)
|
|||||||
wifiplayersImg->SetAlignment(0,4);
|
wifiplayersImg->SetAlignment(0,4);
|
||||||
gameinfoWindow.Append(wifiplayersImg);
|
gameinfoWindow.Append(wifiplayersImg);
|
||||||
intputX += (CFG.widescreen ? wifiplayersImg->GetWidth() * .8 : wifiplayersImg->GetWidth())+5;
|
intputX += (CFG.widescreen ? wifiplayersImg->GetWidth() * .8 : wifiplayersImg->GetWidth())+5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ratings
|
// ratings
|
||||||
if (strcmp(gameinfo.ratingtype,"") !=0){
|
if (strcmp(gameinfo.ratingtype,"") !=0){
|
||||||
@ -501,7 +497,7 @@ 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)
|
||||||
{snprintf(linebuf2, sizeof(linebuf2), "%s ", gameinfo.day);}
|
{snprintf(linebuf2, sizeof(linebuf2), "%s ", gameinfo.day);}
|
||||||
@ -553,30 +549,35 @@ showGameInfo(char *ID, u8 *headerID)
|
|||||||
releasedTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); releasedTxt->SetPosition(-17,12+y); y+=(20 * newline);newline=1;
|
releasedTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); releasedTxt->SetPosition(-17,12+y); y+=(20 * newline);newline=1;
|
||||||
gameinfoWindow.Append(releasedTxt);}
|
gameinfoWindow.Append(releasedTxt);}
|
||||||
//genre
|
//genre
|
||||||
if (strcmp(gameinfo.genre,"") != 0)
|
if (strcmp(gameinfo.genresplit[1],"") != 0){
|
||||||
{snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.genre);
|
for (int i=1;strcmp(gameinfo.genresplit[i],"") !=0;i++)
|
||||||
genreTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
|
{
|
||||||
if (genreTxt->GetWidth()>300) newline=2;
|
snprintf(linebuf, sizeof(linebuf), "%s", gameinfo.genresplit[i]);
|
||||||
genreTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); genreTxt->SetPosition(205,12+y1); y1+=(25 * newline);newline=1;
|
genreTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
|
||||||
gameinfoWindow.Append(genreTxt);}
|
genreTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); genreTxt->SetPosition(205,12+y1); y1+=(20 * i);
|
||||||
|
gameinfoWindow.Append(genreTxt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//developer
|
//developer
|
||||||
if (strcmp(gameinfo.developer,"") != 0 && strcmp(gameinfo.developer,gameinfo.publisher) != 0)
|
if (strcmp(gameinfo.developer,"") != 0 && strcmp(gameinfo.developer,gameinfo.publisher) != 0) {
|
||||||
{snprintf(linebuf, sizeof(linebuf), "%s %s", LANGUAGE.developedby, gameinfo.developer);
|
snprintf(linebuf, sizeof(linebuf), "%s %s", LANGUAGE.developedby, gameinfo.developer);
|
||||||
developerTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
|
developerTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
|
||||||
if (developerTxt->GetWidth()>250) newline=2;
|
if (developerTxt->GetWidth()>250) newline=2;
|
||||||
developerTxt->SetMaxWidth(250,GuiText::WRAP);
|
developerTxt->SetMaxWidth(250,GuiText::WRAP);
|
||||||
developerTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); developerTxt->SetPosition(-17,12+y); y+=(40 * newline);newline=1;
|
developerTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); developerTxt->SetPosition(-17,12+y); y+=(40 * newline);newline=1;
|
||||||
gameinfoWindow.Append(developerTxt);}
|
gameinfoWindow.Append(developerTxt);
|
||||||
|
}
|
||||||
|
|
||||||
//publisher
|
//publisher
|
||||||
if (strcmp(gameinfo.publisher,"") != 0)
|
if (strcmp(gameinfo.publisher,"") != 0){
|
||||||
{snprintf(linebuf, sizeof(linebuf), "%s %s", LANGUAGE.publishedby, gameinfo.publisher);
|
snprintf(linebuf, sizeof(linebuf), "%s %s", LANGUAGE.publishedby, gameinfo.publisher);
|
||||||
publisherTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
|
publisherTxt = new GuiText(linebuf, 16, (GXColor){0,0,0, 255});
|
||||||
if (publisherTxt->GetWidth()>250) newline=2;
|
if (publisherTxt->GetWidth()>250) newline=2;
|
||||||
publisherTxt->SetMaxWidth(250,GuiText::WRAP);
|
publisherTxt->SetMaxWidth(250,GuiText::WRAP);
|
||||||
publisherTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); publisherTxt->SetPosition(-17,12+y); y+=(20 * newline);newline=1;
|
publisherTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); publisherTxt->SetPosition(-17,12+y); y+=(20 * newline);newline=1;
|
||||||
gameinfoWindow.Append(publisherTxt);}
|
gameinfoWindow.Append(publisherTxt);
|
||||||
|
}
|
||||||
|
|
||||||
//don't bother us txt
|
//don't bother us txt
|
||||||
snprintf(linebuf, sizeof(linebuf), "Don't bother the USB Loader GX Team about errors in this file.");
|
snprintf(linebuf, sizeof(linebuf), "Don't bother the USB Loader GX Team about errors in this file.");
|
||||||
|
@ -391,7 +391,6 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
/* search for game matching gameid */
|
/* search for game matching gameid */
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
|
||||||
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));
|
||||||
@ -525,6 +524,29 @@ bool LoadGameInfoFromXML(char* gameid, char* langtxt)
|
|||||||
ConvertRating(gameinfo.ratingvalue, gameinfo.ratingtype, "ESRB",gameinfo.ratingvalueESRB);
|
ConvertRating(gameinfo.ratingvalue, gameinfo.ratingtype, "ESRB",gameinfo.ratingvalueESRB);
|
||||||
ConvertRating(gameinfo.ratingvalue, gameinfo.ratingtype, "PEGI",gameinfo.ratingvaluePEGI);
|
ConvertRating(gameinfo.ratingvalue, gameinfo.ratingtype, "PEGI",gameinfo.ratingvaluePEGI);
|
||||||
|
|
||||||
|
/* provide genre as an array: gameinfo.genresplit */
|
||||||
|
if (strcmp(gameinfo.genre,"") != 0){
|
||||||
|
const char *delimgenre = ",;";
|
||||||
|
char genretxt[500];
|
||||||
|
strcpy(genretxt,gameinfo.genre);
|
||||||
|
char *splitresult;
|
||||||
|
splitresult = strtok(genretxt, delimgenre);
|
||||||
|
if (splitresult != NULL) {
|
||||||
|
trim_inplace(splitresult);
|
||||||
|
strcpy(gameinfo.genresplit[1],splitresult);
|
||||||
|
int incr = 1;
|
||||||
|
while (splitresult != NULL)
|
||||||
|
{
|
||||||
|
splitresult = strtok(NULL, delimgenre);
|
||||||
|
if (splitresult != NULL && strcmp(splitresult,"")!=0) {
|
||||||
|
++incr;
|
||||||
|
trim_inplace(splitresult);
|
||||||
|
strcpy(gameinfo.genresplit[incr],splitresult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//PrintGameInfo();
|
//PrintGameInfo();
|
||||||
|
|
||||||
exist=true;
|
exist=true;
|
||||||
@ -651,3 +673,46 @@ void PrintGameInfo(bool showfullinfo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* trim leading and trailing whitespace functions, by calv */
|
||||||
|
void trim_copy(char *input, char *output)
|
||||||
|
{
|
||||||
|
char *end = output;
|
||||||
|
char c;
|
||||||
|
while(*input && isspace(*input))
|
||||||
|
++input;
|
||||||
|
|
||||||
|
while(*input)
|
||||||
|
{
|
||||||
|
c = *(output++) = *(input++);
|
||||||
|
|
||||||
|
if( !isspace(c) )
|
||||||
|
end = output;
|
||||||
|
}
|
||||||
|
*end = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void trim_inplace(char *s)
|
||||||
|
{
|
||||||
|
trim_copy(s, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *trim_nocopy(char *s)
|
||||||
|
{
|
||||||
|
char *start = s;
|
||||||
|
while(*start && isspace(*start))
|
||||||
|
++start;
|
||||||
|
|
||||||
|
char *i = start;
|
||||||
|
char *end = start;
|
||||||
|
while(*i)
|
||||||
|
{
|
||||||
|
if( !isspace(*(i++)) )
|
||||||
|
end = i;
|
||||||
|
}
|
||||||
|
*end = 0;
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ struct gameXMLinfo
|
|||||||
char month[10];
|
char month[10];
|
||||||
char day[10];
|
char day[10];
|
||||||
char genre[500];
|
char genre[500];
|
||||||
|
char genresplit[100][500];
|
||||||
char ratingtype[10];
|
char ratingtype[10];
|
||||||
char ratingvalue[10];
|
char ratingvalue[10];
|
||||||
char ratingdescriptors[100][500];
|
char ratingdescriptors[100][500];
|
||||||
@ -62,7 +63,9 @@ void FreeXMLMemory();
|
|||||||
|
|
||||||
void title_set(char *id, char *title);
|
void title_set(char *id, char *title);
|
||||||
|
|
||||||
|
void trim_copy(char *input, char *output);
|
||||||
|
void trim_inplace(char *s);
|
||||||
|
char *trim_nocopy(char *s);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user