snes-make CARTROM memorydomain actually edit bsnes's sense of the cartrom, instead of the rom[] array that the core now pointlessly holds onto

This commit is contained in:
zeromus 2014-01-29 21:59:06 +00:00
parent c18f1af150
commit cc73af76bd
7 changed files with 16 additions and 5 deletions

View File

@ -179,6 +179,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
OAM = 103,
CGRAM = 104,
CARTRIDGE_ROM = 105,
SYSBUS = 200,
LOGICAL_REGS = 201
}

View File

@ -1020,11 +1020,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
{
MainMemory = MakeMemoryDomain("WRAM", LibsnesApi.SNES_MEMORY.WRAM, MemoryDomain.Endian.Little);
var romDomain = new MemoryDomain("CARTROM", romData.Length, MemoryDomain.Endian.Little,
(addr) => romData[addr],
(addr, value) => romData[addr] = value);
_memoryDomains.Add(romDomain);
MakeMemoryDomain("CARTROM", LibsnesApi.SNES_MEMORY.CARTRIDGE_ROM, MemoryDomain.Endian.Little);
MakeMemoryDomain("CARTRAM", LibsnesApi.SNES_MEMORY.CARTRIDGE_RAM, MemoryDomain.Endian.Little);
MakeMemoryDomain("VRAM", LibsnesApi.SNES_MEMORY.VRAM, MemoryDomain.Endian.Little);
MakeMemoryDomain("OAM", LibsnesApi.SNES_MEMORY.OAM, MemoryDomain.Endian.Little);

View File

@ -82,7 +82,7 @@ void Cartridge::unload() {
}
Cartridge::Cartridge()
: rom()
: rom("CARTRIDGE_ROM")
, ram("CARTRIDGE_RAM")
{
loaded = false;

View File

@ -586,6 +586,9 @@ uint8_t* snes_get_memory_data(unsigned id) {
return SNES::ppu.oam;
case SNES_MEMORY_CGRAM:
return SNES::ppu.cgram;
case SNES_MEMORY_CARTRIDGE_ROM:
return SNES::cartridge.rom.data();
}
return 0;
@ -640,6 +643,9 @@ const char* snes_get_memory_id_name(unsigned id) {
return "OAM";
case SNES_MEMORY_CGRAM:
return "CGRAM";
case SNES_MEMORY_CARTRIDGE_ROM:
return "CARTRIDGE_ROM";
}
return nullptr;
@ -705,6 +711,10 @@ unsigned snes_get_memory_size(unsigned id) {
case SNES_MEMORY_CGRAM:
size = 512;
break;
case SNES_MEMORY_CARTRIDGE_ROM:
size = SNES::cartridge.rom.size();
break;
}
if(size == -1U) size = 0;

View File

@ -78,6 +78,8 @@ extern "C" {
#define SNES_MEMORY_OAM 103
#define SNES_MEMORY_CGRAM 104
#define SNES_MEMORY_CARTRIDGE_ROM 105
#define SNES_MEMORY_SYSBUS 200
#define SNES_MEMORY_LOGICAL_REGS 201