mirror of
https://github.com/libretro/Mesen.git
synced 2025-02-25 19:11:20 +00:00
Debugger: Copy info based on CHR ROM vs RAM (right-click in ppu viewer)
This commit is contained in:
parent
70a9b85d4c
commit
47026c3ba8
@ -738,6 +738,11 @@ int32_t Debugger::GetAbsoluteAddress(uint32_t addr)
|
|||||||
return _mapper->ToAbsoluteAddress(addr);
|
return _mapper->ToAbsoluteAddress(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t Debugger::GetAbsoluteChrAddress(uint32_t addr)
|
||||||
|
{
|
||||||
|
return _mapper->ToAbsoluteChrAddress(addr);
|
||||||
|
}
|
||||||
|
|
||||||
void Debugger::SetNextStatement(uint16_t addr)
|
void Debugger::SetNextStatement(uint16_t addr)
|
||||||
{
|
{
|
||||||
if(_currentReadAddr) {
|
if(_currentReadAddr) {
|
||||||
|
@ -168,6 +168,7 @@ public:
|
|||||||
|
|
||||||
int32_t GetRelativeAddress(uint32_t addr, AddressType type);
|
int32_t GetRelativeAddress(uint32_t addr, AddressType type);
|
||||||
int32_t GetAbsoluteAddress(uint32_t addr);
|
int32_t GetAbsoluteAddress(uint32_t addr);
|
||||||
|
int32_t GetAbsoluteChrAddress(uint32_t addr);
|
||||||
void GetAbsoluteAddressAndType(uint32_t relativeAddr, AddressTypeInfo* info);
|
void GetAbsoluteAddressAndType(uint32_t relativeAddr, AddressTypeInfo* info);
|
||||||
|
|
||||||
shared_ptr<Profiler> GetProfiler();
|
shared_ptr<Profiler> GetProfiler();
|
||||||
|
@ -250,6 +250,11 @@ void MemoryDumper::GetChrBank(int bankIndex, uint32_t* frameBuffer, uint8_t pale
|
|||||||
int bank = bankIndex - 2;
|
int bank = bankIndex - 2;
|
||||||
uint32_t baseAddr = bank * 0x1000;
|
uint32_t baseAddr = bank * 0x1000;
|
||||||
uint32_t chrSize = _mapper->GetMemorySize(isChrRam ? DebugMemoryType::ChrRam : DebugMemoryType::ChrRom);
|
uint32_t chrSize = _mapper->GetMemorySize(isChrRam ? DebugMemoryType::ChrRam : DebugMemoryType::ChrRom);
|
||||||
|
if(baseAddr + 0xFFF >= chrSize) {
|
||||||
|
//Out of range, return to prevent crash
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
vector<uint8_t> chrData(chrSize, 0);
|
vector<uint8_t> chrData(chrSize, 0);
|
||||||
_mapper->CopyMemory(isChrRam ? DebugMemoryType::ChrRam : DebugMemoryType::ChrRom, chrData.data());
|
_mapper->CopyMemory(isChrRam ? DebugMemoryType::ChrRam : DebugMemoryType::ChrRom, chrData.data());
|
||||||
|
|
||||||
|
@ -145,6 +145,7 @@ namespace Mesen.GUI.Debugger.Controls
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.cboChrSelection.SelectedIndex = this.cboChrSelection.Items.Count > index && index >= 0 ? index : 0;
|
this.cboChrSelection.SelectedIndex = this.cboChrSelection.Items.Count > index && index >= 0 ? index : 0;
|
||||||
|
this._chrSelection = this.cboChrSelection.SelectedIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,9 +433,15 @@ namespace Mesen.GUI.Debugger.Controls
|
|||||||
|
|
||||||
int tileIndex = GetLargeSpriteIndex(_tileIndex);
|
int tileIndex = GetLargeSpriteIndex(_tileIndex);
|
||||||
|
|
||||||
|
bool isChrRam = InteropEmu.DebugGetMemorySize(DebugMemoryType.ChrRom) == 0;
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for(int i = 0; i < 16; i++) {
|
if(isChrRam) {
|
||||||
sb.Append(InteropEmu.DebugGetMemoryValue(ppuMemory ? DebugMemoryType.PpuMemory : DebugMemoryType.ChrRom, (UInt32)(baseAddress + tileIndex * 16 + i)).ToString("X2"));
|
for(int i = 0; i < 16; i++) {
|
||||||
|
sb.Append(InteropEmu.DebugGetMemoryValue(ppuMemory ? DebugMemoryType.PpuMemory : DebugMemoryType.ChrRom, (UInt32)(baseAddress + tileIndex * 16 + i)).ToString("X2"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int absoluteTileIndex = ppuMemory ? InteropEmu.DebugGetAbsoluteChrAddress((uint)(baseAddress+tileIndex*16))/16 : (baseAddress / 16 + tileIndex);
|
||||||
|
sb.Append(absoluteTileIndex.ToString());
|
||||||
}
|
}
|
||||||
sb.Append(",");
|
sb.Append(",");
|
||||||
for(int i = 0; i < 4; i++) {
|
for(int i = 0; i < 4; i++) {
|
||||||
|
@ -243,9 +243,15 @@ namespace Mesen.GUI.Debugger.Controls
|
|||||||
int bgAddr = state.PPU.ControlFlags.BackgroundPatternAddr;
|
int bgAddr = state.PPU.ControlFlags.BackgroundPatternAddr;
|
||||||
int tileAddr = bgAddr + tileIndex * 16;
|
int tileAddr = bgAddr + tileIndex * 16;
|
||||||
|
|
||||||
|
bool isChrRam = InteropEmu.DebugGetMemorySize(DebugMemoryType.ChrRom) == 0;
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for(int i = 0; i < 16; i++) {
|
if(isChrRam) {
|
||||||
sb.Append(InteropEmu.DebugGetMemoryValue(DebugMemoryType.PpuMemory, (uint)(tileAddr + i)).ToString("X2"));
|
for(int i = 0; i < 16; i++) {
|
||||||
|
sb.Append(InteropEmu.DebugGetMemoryValue(DebugMemoryType.PpuMemory, (uint)(tileAddr + i)).ToString("X2"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int absoluteTileIndex = InteropEmu.DebugGetAbsoluteChrAddress((uint)tileAddr) / 16;
|
||||||
|
sb.Append(absoluteTileIndex.ToString());
|
||||||
}
|
}
|
||||||
sb.Append(",");
|
sb.Append(",");
|
||||||
for(int i = 0; i < 4; i++) {
|
for(int i = 0; i < 4; i++) {
|
||||||
|
@ -195,9 +195,15 @@ namespace Mesen.GUI.Debugger.Controls
|
|||||||
tileAddr = _spritePatternAddr + (tileIndex << 4);
|
tileAddr = _spritePatternAddr + (tileIndex << 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isChrRam = InteropEmu.DebugGetMemorySize(DebugMemoryType.ChrRom) == 0;
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for(int i = 0; i < 16; i++) {
|
if(isChrRam) {
|
||||||
sb.Append(InteropEmu.DebugGetMemoryValue(DebugMemoryType.PpuMemory, (UInt32)(tileAddr + i)).ToString("X2"));
|
for(int i = 0; i < 16; i++) {
|
||||||
|
sb.Append(InteropEmu.DebugGetMemoryValue(DebugMemoryType.PpuMemory, (UInt32)(tileAddr + i)).ToString("X2"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int absoluteTileIndex = InteropEmu.DebugGetAbsoluteChrAddress((uint)tileAddr)/16;
|
||||||
|
sb.Append(absoluteTileIndex.ToString());
|
||||||
}
|
}
|
||||||
sb.Append(",FF");
|
sb.Append(",FF");
|
||||||
for(int i = 1; i < 4; i++) {
|
for(int i = 1; i < 4; i++) {
|
||||||
|
@ -197,6 +197,7 @@ namespace Mesen.GUI
|
|||||||
[DllImport(DLLPath)] public static extern Int32 DebugGetRelativeAddress(UInt32 absoluteAddr, AddressType type);
|
[DllImport(DLLPath)] public static extern Int32 DebugGetRelativeAddress(UInt32 absoluteAddr, AddressType type);
|
||||||
[DllImport(DLLPath)] public static extern Int32 DebugFindSubEntryPoint(UInt16 relativeAddr);
|
[DllImport(DLLPath)] public static extern Int32 DebugFindSubEntryPoint(UInt16 relativeAddr);
|
||||||
[DllImport(DLLPath)] public static extern Int32 DebugGetAbsoluteAddress(UInt32 relativeAddr);
|
[DllImport(DLLPath)] public static extern Int32 DebugGetAbsoluteAddress(UInt32 relativeAddr);
|
||||||
|
[DllImport(DLLPath)] public static extern Int32 DebugGetAbsoluteChrAddress(UInt32 relativeAddr);
|
||||||
[DllImport(DLLPath)] public static extern Int32 DebugGetMemorySize(DebugMemoryType type);
|
[DllImport(DLLPath)] public static extern Int32 DebugGetMemorySize(DebugMemoryType type);
|
||||||
[DllImport(DLLPath)] public static extern Byte DebugGetMemoryValue(DebugMemoryType type, UInt32 address);
|
[DllImport(DLLPath)] public static extern Byte DebugGetMemoryValue(DebugMemoryType type, UInt32 address);
|
||||||
[DllImport(DLLPath)] public static extern void DebugSetMemoryValue(DebugMemoryType type, UInt32 address, byte value);
|
[DllImport(DLLPath)] public static extern void DebugSetMemoryValue(DebugMemoryType type, UInt32 address, byte value);
|
||||||
|
@ -67,6 +67,7 @@ extern "C"
|
|||||||
|
|
||||||
DllExport int32_t __stdcall DebugGetRelativeAddress(uint32_t addr, AddressType type) { return GetDebugger()->GetRelativeAddress(addr, type); }
|
DllExport int32_t __stdcall DebugGetRelativeAddress(uint32_t addr, AddressType type) { return GetDebugger()->GetRelativeAddress(addr, type); }
|
||||||
DllExport int32_t __stdcall DebugGetAbsoluteAddress(uint32_t addr) { return GetDebugger()->GetAbsoluteAddress(addr); }
|
DllExport int32_t __stdcall DebugGetAbsoluteAddress(uint32_t addr) { return GetDebugger()->GetAbsoluteAddress(addr); }
|
||||||
|
DllExport int32_t __stdcall DebugGetAbsoluteChrAddress(uint32_t addr) { return GetDebugger()->GetAbsoluteChrAddress(addr); }
|
||||||
DllExport void __stdcall DebugGetAbsoluteAddressAndType(uint32_t relativeAddr, AddressTypeInfo* info) { return GetDebugger()->GetAbsoluteAddressAndType(relativeAddr, info); }
|
DllExport void __stdcall DebugGetAbsoluteAddressAndType(uint32_t relativeAddr, AddressTypeInfo* info) { return GetDebugger()->GetAbsoluteAddressAndType(relativeAddr, info); }
|
||||||
|
|
||||||
DllExport bool __stdcall DebugLoadCdlFile(char* cdlFilepath) { return GetDebugger()->LoadCdlFile(cdlFilepath); }
|
DllExport bool __stdcall DebugLoadCdlFile(char* cdlFilepath) { return GetDebugger()->LoadCdlFile(cdlFilepath); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user