Display the game ID on the info screen

This commit is contained in:
wiidev 2023-01-01 17:00:05 +00:00
parent 4396e50193
commit b403ecea6a

View File

@ -165,6 +165,7 @@ static int InternalShowGameInfo(struct discHdr *header)
GuiText * releasedTxt = NULL; GuiText * releasedTxt = NULL;
GuiText * publisherTxt = NULL; GuiText * publisherTxt = NULL;
GuiText * developerTxt = NULL; GuiText * developerTxt = NULL;
GuiText * idTxt = NULL;
GuiText * titleTxt = NULL; GuiText * titleTxt = NULL;
Text * synopsisTxt = NULL; Text * synopsisTxt = NULL;
GuiText * genreTitleTxt = NULL; GuiText * genreTitleTxt = NULL;
@ -684,57 +685,17 @@ static int InternalShowGameInfo(struct discHdr *header)
} }
//date //date
int n = snprintf(linebuf2, sizeof(linebuf2), " ");
if (GameInfo.PublishDate != 0) if (GameInfo.PublishDate != 0)
{ {
int year = GameInfo.PublishDate >> 16; int year = GameInfo.PublishDate >> 16;
int day = GameInfo.PublishDate & 0xFF; int day = GameInfo.PublishDate & 0xFF;
int month = (GameInfo.PublishDate >> 8) & 0xFF; int month = (GameInfo.PublishDate >> 8) & 0xFF;
n += snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%02i ", day); const char *readableMonths[13] = {
tr( "Jan" ), tr( "Feb" ), tr( "Mar" ), tr( "Apr" ), tr( "May" ), tr( "June" ),
switch (month) tr( "July" ), tr( "Aug" ), tr( "Sept" ), tr( "Oct" ), tr( "Nov" ), tr( "Dec" )
{ };
case 1: snprintf(linebuf2, sizeof(linebuf2), "%s: %02i %s %i", tr( "Released" ), day, readableMonths[month - 1], year);
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Jan" )); releasedTxt = new GuiText(linebuf2, 16, ( GXColor ) {0, 0, 0, 255});
break;
case 2:
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Feb" ));
break;
case 3:
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Mar" ));
break;
case 4:
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Apr" ));
break;
case 5:
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "May" ));
break;
case 6:
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "June" ));
break;
case 7:
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "July" ));
break;
case 8:
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Aug" ));
break;
case 9:
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Sept" ));
break;
case 10:
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Oct" ));
break;
case 11:
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Nov" ));
break;
case 12:
snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Dec" ));
break;
}
char linebuf[300];
snprintf(linebuf, sizeof(linebuf), "%s : %s%i", tr( "Released" ), linebuf2, year);
releasedTxt = new GuiText(linebuf, 16, ( GXColor ) {0, 0, 0, 255});
if (releasedTxt->GetTextWidth() > 300) newline = 2; if (releasedTxt->GetTextWidth() > 300) newline = 2;
releasedTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); releasedTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
releasedTxt->SetPosition(-17, 12 + indexy); releasedTxt->SetPosition(-17, 12 + indexy);
@ -771,6 +732,20 @@ static int InternalShowGameInfo(struct discHdr *header)
InfoWindow.Append(developerTxt); InfoWindow.Append(developerTxt);
} }
//game id
if (GameInfo.GameID.size() != 0)
{
snprintf(linebuf2, sizeof(linebuf2), "%s: %s", tr( "Game ID" ), GameInfo.GameID.c_str());
idTxt = new GuiText(linebuf2, 16, ( GXColor ) {0, 0, 0, 255});
if (idTxt->GetTextWidth() > 250) newline = 2;
idTxt->SetMaxWidth(250, WRAP);
idTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
idTxt->SetPosition(-17, 12 + indexy);
indexy += (20 * newline);
newline = 1;
InfoWindow.Append(idTxt);
}
GuiText *categoryTitle = NULL; GuiText *categoryTitle = NULL;
std::vector<GuiText *> categoriesTxt; std::vector<GuiText *> categoriesTxt;
indexy += 10; indexy += 10;
@ -878,7 +853,7 @@ static int InternalShowGameInfo(struct discHdr *header)
gametdb1Txt = new GuiText("gametdb.com", 16, ( GXColor ) {0, 0, 0, 255}); gametdb1Txt = new GuiText("gametdb.com", 16, ( GXColor ) {0, 0, 0, 255});
gametdb1Txt->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); gametdb1Txt->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
gametdb1Txt->SetPosition(40, -15); gametdb1Txt->SetPosition(80, -15);
gameinfoWindow.Append(gametdb1Txt); gameinfoWindow.Append(gametdb1Txt);
if(coverImg) if(coverImg)
{ {
@ -1072,6 +1047,7 @@ static int InternalShowGameInfo(struct discHdr *header)
delete releasedTxt; delete releasedTxt;
delete publisherTxt; delete publisherTxt;
delete developerTxt; delete developerTxt;
delete idTxt;
delete titleTxt; delete titleTxt;
delete synopsisTxt; delete synopsisTxt;
delete genreTitleTxt; delete genreTitleTxt;
@ -1156,6 +1132,8 @@ bool save_gamelist(bool bCSV) // save gamelist
mainWindow->SetState(STATE_DEFAULT); mainWindow->SetState(STATE_DEFAULT);
return false; return false;
} }
wString oldFilter(gameList.GetCurrentFilter());
//make sure that all games are added to the gamelist //make sure that all games are added to the gamelist
gameList.LoadUnfiltered(); gameList.LoadUnfiltered();
@ -1258,7 +1236,7 @@ bool save_gamelist(bool bCSV) // save gamelist
} }
fclose(f); fclose(f);
gameList.FilterList(); gameList.FilterList(oldFilter.c_str());
mainWindow->SetState(STATE_DEFAULT); mainWindow->SetState(STATE_DEFAULT);
return true; return true;
} }