Debugger - Added palette memory option to memory viewer

This commit is contained in:
Souryo 2015-08-05 21:43:53 -04:00
parent 1591c312cc
commit 0a7e1a9c32
6 changed files with 22 additions and 12 deletions

View file

@ -275,6 +275,12 @@ uint32_t Debugger::GetMemoryState(DebugMemoryType type, uint8_t *buffer)
}
return 0x4000;
case DebugMemoryType::PaletteMemory:
for(int i = 0; i <= 0x1F; i++) {
buffer[i] = _ppu->ReadPaletteRAM(i);
}
return 0x20;
case DebugMemoryType::SpriteMemory:
memcpy(buffer, _ppu->GetSpriteRam(), 0x100);
return 0x100;

View file

@ -23,10 +23,11 @@ enum class DebugMemoryType
{
CpuMemory = 0,
PpuMemory = 1,
SpriteMemory = 2,
SecondarySpriteMemory = 3,
PrgRom = 4,
ChrRom = 5,
PaletteMemory = 2,
SpriteMemory = 3,
SecondarySpriteMemory = 4,
PrgRom = 5,
ChrRom = 6,
};
class Debugger

View file

@ -712,7 +712,7 @@ void PPU::StreamState(bool saving)
Stream<uint32_t>(_frameCount);
Stream<uint8_t>(_memoryReadBuffer);
StreamArray<uint8_t>(_paletteRAM, 0x100);
StreamArray<uint8_t>(_paletteRAM, 0x20);
StreamArray<uint8_t>(_spriteRAM, 0x100);
StreamArray<uint8_t>(_secondarySpriteRAM, 0x20);

View file

@ -99,7 +99,7 @@ class PPU : public IMemoryHandler, public Snapshotable
uint32_t _frameCount;
uint8_t _memoryReadBuffer;
uint8_t _paletteRAM[0x100];
uint8_t _paletteRAM[0x20];
uint8_t _spriteRAM[0x100];
uint8_t _secondarySpriteRAM[0x20];
@ -157,7 +157,6 @@ class PPU : public IMemoryHandler, public Snapshotable
uint32_t GetBGPaletteEntry(uint32_t paletteOffset, uint32_t pixel);
uint32_t GetSpritePaletteEntry(uint32_t paletteOffset, uint32_t pixel);
uint8_t ReadPaletteRAM(uint16_t addr);
void WritePaletteRAM(uint16_t addr, uint8_t value);
void LoadTileInfo();
@ -202,6 +201,8 @@ class PPU : public IMemoryHandler, public Snapshotable
ranges.AddHandler(MemoryOperation::Write, 0x4014);
}
uint8_t ReadPaletteRAM(uint16_t addr);
uint8_t ReadRAM(uint16_t addr);
void WriteRAM(uint16_t addr, uint8_t value);
@ -239,7 +240,7 @@ class PPU : public IMemoryHandler, public Snapshotable
{
return PPU::Instance->_scanline;
}
uint8_t* GetSpriteRam()
{
return _spriteRAM;

View file

@ -88,6 +88,7 @@
this.cboMemoryType.Items.AddRange(new object[] {
"CPU Memory",
"PPU Memory",
"Palette Memory",
"OAM Memory",
"Secondary OAM Memory",
"PRG ROM",

View file

@ -303,10 +303,11 @@ namespace Mesen.GUI
{
CpuMemory = 0,
PpuMemory = 1,
SpriteMemory = 2,
SecondarySpriteMemory = 3,
PrgRom = 4,
ChrRom = 5,
PaletteMemory = 2,
SpriteMemory = 3,
SecondarySpriteMemory = 4,
PrgRom = 5,
ChrRom = 6,
}
public class MD5Helper