2011-01-02 04:46:54 +00:00
|
|
|
struct Cartridge : property<Cartridge> {
|
|
|
|
#include "mbc0/mbc0.hpp"
|
|
|
|
#include "mbc1/mbc1.hpp"
|
2011-01-03 04:28:36 +00:00
|
|
|
#include "mbc2/mbc2.hpp"
|
|
|
|
#include "mbc5/mbc5.hpp"
|
2011-01-02 04:46:54 +00:00
|
|
|
|
|
|
|
enum Mapper : unsigned {
|
|
|
|
MBC0,
|
|
|
|
MBC1,
|
2011-01-03 04:28:36 +00:00
|
|
|
MBC2,
|
|
|
|
MBC5,
|
2011-01-02 04:46:54 +00:00
|
|
|
Unknown,
|
|
|
|
};
|
2010-12-29 11:03:42 +00:00
|
|
|
|
2010-12-28 01:53:15 +00:00
|
|
|
struct Information {
|
2011-01-03 04:28:36 +00:00
|
|
|
string name;
|
|
|
|
uint8 cgbflag;
|
|
|
|
uint8 sgbflag;
|
2011-01-02 04:46:54 +00:00
|
|
|
|
2011-01-03 04:28:36 +00:00
|
|
|
Mapper mapper;
|
|
|
|
bool ram;
|
|
|
|
bool battery;
|
|
|
|
bool rtc;
|
|
|
|
bool rumble;
|
2011-01-02 04:46:54 +00:00
|
|
|
|
2010-12-28 01:53:15 +00:00
|
|
|
unsigned romsize;
|
|
|
|
unsigned ramsize;
|
|
|
|
} info;
|
|
|
|
|
|
|
|
readonly<bool> loaded;
|
|
|
|
|
2010-12-29 11:03:42 +00:00
|
|
|
uint8_t *romdata;
|
|
|
|
unsigned romsize;
|
|
|
|
|
|
|
|
uint8_t *ramdata;
|
|
|
|
unsigned ramsize;
|
|
|
|
|
2010-12-28 01:53:15 +00:00
|
|
|
void load(uint8_t *data, unsigned size);
|
|
|
|
void unload();
|
2010-12-29 11:03:42 +00:00
|
|
|
|
2011-01-02 04:46:54 +00:00
|
|
|
uint8 rom_read(unsigned addr);
|
|
|
|
void rom_write(unsigned addr, uint8 data);
|
|
|
|
uint8 ram_read(unsigned addr);
|
|
|
|
void ram_write(unsigned addr, uint8 data);
|
|
|
|
|
2010-12-29 11:03:42 +00:00
|
|
|
void power();
|
|
|
|
|
2010-12-28 01:53:15 +00:00
|
|
|
Cartridge();
|
2010-12-29 11:03:42 +00:00
|
|
|
~Cartridge();
|
2010-12-28 01:53:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern Cartridge cartridge;
|