mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 14:42:33 +01:00
byuu says: Changelog: - hiro: BrowserDialog can navigate up to drive selection on Windows - nall: (file,path,dir,base,prefix,suffix)name => Location::(file,path,dir,base,prefix,suffix) - higan/tomoko: rename audio filter label from "Sinc" to "IIR - Biquad" - higan/tomoko: allow loading files via icarus on the command-line once again - higan/tomoko: (begrudging) quick hack to fix presentation window focus on startup - higan/audio: don't divide output audio volume by number of streams - processor/r65816: fix a regression in (read,write)DB; fixes Taz-Mania - fixed compilation regressions on Windows and Linux I'm happy with where we are at with code cleanups and stability, so I'd like to release v100. But even though I'm not assigning any special significance to this version, we should probably test it more thoroughly first.
54 lines
2.0 KiB
C++
54 lines
2.0 KiB
C++
struct WonderSwanCartridge {
|
|
WonderSwanCartridge(string location, uint8_t* data, uint size);
|
|
|
|
string manifest;
|
|
|
|
//private:
|
|
struct Information {
|
|
bool color;
|
|
|
|
string ramType;
|
|
uint ramSize;
|
|
bool orientation; //0 = horizontal; 1 = vertical
|
|
bool hasRTC;
|
|
} information;
|
|
};
|
|
|
|
WonderSwanCartridge::WonderSwanCartridge(string location, uint8_t* data, uint size) {
|
|
if(size < 0x10000) return;
|
|
|
|
auto metadata = data + size - 16;
|
|
|
|
information.color = metadata[7];
|
|
|
|
switch(metadata[11]) {
|
|
default: information.ramType = ""; information.ramSize = 0; break;
|
|
case 0x01: information.ramType = "sram"; information.ramSize = 8 * 1024; break;
|
|
case 0x02: information.ramType = "sram"; information.ramSize = 32 * 1024; break;
|
|
case 0x03: information.ramType = "sram"; information.ramSize = 128 * 1024; break;
|
|
case 0x04: information.ramType = "sram"; information.ramSize = 256 * 1024; break;
|
|
case 0x05: information.ramType = "sram"; information.ramSize = 512 * 1024; break;
|
|
case 0x10: information.ramType = "eeprom"; information.ramSize = 128; break;
|
|
case 0x20: information.ramType = "eeprom"; information.ramSize = 2048; break;
|
|
case 0x50: information.ramType = "eeprom"; information.ramSize = 1024; break;
|
|
}
|
|
|
|
information.orientation = metadata[12] & 1;
|
|
|
|
information.hasRTC = metadata[13] & 1;
|
|
|
|
manifest.append("board\n");
|
|
manifest.append(" rom name=program.rom size=0x", hex(size), "\n");
|
|
if(information.ramType && information.ramSize)
|
|
manifest.append(" ram name=save.ram type=", information.ramType, " size=0x", hex(information.ramSize), "\n");
|
|
if(information.hasRTC)
|
|
manifest.append(" rtc name=rtc.ram size=16\n");
|
|
manifest.append("\n");
|
|
manifest.append("information\n");
|
|
manifest.append(" title: ", Location::prefix(location), "\n");
|
|
manifest.append(" orientation: ", !information.orientation ? "horizontal" : "vertical", "\n");
|
|
manifest.append(" sha256: ", Hash::SHA256(data, size).digest(), "\n");
|
|
manifest.append("\n");
|
|
manifest.append("note: heuristically generated by icarus\n");
|
|
}
|