From b403ecea6a2c0e033e051f9d2a0d91d51074eef6 Mon Sep 17 00:00:00 2001 From: wiidev Date: Sun, 1 Jan 2023 17:00:05 +0000 Subject: [PATCH] Display the game ID on the info screen --- source/prompts/gameinfo.cpp | 74 +++++++++++++------------------------ 1 file changed, 26 insertions(+), 48 deletions(-) diff --git a/source/prompts/gameinfo.cpp b/source/prompts/gameinfo.cpp index 32e4aaf0..9287cbe7 100644 --- a/source/prompts/gameinfo.cpp +++ b/source/prompts/gameinfo.cpp @@ -165,6 +165,7 @@ static int InternalShowGameInfo(struct discHdr *header) GuiText * releasedTxt = NULL; GuiText * publisherTxt = NULL; GuiText * developerTxt = NULL; + GuiText * idTxt = NULL; GuiText * titleTxt = NULL; Text * synopsisTxt = NULL; GuiText * genreTitleTxt = NULL; @@ -684,57 +685,17 @@ static int InternalShowGameInfo(struct discHdr *header) } //date - int n = snprintf(linebuf2, sizeof(linebuf2), " "); if (GameInfo.PublishDate != 0) { int year = GameInfo.PublishDate >> 16; int day = GameInfo.PublishDate & 0xFF; int month = (GameInfo.PublishDate >> 8) & 0xFF; - n += snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%02i ", day); - - switch (month) - { - case 1: - snprintf(linebuf2 + n, sizeof(linebuf2) - n, "%s ", tr( "Jan" )); - 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}); + const char *readableMonths[13] = { + tr( "Jan" ), tr( "Feb" ), tr( "Mar" ), tr( "Apr" ), tr( "May" ), tr( "June" ), + tr( "July" ), tr( "Aug" ), tr( "Sept" ), tr( "Oct" ), tr( "Nov" ), tr( "Dec" ) + }; + snprintf(linebuf2, sizeof(linebuf2), "%s: %02i %s %i", tr( "Released" ), day, readableMonths[month - 1], year); + releasedTxt = new GuiText(linebuf2, 16, ( GXColor ) {0, 0, 0, 255}); if (releasedTxt->GetTextWidth() > 300) newline = 2; releasedTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); releasedTxt->SetPosition(-17, 12 + indexy); @@ -771,6 +732,20 @@ static int InternalShowGameInfo(struct discHdr *header) 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; std::vector categoriesTxt; indexy += 10; @@ -878,7 +853,7 @@ static int InternalShowGameInfo(struct discHdr *header) gametdb1Txt = new GuiText("gametdb.com", 16, ( GXColor ) {0, 0, 0, 255}); gametdb1Txt->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); - gametdb1Txt->SetPosition(40, -15); + gametdb1Txt->SetPosition(80, -15); gameinfoWindow.Append(gametdb1Txt); if(coverImg) { @@ -1072,6 +1047,7 @@ static int InternalShowGameInfo(struct discHdr *header) delete releasedTxt; delete publisherTxt; delete developerTxt; + delete idTxt; delete titleTxt; delete synopsisTxt; delete genreTitleTxt; @@ -1156,6 +1132,8 @@ bool save_gamelist(bool bCSV) // save gamelist mainWindow->SetState(STATE_DEFAULT); return false; } + wString oldFilter(gameList.GetCurrentFilter()); + //make sure that all games are added to the gamelist gameList.LoadUnfiltered(); @@ -1258,7 +1236,7 @@ bool save_gamelist(bool bCSV) // save gamelist } fclose(f); - gameList.FilterList(); + gameList.FilterList(oldFilter.c_str()); mainWindow->SetState(STATE_DEFAULT); return true; }