Fixes for GCC 11

This commit is contained in:
wiidev 2021-08-01 18:00:15 +01:00
parent d79ce271aa
commit 0ac4d8249c
41 changed files with 287 additions and 265 deletions

View File

@ -39,6 +39,12 @@
#include "cache/cache.hpp" #include "cache/cache.hpp"
#include "channels.h" #include "channels.h"
/* GCC 11 false positives */
#if __GNUC__ > 10
#pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif
typedef struct _dolheader typedef struct _dolheader
{ {
u32 section_pos[18]; u32 section_pos[18];
@ -126,7 +132,7 @@ void Channels::InternalGetNandChannelList(u32 type)
} }
} }
vector<struct discHdr> &Channels::GetNandHeaders(void) std::vector<struct discHdr> &Channels::GetNandHeaders(void)
{ {
if (NandChannels.empty()) if (NandChannels.empty())
this->GetChannelList(); this->GetChannelList();
@ -134,7 +140,7 @@ vector<struct discHdr> &Channels::GetNandHeaders(void)
return NandChannels; return NandChannels;
} }
vector<struct discHdr> &Channels::GetEmuHeaders(void) std::vector<struct discHdr> &Channels::GetEmuHeaders(void)
{ {
if (Settings.UseGameHeaderCache && isCacheFile(EMUNAND_HEADER_CACHE_FILE)) if (Settings.UseGameHeaderCache && isCacheFile(EMUNAND_HEADER_CACHE_FILE))
{ {

View File

@ -30,8 +30,6 @@
#include <gccore.h> #include <gccore.h>
#include "usbloader/disc.h" #include "usbloader/disc.h"
using namespace std;
class Channels class Channels
{ {
public: public:
@ -46,8 +44,8 @@ public:
void GetChannelList(); void GetChannelList();
void GetEmuChannelList(); void GetEmuChannelList();
vector<struct discHdr> & GetNandHeaders(void); std::vector<struct discHdr> & GetNandHeaders(void);
vector<struct discHdr> & GetEmuHeaders(void); std::vector<struct discHdr> & GetEmuHeaders(void);
private: private:
static Channels *instance; static Channels *instance;
@ -58,8 +56,8 @@ private:
bool ParseTitleDir(char *path, int language); bool ParseTitleDir(char *path, int language);
bool GetEmuChanTitle(char *tmdpath, int language, std::string &Title); bool GetEmuChanTitle(char *tmdpath, int language, std::string &Title);
vector<struct discHdr> NandChannels; std::vector<struct discHdr> NandChannels;
vector<struct discHdr> EmuChannels; std::vector<struct discHdr> EmuChannels;
}; };
#endif #endif

View File

@ -81,7 +81,7 @@ void GuiCheckboxBrowser::Clear()
checkBoxList.clear(); checkBoxList.clear();
} }
bool GuiCheckboxBrowser::AddEntrie(const string &text, bool checked, int style, bool multistates) bool GuiCheckboxBrowser::AddEntrie(const std::string &text, bool checked, int style, bool multistates)
{ {
LOCK(this); LOCK(this);
int currentSize = checkBoxList.size(); int currentSize = checkBoxList.size();

View File

@ -29,14 +29,12 @@
#include "gui_checkbox.hpp" #include "gui_checkbox.hpp"
#include "gui_scrollbar.hpp" #include "gui_scrollbar.hpp"
using namespace std;
class GuiCheckboxBrowser : public GuiElement, public sigslot::has_slots<> class GuiCheckboxBrowser : public GuiElement, public sigslot::has_slots<>
{ {
public: public:
GuiCheckboxBrowser(int w, int h, int maxSize = 7); GuiCheckboxBrowser(int w, int h, int maxSize = 7);
virtual ~GuiCheckboxBrowser(); virtual ~GuiCheckboxBrowser();
bool AddEntrie(const string &text, bool checked = false, int style = GuiCheckbox::CHECKSIGN, bool multistates = false); bool AddEntrie(const std::string &text, bool checked = false, int style = GuiCheckbox::CHECKSIGN, bool multistates = false);
int GetSelected() const { return pageIndex+selectedItem; } int GetSelected() const { return pageIndex+selectedItem; }
bool IsChecked(u32 i) { if(i >= checkBoxList.size()) return false; else return checkBoxList[i]->IsChecked(); } bool IsChecked(u32 i) { if(i >= checkBoxList.size()) return false; else return checkBoxList[i]->IsChecked(); }
GuiCheckbox *GetCheckbox(u32 i) { if(i >= checkBoxList.size()) return NULL; else return checkBoxList[i]; } GuiCheckbox *GetCheckbox(u32 i) { if(i >= checkBoxList.size()) return NULL; else return checkBoxList[i]; }
@ -62,10 +60,10 @@ class GuiCheckboxBrowser : public GuiElement, public sigslot::has_slots<>
GuiImage *backgroundImg; GuiImage *backgroundImg;
GuiImageData *markImgData; GuiImageData *markImgData;
GuiImage *markImg; GuiImage *markImg;
vector<GuiText *> textLineDrawn; std::vector<GuiText *> textLineDrawn;
vector<GuiCheckbox *> checkBoxDrawn; std::vector<GuiCheckbox *> checkBoxDrawn;
vector<GuiText *> textLineList; std::vector<GuiText *> textLineList;
vector<GuiCheckbox *> checkBoxList; std::vector<GuiCheckbox *> checkBoxList;
}; };
#endif #endif

View File

@ -30,8 +30,6 @@
#include <gctypes.h> #include <gctypes.h>
#include <vector> #include <vector>
using namespace std;
class GCDumper class GCDumper
{ {
public: public:
@ -42,14 +40,14 @@ public:
int ReadDiscInfo(const u64 &game_offset); int ReadDiscInfo(const u64 &game_offset);
void SetForceAlign(bool b) { force_align32 = b; } void SetForceAlign(bool b) { force_align32 = b; }
void SetCompressed(bool b) { compressed = b; } void SetCompressed(bool b) { compressed = b; }
vector<struct discHdr> & GetDiscHeaders() { return discHeaders; } std::vector<struct discHdr> & GetDiscHeaders() { return discHeaders; }
vector<u32> & GetDiscSizes() { return gameSizes; } std::vector<u32> & GetDiscSizes() { return gameSizes; }
private: private:
s32 CopyDiscData(FILE *f, u64 offset, u32 length, u8 *buffer); s32 CopyDiscData(FILE *f, u64 offset, u32 length, u8 *buffer);
vector<struct discHdr> discHeaders; std::vector<struct discHdr> discHeaders;
vector<u32> gameSizes; std::vector<u32> gameSizes;
vector<u64> gameOffsets; std::vector<u64> gameOffsets;
bool force_align32; bool force_align32;
bool compressed; bool compressed;
u32 discWrote; u32 discWrote;

View File

@ -58,7 +58,7 @@ const char *GCGames::GetPath(const char *gameID) const
return ""; return "";
} }
void GCGames::LoadGameList(const string &path, vector<struct discHdr> &headerList, vector<string> &pathList) void GCGames::LoadGameList(const std::string &path, std::vector<struct discHdr> &headerList, std::vector<std::string> &pathList)
{ {
struct discHdr tmpHdr; struct discHdr tmpHdr;
struct stat st; struct stat st;
@ -183,7 +183,7 @@ void GCGames::LoadGameList(const string &path, vector<struct discHdr> &headerLis
if (*id != 0 && strlen(title) > 0) if (*id != 0 && strlen(title) > 0)
{ {
string gamePath = string(path) + dirname + (extracted ? "/" : strrchr(fpath, '/')); std::string gamePath = std::string(path) + dirname + (extracted ? "/" : strrchr(fpath, '/'));
memset(&tmpHdr, 0, sizeof(tmpHdr)); memset(&tmpHdr, 0, sizeof(tmpHdr));
memcpy(tmpHdr.id, id, sizeof(tmpHdr.id)); memcpy(tmpHdr.id, id, sizeof(tmpHdr.id));
snprintf(tmpHdr.title, sizeof(tmpHdr.title), "%s", title); snprintf(tmpHdr.title, sizeof(tmpHdr.title), "%s", title);
@ -206,7 +206,7 @@ void GCGames::LoadGameList(const string &path, vector<struct discHdr> &headerLis
if (tmpHdr.gc_magic == GCGames::MAGIC) if (tmpHdr.gc_magic == GCGames::MAGIC)
{ {
string gamePath = string(path) + dirname + (extracted ? "/" : strrchr(fpath, '/')); std::string gamePath = std::string(path) + dirname + (extracted ? "/" : strrchr(fpath, '/'));
tmpHdr.magic = tmpHdr.gc_magic; tmpHdr.magic = tmpHdr.gc_magic;
tmpHdr.type = extracted ? TYPE_GAME_GC_EXTRACTED : TYPE_GAME_GC_IMG; tmpHdr.type = extracted ? TYPE_GAME_GC_EXTRACTED : TYPE_GAME_GC_IMG;
headerList.push_back(tmpHdr); headerList.push_back(tmpHdr);

View File

@ -26,8 +26,6 @@
int nintendontBuildDate(const char *NIN_loader_path, char* NINBuildDate); int nintendontBuildDate(const char *NIN_loader_path, char* NINBuildDate);
int nintendontVersion(const char *NIN_loader_path, char* NINVersion, int len); int nintendontVersion(const char *NIN_loader_path, char* NINVersion, int len);
using namespace std;
class GCGames class GCGames
{ {
public: public:
@ -40,7 +38,7 @@ public:
u32 LoadAllGames(void); u32 LoadAllGames(void);
void LoadGameList(const string &path, vector<struct discHdr> &headerList, vector<string> &pathList); void LoadGameList(const std::string &path, std::vector<struct discHdr> &headerList, std::vector<std::string> &pathList);
bool RemoveGame(const char *gameID); bool RemoveGame(const char *gameID);
bool RemoveSDGame(const char *gameID); bool RemoveSDGame(const char *gameID);
@ -48,14 +46,14 @@ public:
const char *GetPath(const char *gameID) const; const char *GetPath(const char *gameID) const;
vector<struct discHdr> & GetHeaders(void) std::vector<struct discHdr> & GetHeaders(void)
{ {
LoadAllGames(); LoadAllGames();
return HeaderList; return HeaderList;
} }
vector<struct discHdr> & GetSDHeaders(void) { std::vector<struct discHdr> & GetSDHeaders(void) {
return sdGCList; return sdGCList;
} }
@ -65,10 +63,10 @@ private:
static GCGames *instance; static GCGames *instance;
vector<string> PathList; std::vector<std::string> PathList;
vector<struct discHdr> HeaderList; std::vector<struct discHdr> HeaderList;
vector<struct discHdr> sdGCList; std::vector<struct discHdr> sdGCList;
vector<string> sdGCPathList; std::vector<std::string> sdGCPathList;
}; };
#endif #endif

View File

@ -28,8 +28,8 @@ distribution.
#include "OpeningBNR.hpp" #include "OpeningBNR.hpp"
#include "BannerAsync.h" #include "BannerAsync.h"
vector<BannerAsync *> BannerAsync::List; std::vector<BannerAsync *> BannerAsync::List;
queue<BannerAsync *> BannerAsync::DeleteList; std::queue<BannerAsync *> BannerAsync::DeleteList;
lwp_t BannerAsync::Thread = LWP_THREAD_NULL; lwp_t BannerAsync::Thread = LWP_THREAD_NULL;
mutex_t BannerAsync::ListLock = LWP_THREAD_NULL; mutex_t BannerAsync::ListLock = LWP_THREAD_NULL;
BannerAsync * BannerAsync::InUse = NULL; BannerAsync * BannerAsync::InUse = NULL;

View File

@ -29,8 +29,6 @@ distribution.
#include "usbloader/GameList.h" #include "usbloader/GameList.h"
#include "Banner.h" #include "Banner.h"
using namespace std;
class BannerAsync : public Banner class BannerAsync : public Banner
{ {
public: public:
@ -52,8 +50,8 @@ private:
static void ThreadAdd(BannerAsync* banner); static void ThreadAdd(BannerAsync* banner);
static void ThreadRemove(BannerAsync* banner); static void ThreadRemove(BannerAsync* banner);
static vector<BannerAsync *> List; static std::vector<BannerAsync *> List;
static queue<BannerAsync *> DeleteList; static std::queue<BannerAsync *> DeleteList;
static lwp_t Thread; static lwp_t Thread;
static mutex_t ListLock; static mutex_t ListLock;
static BannerAsync * InUse; static BannerAsync * InUse;

View File

@ -20,8 +20,6 @@
#include <vector> #include <vector>
#include "Banner.h" #include "Banner.h"
using namespace std;
class CustomBanner : public Banner class CustomBanner : public Banner
{ {
public: public:
@ -37,7 +35,7 @@ public:
void SetBannerPaneVisible(const char *pane, bool visible); void SetBannerPaneVisible(const char *pane, bool visible);
private: private:
u8 *LoadTextureFromPng(const u8 * img, u32 imgSize, int *width, int *height); u8 *LoadTextureFromPng(const u8 * img, u32 imgSize, int *width, int *height);
vector<u16 *> text_list; std::vector<u16 *> text_list;
}; };
#endif /*CUSTOM_BANNER_H_*/ #endif /*CUSTOM_BANNER_H_*/

View File

@ -330,7 +330,7 @@ u8 *OpeningBNR::LoadGCBNR(const discHdr * header, u32 *len)
} }
else if(header->type == TYPE_GAME_GC_EXTRACTED) else if(header->type == TYPE_GAME_GC_EXTRACTED)
{ {
string gamePath = path; std::string gamePath = path;
gamePath += "root/"; gamePath += "root/";
//! open default file first //! open default file first
file = fopen((gamePath + "opening.bnr").c_str(), "rb"); file = fopen((gamePath + "opening.bnr").c_str(), "rb");
@ -446,7 +446,7 @@ CustomBanner *OpeningBNR::CreateGCBanner(const discHdr * header)
// sets the description and converts encodings (Japan and Taiwan) // sets the description and converts encodings (Japan and Taiwan)
if(header->id[3] == 'J' || header->id[3] == 'W') if(header->id[3] == 'J' || header->id[3] == 'W')
{ {
string description((char *) openingBnr->description[language].long_description); std::string description((char *) openingBnr->description[language].long_description);
banner->SetBannerText("T_short_descript", sj2utf8(description).c_str()); banner->SetBannerText("T_short_descript", sj2utf8(description).c_str());
} }
else else

View File

@ -21,9 +21,9 @@ void ResetGameHeaderCache()
} }
// emuNAND // emuNAND
void SaveGameHeaderCache(vector<struct discHdr> &list) void SaveGameHeaderCache(std::vector<struct discHdr> &list)
{ {
string path = string(Settings.GameHeaderCachePath) + EMUNAND_HEADER_CACHE_FILE; std::string path = std::string(Settings.GameHeaderCachePath) + EMUNAND_HEADER_CACHE_FILE;
if (!CheckFile(Settings.GameHeaderCachePath)) if (!CheckFile(Settings.GameHeaderCachePath))
CreateSubfolder(Settings.GameHeaderCachePath); CreateSubfolder(Settings.GameHeaderCachePath);
@ -38,9 +38,9 @@ void SaveGameHeaderCache(vector<struct discHdr> &list)
fclose(cache); fclose(cache);
} }
void LoadGameHeaderCache(vector<struct discHdr> &list) void LoadGameHeaderCache(std::vector<struct discHdr> &list)
{ {
string path = string(Settings.GameHeaderCachePath) + EMUNAND_HEADER_CACHE_FILE; std::string path = std::string(Settings.GameHeaderCachePath) + EMUNAND_HEADER_CACHE_FILE;
FILE *cache = fopen(path.c_str(), "rb"); FILE *cache = fopen(path.c_str(), "rb");
@ -66,9 +66,9 @@ void LoadGameHeaderCache(vector<struct discHdr> &list)
} }
// Wii // Wii
void SaveGameHeaderCache(vector<struct discHdr> &list, vector<int> &plist) void SaveGameHeaderCache(std::vector<struct discHdr> &list, std::vector<int> &plist)
{ {
vector<struct wiiCache> wiictmp; std::vector<struct wiiCache> wiictmp;
struct wiiCache gtmp; struct wiiCache gtmp;
for (u32 i = 0; i < list.size(); ++i) for (u32 i = 0; i < list.size(); ++i)
@ -79,7 +79,7 @@ void SaveGameHeaderCache(vector<struct discHdr> &list, vector<int> &plist)
wiictmp.push_back(gtmp); wiictmp.push_back(gtmp);
} }
string path = string(Settings.GameHeaderCachePath) + WII_HEADER_CACHE_FILE; std::string path = std::string(Settings.GameHeaderCachePath) + WII_HEADER_CACHE_FILE;
if (!CheckFile(Settings.GameHeaderCachePath)) if (!CheckFile(Settings.GameHeaderCachePath))
CreateSubfolder(Settings.GameHeaderCachePath); CreateSubfolder(Settings.GameHeaderCachePath);
@ -94,9 +94,9 @@ void SaveGameHeaderCache(vector<struct discHdr> &list, vector<int> &plist)
fclose(cache); fclose(cache);
} }
void LoadGameHeaderCache(vector<struct discHdr> &list, vector<int> &plist) void LoadGameHeaderCache(std::vector<struct discHdr> &list, std::vector<int> &plist)
{ {
string path = string(Settings.GameHeaderCachePath) + WII_HEADER_CACHE_FILE; std::string path = std::string(Settings.GameHeaderCachePath) + WII_HEADER_CACHE_FILE;
FILE *cache = fopen(path.c_str(), "rb"); FILE *cache = fopen(path.c_str(), "rb");
@ -124,9 +124,9 @@ void LoadGameHeaderCache(vector<struct discHdr> &list, vector<int> &plist)
} }
// GameCube // GameCube
void SaveGameHeaderCache(vector<struct discHdr> &list, vector<string> &plist) void SaveGameHeaderCache(std::vector<struct discHdr> &list, std::vector<std::string> &plist)
{ {
vector<struct gcCache> gcctmp; std::vector<struct gcCache> gcctmp;
struct gcCache gtmp; struct gcCache gtmp;
for (u32 i = 0; i < list.size(); ++i) for (u32 i = 0; i < list.size(); ++i)
@ -139,7 +139,7 @@ void SaveGameHeaderCache(vector<struct discHdr> &list, vector<string> &plist)
gcctmp.push_back(gtmp); gcctmp.push_back(gtmp);
} }
string path = string(Settings.GameHeaderCachePath) + GAMECUBE_HEADER_CACHE_FILE; std::string path = std::string(Settings.GameHeaderCachePath) + GAMECUBE_HEADER_CACHE_FILE;
if (!CheckFile(Settings.GameHeaderCachePath)) if (!CheckFile(Settings.GameHeaderCachePath))
CreateSubfolder(Settings.GameHeaderCachePath); CreateSubfolder(Settings.GameHeaderCachePath);
@ -154,9 +154,9 @@ void SaveGameHeaderCache(vector<struct discHdr> &list, vector<string> &plist)
fclose(cache); fclose(cache);
} }
void LoadGameHeaderCache(vector<struct discHdr> &list, vector<string> &plist) void LoadGameHeaderCache(std::vector<struct discHdr> &list, std::vector<std::string> &plist)
{ {
string path = string(Settings.GameHeaderCachePath) + GAMECUBE_HEADER_CACHE_FILE; std::string path = std::string(Settings.GameHeaderCachePath) + GAMECUBE_HEADER_CACHE_FILE;
FILE *cache = fopen(path.c_str(), "rb"); FILE *cache = fopen(path.c_str(), "rb");
@ -178,15 +178,15 @@ void LoadGameHeaderCache(vector<struct discHdr> &list, vector<string> &plist)
fread((void *)&gcctmp, 1, sizeof(struct gcCache), cache); fread((void *)&gcctmp, 1, sizeof(struct gcCache), cache);
list.push_back(gcctmp.header); list.push_back(gcctmp.header);
string tmp((char *)gcctmp.path); std::string tmp((char *)gcctmp.path);
plist.push_back(tmp); plist.push_back(tmp);
} }
fclose(cache); fclose(cache);
} }
void SaveFilteredListCache(vector<struct discHdr *> &list, const wchar_t *gameFilter) void SaveFilteredListCache(std::vector<struct discHdr *> &list, const wchar_t *gameFilter)
{ {
string path = string(Settings.GameHeaderCachePath) + FilteredListCacheFileName(gameFilter); std::string path = std::string(Settings.GameHeaderCachePath) + FilteredListCacheFileName(gameFilter);
if (!CheckFile(Settings.GameHeaderCachePath)) if (!CheckFile(Settings.GameHeaderCachePath))
CreateSubfolder(Settings.GameHeaderCachePath); CreateSubfolder(Settings.GameHeaderCachePath);
@ -196,7 +196,7 @@ void SaveFilteredListCache(vector<struct discHdr *> &list, const wchar_t *gameFi
if (!cache) if (!cache)
return; return;
vector<struct gameHdr> tmplist; std::vector<struct gameHdr> tmplist;
struct gameHdr tmp; struct gameHdr tmp;
for (u32 i = 0; i < list.size(); ++i) for (u32 i = 0; i < list.size(); ++i)
@ -209,9 +209,9 @@ void SaveFilteredListCache(vector<struct discHdr *> &list, const wchar_t *gameFi
fclose(cache); fclose(cache);
} }
void LoadFilteredListCache(vector<struct discHdr *> &list, const wchar_t *gameFilter) void LoadFilteredListCache(std::vector<struct discHdr *> &list, const wchar_t *gameFilter)
{ {
string path = string(Settings.GameHeaderCachePath) + FilteredListCacheFileName(gameFilter); std::string path = std::string(Settings.GameHeaderCachePath) + FilteredListCacheFileName(gameFilter);
if (!CheckFile(Settings.GameHeaderCachePath)) if (!CheckFile(Settings.GameHeaderCachePath))
CreateSubfolder(Settings.GameHeaderCachePath); CreateSubfolder(Settings.GameHeaderCachePath);
@ -238,7 +238,7 @@ void LoadFilteredListCache(vector<struct discHdr *> &list, const wchar_t *gameFi
if (!found) if (!found)
{ {
vector<struct discHdr> &tmplist = gameList.GetFullGameList(); std::vector<struct discHdr> &tmplist = gameList.GetFullGameList();
for (u32 c = 0; c < tmplist.size(); ++c) for (u32 c = 0; c < tmplist.size(); ++c)
{ {
struct discHdr *header = &tmplist[c]; struct discHdr *header = &tmplist[c];
@ -253,7 +253,7 @@ void LoadFilteredListCache(vector<struct discHdr *> &list, const wchar_t *gameFi
if (!found) if (!found)
{ {
vector<struct discHdr> &tmplist = GCGames::Instance()->GetHeaders(); std::vector<struct discHdr> &tmplist = GCGames::Instance()->GetHeaders();
for (u32 c = 0; c < tmplist.size(); ++c) for (u32 c = 0; c < tmplist.size(); ++c)
{ {
struct discHdr *header = &tmplist[c]; struct discHdr *header = &tmplist[c];
@ -268,7 +268,7 @@ void LoadFilteredListCache(vector<struct discHdr *> &list, const wchar_t *gameFi
if (!found) if (!found)
{ {
vector<struct discHdr> &tmplist = Channels::Instance()->GetNandHeaders(); std::vector<struct discHdr> &tmplist = Channels::Instance()->GetNandHeaders();
for (u32 c = 0; c < tmplist.size(); ++c) for (u32 c = 0; c < tmplist.size(); ++c)
{ {
struct discHdr *header = &tmplist[c]; struct discHdr *header = &tmplist[c];
@ -283,7 +283,7 @@ void LoadFilteredListCache(vector<struct discHdr *> &list, const wchar_t *gameFi
if (!found) if (!found)
{ {
vector<struct discHdr> &tmplist = Channels::Instance()->GetEmuHeaders(); std::vector<struct discHdr> &tmplist = Channels::Instance()->GetEmuHeaders();
for (u32 c = 0; c < tmplist.size(); ++c) for (u32 c = 0; c < tmplist.size(); ++c)
{ {
struct discHdr *header = &tmplist[c]; struct discHdr *header = &tmplist[c];
@ -300,16 +300,16 @@ void LoadFilteredListCache(vector<struct discHdr *> &list, const wchar_t *gameFi
fclose(cache); fclose(cache);
} }
string FilteredListCacheFileName(const wchar_t *gameFilter) std::string FilteredListCacheFileName(const wchar_t *gameFilter)
{ {
string tmp; std::string tmp;
tmp = "FL"; tmp = "FL";
tmp += "_" + to_string(Settings.LoaderMode); tmp += "_" + std::to_string(Settings.LoaderMode);
tmp += "_" + to_string(Settings.GameSort); tmp += "_" + std::to_string(Settings.GameSort);
if (gameFilter) if (gameFilter)
{ {
wstring ws(gameFilter); std::wstring ws(gameFilter);
string gf(ws.begin(), ws.end()); std::string gf(ws.begin(), ws.end());
if ((gf.length()) > 0) if ((gf.length()) > 0)
tmp += "_" + gf; tmp += "_" + gf;
} }
@ -317,19 +317,19 @@ string FilteredListCacheFileName(const wchar_t *gameFilter)
return tmp; return tmp;
} }
string FilteredListCacheFileName() std::string FilteredListCacheFileName()
{ {
string tmp; std::string tmp;
tmp = "FL"; tmp = "FL";
tmp += "_" + to_string(Settings.LoaderMode); tmp += "_" + std::to_string(Settings.LoaderMode);
tmp += "_" + to_string(Settings.GameSort); tmp += "_" + std::to_string(Settings.GameSort);
tmp += ".cache"; tmp += ".cache";
return tmp; return tmp;
} }
bool isCacheFile(string filename) bool isCacheFile(std::string filename)
{ {
string path = string(Settings.GameHeaderCachePath) + filename; std::string path = std::string(Settings.GameHeaderCachePath) + filename;
if (CheckFile(path.c_str())) if (CheckFile(path.c_str()))
return true; return true;

View File

@ -9,8 +9,6 @@
#define GAMECUBE_HEADER_CACHE_FILE "GAMECUBE.cache" #define GAMECUBE_HEADER_CACHE_FILE "GAMECUBE.cache"
#define EMUNAND_HEADER_CACHE_FILE "EMUNAND.cache" #define EMUNAND_HEADER_CACHE_FILE "EMUNAND.cache"
using namespace std;
struct gameHdr struct gameHdr
{ {
/* Game ID */ /* Game ID */
@ -33,22 +31,22 @@ struct gcCache
}; };
// emuNAND // emuNAND
void SaveGameHeaderCache(vector<struct discHdr> &list); void SaveGameHeaderCache(std::vector<struct discHdr> &list);
void LoadGameHeaderCache(vector<struct discHdr> &list); void LoadGameHeaderCache(std::vector<struct discHdr> &list);
// Wii // Wii
void SaveGameHeaderCache(vector<struct discHdr> &list, vector<int> &plist); void SaveGameHeaderCache(std::vector<struct discHdr> &list, std::vector<int> &plist);
void LoadGameHeaderCache(vector<struct discHdr> &list, vector<int> &plist); void LoadGameHeaderCache(std::vector<struct discHdr> &list, std::vector<int> &plist);
// GameCube // GameCube
void SaveGameHeaderCache(vector<struct discHdr> &list, vector<string> &plist); void SaveGameHeaderCache(std::vector<struct discHdr> &list, std::vector<std::string> &plist);
void LoadGameHeaderCache(vector<struct discHdr> &list, vector<string> &plist); void LoadGameHeaderCache(std::vector<struct discHdr> &list, std::vector<std::string> &plist);
void ResetGameHeaderCache(); void ResetGameHeaderCache();
void SaveFilteredListCache(vector<struct discHdr *> &list, const wchar_t *gameFilter); void SaveFilteredListCache(std::vector<struct discHdr *> &list, const wchar_t *gameFilter);
void LoadFilteredListCache(vector<struct discHdr *> &list, const wchar_t *gameFilter); void LoadFilteredListCache(std::vector<struct discHdr *> &list, const wchar_t *gameFilter);
string FilteredListCacheFileName(const wchar_t *gameFilter); std::string FilteredListCacheFileName(const wchar_t *gameFilter);
string FilteredListCacheFileName(); std::string FilteredListCacheFileName();
bool isCacheFile(string filename); bool isCacheFile(std::string filename);

View File

@ -141,7 +141,7 @@ int CheatMenu(const char * gameID)
{ {
if (cntcheats > 0) if (cntcheats > 0)
{ {
vector<int> vActiveCheats; std::vector<int> vActiveCheats;
for (int i = 0; i < cntcheats; i++) for (int i = 0; i < cntcheats; i++)
{ {
const char *strCheck = cheatslst.GetName(i); const char *strCheck = cheatslst.GetName(i);

View File

@ -42,25 +42,25 @@ void GCTCheats::Clear(void)
} }
string GCTCheats::getGameName(void) std::string GCTCheats::getGameName(void)
{ {
return sGameTitle; return sGameTitle;
} }
string GCTCheats::getGameID(void) std::string GCTCheats::getGameID(void)
{ {
return sGameID; return sGameID;
} }
vector<unsigned int> GCTCheats::getCheat(int nr) std::vector<unsigned int> GCTCheats::getCheat(int nr)
{ {
if((unsigned int)nr >= cheatList.size()) if((unsigned int)nr >= cheatList.size())
return vector<unsigned int>(); return std::vector<unsigned int>();
return cheatList[nr].sCheats; return cheatList[nr].sCheats;
} }
string GCTCheats::getCheatName(int nr) std::string GCTCheats::getCheatName(int nr)
{ {
if((unsigned int)nr >= cheatList.size()) if((unsigned int)nr >= cheatList.size())
return ERRORRANGE; return ERRORRANGE;
@ -68,7 +68,7 @@ string GCTCheats::getCheatName(int nr)
return cheatList[nr].sCheatName; return cheatList[nr].sCheatName;
} }
string GCTCheats::getCheatComment(int nr) std::string GCTCheats::getCheatComment(int nr)
{ {
if((unsigned int)nr >= cheatList.size()) if((unsigned int)nr >= cheatList.size())
return ERRORRANGE; return ERRORRANGE;
@ -76,7 +76,7 @@ string GCTCheats::getCheatComment(int nr)
return cheatList[nr].sCheatComment; return cheatList[nr].sCheatComment;
} }
int GCTCheats::createGCT(const vector<int> &vCheats, const char * filename) int GCTCheats::createGCT(const std::vector<int> &vCheats, const char * filename)
{ {
if (vCheats.size() == 0 || !filename) if (vCheats.size() == 0 || !filename)
return 0; return 0;
@ -95,7 +95,7 @@ int GCTCheats::createGCT(const vector<int> &vCheats, const char * filename)
if((unsigned int)vCheats[c] >= cheatList.size()) if((unsigned int)vCheats[c] >= cheatList.size())
continue; continue;
vector<unsigned int> &cheatBuf = cheatList[vCheats[c]].sCheats; std::vector<unsigned int> &cheatBuf = cheatList[vCheats[c]].sCheats;
if(cheatBuf.size() > 0) if(cheatBuf.size() > 0)
fwrite((char*)&cheatBuf[0], cheatBuf.size() * sizeof(unsigned int), 1, pFile); fwrite((char*)&cheatBuf[0], cheatBuf.size() * sizeof(unsigned int), 1, pFile);
@ -223,7 +223,7 @@ bool GCTCheats::IsCheatIncluded(int iCheat, const unsigned char *gctBuf, unsigne
if(!gctBuf || (unsigned int)iCheat >= cheatList.size()) if(!gctBuf || (unsigned int)iCheat >= cheatList.size())
return false; return false;
vector<unsigned int> &Cheat = cheatList[iCheat].sCheats; std::vector<unsigned int> &Cheat = cheatList[iCheat].sCheats;
int len = Cheat.size() * sizeof(unsigned int); int len = Cheat.size() * sizeof(unsigned int);
for(unsigned int i = sizeof(GCT_Header); i + len <= gctSize - sizeof(GCT_Footer); i += 4) for(unsigned int i = sizeof(GCT_Header); i + len <= gctSize - sizeof(GCT_Footer); i += 4)

View File

@ -21,21 +21,19 @@
#include <string> #include <string>
#include <vector> #include <vector>
using namespace std;
//!Handles Ocarina TXT Cheatfiles //!Handles Ocarina TXT Cheatfiles
class GCTCheats class GCTCheats
{ {
private: private:
string sGameID; std::string sGameID;
string sGameTitle; std::string sGameTitle;
struct CheatEntry struct CheatEntry
{ {
string sCheatName; std::string sCheatName;
string sCheatComment; std::string sCheatComment;
vector<unsigned int> sCheats; std::vector<unsigned int> sCheats;
}; };
vector<CheatEntry> cheatList; std::vector<CheatEntry> cheatList;
public: public:
//!Constructor //!Constructor
GCTCheats(void); GCTCheats(void);
@ -50,25 +48,25 @@ class GCTCheats
//!\param cnt size of array //!\param cnt size of array
//!\param filename name of GCT file //!\param filename name of GCT file
//!\return error code //!\return error code
int createGCT(const vector<int> &vCheats, const char * filename); int createGCT(const std::vector<int> &vCheats, const char * filename);
//!Gets Count cheats //!Gets Count cheats
//!\return Count cheats //!\return Count cheats
int getCnt() const { return cheatList.size(); } int getCnt() const { return cheatList.size(); }
//!Gets Game Name //!Gets Game Name
//!\return Game Name //!\return Game Name
string getGameName(void); std::string getGameName(void);
//!Gets GameID //!Gets GameID
//!\return GameID //!\return GameID
string getGameID(void); std::string getGameID(void);
//!Gets cheat data //!Gets cheat data
//!\return cheat data //!\return cheat data
vector<unsigned int> getCheat(int nr); std::vector<unsigned int> getCheat(int nr);
//!Gets Cheat Name //!Gets Cheat Name
//!\return Cheat Name //!\return Cheat Name
string getCheatName(int nr); std::string getCheatName(int nr);
//!Gets Cheat Comment //!Gets Cheat Comment
//!\return Cheat Comment //!\return Cheat Comment
string getCheatComment(int nr); std::string getCheatComment(int nr);
//!Clear all loaded cheats //!Clear all loaded cheats
void Clear(void); void Clear(void);
//!Check if string is a code //!Check if string is a code

View File

@ -15,6 +15,12 @@
#include "sys.h" #include "sys.h"
#include "gecko.h" #include "gecko.h"
/* GCC 11 false positives */
#if __GNUC__ > 10
#pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif
#define EXECUTE_ADDR ((u8 *) 0x92000000) #define EXECUTE_ADDR ((u8 *) 0x92000000)
#define BOOTER_ADDR ((u8 *) 0x93000000) #define BOOTER_ADDR ((u8 *) 0x93000000)
#define ARGS_ADDR ((u8 *) 0x93200000) #define ARGS_ADDR ((u8 *) 0x93200000)

View File

@ -205,13 +205,13 @@ void WDMMenu::CheckGameFiles(const struct discHdr * header)
WBFS_CloseDisc(disc); WBFS_CloseDisc(disc);
int position = 0; int position = 0;
vector<pair<int, string> > FilesNotInWDM; std::vector<std::pair<int, std::string> > FilesNotInWDM;
for(int i = 0; i < wdmFile->size(); ++i) for(int i = 0; i < wdmFile->size(); ++i)
{ {
if(stringcompare(wdmFile->GetDolName(i), "main") == true) if(stringcompare(wdmFile->GetDolName(i), "main") == true)
{ {
DOLOffsetList.push_back(pair<int, int>(0, wdmFile->GetParameter(i))); DOLOffsetList.push_back(std::pair<int, int>(0, wdmFile->GetParameter(i)));
Options->SetName(position, "%i.", position+1); Options->SetName(position, "%i.", position+1);
Options->SetValue(position, wdmFile->GetReplaceName(i)); Options->SetValue(position, wdmFile->GetReplaceName(i));
position++; position++;
@ -239,7 +239,7 @@ void WDMMenu::CheckGameFiles(const struct discHdr * header)
{ {
if(stringcompare(wdmFile->GetDolName(j), NameCpy) == true) if(stringcompare(wdmFile->GetDolName(j), NameCpy) == true)
{ {
DOLOffsetList.push_back(pair<int, int>(i, wdmFile->GetParameter(j))); DOLOffsetList.push_back(std::pair<int, int>(i, wdmFile->GetParameter(j)));
Options->SetName(position, "%i.", position+1); Options->SetName(position, "%i.", position+1);
Options->SetValue(position, wdmFile->GetReplaceName(j)); Options->SetValue(position, wdmFile->GetReplaceName(j));
position++; position++;
@ -248,13 +248,13 @@ void WDMMenu::CheckGameFiles(const struct discHdr * header)
} }
if(j == wdmFile->size()) if(j == wdmFile->size())
FilesNotInWDM.push_back(pair<int, string>(i, filename)); FilesNotInWDM.push_back(std::pair<int, std::string>(i, filename));
} }
} }
for(u32 i = 0; i < FilesNotInWDM.size(); ++i) for(u32 i = 0; i < FilesNotInWDM.size(); ++i)
{ {
DOLOffsetList.push_back(pair<int, int>(FilesNotInWDM[i].first, 1)); DOLOffsetList.push_back(std::pair<int, int>(FilesNotInWDM[i].first, 1));
Options->SetName(position, "%i.", position+1); Options->SetName(position, "%i.", position+1);
Options->SetValue(position, FilesNotInWDM[i].second.c_str()); Options->SetValue(position, FilesNotInWDM[i].second.c_str());
position++; position++;

View File

@ -22,7 +22,7 @@ class WDMMenu : public GuiWindow
static u32 AlternateDolParameter; static u32 AlternateDolParameter;
WDMFile * wdmFile; WDMFile * wdmFile;
vector<pair<int, int> > DOLOffsetList; std::vector<std::pair<int, int> > DOLOffsetList;
GuiImageData * btnOutline; GuiImageData * btnOutline;
GuiTrigger * trigA; GuiTrigger * trigA;

View File

@ -32,12 +32,12 @@
using namespace tinyxml2; using namespace tinyxml2;
Wiinnertag::Wiinnertag(const string &filepath) Wiinnertag::Wiinnertag(const std::string &filepath)
{ {
ReadXML(filepath); ReadXML(filepath);
} }
bool Wiinnertag::ReadXML(const string &filepath) bool Wiinnertag::ReadXML(const std::string &filepath)
{ {
XMLDocument xmlDoc; XMLDocument xmlDoc;
if(xmlDoc.LoadFile(filepath.c_str()) != 0) if(xmlDoc.LoadFile(filepath.c_str()) != 0)
@ -88,7 +88,7 @@ bool Wiinnertag::Send(const char *gameID)
bool Wiinnertag::TagGame(const char *gameID) bool Wiinnertag::TagGame(const char *gameID)
{ {
string fullpath = Settings.WiinnertagPath; std::string fullpath = Settings.WiinnertagPath;
if(fullpath.size() == 0) if(fullpath.size() == 0)
return false; return false;
@ -100,14 +100,14 @@ bool Wiinnertag::TagGame(const char *gameID)
return Tag.Send(gameID); return Tag.Send(gameID);
} }
bool Wiinnertag::CreateExample(const string &filepath) bool Wiinnertag::CreateExample(const std::string &filepath)
{ {
if(filepath.size() == 0) if(filepath.size() == 0)
return false; return false;
CreateSubfolder(filepath.c_str()); CreateSubfolder(filepath.c_str());
string fullpath = filepath; std::string fullpath = filepath;
if(fullpath[fullpath.size()-1] != '/') if(fullpath[fullpath.size()-1] != '/')
fullpath += '/'; fullpath += '/';
fullpath += "Wiinnertag.xml"; fullpath += "Wiinnertag.xml";

View File

@ -28,18 +28,16 @@
#include <string> #include <string>
#include <gctypes.h> #include <gctypes.h>
using namespace std;
class Wiinnertag class Wiinnertag
{ {
public: public:
static bool CreateExample(const string &filepath); static bool CreateExample(const std::string &filepath);
static bool TagGame(const char *gameID); static bool TagGame(const char *gameID);
private: private:
Wiinnertag(const string &filepath); Wiinnertag(const std::string &filepath);
bool Send(const char *gameID); bool Send(const char *gameID);
bool ReadXML(const string &filepath); bool ReadXML(const std::string &filepath);
vector<pair<string, string> > tagList; std::vector<std::pair<std::string, std::string> > tagList;
}; };
#endif #endif

View File

@ -118,7 +118,7 @@ int UpdateGameTDB()
gprintf("Updating GameTDB...\n"); gprintf("Updating GameTDB...\n");
string ZipPath = Settings.titlestxt_path; std::string ZipPath = Settings.titlestxt_path;
if (Settings.titlestxt_path[ZipPath.size() - 1] != '/') if (Settings.titlestxt_path[ZipPath.size() - 1] != '/')
ZipPath += '/'; ZipPath += '/';

View File

@ -13,6 +13,13 @@
#include "settings/SettingsEnums.h" #include "settings/SettingsEnums.h"
#include "svnrev.h" #include "svnrev.h"
/* GCC 11 false positives */
#if __GNUC__ > 10
#pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#pragma GCC diagnostic ignored "-Wstringop-overread"
#endif
typedef struct _appDOL typedef struct _appDOL
{ {
u8 *dst; u8 *dst;

View File

@ -37,6 +37,12 @@
#include "memory/memory.h" #include "memory/memory.h"
#include "gecko.h" #include "gecko.h"
/* GCC 11 false positives */
#if __GNUC__ > 10
#pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif
static u8 *codelistend = (u8 *)0x80003000; static u8 *codelistend = (u8 *)0x80003000;
static u8 *codelist = (u8 *)0x800022A8; static u8 *codelist = (u8 *)0x800022A8;

View File

@ -30,7 +30,7 @@
#include "themes/Resources.h" #include "themes/Resources.h"
#include "menu/menus.h" #include "menu/menus.h"
CategoryPrompt::CategoryPrompt(const string &title) CategoryPrompt::CategoryPrompt(const std::string &title)
: GuiWindow(0, 0) : GuiWindow(0, 0)
{ {
changed = false; changed = false;

View File

@ -29,7 +29,7 @@
class CategoryPrompt : public GuiWindow, public sigslot::has_slots<> class CategoryPrompt : public GuiWindow, public sigslot::has_slots<>
{ {
public: public:
CategoryPrompt(const string &title); CategoryPrompt(const std::string &title);
virtual ~CategoryPrompt(); virtual ~CategoryPrompt();
int Show(); int Show();
bool categoriesChanged() const { return changed; } bool categoriesChanged() const { return changed; }

View File

@ -51,7 +51,7 @@ void CategorySelectPrompt::onBrowserRefresh()
do do
{ {
bool checked = false; bool checked = false;
const vector<unsigned int> gameCat = GameCategories[gameHeader->id]; const std::vector<unsigned int> gameCat = GameCategories[gameHeader->id];
for(u32 i = 0; i < gameCat.size(); ++i) for(u32 i = 0; i < gameCat.size(); ++i)
{ {
@ -82,7 +82,7 @@ void CategorySelectPrompt::OnCheckboxClick(GuiCheckbox *checkBox, int index)
return; return;
} }
const vector<unsigned int> gameCat = GameCategories[gameHeader->id]; const std::vector<unsigned int> gameCat = GameCategories[gameHeader->id];
u32 i; u32 i;
for(i = 0; i < gameCat.size(); ++i) for(i = 0; i < gameCat.size(); ++i)

View File

@ -47,20 +47,20 @@ void CCategoryList::clear()
const char * CCategoryList::operator[](unsigned int id) const char * CCategoryList::operator[](unsigned int id)
{ {
map<unsigned int, string>::iterator itr = nameList.find(id); std::map<unsigned int, std::string>::iterator itr = nameList.find(id);
if(itr == nameList.end()) if(itr == nameList.end())
return NULL; return NULL;
return nameList[id].c_str(); return nameList[id].c_str();
} }
bool CCategoryList::AddCategory(const string &name) bool CCategoryList::AddCategory(const std::string &name)
{ {
if(findCategory(name)) if(findCategory(name))
return false; return false;
unsigned int i = 1; unsigned int i = 1;
map<unsigned int, string>::iterator itr; std::map<unsigned int, std::string>::iterator itr;
//! Find next free key //! Find next free key
while((itr = nameList.find(i)) != nameList.end()) while((itr = nameList.find(i)) != nameList.end())
@ -72,7 +72,7 @@ bool CCategoryList::AddCategory(const string &name)
return true; return true;
} }
bool CCategoryList::SetCategory(unsigned int id, const string &name) bool CCategoryList::SetCategory(unsigned int id, const std::string &name)
{ {
RemoveCategory(name); RemoveCategory(name);
nameList[id] = name; nameList[id] = name;
@ -80,9 +80,9 @@ bool CCategoryList::SetCategory(unsigned int id, const string &name)
return true; return true;
} }
void CCategoryList::RemoveCategory(const string &name) void CCategoryList::RemoveCategory(const std::string &name)
{ {
for (map<unsigned int, string>::iterator itr = nameList.begin(); itr != nameList.end(); itr++) for (std::map<unsigned int, std::string>::iterator itr = nameList.begin(); itr != nameList.end(); itr++)
{ {
if(strcasecmp(name.c_str(), itr->second.c_str()) == 0) if(strcasecmp(name.c_str(), itr->second.c_str()) == 0)
{ {
@ -94,13 +94,13 @@ void CCategoryList::RemoveCategory(const string &name)
void CCategoryList::RemoveCategory(unsigned int id) void CCategoryList::RemoveCategory(unsigned int id)
{ {
map<unsigned int, string>::iterator itr = nameList.find(id); std::map<unsigned int, std::string>::iterator itr = nameList.find(id);
if(itr != nameList.end()) if(itr != nameList.end())
nameList.erase(itr); nameList.erase(itr);
} }
bool CCategoryList::findCategory(const string &name) bool CCategoryList::findCategory(const std::string &name)
{ {
for (listIter = nameList.begin(); listIter != nameList.end(); listIter++) for (listIter = nameList.begin(); listIter != nameList.end(); listIter++)
{ {

View File

@ -27,35 +27,33 @@
#include <map> #include <map>
#include <string> #include <string>
using namespace std;
class CCategoryList class CCategoryList
{ {
public: public:
CCategoryList(); CCategoryList();
bool Load(string filepath); bool Load(std::string filepath);
bool Save(); bool Save();
bool AddCategory(const string &name); bool AddCategory(const std::string &name);
bool SetCategory(unsigned int id, const string &name); bool SetCategory(unsigned int id, const std::string &name);
void RemoveCategory(unsigned int id); void RemoveCategory(unsigned int id);
void RemoveCategory(const string &name); void RemoveCategory(const std::string &name);
bool goToFirst() { listIter = nameList.begin(); return true; } bool goToFirst() { listIter = nameList.begin(); return true; }
bool goToNext() { listIter++; return listIter != nameList.end(); } bool goToNext() { listIter++; return listIter != nameList.end(); }
unsigned int getCurrentID() const { return listIter->first; } unsigned int getCurrentID() const { return listIter->first; }
const string &getCurrentName() const { return listIter->second; } const std::string &getCurrentName() const { return listIter->second; }
const char * operator[](unsigned int id); const char * operator[](unsigned int id);
const char *at(unsigned int id) { return operator[](id); } const char *at(unsigned int id) { return operator[](id); }
void goToNextCicle() { listIter++; if(listIter == nameList.end()) listIter = nameList.begin(); } void goToNextCicle() { listIter++; if(listIter == nameList.end()) listIter = nameList.begin(); }
void goToPreviousCicle() { if(listIter == nameList.begin()) listIter = nameList.end(); listIter--; } void goToPreviousCicle() { if(listIter == nameList.begin()) listIter = nameList.end(); listIter--; }
bool findCategory(const string &name); bool findCategory(const std::string &name);
bool findCategory(unsigned int id) { listIter = nameList.find(id); return listIter != nameList.end(); }; bool findCategory(unsigned int id) { listIter = nameList.find(id); return listIter != nameList.end(); };
int pos() const { return distance(nameList.begin(), listIter); } int pos() const { return distance(nameList.begin(), listIter); }
int size() const { return nameList.size(); } int size() const { return nameList.size(); }
void clear(); void clear();
private: private:
string configPath; std::string configPath;
map<unsigned int, string>::const_iterator listIter; std::map<unsigned int, std::string>::const_iterator listIter;
map<unsigned int, string> nameList; std::map<unsigned int, std::string> nameList;
}; };
#endif #endif

View File

@ -46,11 +46,11 @@ CGameCategories::CGameCategories()
{ {
} }
const vector<unsigned int> &CGameCategories::operator[](const char *id) const const std::vector<unsigned int> &CGameCategories::operator[](const char *id) const
{ {
if(!id) return defaultCategory; if(!id) return defaultCategory;
for(map<string, vector<unsigned int> >::const_iterator itr = List.begin(); itr != List.end(); itr++) for(std::map<std::string, std::vector<unsigned int> >::const_iterator itr = List.begin(); itr != List.end(); itr++)
{ {
if(strncasecmp(itr->first.c_str(), id, 6) == 0) if(strncasecmp(itr->first.c_str(), id, 6) == 0)
return itr->second; return itr->second;
@ -59,7 +59,7 @@ const vector<unsigned int> &CGameCategories::operator[](const char *id) const
return defaultCategory; return defaultCategory;
} }
bool CGameCategories::Load(string filepath) bool CGameCategories::Load(std::string filepath)
{ {
if(filepath.size() == 0) if(filepath.size() == 0)
return false; return false;
@ -179,7 +179,7 @@ bool CGameCategories::Save()
//! This is more memory efficient than making another copy of the elements. //! This is more memory efficient than making another copy of the elements.
XMLElement *GameCategories = xmlDoc.NewElement("GameCategories"); XMLElement *GameCategories = xmlDoc.NewElement("GameCategories");
for(map<string, vector<unsigned int> >::iterator itr = List.begin(); itr != List.end(); itr++) for(std::map<std::string, std::vector<unsigned int> >::iterator itr = List.begin(); itr != List.end(); itr++)
{ {
ShowProgress(progress, progressSize); ShowProgress(progress, progressSize);
@ -232,17 +232,17 @@ bool CGameCategories::SetCategory(const char *gameID, unsigned int id)
char gameID6[7]; char gameID6[7];
snprintf(gameID6, sizeof(gameID6), gameID); snprintf(gameID6, sizeof(gameID6), gameID);
string stringGameID(gameID6); std::string stringGameID(gameID6);
return SetCategory(stringGameID, id); return SetCategory(stringGameID, id);
} }
bool CGameCategories::SetCategory(const string &gameID, unsigned int id) bool CGameCategories::SetCategory(const std::string &gameID, unsigned int id)
{ {
if(List[gameID].empty()) if(List[gameID].empty())
List[gameID] = defaultCategory; List[gameID] = defaultCategory;
vector<unsigned int> tmpVect(List[gameID]); std::vector<unsigned int> tmpVect(List[gameID]);
for(u32 i = 0; i < tmpVect.size(); ++i) for(u32 i = 0; i < tmpVect.size(); ++i)
{ {
@ -261,13 +261,13 @@ bool CGameCategories::ReplaceCategory(const char *gameID, unsigned int id)
char gameID6[7]; char gameID6[7];
snprintf(gameID6, sizeof(gameID6), gameID); snprintf(gameID6, sizeof(gameID6), gameID);
List[string(gameID6)] = defaultCategory; List[std::string(gameID6)] = defaultCategory;
List[string(gameID6)].push_back(id); List[std::string(gameID6)].push_back(id);
return true; return true;
} }
bool CGameCategories::ReplaceCategory(const string &gameID, unsigned int id) bool CGameCategories::ReplaceCategory(const std::string &gameID, unsigned int id)
{ {
List[gameID] = defaultCategory; List[gameID] = defaultCategory;
List[gameID].push_back(id); List[gameID].push_back(id);
@ -276,7 +276,7 @@ bool CGameCategories::ReplaceCategory(const string &gameID, unsigned int id)
void CGameCategories::RemoveCategory(unsigned int id) void CGameCategories::RemoveCategory(unsigned int id)
{ {
for(map<string, vector<unsigned int> >::iterator itr = List.begin(); itr != List.end(); itr++) for(std::map<std::string, std::vector<unsigned int> >::iterator itr = List.begin(); itr != List.end(); itr++)
{ {
for(u32 i = 0; i < itr->second.size(); ++i) for(u32 i = 0; i < itr->second.size(); ++i)
{ {
@ -289,9 +289,9 @@ void CGameCategories::RemoveCategory(unsigned int id)
} }
} }
void CGameCategories::RemoveGameCategories(const string &gameID) void CGameCategories::RemoveGameCategories(const std::string &gameID)
{ {
for (map<string, vector<unsigned int> >::iterator itr = List.begin(); itr != List.end(); itr++) for (std::map<std::string, std::vector<unsigned int> >::iterator itr = List.begin(); itr != List.end(); itr++)
{ {
if(gameID == itr->first) if(gameID == itr->first)
{ {
@ -304,16 +304,16 @@ void CGameCategories::RemoveCategory(const char *gameID, unsigned int id)
{ {
if(!gameID) return; if(!gameID) return;
string gameID6; std::string gameID6;
for(int i = 0; i < 6 && gameID[i] != 0; ++i) for(int i = 0; i < 6 && gameID[i] != 0; ++i)
gameID6.push_back(gameID[i]); gameID6.push_back(gameID[i]);
RemoveCategory(gameID6, id); RemoveCategory(gameID6, id);
} }
void CGameCategories::RemoveCategory(const string &gameID, unsigned int id) void CGameCategories::RemoveCategory(const std::string &gameID, unsigned int id)
{ {
for (map<string, vector<unsigned int> >::iterator itr = List.begin(); itr != List.end(); itr++) for (std::map<std::string, std::vector<unsigned int> >::iterator itr = List.begin(); itr != List.end(); itr++)
{ {
if(gameID == itr->first) if(gameID == itr->first)
{ {
@ -337,11 +337,11 @@ bool CGameCategories::isInCategory(const char *gameID, unsigned int id)
if(!gameID) return false; if(!gameID) return false;
string gameID6; std::string gameID6;
for(int i = 0; i < 6 && gameID[i] != 0; ++i) for(int i = 0; i < 6 && gameID[i] != 0; ++i)
gameID6.push_back(gameID[i]); gameID6.push_back(gameID[i]);
for (map<string, vector<unsigned int> >::iterator itr = GameCategories.List.begin(); itr != GameCategories.List.end(); itr++) for (std::map<std::string, std::vector<unsigned int> >::iterator itr = GameCategories.List.begin(); itr != GameCategories.List.end(); itr++)
{ {
if(itr->first == gameID6) if(itr->first == gameID6)
{ {
@ -357,7 +357,7 @@ bool CGameCategories::isInCategory(const char *gameID, unsigned int id)
return false; return false;
} }
bool CGameCategories::ImportFromGameTDB(const string &xmlpath) bool CGameCategories::ImportFromGameTDB(const std::string &xmlpath)
{ {
GameTDB XML_DB; GameTDB XML_DB;
@ -374,8 +374,8 @@ bool CGameCategories::ImportFromGameTDB(const string &xmlpath)
{ {
ShowProgress(i, gameList.size()); ShowProgress(i, gameList.size());
vector<string> genreList; std::vector<std::string> genreList;
string GameType; std::string GameType;
if(XML_DB.GetGameType((const char *) gameList[i]->id, GameType)) if(XML_DB.GetGameType((const char *) gameList[i]->id, GameType))
{ {

View File

@ -37,22 +37,22 @@ class CGameCategories
{ {
public: public:
CGameCategories(); CGameCategories();
bool Load(string filepath); bool Load(std::string filepath);
bool Save(); bool Save();
bool SetCategory(const string &gameID, unsigned int id); bool SetCategory(const std::string &gameID, unsigned int id);
bool SetCategory(const char *gameID, unsigned int id); bool SetCategory(const char *gameID, unsigned int id);
bool SetCategory(const unsigned char *gameID, int unsigned id) { return SetCategory((const char *) gameID, id); }; bool SetCategory(const unsigned char *gameID, int unsigned id) { return SetCategory((const char *) gameID, id); };
bool ReplaceCategory(const string &gameID, unsigned int id); bool ReplaceCategory(const std::string &gameID, unsigned int id);
bool ReplaceCategory(const char *gameID, unsigned int id); bool ReplaceCategory(const char *gameID, unsigned int id);
bool ReplaceCategory(const unsigned char *gameID, int unsigned id) { return SetCategory((const char *) gameID, id); }; bool ReplaceCategory(const unsigned char *gameID, int unsigned id) { return SetCategory((const char *) gameID, id); };
void RemoveCategory(unsigned int id); void RemoveCategory(unsigned int id);
void RemoveCategory(const string &gameID, unsigned int id); void RemoveCategory(const std::string &gameID, unsigned int id);
void RemoveCategory(const char *gameID, unsigned int id); void RemoveCategory(const char *gameID, unsigned int id);
void RemoveCategory(const unsigned char *gameID, unsigned int id) { RemoveCategory((const char *) gameID, id); }; void RemoveCategory(const unsigned char *gameID, unsigned int id) { RemoveCategory((const char *) gameID, id); };
void RemoveGameCategories(const string &gameID); void RemoveGameCategories(const std::string &gameID);
const vector<unsigned int> &operator[](const char *gameID) const; const std::vector<unsigned int> &operator[](const char *gameID) const;
const vector<unsigned int> &operator[](const unsigned char *gameID) const { return operator[]((const char *) gameID); } const std::vector<unsigned int> &operator[](const unsigned char *gameID) const { return operator[]((const char *) gameID); }
bool ImportFromGameTDB(const string &xmlpath); bool ImportFromGameTDB(const std::string &xmlpath);
void clear() { List.clear(); CategoryList.clear(); }; void clear() { List.clear(); CategoryList.clear(); };
static bool isInCategory(const char *gameID, unsigned int id); static bool isInCategory(const char *gameID, unsigned int id);
@ -60,9 +60,9 @@ class CGameCategories
protected: protected:
bool ValidVersion(XMLElement *xmlfile); bool ValidVersion(XMLElement *xmlfile);
string configPath; std::string configPath;
const vector<unsigned int> defaultCategory; const std::vector<unsigned int> defaultCategory;
map<string, vector<unsigned int> > List; std::map<std::string, std::vector<unsigned int> > List;
}; };
extern CGameCategories GameCategories; extern CGameCategories GameCategories;

View File

@ -56,6 +56,12 @@
#include "prompts/ProgressWindow.h" #include "prompts/ProgressWindow.h"
#include "neek.hpp" #include "neek.hpp"
/* GCC 11 false positives */
#if __GNUC__ > 10
#pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif
//appentrypoint has to be global because of asm //appentrypoint has to be global because of asm
u32 AppEntrypoint = 0; u32 AppEntrypoint = 0;

View File

@ -6,8 +6,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
using namespace std;
class WDMFile class WDMFile
{ {
public: public:
@ -19,12 +17,12 @@ class WDMFile
private: private:
struct WDMEntry struct WDMEntry
{ {
string DolName; std::string DolName;
string ReplaceName; std::string ReplaceName;
int Parameter; int Parameter;
}; };
vector<WDMEntry> WDMEntries; std::vector<WDMEntry> WDMEntries;
}; };
#endif #endif

View File

@ -9,6 +9,12 @@
#include "wdvd.h" #include "wdvd.h"
#include "fstfile.h" #include "fstfile.h"
/* GCC 11 false positives */
#if __GNUC__ > 10
#pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Wstringop-overread"
#endif
typedef struct _dolheader typedef struct _dolheader
{ {
u32 text_pos[7]; u32 text_pos[7];

View File

@ -19,6 +19,13 @@
#include "GameCube/NIN_Config.h" #include "GameCube/NIN_Config.h"
#include "gecko.h" #include "gecko.h"
/* GCC 11 false positives */
#if __GNUC__ > 10
#pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#pragma GCC diagnostic ignored "-Wstringop-overread"
#endif
// Global app entry point // Global app entry point
extern u32 AppEntrypoint; extern u32 AppEntrypoint;

View File

@ -28,6 +28,11 @@
#include "sys.h" #include "sys.h"
#include "gecko.h" #include "gecko.h"
/* GCC 11 false positives */
#if __GNUC__ > 10
#pragma GCC diagnostic ignored "-Wstringop-overread"
#endif
typedef struct { typedef struct {
u32 hdrsize; u32 hdrsize;
u32 loadersize; u32 loadersize;

View File

@ -248,7 +248,7 @@ int NandTitle::IndexOf(u64 tid)
const char* NandTitle::NameOf(u64 tid) const char* NandTitle::NameOf(u64 tid)
{ {
map<u64, string>::iterator itr = NameList.find(tid); std::map<u64, std::string>::iterator itr = NameList.find(tid);
if (itr != NameList.end()) return itr->second.c_str(); if (itr != NameList.end()) return itr->second.c_str();
return NULL; return NULL;
@ -258,7 +258,7 @@ const char* NandTitle::NameFromIndex(u32 i)
{ {
if (i >= titleIds.size()) return NULL; if (i >= titleIds.size()) return NULL;
map<u64, string>::iterator itr = NameList.find(titleIds.at(i)); std::map<u64, std::string>::iterator itr = NameList.find(titleIds.at(i));
if (itr != NameList.end()) return itr->second.c_str(); if (itr != NameList.end()) return itr->second.c_str();
return NULL; return NULL;

View File

@ -11,7 +11,6 @@
#include <map> #include <map>
#include "wstring.hpp" #include "wstring.hpp"
using namespace std;
#define TITLE_ID(x,y) (((u64)(x) << 32) | (y)) #define TITLE_ID(x,y) (((u64)(x) << 32) | (y))
#define TITLE_UPPER(x) ((u32)((x) >> 32)) #define TITLE_UPPER(x) ((u32)((x) >> 32))
@ -106,7 +105,7 @@ class NandTitle
static int InternalExtractDir(char *nandPath, std::string &filepath); static int InternalExtractDir(char *nandPath, std::string &filepath);
std::vector<u64> titleIds; std::vector<u64> titleIds;
std::map<u64, string> NameList; std::map<u64, std::string> NameList;
u32 currentIndex; u32 currentIndex;
u32 currentType; u32 currentType;

View File

@ -1,19 +1,17 @@
#include <wctype.h> #include <wctype.h>
#include "wstring.hpp" #include "wstring.hpp"
using namespace std;
wString::wString(const wchar_t *s) : wString::wString(const wchar_t *s) :
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >(s) std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >(s)
{ {
} }
wString::wString(const basic_string<wchar_t, char_traits<wchar_t> , allocator<wchar_t> > &ws) : wString::wString(const basic_string<wchar_t, std::char_traits<wchar_t> , std::allocator<wchar_t> > &ws) :
basic_string<wchar_t, char_traits<wchar_t> , allocator<wchar_t> > (ws) std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > (ws)
{ {
} }
wString::wString(const string &s) wString::wString(const std::string &s)
{ {
std::string::size_type size; std::string::size_type size;
@ -23,7 +21,7 @@ wString::wString(const string &s)
(*this)[i] = (unsigned char) s[i]; (*this)[i] = (unsigned char) s[i];
} }
wString &wString::operator=(const string & s) wString &wString::operator=(const std::string & s)
{ {
std::string::size_type size; std::string::size_type size;
@ -68,9 +66,9 @@ void wString::fromUTF8(const char *s)
} }
} }
string wString::toUTF8(void) const std::string wString::toUTF8(void) const
{ {
string s; std::string s;
size_t len = 0; size_t len = 0;
wchar_t wc; wchar_t wc;

View File

@ -73,8 +73,8 @@ bool GameTDB::OpenFile(const char * filepath)
if(file) if(file)
{ {
int pos; int pos;
string OffsetsPath = filepath; std::string OffsetsPath = filepath;
if((pos = OffsetsPath.find_last_of('/')) != (int) string::npos) if((pos = OffsetsPath.find_last_of('/')) != (int) std::string::npos)
OffsetsPath[pos] = '\0'; OffsetsPath[pos] = '\0';
else else
OffsetsPath.clear(); //! Relative path OffsetsPath.clear(); //! Relative path
@ -88,7 +88,7 @@ bool GameTDB::OpenFile(const char * filepath)
void GameTDB::CloseFile() void GameTDB::CloseFile()
{ {
OffsetMap.clear(); OffsetMap.clear();
vector<GameOffsets>().swap(OffsetMap); std::vector<GameOffsets>().swap(OffsetMap);
if(GameNodeCache) if(GameNodeCache)
delete [] GameNodeCache; delete [] GameNodeCache;
@ -104,7 +104,7 @@ bool GameTDB::LoadGameOffsets(const char * path)
if(!path) if(!path)
return false; return false;
string OffsetDBPath = path; std::string OffsetDBPath = path;
if(strlen(path) > 0 && path[strlen(path)-1] != '/') if(strlen(path) > 0 && path[strlen(path)-1] != '/')
OffsetDBPath += '/'; OffsetDBPath += '/';
OffsetDBPath += NAME_OFFSET_DB; OffsetDBPath += NAME_OFFSET_DB;
@ -467,7 +467,7 @@ bool GameTDB::ParseFile()
return true; return true;
} }
bool GameTDB::GetTitle(const char * id, string & title) bool GameTDB::GetTitle(const char * id, std::string & title)
{ {
if(!id) if(!id)
return false; return false;
@ -501,7 +501,7 @@ bool GameTDB::GetTitle(const char * id, string & title)
return true; return true;
} }
bool GameTDB::GetSynopsis(const char * id, string & synopsis) bool GameTDB::GetSynopsis(const char * id, std::string & synopsis)
{ {
if(!id) if(!id)
return false; return false;
@ -535,7 +535,7 @@ bool GameTDB::GetSynopsis(const char * id, string & synopsis)
return true; return true;
} }
bool GameTDB::GetRegion(const char * id, string & region) bool GameTDB::GetRegion(const char * id, std::string & region)
{ {
if(!id) if(!id)
return false; return false;
@ -558,7 +558,7 @@ bool GameTDB::GetRegion(const char * id, string & region)
return true; return true;
} }
bool GameTDB::GetDeveloper(const char * id, string & dev) bool GameTDB::GetDeveloper(const char * id, std::string & dev)
{ {
if(!id) if(!id)
return false; return false;
@ -581,7 +581,7 @@ bool GameTDB::GetDeveloper(const char * id, string & dev)
return true; return true;
} }
bool GameTDB::GetPublisher(const char * id, string & pub) bool GameTDB::GetPublisher(const char * id, std::string & pub)
{ {
if(!id) if(!id)
return false; return false;
@ -651,7 +651,7 @@ unsigned int GameTDB::GetPublishDate(const char * id)
return ((year & 0xFFFF) << 16 | (month & 0xFF) << 8 | (day & 0xFF)); return ((year & 0xFFFF) << 16 | (month & 0xFF) << 8 | (day & 0xFF));
} }
bool GameTDB::GetGenreList(const char * id, vector<string> & genre) bool GameTDB::GetGenreList(const char * id, std::vector<std::string> & genre)
{ {
if(!id) if(!id)
return false; return false;
@ -706,7 +706,7 @@ bool GameTDB::GetGenreList(const char * id, vector<string> & genre)
return true; return true;
} }
void GameTDB::TranslateGenres(vector<string> &GenreList) void GameTDB::TranslateGenres(std::vector<std::string> &GenreList)
{ {
char * data = GetGameNode("gnrmap"); char * data = GetGameNode("gnrmap");
if(!data) if(!data)
@ -716,7 +716,7 @@ void GameTDB::TranslateGenres(vector<string> &GenreList)
{ {
for(unsigned int n = 0; n < 2; n++) for(unsigned int n = 0; n < 2; n++)
{ {
string nodeStart; std::string nodeStart;
if(n == 0) if(n == 0)
nodeStart = "<genre name=\""; nodeStart = "<genre name=\"";
@ -738,7 +738,7 @@ void GameTDB::TranslateGenres(vector<string> &GenreList)
if(!genreNodeEnd) if(!genreNodeEnd)
continue; continue;
string localStr = "<locale lang=\""; std::string localStr = "<locale lang=\"";
localStr += LangCode; localStr += LangCode;
localStr += "\">"; localStr += "\">";
@ -904,7 +904,7 @@ int GameTDB::GetRating(const char * id)
return rating; return rating;
} }
bool GameTDB::GetRatingValue(const char * id, string & rating_value) bool GameTDB::GetRatingValue(const char * id, std::string & rating_value)
{ {
if(!id) if(!id)
return false; return false;
@ -934,7 +934,7 @@ bool GameTDB::GetRatingValue(const char * id, string & rating_value)
return true; return true;
} }
int GameTDB::GetRatingDescriptorList(const char * id, vector<string> & desc_list) int GameTDB::GetRatingDescriptorList(const char * id, std::vector<std::string> & desc_list)
{ {
if(!id) if(!id)
return -1; return -1;
@ -980,7 +980,7 @@ int GameTDB::GetRatingDescriptorList(const char * id, vector<string> & desc_list
return desc_list.size(); return desc_list.size();
} }
void GameTDB::TranslateDescriptors(vector<string> &DescList) void GameTDB::TranslateDescriptors(std::vector<std::string> &DescList)
{ {
char * data = GetGameNode("dscmap"); char * data = GetGameNode("dscmap");
if(!data) if(!data)
@ -988,7 +988,7 @@ void GameTDB::TranslateDescriptors(vector<string> &DescList)
for(unsigned int i = 0; i < DescList.size(); ++i) for(unsigned int i = 0; i < DescList.size(); ++i)
{ {
string nodeStart = "<descriptor name=\""; std::string nodeStart = "<descriptor name=\"";
nodeStart += DescList[i]; nodeStart += DescList[i];
const char *genreNode = strcasestr(data, nodeStart.c_str()); const char *genreNode = strcasestr(data, nodeStart.c_str());
@ -1001,7 +1001,7 @@ void GameTDB::TranslateDescriptors(vector<string> &DescList)
if(!genreNodeEnd) if(!genreNodeEnd)
continue; continue;
string localStr = "<locale lang=\""; std::string localStr = "<locale lang=\"";
localStr += LangCode; localStr += LangCode;
localStr += "\">"; localStr += "\">";
@ -1060,7 +1060,7 @@ int GameTDB::GetWifiPlayers(const char * id)
return players; return players;
} }
int GameTDB::GetWifiFeatureList(const char * id, vector<string> & feat_list) int GameTDB::GetWifiFeatureList(const char * id, std::vector<std::string> & feat_list)
{ {
if(!id) if(!id)
return -1; return -1;
@ -1133,7 +1133,7 @@ int GameTDB::GetPlayers(const char * id)
return players; return players;
} }
int GameTDB::GetAccessoirList(const char * id, vector<Accessoir> & acc_list) int GameTDB::GetAccessoirList(const char * id, std::vector<Accessoir> & acc_list)
{ {
if(!id) if(!id)
return -1; return -1;
@ -1205,7 +1205,7 @@ int GameTDB::GetCaseColor(const char * id)
return color; return color;
} }
bool GameTDB::GetGameType(const char * id, string &GameType) bool GameTDB::GetGameType(const char * id, std::string &GameType)
{ {
if(!id) if(!id)
return false; return false;

View File

@ -27,31 +27,29 @@
#include <vector> #include <vector>
#include <string> #include <string>
using namespace std;
typedef struct _Accessoir typedef struct _Accessoir
{ {
string Name; std::string Name;
bool Required; bool Required;
} Accessoir; } Accessoir;
typedef struct _GameXMLInfo typedef struct _GameXMLInfo
{ {
string GameID; std::string GameID;
string Region; std::string Region;
string Title; std::string Title;
string Synopsis; std::string Synopsis;
string Developer; std::string Developer;
string Publisher; std::string Publisher;
unsigned int PublishDate; unsigned int PublishDate;
vector<string> GenreList; std::vector<std::string> GenreList;
int RatingType; int RatingType;
string RatingValue; std::string RatingValue;
vector<string> RatingDescriptorList; std::vector<std::string> RatingDescriptorList;
int WifiPlayers; int WifiPlayers;
vector<string> WifiFeatureList; std::vector<std::string> WifiFeatureList;
int Players; int Players;
vector<Accessoir> AccessoirList; std::vector<Accessoir> AccessoirList;
long CaseColor; long CaseColor;
} GameXMLInfo; } GameXMLInfo;
@ -83,55 +81,55 @@ class GameTDB
//! 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, std::string & 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, std::string & 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, std::string & region);
//! 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, std::string & 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, std::string & 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 GetGenreList(const char * id, vector<string> & genre); bool GetGenreList(const char * id, std::vector<std::string> & genre);
//! 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 std::string with GameTDB::RatingTostd::string(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, std::string & rating_value);
//! Get the rating descriptor list inside a vector for a specific game id //! Get the rating descriptor list inside a std::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 GetRatingDescriptorList(const char * id, vector<string> & desc_list); int GetRatingDescriptorList(const char * id, std::vector<std::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 std::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 GetWifiFeatureList(const char * id, vector<string> & feat_list); int GetWifiFeatureList(const char * id, std::vector<std::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 accessoirs found or -1 if failed //! Returns the amount of accessoirs found or -1 if failed
//! Get the accessoir (inputs) list inside a vector for a specific game id //! Get the accessoir (inputs) list inside a std::vector for a specific game id
int GetAccessoirList(const char * id, vector<Accessoir> & acc_list); int GetAccessoirList(const char * id, std::vector<Accessoir> & 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)
int GetCaseColor(const char * id); int GetCaseColor(const char * id);
//! Get the complete game info in the GameXMLInfo struct //! Get the complete game info in the GameXMLInfo struct
bool GetGameXMLInfo(const char * id, GameXMLInfo * gameInfo); bool GetGameXMLInfo(const char * id, GameXMLInfo * gameInfo);
//! Get the type of the game. If blank the game is a Wii game. //! Get the type of the game. If blank the game is a Wii game.
bool GetGameType(const char * id, string &GameType); bool GetGameType(const char * id, std::string &GameType);
//! Translate genre list to configure language code //! Translate genre list to configure language code
void TranslateGenres(vector<string> &GenreList); void TranslateGenres(std::vector<std::string> &GenreList);
//! Translate descriptors list to configure language code //! Translate descriptors list to configure language code
void TranslateDescriptors(vector<string> &DescList); void TranslateDescriptors(std::vector<std::string> &DescList);
//! Convert a specific game rating to a string //! Convert a specific game rating to a std::string
static const char * RatingToString(int rating); static const char * RatingToString(int rating);
//! Convert a rating string to a rating number //! Convert a rating std::string to a rating number
static int StringToRating(const char *rate_string); static int StringToRating(const char *rate_string);
//! Convert a rating to another rating //! Convert a rating to another rating
static int ConvertRating(const char *value, const char *from, const char *to); static int ConvertRating(const char *value, const char *from, const char *to);
@ -150,9 +148,9 @@ class GameTDB
inline char * SeekLang(char * text, const char * langcode); inline char * SeekLang(char * text, const char * langcode);
inline char * GetNodeText(char * data, const char * nodestart, const char * nodeend); inline char * GetNodeText(char * data, const char * nodestart, const char * nodeend);
vector<GameOffsets> OffsetMap; std::vector<GameOffsets> OffsetMap;
FILE * file; FILE * file;
string LangCode; std::string LangCode;
char * GameNodeCache; char * GameNodeCache;
char GameIDCache[7]; char GameIDCache[7];
}; };