2010-08-09 13:28:56 +00:00
|
|
|
struct CheatCode {
|
|
|
|
bool enabled;
|
|
|
|
array<unsigned> addr;
|
|
|
|
array<uint8> data;
|
|
|
|
|
|
|
|
bool operator=(string);
|
|
|
|
CheatCode();
|
|
|
|
};
|
|
|
|
|
|
|
|
class Cheat : public linear_vector<CheatCode> {
|
|
|
|
public:
|
|
|
|
enum class Type : unsigned { ProActionReplay, GameGenie };
|
|
|
|
|
|
|
|
bool enabled() const;
|
|
|
|
void enable(bool);
|
|
|
|
void synchronize();
|
2011-01-18 10:17:48 +00:00
|
|
|
uint8 read(unsigned) const;
|
|
|
|
void init();
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
Cheat();
|
2011-01-18 10:17:48 +00:00
|
|
|
~Cheat();
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
static bool decode(const char*, unsigned&, uint8&, Type&);
|
|
|
|
static bool encode(string&, unsigned, uint8, Type);
|
|
|
|
|
|
|
|
private:
|
2011-01-18 10:17:48 +00:00
|
|
|
uint8 *lookup;
|
2010-08-09 13:28:56 +00:00
|
|
|
bool system_enabled;
|
|
|
|
bool code_enabled;
|
|
|
|
bool cheat_enabled;
|
|
|
|
unsigned mirror(unsigned) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern Cheat cheat;
|