2015-08-21 11:29:53 +00:00
|
|
|
struct GameBoyAdvanceCartridge {
|
|
|
|
GameBoyAdvanceCartridge(const uint8_t *data, unsigned size);
|
|
|
|
|
|
|
|
string markup;
|
|
|
|
string identifiers;
|
|
|
|
};
|
|
|
|
|
|
|
|
GameBoyAdvanceCartridge::GameBoyAdvanceCartridge(const uint8_t *data, unsigned size) {
|
|
|
|
struct Identifier {
|
|
|
|
string name;
|
|
|
|
unsigned size;
|
|
|
|
};
|
|
|
|
vector<Identifier> idlist;
|
|
|
|
idlist.append({"SRAM_V", 6});
|
|
|
|
idlist.append({"SRAM_F_V", 8});
|
|
|
|
idlist.append({"EEPROM_V", 8});
|
|
|
|
idlist.append({"FLASH_V", 7});
|
|
|
|
idlist.append({"FLASH512_V", 10});
|
|
|
|
idlist.append({"FLASH1M_V", 9});
|
|
|
|
|
|
|
|
lstring list;
|
|
|
|
for(auto& id : idlist) {
|
|
|
|
for(signed n = 0; n < size - 16; n++) {
|
|
|
|
if(!memcmp(data + n, (const char*)id.name, id.size)) {
|
|
|
|
const char* p = (const char*)data + n + id.size;
|
|
|
|
if(p[0] >= '0' && p[0] <= '9'
|
|
|
|
&& p[1] >= '0' && p[1] <= '9'
|
|
|
|
&& p[2] >= '0' && p[2] <= '9'
|
|
|
|
) {
|
|
|
|
char text[16];
|
|
|
|
memcpy(text, data + n, id.size + 3);
|
|
|
|
text[id.size + 3] = 0;
|
|
|
|
list.appendOnce(text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
identifiers = list.merge(",");
|
|
|
|
|
|
|
|
markup.append("cartridge\n");
|
Update to v095r03 release and icarus 20151107.
byuu says:
Note: you will need the new icarus (and please use the "no manifest"
system) to run GBA games with this WIP.
Changelog:
- fixed caching of r(d) to pass armwrestler tests [Jonas Quinn]
- DMA to/from GBA BIOS should fail [Cydrak]
- fixed sign-extend and rotate on ldrs instructions [Cydrak]
- fixed 8-bit SRAM reading/writing [byuu]
- refactored GBA/cartridge
- cartridge/rom,ram.type is now cartridge/mrom,sram,eeprom,flash
- things won't crash horribly if you specify a RAM size larger than
the largest legal size in the manifest
- specialized MROM / SRAM classes replace all the shared read/write
functions that didn't work right anyway
- there's a new ruby/video.glx2 driver, which is not enabled by default
- use this if you are running Linux/BSD, but don't have OpenGL 3.2 yet
- I'm not going to support OpenGL2 on Windows/OS X, because these OSes
don't ship ancient video card drivers
- probably more. What am I, clairvoyant? :P
For endrift's tests, this gets us to 1348/1552 memory and 1016/1260
timing. Overall, this puts us back in second place. Only no$ is ahead
on memory, but bgba is even more ahead on timing.
2015-11-08 09:09:18 +00:00
|
|
|
markup.append(" mrom name=program.rom size=0x", hex(size), "\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
if(0);
|
Update to v095r03 release and icarus 20151107.
byuu says:
Note: you will need the new icarus (and please use the "no manifest"
system) to run GBA games with this WIP.
Changelog:
- fixed caching of r(d) to pass armwrestler tests [Jonas Quinn]
- DMA to/from GBA BIOS should fail [Cydrak]
- fixed sign-extend and rotate on ldrs instructions [Cydrak]
- fixed 8-bit SRAM reading/writing [byuu]
- refactored GBA/cartridge
- cartridge/rom,ram.type is now cartridge/mrom,sram,eeprom,flash
- things won't crash horribly if you specify a RAM size larger than
the largest legal size in the manifest
- specialized MROM / SRAM classes replace all the shared read/write
functions that didn't work right anyway
- there's a new ruby/video.glx2 driver, which is not enabled by default
- use this if you are running Linux/BSD, but don't have OpenGL 3.2 yet
- I'm not going to support OpenGL2 on Windows/OS X, because these OSes
don't ship ancient video card drivers
- probably more. What am I, clairvoyant? :P
For endrift's tests, this gets us to 1348/1552 memory and 1016/1260
timing. Overall, this puts us back in second place. Only no$ is ahead
on memory, but bgba is even more ahead on timing.
2015-11-08 09:09:18 +00:00
|
|
|
else if(identifiers.beginsWith("SRAM_V" )) markup.append(" sram name=save.ram size=0x8000\n");
|
|
|
|
else if(identifiers.beginsWith("SRAM_F_V" )) markup.append(" sram name=save.ram size=0x8000\n");
|
|
|
|
else if(identifiers.beginsWith("EEPROM_V" )) markup.append(" eeprom name=save.ram size=0x0\n");
|
|
|
|
else if(identifiers.beginsWith("FLASH_V" )) markup.append(" flash name=save.ram size=0x10000\n");
|
|
|
|
else if(identifiers.beginsWith("FLASH512_V")) markup.append(" flash name=save.ram size=0x10000\n");
|
|
|
|
else if(identifiers.beginsWith("FLASH1M_V" )) markup.append(" flash name=save.ram size=0x20000\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
//if(identifiers.empty() == false) markup.append(" #detected: ", identifiers, "\n");
|
|
|
|
}
|