mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 00:55:06 +01:00
-cleaned up gametdb code
-fixed gametdb memory management, now you can reload cache as often as you want, read synopsis as often as you want without wiiflow codedumping or freezing anymore after a few
This commit is contained in:
parent
9665ea5dc7
commit
c08a0710ce
@ -31,7 +31,7 @@
|
|||||||
#include "text.hpp"
|
#include "text.hpp"
|
||||||
#include "config/config.hpp"
|
#include "config/config.hpp"
|
||||||
#include "gecko/gecko.h"
|
#include "gecko/gecko.h"
|
||||||
|
#include "memory/mem2.hpp"
|
||||||
#define NAME_OFFSET_DB "gametdb_offsets.bin"
|
#define NAME_OFFSET_DB "gametdb_offsets.bin"
|
||||||
#define MAXREADSIZE 1024*1024 //Cache size only for parsing the offsets: 1MB
|
#define MAXREADSIZE 1024*1024 //Cache size only for parsing the offsets: 1MB
|
||||||
|
|
||||||
@ -54,12 +54,12 @@ static const ReplaceStruct Replacements[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
GameTDB::GameTDB()
|
GameTDB::GameTDB()
|
||||||
: isLoaded(false), isParsed(false), file(0), filepath(0), LangCode("EN"), GameNodeCache(0)
|
: isLoaded(false), isParsed(false), file(0), filepath(0), LangCode("EN"), GameNodeCache(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
GameTDB::GameTDB(const char *filepath)
|
GameTDB::GameTDB(const char *filepath)
|
||||||
: isLoaded(false), isParsed(false), file(0), filepath(0), LangCode("EN"), GameNodeCache(0)
|
: isLoaded(false), isParsed(false), file(0), filepath(0), LangCode("EN"), GameNodeCache(NULL)
|
||||||
{
|
{
|
||||||
OpenFile(filepath);
|
OpenFile(filepath);
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ void GameTDB::CloseFile()
|
|||||||
OffsetMap.clear();
|
OffsetMap.clear();
|
||||||
|
|
||||||
if(GameNodeCache)
|
if(GameNodeCache)
|
||||||
delete [] GameNodeCache;
|
MEM2_free(GameNodeCache);
|
||||||
GameNodeCache = NULL;
|
GameNodeCache = NULL;
|
||||||
|
|
||||||
if(file)
|
if(file)
|
||||||
@ -143,24 +143,22 @@ bool GameTDB::LoadGameOffsets(const char *path)
|
|||||||
bool result = ParseFile();
|
bool result = ParseFile();
|
||||||
if(result)
|
if(result)
|
||||||
SaveGameOffsets(OffsetDBPath.c_str());
|
SaveGameOffsets(OffsetDBPath.c_str());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 ExistingVersion = GetGameTDBVersion();
|
u64 ExistingVersion = GetGameTDBVersion();
|
||||||
u64 Version = 0;
|
u64 Version = 0;
|
||||||
u32 NodeCount = 0;
|
u32 NodeCount = 0;
|
||||||
|
|
||||||
fread(&Version, 1, sizeof(Version), fp);
|
fread(&Version, 1, sizeof(Version), fp);
|
||||||
|
|
||||||
if(ExistingVersion != Version)
|
if(ExistingVersion != Version)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
bool result = ParseFile();
|
bool result = ParseFile();
|
||||||
if(result)
|
if(result)
|
||||||
SaveGameOffsets(OffsetDBPath.c_str());
|
SaveGameOffsets(OffsetDBPath.c_str());
|
||||||
|
return result;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(&NodeCount, 1, sizeof(NodeCount), fp);
|
fread(&NodeCount, 1, sizeof(NodeCount), fp);
|
||||||
@ -171,7 +169,6 @@ bool GameTDB::LoadGameOffsets(const char *path)
|
|||||||
bool result = ParseFile();
|
bool result = ParseFile();
|
||||||
if(result)
|
if(result)
|
||||||
SaveGameOffsets(OffsetDBPath.c_str());
|
SaveGameOffsets(OffsetDBPath.c_str());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +180,6 @@ bool GameTDB::LoadGameOffsets(const char *path)
|
|||||||
bool result = ParseFile();
|
bool result = ParseFile();
|
||||||
if(result)
|
if(result)
|
||||||
SaveGameOffsets(OffsetDBPath.c_str());
|
SaveGameOffsets(OffsetDBPath.c_str());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,13 +258,13 @@ char *GameTDB::LoadGameNode(const char *id)
|
|||||||
if(!offset)
|
if(!offset)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
char *data = new (std::nothrow) char[offset->nodesize+1];
|
char *data = (char*)MEM2_alloc(offset->nodesize+1);
|
||||||
if(!data)
|
if(!data)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if((read = GetData(data, offset->gamenode, offset->nodesize)) != offset->nodesize)
|
if((read = GetData(data, offset->gamenode, offset->nodesize)) != offset->nodesize)
|
||||||
{
|
{
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,23 +277,21 @@ char *GameTDB::GetGameNode(const char *id)
|
|||||||
{
|
{
|
||||||
char *data = NULL;
|
char *data = NULL;
|
||||||
|
|
||||||
if(GameNodeCache != 0 && strncmp(id, GameIDCache, strlen(GameIDCache)) == 0)
|
if(GameNodeCache != NULL && strncmp(id, GameIDCache, strlen(GameIDCache)) == 0)
|
||||||
{
|
{
|
||||||
data = new (std::nothrow) char[strlen(GameNodeCache)+1];
|
data = (char*)MEM2_alloc(strlen(GameNodeCache)+1);
|
||||||
if(data)
|
if(data)
|
||||||
strcpy(data, GameNodeCache);
|
strcpy(data, GameNodeCache);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(GameNodeCache)
|
if(GameNodeCache)
|
||||||
delete [] GameNodeCache;
|
MEM2_free(GameNodeCache);
|
||||||
|
|
||||||
GameNodeCache = LoadGameNode(id);
|
GameNodeCache = LoadGameNode(id);
|
||||||
|
|
||||||
if(GameNodeCache)
|
if(GameNodeCache)
|
||||||
{
|
{
|
||||||
snprintf(GameIDCache, sizeof(GameIDCache), id);
|
snprintf(GameIDCache, sizeof(GameIDCache), id);
|
||||||
data = new (std::nothrow) char[strlen(GameNodeCache)+1];
|
data = (char*)MEM2_alloc(strlen(GameNodeCache)+1);
|
||||||
if(data)
|
if(data)
|
||||||
strcpy(data, GameNodeCache);
|
strcpy(data, GameNodeCache);
|
||||||
}
|
}
|
||||||
@ -317,7 +311,7 @@ GameOffsets *GameTDB::GetGameOffset(const char *gameID)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline char *CleanText(char *in_text)
|
static inline char *CleanText(char * &in_text)
|
||||||
{
|
{
|
||||||
if(!in_text)
|
if(!in_text)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -409,7 +403,7 @@ bool GameTDB::ParseFile()
|
|||||||
if(!file)
|
if(!file)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char *Line = new (std::nothrow) char[MAXREADSIZE+1];
|
char *Line = (char*)MEM2_alloc(MAXREADSIZE+1);
|
||||||
if(!Line)
|
if(!Line)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -454,59 +448,48 @@ bool GameTDB::ParseFile()
|
|||||||
OffsetMap[size].nodesize = (gameEndNode-gameNode);
|
OffsetMap[size].nodesize = (gameEndNode-gameNode);
|
||||||
gameNode = gameEndNode;
|
gameNode = gameEndNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(readnew)
|
if(readnew)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
currentPos += read;
|
currentPos += read;
|
||||||
}
|
}
|
||||||
|
MEM2_free(Line);
|
||||||
delete [] Line;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameTDB::FindTitle(char *data, string & title, string langCode)
|
bool GameTDB::FindTitle(char *data, const char * &title, const string &langCode)
|
||||||
{
|
{
|
||||||
char *language = SeekLang(data, langCode.c_str());
|
char *language = SeekLang(data, langCode.c_str());
|
||||||
if(!language)
|
if(language == NULL)
|
||||||
{
|
{
|
||||||
language = SeekLang(data, "EN");
|
language = SeekLang(data, "EN");
|
||||||
if(!language)
|
if(language == NULL)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
title = GetNodeText(language, "<title>", "</title>");
|
||||||
|
|
||||||
char *the_title = GetNodeText(language, "<title>", "</title>");
|
if(title == NULL)
|
||||||
if(!the_title)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char tmp[64];
|
|
||||||
strncpy(tmp, the_title, sizeof(tmp) - 1);
|
|
||||||
tmp[sizeof(tmp) - 1] = '\0';
|
|
||||||
title=tmp;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameTDB::GetTitle(const char *id, string & title)
|
bool GameTDB::GetTitle(const char *id, const char * &title)
|
||||||
{
|
{
|
||||||
title = "";
|
title = NULL;
|
||||||
if(!id)
|
if(id == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char *data = GetGameNode(id);
|
char *data = GetGameNode(id);
|
||||||
if(!data)
|
if(data == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool retval = FindTitle(data, title, LangCode);
|
bool retval = FindTitle(data, title, LangCode);
|
||||||
|
MEM2_free(data);
|
||||||
delete [] data;
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameTDB::GetSynopsis(const char *id, string & synopsis)
|
bool GameTDB::GetSynopsis(const char *id, const char * &synopsis)
|
||||||
{
|
{
|
||||||
synopsis = "";
|
synopsis = NULL;
|
||||||
if(!id)
|
if(!id)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -515,99 +498,73 @@ bool GameTDB::GetSynopsis(const char *id, string & synopsis)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
char *language = SeekLang(data, LangCode.c_str());
|
char *language = SeekLang(data, LangCode.c_str());
|
||||||
if(!language)
|
if(language == NULL)
|
||||||
{
|
{
|
||||||
language = SeekLang(data, "EN");
|
language = SeekLang(data, "EN");
|
||||||
if(!language)
|
if(language == NULL)
|
||||||
{
|
{
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
synopsis = GetNodeText(language, "<synopsis>", "</synopsis>");
|
||||||
|
MEM2_free(data);
|
||||||
|
|
||||||
char *the_synopsis = GetNodeText(language, "<synopsis>", "</synopsis>");
|
if(synopsis == NULL)
|
||||||
if(!the_synopsis)
|
|
||||||
{
|
|
||||||
delete [] data;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
synopsis = the_synopsis;
|
|
||||||
|
|
||||||
delete [] data;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameTDB::GetRegion(const char *id, string & region)
|
bool GameTDB::GetRegion(const char *id, const char * ®ion)
|
||||||
{
|
{
|
||||||
region = "";
|
region = NULL;
|
||||||
if(!id)
|
if(!id)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char *data = GetGameNode(id);
|
char *data = GetGameNode(id);
|
||||||
if(!data)
|
if(!data)
|
||||||
return false;
|
return false;
|
||||||
|
region = GetNodeText(data, "<region>", "</region>");
|
||||||
|
MEM2_free(data);
|
||||||
|
|
||||||
char *the_region = GetNodeText(data, "<region>", "</region>");
|
if(region == NULL)
|
||||||
if(!the_region)
|
|
||||||
{
|
|
||||||
delete [] data;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
region = the_region;
|
|
||||||
|
|
||||||
delete [] data;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameTDB::GetDeveloper(const char *id, string & dev)
|
bool GameTDB::GetDeveloper(const char *id, const char * &dev)
|
||||||
{
|
{
|
||||||
dev = "";
|
dev = NULL;
|
||||||
|
if(id == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
char *data = GetGameNode(id);
|
||||||
|
if(data == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
dev = GetNodeText(data, "<developer>", "</developer>");
|
||||||
|
MEM2_free(data);
|
||||||
|
|
||||||
|
if(dev == NULL)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GameTDB::GetPublisher(const char *id, const char * &pub)
|
||||||
|
{
|
||||||
|
pub = NULL;
|
||||||
if(!id)
|
if(!id)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char *data = GetGameNode(id);
|
char *data = GetGameNode(id);
|
||||||
if(!data)
|
if(data == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char *the_dev = GetNodeText(data, "<developer>", "</developer>");
|
pub = GetNodeText(data, "<publisher>", "</publisher>");
|
||||||
if(!the_dev)
|
MEM2_free(data);
|
||||||
{
|
|
||||||
delete [] data;
|
if(pub == NULL)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
dev = the_dev;
|
|
||||||
|
|
||||||
delete [] data;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GameTDB::GetPublisher(const char *id, string & pub)
|
|
||||||
{
|
|
||||||
pub = "";
|
|
||||||
if(!id)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
char *data = GetGameNode(id);
|
|
||||||
if(!data)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
char *the_pub = GetNodeText(data, "<publisher>", "</publisher>");
|
|
||||||
if(!the_pub)
|
|
||||||
{
|
|
||||||
delete [] data;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub = the_pub;
|
|
||||||
|
|
||||||
delete [] data;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,7 +580,7 @@ u32 GameTDB::GetPublishDate(const char *id)
|
|||||||
char *year_string = GetNodeText(data, "<date year=\"", "/>");
|
char *year_string = GetNodeText(data, "<date year=\"", "/>");
|
||||||
if(!year_string)
|
if(!year_string)
|
||||||
{
|
{
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,7 +591,7 @@ u32 GameTDB::GetPublishDate(const char *id)
|
|||||||
char *month_string = strstr(year_string, "month=\"");
|
char *month_string = strstr(year_string, "month=\"");
|
||||||
if(!month_string)
|
if(!month_string)
|
||||||
{
|
{
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,7 +602,7 @@ u32 GameTDB::GetPublishDate(const char *id)
|
|||||||
char *day_string = strstr(month_string, "day=\"");
|
char *day_string = strstr(month_string, "day=\"");
|
||||||
if(!day_string)
|
if(!day_string)
|
||||||
{
|
{
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,60 +610,27 @@ u32 GameTDB::GetPublishDate(const char *id)
|
|||||||
|
|
||||||
day = atoi(day_string);
|
day = atoi(day_string);
|
||||||
|
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
|
|
||||||
return ((year & 0xFFFF) << 16 | (month & 0xFF) << 8 | (day & 0xFF));
|
return ((year & 0xFFFF) << 16 | (month & 0xFF) << 8 | (day & 0xFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameTDB::GetGenres(const char *id, string & gen)
|
bool GameTDB::GetGenres(const char *id, const char * &gen)
|
||||||
{
|
{
|
||||||
vector<string> genre;
|
gen = NULL;
|
||||||
|
|
||||||
gen = "";
|
if(id == NULL)
|
||||||
if(!id)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char *data = GetGameNode(id);
|
char *data = GetGameNode(id);
|
||||||
if(!data)
|
if(data == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char *the_genre = GetNodeText(data, "<genre>", "</genre>");
|
gen = GetNodeText(data, "<genre>", "</genre>");
|
||||||
if(!the_genre)
|
MEM2_free(data);
|
||||||
{
|
|
||||||
delete [] data;
|
if(gen == NULL)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
u32 genre_num = 0;
|
|
||||||
const char *ptr = the_genre;
|
|
||||||
|
|
||||||
while(*ptr != '\0')
|
|
||||||
{
|
|
||||||
if(genre_num >= genre.size())
|
|
||||||
genre.resize(genre_num+1);
|
|
||||||
|
|
||||||
if(*ptr == ',' || *ptr == '/' || *ptr == ';')
|
|
||||||
{
|
|
||||||
ptr++;
|
|
||||||
while(*ptr == ' ')
|
|
||||||
ptr++;
|
|
||||||
genre_num++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(genre[genre_num].size() == 0)
|
|
||||||
genre[genre_num].push_back(toupper((int)*ptr));
|
|
||||||
else
|
|
||||||
genre[genre_num].push_back(*ptr);
|
|
||||||
|
|
||||||
++ptr;
|
|
||||||
}
|
|
||||||
genre[genre_num].push_back('\0');
|
|
||||||
|
|
||||||
delete [] data;
|
|
||||||
|
|
||||||
gen = vectorToString(genre, ", ");
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -743,7 +667,7 @@ int GameTDB::GetRating(const char *id)
|
|||||||
char *rating_text = GetNodeText(data, "<rating type=\"", "/>");
|
char *rating_text = GetNodeText(data, "<rating type=\"", "/>");
|
||||||
if(!rating_text)
|
if(!rating_text)
|
||||||
{
|
{
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
return rating;
|
return rating;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -756,14 +680,14 @@ int GameTDB::GetRating(const char *id)
|
|||||||
else if(strncmp(rating_text, "GRB", 4) == 0)
|
else if(strncmp(rating_text, "GRB", 4) == 0)
|
||||||
rating = GAMETDB_RATING_TYPE_GRB;
|
rating = GAMETDB_RATING_TYPE_GRB;
|
||||||
|
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
|
|
||||||
return rating;
|
return rating;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameTDB::GetRatingValue(const char *id, string & rating_value)
|
bool GameTDB::GetRatingValue(const char *id, const char * &rating_value)
|
||||||
{
|
{
|
||||||
rating_value = "";
|
rating_value = NULL;
|
||||||
if(!id)
|
if(!id)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -774,21 +698,15 @@ bool GameTDB::GetRatingValue(const char *id, string & rating_value)
|
|||||||
char *rating_text = GetNodeText(data, "<rating type=\"", "/>");
|
char *rating_text = GetNodeText(data, "<rating type=\"", "/>");
|
||||||
if(!rating_text)
|
if(!rating_text)
|
||||||
{
|
{
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *value_text = GetNodeText(rating_text, "value=\"", "\"");
|
rating_value = GetNodeText(rating_text, "value=\"", "\"");
|
||||||
if(!value_text)
|
MEM2_free(data);
|
||||||
{
|
|
||||||
delete [] data;
|
if(rating_value == NULL)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
rating_value = value_text;
|
|
||||||
|
|
||||||
delete [] data;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -805,7 +723,7 @@ int GameTDB::GetRatingDescriptors(const char *id, vector<string> & desc_list)
|
|||||||
char *descriptor_text = GetNodeText(data, "<descriptor>", "</rating>");
|
char *descriptor_text = GetNodeText(data, "<descriptor>", "</rating>");
|
||||||
if(!descriptor_text)
|
if(!descriptor_text)
|
||||||
{
|
{
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -831,7 +749,7 @@ int GameTDB::GetRatingDescriptors(const char *id, vector<string> & desc_list)
|
|||||||
++descriptor_text;
|
++descriptor_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
|
|
||||||
return desc_list.size();
|
return desc_list.size();
|
||||||
}
|
}
|
||||||
@ -850,7 +768,7 @@ int GameTDB::GetWifiPlayers(const char *id)
|
|||||||
char *PlayersNode = GetNodeText(data, "<wi-fi players=\"", "\">");
|
char *PlayersNode = GetNodeText(data, "<wi-fi players=\"", "\">");
|
||||||
if(!PlayersNode)
|
if(!PlayersNode)
|
||||||
{
|
{
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -872,7 +790,7 @@ int GameTDB::GetWifiFeatures(const char *id, vector<string> & feat_list)
|
|||||||
char *feature_text = GetNodeText(data, "<feature>", "</wi-fi>");
|
char *feature_text = GetNodeText(data, "<feature>", "</wi-fi>");
|
||||||
if(!feature_text)
|
if(!feature_text)
|
||||||
{
|
{
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -902,7 +820,7 @@ int GameTDB::GetWifiFeatures(const char *id, vector<string> & feat_list)
|
|||||||
++feature_text;
|
++feature_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
|
|
||||||
return feat_list.size();
|
return feat_list.size();
|
||||||
}
|
}
|
||||||
@ -921,7 +839,7 @@ int GameTDB::GetPlayers(const char *id)
|
|||||||
char *PlayersNode = GetNodeText(data, "<input players=\"", "\">");
|
char *PlayersNode = GetNodeText(data, "<input players=\"", "\">");
|
||||||
if(!PlayersNode)
|
if(!PlayersNode)
|
||||||
{
|
{
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -943,7 +861,7 @@ int GameTDB::GetAccessories(const char *id, vector<Accessory> & acc_list)
|
|||||||
char *ControlsNode = GetNodeText(data, "<control type=\"", "</input>");
|
char *ControlsNode = GetNodeText(data, "<control type=\"", "</input>");
|
||||||
if(!ControlsNode)
|
if(!ControlsNode)
|
||||||
{
|
{
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -961,7 +879,7 @@ int GameTDB::GetAccessories(const char *id, vector<Accessory> & acc_list)
|
|||||||
char *requiredField = strstr(ControlsNode, "required=\"");
|
char *requiredField = strstr(ControlsNode, "required=\"");
|
||||||
if(!requiredField)
|
if(!requiredField)
|
||||||
{
|
{
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -976,7 +894,7 @@ int GameTDB::GetAccessories(const char *id, vector<Accessory> & acc_list)
|
|||||||
list_num++;
|
list_num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
|
|
||||||
return acc_list.size();
|
return acc_list.size();
|
||||||
}
|
}
|
||||||
@ -1010,7 +928,7 @@ u32 GameTDB::GetCaseColor(const char *id)
|
|||||||
if(color != 0xffffffff)
|
if(color != 0xffffffff)
|
||||||
gprintf("GameTDB: Found alternate color(%x) for: %s\n", color, id);
|
gprintf("GameTDB: Found alternate color(%x) for: %s\n", color, id);
|
||||||
|
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1031,7 +949,7 @@ int GameTDB::GetCaseVersions(const char *id)
|
|||||||
char *PlayersNode = GetNodeText(data, "case versions=\"", "\"");
|
char *PlayersNode = GetNodeText(data, "case versions=\"", "\"");
|
||||||
if(!PlayersNode)
|
if(!PlayersNode)
|
||||||
{
|
{
|
||||||
delete [] data;
|
MEM2_free(data);
|
||||||
return altcase;
|
return altcase;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1040,32 +958,6 @@ int GameTDB::GetCaseVersions(const char *id)
|
|||||||
return altcase;
|
return altcase;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameTDB::GetGameXMLInfo(const char *id, GameXMLInfo *gameInfo)
|
|
||||||
{
|
|
||||||
if(!id || !gameInfo)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
gameInfo->GameID = id;
|
|
||||||
|
|
||||||
GetTitle(id, gameInfo->Title);
|
|
||||||
GetSynopsis(id, gameInfo->Synopsis);
|
|
||||||
GetRegion(id, gameInfo->Region);
|
|
||||||
GetDeveloper(id, gameInfo->Developer);
|
|
||||||
GetPublisher(id, gameInfo->Publisher);
|
|
||||||
gameInfo->PublishDate = GetPublishDate(id);
|
|
||||||
GetGenres(id, gameInfo->Genres);
|
|
||||||
gameInfo->RatingType = GetRating(id);
|
|
||||||
GetRatingValue(id, gameInfo->RatingValue);
|
|
||||||
GetRatingDescriptors(id, gameInfo->RatingDescriptors);
|
|
||||||
gameInfo->WifiPlayers = GetWifiPlayers(id);
|
|
||||||
GetWifiFeatures(id, gameInfo->WifiFeatures);
|
|
||||||
gameInfo->Players = GetPlayers(id);
|
|
||||||
GetAccessories(id, gameInfo->Accessories);
|
|
||||||
gameInfo->CaseColor = GetCaseColor(id);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GameTDB::IsLoaded()
|
bool GameTDB::IsLoaded()
|
||||||
{
|
{
|
||||||
return isLoaded;
|
return isLoaded;
|
||||||
|
@ -43,27 +43,6 @@ typedef struct _Accessory
|
|||||||
bool Required;
|
bool Required;
|
||||||
} Accessory;
|
} Accessory;
|
||||||
|
|
||||||
typedef struct _GameXMLInfo
|
|
||||||
{
|
|
||||||
string GameID;
|
|
||||||
string Region;
|
|
||||||
string Title;
|
|
||||||
string Synopsis;
|
|
||||||
string Developer;
|
|
||||||
string Publisher;
|
|
||||||
unsigned int PublishDate;
|
|
||||||
string Genres;
|
|
||||||
int RatingType;
|
|
||||||
string RatingValue;
|
|
||||||
vector<string> RatingDescriptors;
|
|
||||||
int WifiPlayers;
|
|
||||||
vector<string> WifiFeatures;
|
|
||||||
int Players;
|
|
||||||
vector<Accessory> Accessories;
|
|
||||||
int CaseColor;
|
|
||||||
|
|
||||||
} GameXMLInfo;
|
|
||||||
|
|
||||||
typedef struct _GameOffsets
|
typedef struct _GameOffsets
|
||||||
{
|
{
|
||||||
char gameID[7];
|
char gameID[7];
|
||||||
@ -73,97 +52,95 @@ typedef struct _GameOffsets
|
|||||||
|
|
||||||
class GameTDB
|
class GameTDB
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
GameTDB();
|
GameTDB();
|
||||||
//! Constructor
|
//! Constructor
|
||||||
//! If filepath is passed the xml file is opened and the node offsets are loaded
|
//! If filepath is passed the xml file is opened and the node offsets are loaded
|
||||||
GameTDB(const char * filepath);
|
GameTDB(const char * filepath);
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~GameTDB();
|
~GameTDB();
|
||||||
//! If filepath is passed the xml file is opened and the node offsets are loaded
|
//! If filepath is passed the xml file is opened and the node offsets are loaded
|
||||||
bool OpenFile(const char * filepath);
|
bool OpenFile(const char * filepath);
|
||||||
//! Closes the GameTDB xml file
|
//! Closes the GameTDB xml file
|
||||||
void CloseFile();
|
void CloseFile();
|
||||||
//! Refresh the GameTDB xml file, in case the file has been updated
|
//! Refresh the GameTDB xml file, in case the file has been updated
|
||||||
void Refresh();
|
void Refresh();
|
||||||
//! Set the language code which should be use to find the appropriate language
|
//! Set the language code which should be use to find the appropriate language
|
||||||
//! If the language code is not found, the language code defaults to EN
|
//! If the language code is not found, the language code defaults to EN
|
||||||
void SetLanguageCode(const char * code) { if(code) LangCode = code; };
|
void SetLanguageCode(const char * code) { if(code) LangCode = code; };
|
||||||
//! Get the current set language code
|
//! Get the current set language code
|
||||||
const char * GetLanguageCode() { return LangCode.c_str(); };
|
const char * GetLanguageCode() { return LangCode.c_str(); };
|
||||||
//! Get the title of a specific game id in the language defined in LangCode
|
//! Get the title of a specific game id in the language defined in LangCode
|
||||||
bool GetTitle(const char * id, string & title);
|
bool GetTitle(const char *id, const char * &title);
|
||||||
//! Get the synopsis of a specific game id in the language defined in LangCode
|
//! Get the synopsis of a specific game id in the language defined in LangCode
|
||||||
bool GetSynopsis(const char * id, string & synopsis);
|
bool GetSynopsis(const char *id, const char * &synopsis);
|
||||||
//! Get the region of a game for a specific game id
|
//! Get the region of a game for a specific game id
|
||||||
bool GetRegion(const char * id, string & region);
|
bool GetRegion(const char *id, const char * ®ion);
|
||||||
//! Get the developer of a game for a specific game id
|
//! Get the developer of a game for a specific game id
|
||||||
bool GetDeveloper(const char * id, string & dev);
|
bool GetDeveloper(const char *id, const char * &dev);
|
||||||
//! Get the publisher of a game for a specific game id
|
//! Get the publisher of a game for a specific game id
|
||||||
bool GetPublisher(const char * id, string & pub);
|
bool GetPublisher(const char *id, const char * &pub);
|
||||||
//! Get the publish date of a game for a specific game id
|
//! Get the publish date of a game for a specific game id
|
||||||
//! First 1 byte is the day, than 1 byte month and last 2 bytes is the year
|
//! First 1 byte is the day, than 1 byte month and last 2 bytes is the year
|
||||||
//! year = (return >> 16), month = (return >> 8) & 0xFF, day = return & 0xFF
|
//! year = (return >> 16), month = (return >> 8) & 0xFF, day = return & 0xFF
|
||||||
unsigned int GetPublishDate(const char * id);
|
unsigned int GetPublishDate(const char *id);
|
||||||
//! Get the genre list of a game for a specific game id
|
//! Get the genre list of a game for a specific game id
|
||||||
bool GetGenres(const char * id, string & gen);
|
bool GetGenres(const char * id, const char * &gen);
|
||||||
//! Get the rating type for a specific game id
|
//! Get the rating type for a specific game id
|
||||||
//! The rating type can be converted to a string with GameTDB::RatingToString(rating)
|
//! The rating type can be converted to a string with GameTDB::RatingToString(rating)
|
||||||
int GetRating(const char * id);
|
int GetRating(const char * id);
|
||||||
//! Get the rating value for a specific game id
|
//! Get the rating value for a specific game id
|
||||||
bool GetRatingValue(const char * id, string & rating_value);
|
bool GetRatingValue(const char * id, const char * &rating_value);
|
||||||
//! Get the rating descriptor list inside a vector for a specific game id
|
//! Get the rating descriptor list inside a vector for a specific game id
|
||||||
//! Returns the amount of descriptors found or -1 if failed
|
//! Returns the amount of descriptors found or -1 if failed
|
||||||
int GetRatingDescriptors(const char * id, vector<string> & desc_list);
|
int GetRatingDescriptors(const char * id, vector<string> & desc_list);
|
||||||
//! Get the wifi player count for a specific game id
|
//! Get the wifi player count for a specific game id
|
||||||
//! Returns the amount of wifi players or -1 if failed
|
//! Returns the amount of wifi players or -1 if failed
|
||||||
int GetWifiPlayers(const char * id);
|
int GetWifiPlayers(const char * id);
|
||||||
//! Get the wifi feature list inside a vector for a specific game id
|
//! Get the wifi feature list inside a vector for a specific game id
|
||||||
//! Returns the amount of wifi features found or -1 if failed
|
//! Returns the amount of wifi features found or -1 if failed
|
||||||
int GetWifiFeatures(const char * id, vector<string> & feat_list);
|
int GetWifiFeatures(const char * id, vector<string> & feat_list);
|
||||||
//! Get the player count for a specific game id
|
//! Get the player count for a specific game id
|
||||||
//! Returns the amount of players or -1 if failed
|
//! Returns the amount of players or -1 if failed
|
||||||
int GetPlayers(const char * id);
|
int GetPlayers(const char * id);
|
||||||
//! Returns the amount of accessoires found or -1 if failed
|
//! Returns the amount of accessoires found or -1 if failed
|
||||||
//! Get the accessoire (inputs) list inside a vector for a specific game id
|
//! Get the accessoire (inputs) list inside a vector for a specific game id
|
||||||
int GetAccessories(const char * id, vector<Accessory> & acc_list);
|
int GetAccessories(const char * id, vector<Accessory> & acc_list);
|
||||||
//! Get the box (case) color for a specific game id
|
//! Get the box (case) color for a specific game id
|
||||||
//! Returns the color in RGB (first 3 bytes)
|
//! Returns the color in RGB (first 3 bytes)
|
||||||
unsigned int GetCaseColor(const char * id);
|
unsigned int GetCaseColor(const char * id);
|
||||||
int GetCaseVersions(const char * id);
|
int GetCaseVersions(const char * id);
|
||||||
//! Get the complete game info in the GameXMLInfo struct
|
//! Convert a specific game rating to a string
|
||||||
bool GetGameXMLInfo(const char * id, GameXMLInfo * gameInfo);
|
static const char * RatingToString(int rating);
|
||||||
//! Convert a specific game rating to a string
|
//! Get the version of the gametdb xml database
|
||||||
static const char * RatingToString(int rating);
|
unsigned long long GetGameTDBVersion();
|
||||||
//! Get the version of the gametdb xml database
|
//! Get the entry count in the xml database
|
||||||
unsigned long long GetGameTDBVersion();
|
inline size_t GetEntryCount() { return OffsetMap.size(); };
|
||||||
//! Get the entry count in the xml database
|
//! Is a database loaded
|
||||||
inline size_t GetEntryCount() { return OffsetMap.size(); };
|
bool IsLoaded();
|
||||||
//! Is a database loaded
|
private:
|
||||||
bool IsLoaded();
|
bool ParseFile();
|
||||||
private:
|
bool LoadGameOffsets(const char * path);
|
||||||
bool ParseFile();
|
bool SaveGameOffsets(const char * path);
|
||||||
bool LoadGameOffsets(const char * path);
|
bool CheckTitlesIni(const char * path);
|
||||||
bool SaveGameOffsets(const char * path);
|
bool FindTitle(char *data, const char * &title, const string &langCode);
|
||||||
bool CheckTitlesIni(const char * path);
|
unsigned int FindCaseColor(char * data);
|
||||||
bool FindTitle(char * data, string & title, string langCode);
|
inline int GetData(char * data, int offset, int size);
|
||||||
unsigned int FindCaseColor(char * data);
|
inline char * LoadGameNode(const char * id);
|
||||||
inline int GetData(char * data, int offset, int size);
|
inline char * GetGameNode(const char * id);
|
||||||
inline char * LoadGameNode(const char * id);
|
inline GameOffsets * GetGameOffset(const char * id);
|
||||||
inline char * GetGameNode(const char * id);
|
inline char * SeekLang(char * text, const char * langcode);
|
||||||
inline GameOffsets * GetGameOffset(const char * id);
|
inline char * GetNodeText(char *data, const char *nodestart, const char *nodeend);
|
||||||
inline char * SeekLang(char * text, const char * langcode);
|
|
||||||
inline char * GetNodeText(char * data, const char * nodestart, const char * nodeend);
|
|
||||||
|
|
||||||
bool isLoaded;
|
bool isLoaded;
|
||||||
bool isParsed;
|
bool isParsed;
|
||||||
vector<GameOffsets> OffsetMap;
|
vector<GameOffsets> OffsetMap;
|
||||||
FILE * file;
|
FILE * file;
|
||||||
const char *filepath;
|
const char *filepath;
|
||||||
string LangCode;
|
string LangCode;
|
||||||
char * GameNodeCache;
|
char *GameNodeCache;
|
||||||
char GameIDCache[7];
|
char GameIDCache[7];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -70,18 +70,18 @@ static void AddISO(const char *GameID, const char *GameTitle, const char *GamePa
|
|||||||
if(GameID != NULL) strncpy(ListElement.id, GameID, 6);
|
if(GameID != NULL) strncpy(ListElement.id, GameID, 6);
|
||||||
if(GamePath != NULL) strncpy(ListElement.path, GamePath, sizeof(ListElement.path) - 1);
|
if(GamePath != NULL) strncpy(ListElement.path, GamePath, sizeof(ListElement.path) - 1);
|
||||||
ListElement.casecolor = CustomTitles.getColor("COVERS", ListElement.id, GameColor).intVal();
|
ListElement.casecolor = CustomTitles.getColor("COVERS", ListElement.id, GameColor).intVal();
|
||||||
string CustomTitle = CustomTitles.getString("TITLES", ListElement.id);
|
const char *CustomTitle = CustomTitles.getString("TITLES", ListElement.id).c_str();
|
||||||
if(gameTDB.IsLoaded())
|
if(gameTDB.IsLoaded())
|
||||||
{
|
{
|
||||||
if(ListElement.casecolor == GameColor)
|
if(ListElement.casecolor == GameColor)
|
||||||
ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id);
|
ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id);
|
||||||
if(CustomTitle.size() == 0)
|
|
||||||
gameTDB.GetTitle(ListElement.id, CustomTitle);
|
|
||||||
ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id);
|
ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id);
|
||||||
ListElement.players = gameTDB.GetPlayers(ListElement.id);
|
ListElement.players = gameTDB.GetPlayers(ListElement.id);
|
||||||
|
if(CustomTitle == NULL || CustomTitle[0] == '\0')
|
||||||
|
gameTDB.GetTitle(ListElement.id, CustomTitle);
|
||||||
}
|
}
|
||||||
if(CustomTitle.size() > 0)
|
if(CustomTitle != NULL && CustomTitle[0] != '\0')
|
||||||
mbstowcs(ListElement.title, CustomTitle.c_str(), 63);
|
mbstowcs(ListElement.title, CustomTitle, 63);
|
||||||
else if(GameTitle != NULL)
|
else if(GameTitle != NULL)
|
||||||
mbstowcs(ListElement.title, GameTitle, 63);
|
mbstowcs(ListElement.title, GameTitle, 63);
|
||||||
Asciify(ListElement.title);
|
Asciify(ListElement.title);
|
||||||
@ -201,18 +201,18 @@ static void Create_Channel_List()
|
|||||||
ListElement.settings[1] = TITLE_LOWER(chan->title);
|
ListElement.settings[1] = TITLE_LOWER(chan->title);
|
||||||
strncpy(ListElement.id, chan->id, 4);
|
strncpy(ListElement.id, chan->id, 4);
|
||||||
ListElement.casecolor = CustomTitles.getColor("COVERS", ListElement.id, 1).intVal();
|
ListElement.casecolor = CustomTitles.getColor("COVERS", ListElement.id, 1).intVal();
|
||||||
string CustomTitle = CustomTitles.getString("TITLES", ListElement.id);
|
const char *CustomTitle = CustomTitles.getString("TITLES", ListElement.id).c_str();
|
||||||
if(gameTDB.IsLoaded())
|
if(gameTDB.IsLoaded())
|
||||||
{
|
{
|
||||||
if(ListElement.casecolor == 1)
|
if(ListElement.casecolor == 1)
|
||||||
ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id);
|
ListElement.casecolor = gameTDB.GetCaseColor(ListElement.id);
|
||||||
if(CustomTitle.size() == 0)
|
|
||||||
gameTDB.GetTitle(ListElement.id, CustomTitle);
|
|
||||||
ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id);
|
ListElement.wifi = gameTDB.GetWifiPlayers(ListElement.id);
|
||||||
ListElement.players = gameTDB.GetPlayers(ListElement.id);
|
ListElement.players = gameTDB.GetPlayers(ListElement.id);
|
||||||
|
if(CustomTitle == NULL || CustomTitle[0] == '\0')
|
||||||
|
gameTDB.GetTitle(ListElement.id, CustomTitle);
|
||||||
}
|
}
|
||||||
if(CustomTitle.size() > 0)
|
if(CustomTitle != NULL && CustomTitle[0] != '\0')
|
||||||
mbstowcs(ListElement.title, CustomTitle.c_str(), 63);
|
mbstowcs(ListElement.title, CustomTitle, 63);
|
||||||
else
|
else
|
||||||
wcsncpy(ListElement.title, chan->name, 64);
|
wcsncpy(ListElement.title, chan->name, 64);
|
||||||
ListElement.type = TYPE_CHANNEL;
|
ListElement.type = TYPE_CHANNEL;
|
||||||
|
@ -1668,60 +1668,59 @@ void CMenu::_initCF(void)
|
|||||||
if (ageLock < 19)
|
if (ageLock < 19)
|
||||||
{
|
{
|
||||||
int ageRated = min(max(gameAgeList.getInt(domain, id), 0), 19);
|
int ageRated = min(max(gameAgeList.getInt(domain, id), 0), 19);
|
||||||
|
if(ageRated == 0 && gametdb.IsLoaded() && (element->type == TYPE_WII_GAME || element->type == TYPE_CHANNEL))
|
||||||
if(ageRated == 0 && (element->type == TYPE_WII_GAME || element->type == TYPE_CHANNEL))
|
|
||||||
{
|
{
|
||||||
GameXMLInfo gameinfo;
|
const char *RatingValue = NULL;
|
||||||
if(gametdb.IsLoaded() && gametdb.GetGameXMLInfo(id.c_str(), &gameinfo))
|
if(gametdb.GetRatingValue(id.c_str(), RatingValue))
|
||||||
{
|
{
|
||||||
switch(gameinfo.RatingType)
|
switch(gametdb.GetRating(id.c_str()))
|
||||||
{
|
{
|
||||||
case GAMETDB_RATING_TYPE_CERO:
|
case GAMETDB_RATING_TYPE_CERO:
|
||||||
if (gameinfo.RatingValue == "A")
|
if(RatingValue[0] == 'A')
|
||||||
ageRated = 3;
|
ageRated = 3;
|
||||||
else if (gameinfo.RatingValue == "B")
|
else if(RatingValue[0] == 'B')
|
||||||
ageRated = 12;
|
ageRated = 12;
|
||||||
else if (gameinfo.RatingValue == "D")
|
else if(RatingValue[0] == 'D')
|
||||||
ageRated = 15;
|
ageRated = 15;
|
||||||
else if (gameinfo.RatingValue == "C")
|
else if(RatingValue[0] == 'C')
|
||||||
ageRated = 17;
|
ageRated = 17;
|
||||||
else if (gameinfo.RatingValue == "Z")
|
else if(RatingValue[0] == 'Z')
|
||||||
ageRated = 18;
|
ageRated = 18;
|
||||||
break;
|
break;
|
||||||
case GAMETDB_RATING_TYPE_ESRB:
|
case GAMETDB_RATING_TYPE_ESRB:
|
||||||
if (gameinfo.RatingValue == "E")
|
if(RatingValue[0] == 'E')
|
||||||
ageRated = 6;
|
ageRated = 6;
|
||||||
else if (gameinfo.RatingValue == "EC")
|
else if(memcmp(RatingValue, "EC", 2) == 0)
|
||||||
ageRated = 3;
|
ageRated = 3;
|
||||||
else if (gameinfo.RatingValue == "E10+")
|
else if(memcmp(RatingValue, "E10+", 4) == 0)
|
||||||
ageRated = 10;
|
ageRated = 10;
|
||||||
else if (gameinfo.RatingValue == "T")
|
else if(RatingValue[0] == 'T')
|
||||||
ageRated = 13;
|
ageRated = 13;
|
||||||
else if (gameinfo.RatingValue == "M")
|
else if(RatingValue[0] == 'M')
|
||||||
ageRated = 17;
|
ageRated = 17;
|
||||||
else if (gameinfo.RatingValue == "AO")
|
else if(memcmp(RatingValue, "AO", 2) == 0)
|
||||||
ageRated = 18;
|
ageRated = 18;
|
||||||
break;
|
break;
|
||||||
case GAMETDB_RATING_TYPE_PEGI:
|
case GAMETDB_RATING_TYPE_PEGI:
|
||||||
if (gameinfo.RatingValue == "3")
|
if(RatingValue[0] == '3')
|
||||||
ageRated = 3;
|
ageRated = 3;
|
||||||
else if (gameinfo.RatingValue == "7")
|
else if(RatingValue[0] == '7')
|
||||||
ageRated = 7;
|
ageRated = 7;
|
||||||
else if (gameinfo.RatingValue == "12")
|
else if(memcmp(RatingValue, "12", 2) == 0)
|
||||||
ageRated = 12;
|
ageRated = 12;
|
||||||
else if (gameinfo.RatingValue == "16")
|
else if(memcmp(RatingValue, "16", 2) == 0)
|
||||||
ageRated = 16;
|
ageRated = 16;
|
||||||
else if (gameinfo.RatingValue == "18")
|
else if(memcmp(RatingValue, "18", 2) == 0)
|
||||||
ageRated = 18;
|
ageRated = 18;
|
||||||
break;
|
break;
|
||||||
case GAMETDB_RATING_TYPE_GRB:
|
case GAMETDB_RATING_TYPE_GRB:
|
||||||
if (gameinfo.RatingValue == "A")
|
if(RatingValue[0] == 'A')
|
||||||
ageRated = 3;
|
ageRated = 3;
|
||||||
else if (gameinfo.RatingValue == "12")
|
else if(memcmp(RatingValue, "12", 2) == 0)
|
||||||
ageRated = 12;
|
ageRated = 12;
|
||||||
else if (gameinfo.RatingValue == "15")
|
else if(memcmp(RatingValue, "15", 2) == 0)
|
||||||
ageRated = 15;
|
ageRated = 15;
|
||||||
else if (gameinfo.RatingValue == "18")
|
else if(memcmp(RatingValue, "18", 2) == 0)
|
||||||
ageRated = 18;
|
ageRated = 18;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -77,11 +77,10 @@ extern const u8 pegi_12_png[];
|
|||||||
extern const u8 pegi_16_png[];
|
extern const u8 pegi_16_png[];
|
||||||
extern const u8 pegi_18_png[];
|
extern const u8 pegi_18_png[];
|
||||||
|
|
||||||
GameXMLInfo gameinfo;
|
|
||||||
wstringEx gameinfo_Synopsis_w;
|
wstringEx gameinfo_Synopsis_w;
|
||||||
wstringEx gameinfo_Title_w;
|
wstringEx gameinfo_Title_w;
|
||||||
|
|
||||||
static bool titlecheck = false;
|
bool titlecheck = false;
|
||||||
u8 cnt_controlsreq = 0, cnt_controls = 0;
|
u8 cnt_controlsreq = 0, cnt_controls = 0;
|
||||||
const int pixels_to_skip = 10;
|
const int pixels_to_skip = 10;
|
||||||
|
|
||||||
@ -130,7 +129,7 @@ void CMenu::_gameinfo(void)
|
|||||||
amount_of_skips--;
|
amount_of_skips--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (BTN_RIGHT_PRESSED && !(m_thrdWorking && m_thrdStop) && page == 0 && gameinfo.Synopsis.size() > 0)
|
else if (BTN_RIGHT_PRESSED && !(m_thrdWorking && m_thrdStop) && page == 0 && !gameinfo_Synopsis_w.empty())
|
||||||
{
|
{
|
||||||
page = 1;
|
page = 1;
|
||||||
amount_of_skips = 0;
|
amount_of_skips = 0;
|
||||||
@ -313,24 +312,37 @@ void CMenu::_textGameInfo(void)
|
|||||||
GameTDB gametdb;
|
GameTDB gametdb;
|
||||||
gametdb.OpenFile(fmt("%s/wiitdb.xml", m_settingsDir.c_str()));
|
gametdb.OpenFile(fmt("%s/wiitdb.xml", m_settingsDir.c_str()));
|
||||||
gametdb.SetLanguageCode(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
|
gametdb.SetLanguageCode(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
|
||||||
|
const char *TMP_Char = NULL;
|
||||||
titlecheck = gametdb.IsLoaded() && gametdb.GetGameXMLInfo(m_cf.getId().c_str(), &gameinfo);
|
titlecheck = gametdb.IsLoaded();
|
||||||
if(titlecheck)
|
if(titlecheck)
|
||||||
{
|
{
|
||||||
gameinfo_Title_w.fromUTF8(gameinfo.Title);
|
char GameID[7];
|
||||||
m_btnMgr.setText(m_gameinfoLblTitle, gameinfo_Title_w, true);
|
GameID[6] = '\0';
|
||||||
gameinfo_Synopsis_w.fromUTF8(gameinfo.Synopsis);
|
strncpy(GameID, m_cf.getId().c_str(), 6);
|
||||||
m_btnMgr.setText(m_gameinfoLblSynopsis, gameinfo_Synopsis_w);
|
if(gametdb.GetTitle(GameID, TMP_Char))
|
||||||
|
{
|
||||||
|
gameinfo_Title_w.fromUTF8(TMP_Char);
|
||||||
|
m_btnMgr.setText(m_gameinfoLblTitle, gameinfo_Title_w, true);
|
||||||
|
}
|
||||||
|
if(gametdb.GetSynopsis(GameID, TMP_Char))
|
||||||
|
{
|
||||||
|
gameinfo_Synopsis_w.fromUTF8(TMP_Char);
|
||||||
|
m_btnMgr.setText(m_gameinfoLblSynopsis, gameinfo_Synopsis_w);
|
||||||
|
}
|
||||||
|
m_btnMgr.setText(m_gameinfoLblID, wfmt(L"GameID: %s", GameID), true);
|
||||||
|
if(gametdb.GetDeveloper(GameID, TMP_Char))
|
||||||
|
m_btnMgr.setText(m_gameinfoLblDev, wfmt(_fmt("gameinfo1",L"Developer: %s"), TMP_Char), true);
|
||||||
|
if(gametdb.GetPublisher(GameID, TMP_Char))
|
||||||
|
m_btnMgr.setText(m_gameinfoLblPublisher, wfmt(_fmt("gameinfo2",L"Publisher: %s"), TMP_Char), true);
|
||||||
|
if(gametdb.GetRegion(GameID, TMP_Char))
|
||||||
|
m_btnMgr.setText(m_gameinfoLblRegion, wfmt(_fmt("gameinfo3",L"Region: %s"), TMP_Char), true);
|
||||||
|
if(gametdb.GetGenres(GameID, TMP_Char))
|
||||||
|
m_btnMgr.setText(m_gameinfoLblGenre, wfmt(_fmt("gameinfo5",L"Genre: %s"), TMP_Char), true);
|
||||||
|
|
||||||
m_btnMgr.setText(m_gameinfoLblID, wfmt(L"GameID: %s", gameinfo.GameID.c_str()), true);
|
int PublishDate = gametdb.GetPublishDate(GameID);
|
||||||
m_btnMgr.setText(m_gameinfoLblDev, wfmt(_fmt("gameinfo1",L"Developer: %s"), gameinfo.Developer.c_str()), true);
|
int year = PublishDate >> 16;
|
||||||
m_btnMgr.setText(m_gameinfoLblPublisher, wfmt(_fmt("gameinfo2",L"Publisher: %s"), gameinfo.Publisher.c_str()), true);
|
int day = PublishDate & 0xFF;
|
||||||
m_btnMgr.setText(m_gameinfoLblRegion, wfmt(_fmt("gameinfo3",L"Region: %s"), gameinfo.Region.c_str()), true);
|
int month = (PublishDate >> 8) & 0xFF;
|
||||||
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;
|
|
||||||
int month = (gameinfo.PublishDate >> 8) & 0xFF;
|
|
||||||
switch(CONF_GetRegion())
|
switch(CONF_GetRegion())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@ -345,151 +357,153 @@ void CMenu::_textGameInfo(void)
|
|||||||
m_btnMgr.setText(m_gameinfoLblRlsdate, wfmt(_fmt("gameinfo4",L"Release Date: %i-%i-%i"), day, month, year), true);
|
m_btnMgr.setText(m_gameinfoLblRlsdate, wfmt(_fmt("gameinfo4",L"Release Date: %i-%i-%i"), day, month, year), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Ratings
|
//Ratings
|
||||||
m_rating.fromJPG(norating_jpg, norating_jpg_size);
|
m_rating.fromJPG(norating_jpg, norating_jpg_size);
|
||||||
switch(gameinfo.RatingType)
|
const char *RatingValue = NULL;
|
||||||
|
if(gametdb.GetRatingValue(GameID, RatingValue))
|
||||||
{
|
{
|
||||||
case GAMETDB_RATING_TYPE_CERO:
|
switch(gametdb.GetRating(GameID))
|
||||||
if (gameinfo.RatingValue == "A")
|
{
|
||||||
m_rating.fromPNG(cero_a_png);
|
case GAMETDB_RATING_TYPE_CERO:
|
||||||
else if (gameinfo.RatingValue == "B")
|
if(RatingValue[0] == 'A')
|
||||||
m_rating.fromPNG(cero_b_png);
|
m_rating.fromPNG(cero_a_png);
|
||||||
else if (gameinfo.RatingValue == "D")
|
else if(RatingValue[0] == 'B')
|
||||||
m_rating.fromPNG(cero_d_png);
|
m_rating.fromPNG(cero_b_png);
|
||||||
else if (gameinfo.RatingValue == "C")
|
else if(RatingValue[0] == 'D')
|
||||||
m_rating.fromPNG(cero_c_png);
|
m_rating.fromPNG(cero_d_png);
|
||||||
else if (gameinfo.RatingValue == "Z")
|
else if(RatingValue[0] == 'C')
|
||||||
m_rating.fromPNG(cero_z_png);
|
m_rating.fromPNG(cero_c_png);
|
||||||
break;
|
else if(RatingValue[0] == 'Z')
|
||||||
case GAMETDB_RATING_TYPE_ESRB:
|
m_rating.fromPNG(cero_z_png);
|
||||||
if (gameinfo.RatingValue == "E")
|
break;
|
||||||
m_rating.fromJPG(esrb_e_jpg, esrb_e_jpg_size);
|
case GAMETDB_RATING_TYPE_ESRB:
|
||||||
else if (gameinfo.RatingValue == "EC")
|
if(RatingValue[0] == 'E')
|
||||||
m_rating.fromJPG(esrb_ec_jpg, esrb_ec_jpg_size);
|
m_rating.fromJPG(esrb_e_jpg, esrb_e_jpg_size);
|
||||||
else if (gameinfo.RatingValue == "E10+")
|
else if(memcmp(RatingValue, "EC", 2) == 0)
|
||||||
m_rating.fromJPG(esrb_eten_jpg, esrb_eten_jpg_size);
|
m_rating.fromJPG(esrb_ec_jpg, esrb_ec_jpg_size);
|
||||||
else if (gameinfo.RatingValue == "T")
|
else if(memcmp(RatingValue, "E10+", 4) == 0)
|
||||||
m_rating.fromJPG(esrb_t_jpg, esrb_t_jpg_size);
|
m_rating.fromJPG(esrb_eten_jpg, esrb_eten_jpg_size);
|
||||||
else if (gameinfo.RatingValue == "M")
|
else if(RatingValue[0] == 'T')
|
||||||
m_rating.fromJPG(esrb_m_jpg, esrb_m_jpg_size);
|
m_rating.fromJPG(esrb_t_jpg, esrb_t_jpg_size);
|
||||||
else if (gameinfo.RatingValue == "AO")
|
else if(RatingValue[0] == 'M')
|
||||||
m_rating.fromJPG(esrb_ao_jpg, esrb_ao_jpg_size);
|
m_rating.fromJPG(esrb_m_jpg, esrb_m_jpg_size);
|
||||||
break;
|
else if(memcmp(RatingValue, "AO", 2) == 0)
|
||||||
case GAMETDB_RATING_TYPE_PEGI:
|
m_rating.fromJPG(esrb_ao_jpg, esrb_ao_jpg_size);
|
||||||
if (gameinfo.RatingValue == "3")
|
break;
|
||||||
m_rating.fromPNG(pegi_3_png);
|
case GAMETDB_RATING_TYPE_PEGI:
|
||||||
else if (gameinfo.RatingValue == "7")
|
if(RatingValue[0] == '3')
|
||||||
m_rating.fromPNG(pegi_7_png);
|
m_rating.fromPNG(pegi_3_png);
|
||||||
else if (gameinfo.RatingValue == "12")
|
else if(RatingValue[0] == '7')
|
||||||
m_rating.fromPNG(pegi_12_png);
|
m_rating.fromPNG(pegi_7_png);
|
||||||
else if (gameinfo.RatingValue == "16")
|
else if(memcmp(RatingValue, "12", 2) == 0)
|
||||||
m_rating.fromPNG(pegi_16_png);
|
m_rating.fromPNG(pegi_12_png);
|
||||||
else if (gameinfo.RatingValue == "18")
|
else if(memcmp(RatingValue, "16", 2) == 0)
|
||||||
m_rating.fromPNG(pegi_18_png);
|
m_rating.fromPNG(pegi_16_png);
|
||||||
break;
|
else if(memcmp(RatingValue, "18", 2) == 0)
|
||||||
case GAMETDB_RATING_TYPE_GRB:
|
m_rating.fromPNG(pegi_18_png);
|
||||||
if (gameinfo.RatingValue == "A")
|
break;
|
||||||
m_rating.fromPNG(grb_a_png);
|
case GAMETDB_RATING_TYPE_GRB:
|
||||||
else if (gameinfo.RatingValue == "12")
|
if(RatingValue[0] == 'A')
|
||||||
m_rating.fromPNG(grb_12_png);
|
m_rating.fromPNG(grb_a_png);
|
||||||
else if (gameinfo.RatingValue == "15")
|
else if(memcmp(RatingValue, "12", 2) == 0)
|
||||||
m_rating.fromPNG(grb_15_png);
|
m_rating.fromPNG(grb_12_png);
|
||||||
else if (gameinfo.RatingValue == "18")
|
else if(memcmp(RatingValue, "15", 2) == 0)
|
||||||
m_rating.fromPNG(grb_18_png);
|
m_rating.fromPNG(grb_15_png);
|
||||||
break;
|
else if(memcmp(RatingValue, "18", 2) == 0)
|
||||||
default:
|
m_rating.fromPNG(grb_18_png);
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
m_btnMgr.setTexture(m_gameinfoLblRating, m_rating);
|
m_btnMgr.setTexture(m_gameinfoLblRating, m_rating);
|
||||||
|
|
||||||
//Wifi players
|
//Wifi players
|
||||||
|
int WifiPlayers = gametdb.GetWifiPlayers(GameID);
|
||||||
STexture emptyTex;
|
STexture emptyTex;
|
||||||
if (gameinfo.WifiPlayers == 1)
|
if(WifiPlayers == 1)
|
||||||
m_wifi.fromPNG(wifi1_png);
|
m_wifi.fromPNG(wifi1_png);
|
||||||
else if (gameinfo.WifiPlayers == 2)
|
else if(WifiPlayers == 2)
|
||||||
m_wifi.fromPNG(wifi2_png);
|
m_wifi.fromPNG(wifi2_png);
|
||||||
else if (gameinfo.WifiPlayers == 4)
|
else if(WifiPlayers == 4)
|
||||||
m_wifi.fromPNG(wifi4_png);
|
m_wifi.fromPNG(wifi4_png);
|
||||||
else if (gameinfo.WifiPlayers == 8)
|
else if(WifiPlayers == 8)
|
||||||
m_wifi.fromPNG(wifi8_png);
|
m_wifi.fromPNG(wifi8_png);
|
||||||
else if (gameinfo.WifiPlayers == 10)
|
else if(WifiPlayers == 10)
|
||||||
m_wifi.fromPNG(wifi10_png);
|
m_wifi.fromPNG(wifi10_png);
|
||||||
else if (gameinfo.WifiPlayers == 12)
|
else if(WifiPlayers == 12)
|
||||||
m_wifi.fromPNG(wifi12_png);
|
m_wifi.fromPNG(wifi12_png);
|
||||||
else if (gameinfo.WifiPlayers == 16)
|
else if(WifiPlayers == 16)
|
||||||
m_wifi.fromPNG(wifi16_png);
|
m_wifi.fromPNG(wifi16_png);
|
||||||
else if (gameinfo.WifiPlayers == 18)
|
else if(WifiPlayers == 18)
|
||||||
m_wifi.fromPNG(wifi18_png);
|
m_wifi.fromPNG(wifi18_png);
|
||||||
else if (gameinfo.WifiPlayers == 32)
|
else if(WifiPlayers == 32)
|
||||||
m_wifi.fromPNG(wifi32_png);
|
m_wifi.fromPNG(wifi32_png);
|
||||||
|
if(WifiPlayers > 0)
|
||||||
if(gameinfo.WifiPlayers > 0)
|
|
||||||
m_btnMgr.setTexture(m_gameinfoLblWifiplayers, m_wifi);
|
m_btnMgr.setTexture(m_gameinfoLblWifiplayers, m_wifi);
|
||||||
else
|
else
|
||||||
m_btnMgr.setTexture(m_gameinfoLblWifiplayers, emptyTex);
|
m_btnMgr.setTexture(m_gameinfoLblWifiplayers, emptyTex);
|
||||||
|
|
||||||
u8 wiimote=0,
|
|
||||||
nunchuk=0,
|
|
||||||
classiccontroller=0,
|
|
||||||
balanceboard=0,
|
|
||||||
dancepad=0,
|
|
||||||
guitar=0,
|
|
||||||
gamecube=0,
|
|
||||||
motionplus=0,
|
|
||||||
drums=0,
|
|
||||||
microphone=0,
|
|
||||||
wheel=0,
|
|
||||||
keyboard=0,
|
|
||||||
udraw = 0,
|
|
||||||
zapper=0;
|
|
||||||
|
|
||||||
//check required controlls
|
//check required controlls
|
||||||
for (vector<Accessory>::iterator acc_itr = gameinfo.Accessories.begin(); acc_itr != gameinfo.Accessories.end(); acc_itr++)
|
bool wiimote = false;
|
||||||
{
|
bool nunchuk = false;
|
||||||
if (!acc_itr->Required) continue;
|
bool classiccontroller = false;
|
||||||
|
bool balanceboard = false;
|
||||||
if (strcmp((acc_itr->Name).c_str(), "wiimote") == 0)
|
bool dancepad = false;
|
||||||
wiimote=1;
|
bool guitar = false;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "nunchuk") == 0)
|
bool gamecube = false;
|
||||||
nunchuk=1;
|
bool motionplus = false;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "guitar") == 0)
|
bool drums = false;
|
||||||
guitar=1;
|
bool microphone = false;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "drums") == 0)
|
bool wheel = false;
|
||||||
drums=1;
|
bool keyboard = false;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "dancepad") == 0)
|
bool udraw = false;
|
||||||
dancepad=1;
|
bool zapper = false;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "motionplus") == 0)
|
|
||||||
motionplus=1;
|
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "microphone") == 0)
|
|
||||||
microphone=1;
|
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "balanceboard") == 0)
|
|
||||||
balanceboard=1;
|
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "udraw") == 0)
|
|
||||||
udraw = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
vector<Accessory> Accessories;
|
||||||
|
gametdb.GetAccessories(GameID, Accessories);
|
||||||
|
for(vector<Accessory>::iterator acc_itr = Accessories.begin(); acc_itr != Accessories.end(); acc_itr++)
|
||||||
|
{
|
||||||
|
if(!acc_itr->Required)
|
||||||
|
continue;
|
||||||
|
if(strcmp((acc_itr->Name).c_str(), "wiimote") == 0)
|
||||||
|
wiimote = true;
|
||||||
|
else if(strcmp((acc_itr->Name).c_str(), "nunchuk") == 0)
|
||||||
|
nunchuk = true;
|
||||||
|
else if(strcmp((acc_itr->Name).c_str(), "guitar") == 0)
|
||||||
|
guitar = true;
|
||||||
|
else if(strcmp((acc_itr->Name).c_str(), "drums") == 0)
|
||||||
|
drums = true;
|
||||||
|
else if(strcmp((acc_itr->Name).c_str(), "dancepad") == 0)
|
||||||
|
dancepad = true;
|
||||||
|
else if(strcmp((acc_itr->Name).c_str(), "motionplus") == 0)
|
||||||
|
motionplus = true;
|
||||||
|
else if(strcmp((acc_itr->Name).c_str(), "microphone") == 0)
|
||||||
|
microphone = true;
|
||||||
|
else if(strcmp((acc_itr->Name).c_str(), "balanceboard") == 0)
|
||||||
|
balanceboard = true;
|
||||||
|
else if(strcmp((acc_itr->Name).c_str(), "udraw") == 0)
|
||||||
|
udraw = true;
|
||||||
|
}
|
||||||
u8 x = 0;
|
u8 x = 0;
|
||||||
u8 max_controlsReq = ARRAY_SIZE(m_gameinfoLblControlsReq);
|
u8 max_controlsReq = ARRAY_SIZE(m_gameinfoLblControlsReq);
|
||||||
|
|
||||||
if(wiimote && x < max_controlsReq)
|
if(wiimote && x < max_controlsReq)
|
||||||
{
|
{
|
||||||
u8 players = gameinfo.Players;
|
u8 players = gametdb.GetPlayers(GameID);
|
||||||
if (gameinfo.Players >= 10)
|
if(players >= 10)
|
||||||
players = players/10;
|
players /= 10;
|
||||||
|
|
||||||
if (players == 1)
|
if(players == 1)
|
||||||
m_controlsreq[x].fromPNG(wiimote1_png);
|
m_controlsreq[x].fromPNG(wiimote1_png);
|
||||||
else if (players == 2)
|
else if(players == 2)
|
||||||
m_controlsreq[x].fromPNG(wiimote2_png);
|
m_controlsreq[x].fromPNG(wiimote2_png);
|
||||||
else if (players == 3)
|
else if(players == 3)
|
||||||
m_controlsreq[x].fromPNG(wiimote3_png);
|
m_controlsreq[x].fromPNG(wiimote3_png);
|
||||||
else if (players == 4)
|
else if(players == 4)
|
||||||
m_controlsreq[x].fromPNG(wiimote4_png);
|
m_controlsreq[x].fromPNG(wiimote4_png);
|
||||||
else if (players == 6)
|
else if(players == 6)
|
||||||
m_controlsreq[x].fromPNG(wiimote6_png);
|
m_controlsreq[x].fromPNG(wiimote6_png);
|
||||||
else if (players == 8)
|
else if(players == 8)
|
||||||
m_controlsreq[x].fromPNG(wiimote8_png);
|
m_controlsreq[x].fromPNG(wiimote8_png);
|
||||||
|
|
||||||
m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 20, 60);
|
m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 20, 60);
|
||||||
@ -543,60 +557,56 @@ void CMenu::_textGameInfo(void)
|
|||||||
m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
|
m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
|
|
||||||
cnt_controlsreq = x;
|
cnt_controlsreq = x;
|
||||||
|
|
||||||
//check optional controlls
|
//check optional controlls
|
||||||
wiimote=0,
|
wiimote = false;
|
||||||
nunchuk=0,
|
nunchuk = false;
|
||||||
classiccontroller=0,
|
classiccontroller = false;
|
||||||
balanceboard=0,
|
balanceboard = false;
|
||||||
dancepad=0,
|
dancepad = false;
|
||||||
guitar=0,
|
guitar = false;
|
||||||
gamecube=0,
|
gamecube = false;
|
||||||
motionplus=0,
|
motionplus = false;
|
||||||
drums=0,
|
drums = false;
|
||||||
microphone=0,
|
microphone = false;
|
||||||
wheel=0,
|
wheel = false;
|
||||||
keyboard=0,
|
keyboard = false;
|
||||||
udraw = 0,
|
udraw = false;
|
||||||
zapper=0;
|
zapper = false;
|
||||||
|
for(vector<Accessory>::iterator acc_itr = Accessories.begin(); acc_itr != Accessories.end(); acc_itr++)
|
||||||
for (vector<Accessory>::iterator acc_itr = gameinfo.Accessories.begin(); acc_itr != gameinfo.Accessories.end(); acc_itr++)
|
|
||||||
{
|
{
|
||||||
if (acc_itr->Required) continue;
|
if(acc_itr->Required)
|
||||||
|
continue;
|
||||||
if (strcmp((acc_itr->Name).c_str(), "classiccontroller") == 0)
|
if(strcmp((acc_itr->Name).c_str(), "classiccontroller") == 0)
|
||||||
classiccontroller=1;
|
classiccontroller = true;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "nunchuk") == 0)
|
else if(strcmp((acc_itr->Name).c_str(), "nunchuk") == 0)
|
||||||
nunchuk=1;
|
nunchuk = true;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "guitar") == 0)
|
else if(strcmp((acc_itr->Name).c_str(), "guitar") == 0)
|
||||||
guitar=1;
|
guitar = true;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "drums") == 0)
|
else if(strcmp((acc_itr->Name).c_str(), "drums") == 0)
|
||||||
drums=1;
|
drums = true;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "dancepad") == 0)
|
else if(strcmp((acc_itr->Name).c_str(), "dancepad") == 0)
|
||||||
dancepad=1;
|
dancepad = true;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "motionplus") == 0)
|
else if(strcmp((acc_itr->Name).c_str(), "motionplus") == 0)
|
||||||
motionplus=1;
|
motionplus = true;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "balanceboard") == 0)
|
else if(strcmp((acc_itr->Name).c_str(), "balanceboard") == 0)
|
||||||
balanceboard=1;
|
balanceboard = true;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "microphone") == 0)
|
else if(strcmp((acc_itr->Name).c_str(), "microphone") == 0)
|
||||||
microphone=1;
|
microphone = true;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "gamecube") == 0)
|
else if(strcmp((acc_itr->Name).c_str(), "gamecube") == 0)
|
||||||
gamecube=1;
|
gamecube = true;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "keyboard") == 0)
|
else if(strcmp((acc_itr->Name).c_str(), "keyboard") == 0)
|
||||||
keyboard=1;
|
keyboard = true;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "zapper") == 0)
|
else if(strcmp((acc_itr->Name).c_str(), "zapper") == 0)
|
||||||
zapper=1;
|
zapper = true;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "wheel") == 0)
|
else if(strcmp((acc_itr->Name).c_str(), "wheel") == 0)
|
||||||
wheel=1;
|
wheel = true;
|
||||||
else if (strcmp((acc_itr->Name).c_str(), "udraw") == 0)
|
else if(strcmp((acc_itr->Name).c_str(), "udraw") == 0)
|
||||||
udraw = 1;
|
udraw = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
u8 max_controls = ARRAY_SIZE(m_gameinfoLblControls);
|
u8 max_controls = ARRAY_SIZE(m_gameinfoLblControls);
|
||||||
|
|
||||||
if(classiccontroller && x < max_controls)
|
if(classiccontroller && x < max_controls)
|
||||||
{
|
{
|
||||||
m_controls[x].fromPNG(classiccontroller_png);
|
m_controls[x].fromPNG(classiccontroller_png);
|
||||||
@ -675,12 +685,10 @@ void CMenu::_textGameInfo(void)
|
|||||||
m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
|
m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
|
|
||||||
cnt_controls = x;
|
cnt_controls = x;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_btnMgr.setText(m_gameinfoLblTitle, wfmt(_fmt("gameinfo6",L"No Gameinfo"), true));
|
m_btnMgr.setText(m_gameinfoLblTitle, wfmt(_fmt("gameinfo6",L"No Gameinfo"), true));
|
||||||
|
|
||||||
gametdb.CloseFile();
|
gametdb.CloseFile();
|
||||||
|
}
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user