2010-10-28 11:00:52 +02:00
|
|
|
#include <string.h>
|
|
|
|
#include "GameTitles.h"
|
2010-12-03 19:38:57 +01:00
|
|
|
#include "CSettings.h"
|
|
|
|
#include "usbloader/GameList.h"
|
*Completely rewrote the asynchron GuiImageData class (problems from switch Carousel<->Grid layour should be fixed now)
*Fixed bug mounting a wbfs partition which was formatted from an ext partition
*Rewrote the parental control feature. Removed loading pin or settings from the Wii Settings. Parental control is now completely managed in the loader from the settings selected and the password set.
*Saving password in config file is now encrypted
*Added loop to wait for usb when reloading the cIOS before game start
The parental control feature is filtering games like following when usb loader is locked:
level 0 (everyone 0+) > shows only games with lvl 0
level 1 (childs 7+) > shows games with lvl 0, 1
level 2 (teens 12+) > shows games with lvl 0, 1, 2
level 3 (mature 16+) > shows games with lvl 0, 1, 2, 3
level 4 (adults only 18+) > shows all games (lvl 0, 1, 2, 3, 4)
level 4 is default when creating new configs
2010-12-19 19:20:33 +01:00
|
|
|
#include "xml/xml.h"
|
2010-12-03 19:38:57 +01:00
|
|
|
#include "xml/WiiTDB.hpp"
|
2010-10-28 11:00:52 +02:00
|
|
|
|
|
|
|
CGameTitles GameTitles;
|
|
|
|
|
|
|
|
void CGameTitles::SetGameTitle(const char * id, const char * title)
|
|
|
|
{
|
|
|
|
if(!id || !title)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for(u32 i = 0; i < TitleList.size(); ++i)
|
|
|
|
{
|
|
|
|
if(strncasecmp(id, TitleList[i].GameID, 6) == 0)
|
|
|
|
{
|
|
|
|
TitleList[i].Title = title;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GameTitle newTitle;
|
|
|
|
newTitle.Title = title;
|
|
|
|
|
|
|
|
//! Just in case a 0 termination is missing
|
|
|
|
int n;
|
|
|
|
for(n = 0; n < 6; ++n)
|
|
|
|
newTitle.GameID[n] = id[n];
|
|
|
|
|
|
|
|
newTitle.GameID[n] = '\0';
|
|
|
|
|
|
|
|
TitleList.push_back(newTitle);
|
|
|
|
}
|
|
|
|
|
2011-01-13 20:05:31 +01:00
|
|
|
const char * CGameTitles::GetTitle(const char * id) const
|
2010-10-28 11:00:52 +02:00
|
|
|
{
|
|
|
|
if(!id)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for(u32 i = 0; i < TitleList.size(); ++i)
|
|
|
|
{
|
|
|
|
if(strncasecmp(id, TitleList[i].GameID, 6) == 0)
|
|
|
|
return TitleList[i].Title.c_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-01-13 20:05:31 +01:00
|
|
|
const char * CGameTitles::GetTitle(const struct discHdr *header) const
|
2010-10-28 11:00:52 +02:00
|
|
|
{
|
|
|
|
if(!header)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for(u32 i = 0; i < TitleList.size(); ++i)
|
|
|
|
{
|
|
|
|
if(strncasecmp((const char *) header->id, TitleList[i].GameID, 6) == 0)
|
|
|
|
return TitleList[i].Title.c_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
return header->title;
|
|
|
|
}
|
|
|
|
|
2011-01-13 20:05:31 +01:00
|
|
|
int CGameTitles::GetParentalRating(const char * id) const
|
*Completely rewrote the asynchron GuiImageData class (problems from switch Carousel<->Grid layour should be fixed now)
*Fixed bug mounting a wbfs partition which was formatted from an ext partition
*Rewrote the parental control feature. Removed loading pin or settings from the Wii Settings. Parental control is now completely managed in the loader from the settings selected and the password set.
*Saving password in config file is now encrypted
*Added loop to wait for usb when reloading the cIOS before game start
The parental control feature is filtering games like following when usb loader is locked:
level 0 (everyone 0+) > shows only games with lvl 0
level 1 (childs 7+) > shows games with lvl 0, 1
level 2 (teens 12+) > shows games with lvl 0, 1, 2
level 3 (mature 16+) > shows games with lvl 0, 1, 2, 3
level 4 (adults only 18+) > shows all games (lvl 0, 1, 2, 3, 4)
level 4 is default when creating new configs
2010-12-19 19:20:33 +01:00
|
|
|
{
|
|
|
|
if(!id)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
for(u32 i = 0; i < TitleList.size(); ++i)
|
|
|
|
{
|
|
|
|
if(strncasecmp(id, TitleList[i].GameID, 6) == 0)
|
|
|
|
return TitleList[i].ParentalRating;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-10-28 11:00:52 +02:00
|
|
|
void CGameTitles::SetDefault()
|
|
|
|
{
|
|
|
|
TitleList.clear();
|
|
|
|
//! Free vector memory
|
|
|
|
std::vector<GameTitle>().swap(TitleList);
|
|
|
|
}
|
2010-12-03 19:38:57 +01:00
|
|
|
|
|
|
|
void CGameTitles::LoadTitlesFromWiiTDB(const char * path)
|
|
|
|
{
|
|
|
|
this->SetDefault();
|
|
|
|
|
|
|
|
if(!path || !Settings.titlesOverride)
|
|
|
|
return;
|
|
|
|
|
|
|
|
gameList.LoadUnfiltered();
|
|
|
|
|
|
|
|
std::string Title;
|
|
|
|
std::string Filepath = path;
|
|
|
|
if(path[strlen(path)-1] != '/')
|
|
|
|
Filepath += '/';
|
|
|
|
Filepath += "wiitdb.xml";
|
|
|
|
|
|
|
|
WiiTDB XML_DB(Filepath.c_str());
|
|
|
|
XML_DB.SetLanguageCode(Settings.db_language);
|
*Completely rewrote the asynchron GuiImageData class (problems from switch Carousel<->Grid layour should be fixed now)
*Fixed bug mounting a wbfs partition which was formatted from an ext partition
*Rewrote the parental control feature. Removed loading pin or settings from the Wii Settings. Parental control is now completely managed in the loader from the settings selected and the password set.
*Saving password in config file is now encrypted
*Added loop to wait for usb when reloading the cIOS before game start
The parental control feature is filtering games like following when usb loader is locked:
level 0 (everyone 0+) > shows only games with lvl 0
level 1 (childs 7+) > shows games with lvl 0, 1
level 2 (teens 12+) > shows games with lvl 0, 1, 2
level 3 (mature 16+) > shows games with lvl 0, 1, 2, 3
level 4 (adults only 18+) > shows all games (lvl 0, 1, 2, 3, 4)
level 4 is default when creating new configs
2010-12-19 19:20:33 +01:00
|
|
|
int Rating;
|
|
|
|
std::string RatValTxt;
|
2010-12-03 19:38:57 +01:00
|
|
|
|
|
|
|
for(int i = 0; i < gameList.GameCount(); ++i)
|
|
|
|
{
|
*Completely rewrote the asynchron GuiImageData class (problems from switch Carousel<->Grid layour should be fixed now)
*Fixed bug mounting a wbfs partition which was formatted from an ext partition
*Rewrote the parental control feature. Removed loading pin or settings from the Wii Settings. Parental control is now completely managed in the loader from the settings selected and the password set.
*Saving password in config file is now encrypted
*Added loop to wait for usb when reloading the cIOS before game start
The parental control feature is filtering games like following when usb loader is locked:
level 0 (everyone 0+) > shows only games with lvl 0
level 1 (childs 7+) > shows games with lvl 0, 1
level 2 (teens 12+) > shows games with lvl 0, 1, 2
level 3 (mature 16+) > shows games with lvl 0, 1, 2, 3
level 4 (adults only 18+) > shows all games (lvl 0, 1, 2, 3, 4)
level 4 is default when creating new configs
2010-12-19 19:20:33 +01:00
|
|
|
if(!XML_DB.GetTitle((const char *) gameList[i]->id, Title))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
this->SetGameTitle(gameList[i]->id, Title.c_str());
|
|
|
|
|
|
|
|
TitleList[TitleList.size()-1].ParentalRating = -1;
|
|
|
|
|
|
|
|
Rating = XML_DB.GetRating((const char *) gameList[i]->id);
|
|
|
|
if(Rating < 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if(!XML_DB.GetRatingValue((const char *) gameList[i]->id, RatValTxt))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
TitleList[TitleList.size()-1].ParentalRating = ConvertRating(RatValTxt.c_str(), WiiTDB::RatingToString(Rating), "PEGI");
|
2010-12-03 19:38:57 +01:00
|
|
|
}
|
|
|
|
}
|