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
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
char id[7];
|
|
|
|
short video;
|
2011-12-23 16:48:20 +01:00
|
|
|
short aspectratio;
|
2011-07-26 00:28:22 +02:00
|
|
|
short language;
|
|
|
|
short ocarina;
|
|
|
|
short vipatch;
|
|
|
|
short ios;
|
|
|
|
short parentalcontrol;
|
|
|
|
short errorfix002;
|
|
|
|
short iosreloadblock;
|
|
|
|
short loadalternatedol;
|
|
|
|
u32 alternatedolstart;
|
|
|
|
short patchcountrystrings;
|
2011-12-20 22:41:00 +01:00
|
|
|
std::string alternatedolname;
|
2011-07-26 00:28:22 +02:00
|
|
|
short returnTo;
|
|
|
|
short sneekVideoPatch;
|
2011-09-03 11:39:26 +02:00
|
|
|
short NandEmuMode;
|
2011-12-20 22:41:00 +01:00
|
|
|
std::string NandEmuPath;
|
2011-09-03 11:39:26 +02:00
|
|
|
short Hooktype;
|
|
|
|
short WiirdDebugger;
|
2012-05-09 21:27:54 +02:00
|
|
|
short GCForceInterlace;
|
2012-05-06 12:59:58 +02:00
|
|
|
short DMLNMM;
|
|
|
|
short DMLActivityLED;
|
|
|
|
short DMLPADHOOK;
|
|
|
|
short DMLNoDisc;
|
|
|
|
short DMLDebug;
|
2011-07-26 00:28:22 +02:00
|
|
|
short Locked;
|
2011-12-20 22:41:00 +01:00
|
|
|
|
|
|
|
void operator=(const struct _GameCFG &game)
|
|
|
|
{
|
|
|
|
memcpy(this->id, game.id, sizeof(game.id));
|
|
|
|
this->video = game.video;
|
2011-12-23 16:48:20 +01:00
|
|
|
this->aspectratio = game.aspectratio;
|
2011-12-20 22:41:00 +01:00
|
|
|
this->language = game.language;
|
|
|
|
this->ocarina = game.ocarina;
|
|
|
|
this->vipatch = game.vipatch;
|
|
|
|
this->ios = game.ios;
|
|
|
|
this->parentalcontrol = game.parentalcontrol;
|
|
|
|
this->errorfix002 = game.errorfix002;
|
|
|
|
this->iosreloadblock = game.iosreloadblock;
|
|
|
|
this->loadalternatedol = game.loadalternatedol;
|
|
|
|
this->alternatedolstart = game.alternatedolstart;
|
|
|
|
this->patchcountrystrings = game.patchcountrystrings;
|
|
|
|
this->alternatedolname = game.alternatedolname;
|
|
|
|
this->returnTo = game.returnTo;
|
|
|
|
this->sneekVideoPatch = game.sneekVideoPatch;
|
|
|
|
this->NandEmuMode = game.NandEmuMode;
|
|
|
|
this->NandEmuPath = game.NandEmuPath;
|
|
|
|
this->Hooktype = game.Hooktype;
|
|
|
|
this->WiirdDebugger = game.WiirdDebugger;
|
2012-05-09 21:27:54 +02:00
|
|
|
this->GCForceInterlace = game.GCForceInterlace;
|
2012-05-06 12:59:58 +02:00
|
|
|
this->DMLNMM = game.DMLNMM;
|
|
|
|
this->DMLActivityLED = game.DMLActivityLED;
|
|
|
|
this->DMLPADHOOK = game.DMLPADHOOK;
|
|
|
|
this->DMLNoDisc = game.DMLNoDisc;
|
|
|
|
this->DMLDebug = game.DMLDebug;
|
2011-12-20 22:41:00 +01:00
|
|
|
this->Locked = game.Locked;
|
|
|
|
}
|
2010-09-24 23:22:01 +02:00
|
|
|
} GameCFG;
|
|
|
|
|
|
|
|
class CGameSettings
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
public:
|
|
|
|
//!Constructor
|
|
|
|
CGameSettings();
|
|
|
|
//!Destructor
|
|
|
|
~CGameSettings();
|
|
|
|
//!Load
|
|
|
|
bool Load(const char * path);
|
|
|
|
//!Save
|
|
|
|
bool Save();
|
|
|
|
//!AddGame
|
|
|
|
bool AddGame(const GameCFG & NewGame);
|
|
|
|
//!Reset
|
|
|
|
bool RemoveAll();
|
|
|
|
//!Overload Reset for one Game
|
|
|
|
bool Remove(const char * id);
|
2012-05-06 12:59:58 +02:00
|
|
|
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); }
|
2011-07-26 00:28:22 +02:00
|
|
|
//!Get GameCFG
|
|
|
|
GameCFG * GetGameCFG(const char * id);
|
|
|
|
//!Overload
|
2012-05-06 12:59:58 +02:00
|
|
|
GameCFG * GetGameCFG(const u8 * id) { return GetGameCFG((const char *) id); }
|
2011-07-26 00:28:22 +02:00
|
|
|
//!Overload
|
2012-05-06 12:59:58 +02:00
|
|
|
GameCFG * GetGameCFG(const struct discHdr * game) { if(!game) return NULL; else return GetGameCFG(game->id); }
|
2011-07-26 00:28:22 +02:00
|
|
|
//!Quick settings to PEGI conversion
|
|
|
|
static int GetPartenalPEGI(int parentalsetting);
|
2011-12-20 22:41:00 +01:00
|
|
|
//!Set the default configuration block
|
|
|
|
void SetDefault(GameCFG &game);
|
2011-07-26 00:28:22 +02:00
|
|
|
protected:
|
|
|
|
bool ReadGameID(const char * src, char * GameID, int size);
|
2011-12-20 22:41:00 +01:00
|
|
|
bool SetSetting(GameCFG & game, const char *name, const char *value);
|
2011-07-26 00:28:22 +02:00
|
|
|
bool ValidVersion(FILE * file);
|
|
|
|
//!Find the config file in the default paths
|
|
|
|
bool FindConfig();
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
void ParseLine(char *line);
|
2011-12-20 22:41:00 +01:00
|
|
|
void TrimLine(std::string &dest, const char *src, char stopChar);
|
2011-07-26 00:28:22 +02:00
|
|
|
std::string ConfigPath;
|
|
|
|
std::vector<GameCFG> GameList;
|
|
|
|
GameCFG DefaultConfig;
|
2010-09-24 23:22:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern CGameSettings GameSettings;
|
|
|
|
|
|
|
|
#endif
|