2010-09-24 23:22:01 +02:00
|
|
|
#ifndef _GAME_SETTINGS_H_
|
|
|
|
#define _GAME_SETTINGS_H_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <gctypes.h>
|
|
|
|
#include <vector>
|
|
|
|
#include "usbloader/disc.h"
|
|
|
|
|
|
|
|
typedef struct _GameCFG
|
|
|
|
{
|
|
|
|
char id[7];
|
|
|
|
u8 video;
|
|
|
|
u8 language;
|
|
|
|
u8 ocarina;
|
|
|
|
u8 vipatch;
|
|
|
|
u8 ios;
|
|
|
|
u8 parentalcontrol;
|
|
|
|
u8 errorfix002;
|
|
|
|
u8 iosreloadblock;
|
|
|
|
u8 loadalternatedol;
|
|
|
|
u32 alternatedolstart;
|
|
|
|
u8 patchcountrystrings;
|
|
|
|
char alternatedolname[40];
|
|
|
|
u8 returnTo;
|
2010-10-28 11:00:52 +02:00
|
|
|
u8 Locked;
|
2010-09-24 23:22:01 +02:00
|
|
|
} GameCFG;
|
|
|
|
|
|
|
|
class CGameSettings
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//!Constructor
|
|
|
|
CGameSettings();
|
|
|
|
//!Destructor
|
|
|
|
~CGameSettings();
|
|
|
|
//!Load
|
|
|
|
bool Load(const char * path);
|
|
|
|
//!Save
|
|
|
|
bool Save();
|
|
|
|
//!AddGame
|
2010-09-25 10:51:44 +02:00
|
|
|
bool AddGame(const GameCFG & NewGame);
|
2010-09-24 23:22:01 +02:00
|
|
|
//!Reset
|
|
|
|
bool RemoveAll();
|
|
|
|
//!Overload Reset for one Game
|
|
|
|
bool Remove(const char * id);
|
|
|
|
bool Remove(const u8 * id) { return Remove((const char *) id); };
|
|
|
|
bool Remove(const struct discHdr * game) { if(!game) return false; else return Remove(game->id); };
|
|
|
|
//!Get GameCFG
|
|
|
|
GameCFG * GetGameCFG(const char * id);
|
|
|
|
//!Overload
|
|
|
|
GameCFG * GetGameCFG(const u8 * id) { return GetGameCFG((const char *) id); };
|
|
|
|
//!Overload
|
|
|
|
GameCFG * GetGameCFG(const struct discHdr * game) { if(!game) return NULL; else return GetGameCFG(game->id); };
|
2010-10-28 11:00:52 +02:00
|
|
|
//!Quick settings to PEGI conversion
|
|
|
|
static int GetPartenalPEGI(int parentalsetting);
|
2011-01-21 20:43:59 +01:00
|
|
|
//!Get the default configuration block
|
|
|
|
GameCFG * GetDefault();
|
2010-09-24 23:22:01 +02:00
|
|
|
protected:
|
|
|
|
bool ReadGameID(const char * src, char * GameID, int size);
|
|
|
|
bool SetSetting(GameCFG & game, char *name, char *value);
|
2011-01-06 19:59:45 +01:00
|
|
|
bool ValidVersion(FILE * file);
|
2010-09-24 23:22:01 +02:00
|
|
|
//!Find the config file in the default paths
|
|
|
|
bool FindConfig();
|
|
|
|
|
|
|
|
void ParseLine(char *line);
|
|
|
|
void TrimLine(char *dest, const char *src, int size);
|
|
|
|
std::string ConfigPath;
|
|
|
|
std::vector<GameCFG> GameList;
|
2011-01-21 20:43:59 +01:00
|
|
|
GameCFG DefaultConfig;
|
2010-09-24 23:22:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern CGameSettings GameSettings;
|
|
|
|
|
|
|
|
#endif
|