2011-10-21 20:48:10 +02:00
|
|
|
#ifndef GAMETDB_TITLES_H_
|
|
|
|
#define GAMETDB_TITLES_H_
|
2010-10-28 11:00:52 +02:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <gctypes.h>
|
|
|
|
#include "usbloader/disc.h"
|
2023-01-01 18:00:14 +01:00
|
|
|
#include "SettingsEnums.h"
|
2010-10-28 11:00:52 +02:00
|
|
|
|
|
|
|
typedef struct _GameTitle
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
char GameID[7];
|
|
|
|
std::string Title;
|
2023-01-01 18:00:12 +01:00
|
|
|
std::string Region;
|
2011-07-26 00:28:22 +02:00
|
|
|
int ParentalRating;
|
|
|
|
int PlayersCount;
|
2023-01-01 18:00:14 +01:00
|
|
|
char TitleType;
|
2010-10-28 11:00:52 +02:00
|
|
|
|
|
|
|
} GameTitle;
|
|
|
|
|
2023-01-01 18:00:14 +01:00
|
|
|
typedef struct _CacheTitle
|
|
|
|
{
|
|
|
|
char GameID[7];
|
|
|
|
char Title[130]; // long titles e.g. RGOJJ9 & DLSP64
|
|
|
|
char Region[7];
|
|
|
|
int ParentalRating;
|
|
|
|
int PlayersCount;
|
|
|
|
char TitleType;
|
|
|
|
|
|
|
|
} ATTRIBUTE_PACKED CacheTitle;
|
|
|
|
|
2010-10-28 11:00:52 +02:00
|
|
|
class CGameTitles
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
public:
|
2023-01-01 18:00:14 +01:00
|
|
|
//! Sort the title list
|
|
|
|
void SortTitleList();
|
2011-10-21 20:48:10 +02:00
|
|
|
//! Set a game title from GameTDB
|
2023-01-01 18:00:14 +01:00
|
|
|
void SetGameTitle(const char * id, const char * title, char TitleType = TITLETYPE_DEFAULT, std::string region = "NULL", int ParentalRating = -1, int PlayersCount = 1);
|
2011-07-26 00:28:22 +02:00
|
|
|
//! Overload
|
2023-01-01 18:00:14 +01:00
|
|
|
void SetGameTitle(const u8 * id, const char * title, char TitleType = TITLETYPE_DEFAULT) { SetGameTitle((const char *) id, title, TitleType); };
|
2011-07-26 00:28:22 +02:00
|
|
|
|
|
|
|
//! Get a game title
|
2023-01-01 18:00:14 +01:00
|
|
|
const char * GetTitle(const char * id, bool allow_access = false) const;
|
2011-07-26 00:28:22 +02:00
|
|
|
//! Overload
|
2023-01-01 18:00:14 +01:00
|
|
|
const char * GetTitle(const u8 * id, bool allow_access = false) const { return GetTitle((const char *) id, allow_access); };
|
2011-07-26 00:28:22 +02:00
|
|
|
//! Overload
|
|
|
|
const char * GetTitle(const struct discHdr *header) const;
|
2023-01-01 18:00:14 +01:00
|
|
|
//! Get title type
|
|
|
|
char GetTitleType(const char * id) const;
|
2023-01-01 18:00:12 +01:00
|
|
|
//! Get game region
|
|
|
|
const char * GetRegion(const char * id) const;
|
2011-07-26 00:28:22 +02:00
|
|
|
//! Get game parental rating
|
|
|
|
int GetParentalRating(const char * id) const;
|
|
|
|
//! Get possible number of players for this game
|
|
|
|
int GetPlayersCount(const char * id) const;
|
2011-10-21 20:48:10 +02:00
|
|
|
//! Load Game Titles from GameTDB
|
2023-01-01 18:00:14 +01:00
|
|
|
void LoadTitlesFromGameTDB(const char * path);
|
2011-07-26 00:28:22 +02:00
|
|
|
//! Set default game titles
|
|
|
|
void SetDefault();
|
2023-01-01 18:00:14 +01:00
|
|
|
void Reset();
|
2011-07-26 00:28:22 +02:00
|
|
|
//! Free memory and remove all titles - Same as SetDefault()
|
|
|
|
void Clear() { SetDefault(); }
|
2012-01-08 19:24:46 +01:00
|
|
|
//! Cache titles functions
|
2011-07-26 00:28:22 +02:00
|
|
|
u32 ReadCachedTitles(const char * path);
|
|
|
|
void WriteCachedTitles(const char * path);
|
2012-01-08 19:24:46 +01:00
|
|
|
protected:
|
2023-01-01 18:00:14 +01:00
|
|
|
int GetMissingTitles(std::vector<std::string> &MissingTitles, std::vector<struct discHdr *> &headerlist);
|
|
|
|
void CleanTitles(std::vector<struct discHdr *> &headerlist);
|
2011-07-26 00:28:22 +02:00
|
|
|
|
|
|
|
std::vector<GameTitle> TitleList;
|
2010-10-28 11:00:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern CGameTitles GameTitles;
|
|
|
|
|
|
|
|
#endif
|