From 128254c489472869f9014b1b65207b84c0edc665 Mon Sep 17 00:00:00 2001 From: "overjoy.psm" Date: Mon, 13 Feb 2012 00:22:56 +0000 Subject: [PATCH] * Fixed label "Genre" in game info. It should now always the show right genre (issue 10) --- source/gui/GameTDB.cpp | 7 ++++++- source/gui/GameTDB.hpp | 4 ++-- source/menu/menu_gameinfo.cpp | 5 +---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source/gui/GameTDB.cpp b/source/gui/GameTDB.cpp index 09512011..4300dfc1 100644 --- a/source/gui/GameTDB.cpp +++ b/source/gui/GameTDB.cpp @@ -30,6 +30,7 @@ #include "video.hpp" #include "gecko.h" #include "defines.h" +#include "text.hpp" #define NAME_OFFSET_DB "gametdb_offsets.bin" #define MAXREADSIZE 1024*1024 // Cache size only for parsing the offsets: 1MB @@ -638,8 +639,10 @@ unsigned int GameTDB::GetPublishDate(const char * id) return ((year & 0xFFFF) << 16 | (month & 0xFF) << 8 | (day & 0xFF)); } -bool GameTDB::GetGenres(const char * id, safe_vector & genre) +bool GameTDB::GetGenres(const char * id, string & gen) { + safe_vector genre; + if(!id) return false; char * data = GetGameNode(id); @@ -679,6 +682,8 @@ bool GameTDB::GetGenres(const char * id, safe_vector & genre) genre[genre_num].push_back('\0'); delete [] data; + + gen = vectorToString(genre, ", "); return true; } diff --git a/source/gui/GameTDB.hpp b/source/gui/GameTDB.hpp index c2f6bedf..55b976d3 100644 --- a/source/gui/GameTDB.hpp +++ b/source/gui/GameTDB.hpp @@ -44,7 +44,7 @@ typedef struct _GameXMLInfo string Developer; string Publisher; unsigned int PublishDate; - safe_vector Genres; + string Genres; int RatingType; string RatingValue; safe_vector RatingDescriptors; @@ -99,7 +99,7 @@ class GameTDB //! year = (return >> 16), month = (return >> 8) & 0xFF, day = return & 0xFF unsigned int GetPublishDate(const char * id); //! Get the genre list of a game for a specific game id - bool GetGenres(const char * id, safe_vector & genre); + bool GetGenres(const char * id, string & gen); //! Get the rating type for a specific game id //! The rating type can be converted to a string with GameTDB::RatingToString(rating) int GetRating(const char * id); diff --git a/source/menu/menu_gameinfo.cpp b/source/menu/menu_gameinfo.cpp index 559b13ba..49acacd4 100644 --- a/source/menu/menu_gameinfo.cpp +++ b/source/menu/menu_gameinfo.cpp @@ -313,10 +313,7 @@ void CMenu::_textGameInfo(void) m_btnMgr.setText(m_gameinfoLblDev, wfmt(_fmt("gameinfo1",L"Developer: %s"), gameinfo.Developer.c_str()), true); m_btnMgr.setText(m_gameinfoLblPublisher, wfmt(_fmt("gameinfo2",L"Publisher: %s"), gameinfo.Publisher.c_str()), true); m_btnMgr.setText(m_gameinfoLblRegion, wfmt(_fmt("gameinfo3",L"Region: %s"), gameinfo.Region.c_str()), true); - - string wGenres = vectorToString(gameinfo.Genres, ", "); - m_btnMgr.setText(m_gameinfoLblGenre, wfmt(_fmt("gameinfo5",L"Genre: %s"), wGenres.c_str()), true); -// m_btnMgr.setText(m_gameinfoLblGenre, wfmt(_fmt("gameinfo5",L"Genre: %s"), gameinfo.Genre.c_str()), true); + m_btnMgr.setText(m_gameinfoLblGenre, wfmt(_fmt("gameinfo5",L"Genre: %s"), gameinfo.Genres.c_str()), true); int year = gameinfo.PublishDate >> 16; int day = gameinfo.PublishDate & 0xFF;