Debugger: Add read/write/exec/etc highlighting to memory tools

This commit is contained in:
Sour 2019-03-28 17:47:43 -04:00
parent 41ee29d650
commit 3261f8bcfa
32 changed files with 1137 additions and 132 deletions

View file

@ -64,6 +64,9 @@ BreakpointCategory Breakpoint::GetBreakpointCategory(SnesMemoryType memoryType)
case SnesMemoryType::SaveRam:
return BreakpointCategory::Cpu;
case SnesMemoryType::SpcRam:
return BreakpointCategory::Spc;
case SnesMemoryType::VideoRam:
return BreakpointCategory::VideoRam;

View file

@ -13,7 +13,7 @@ class BreakpointManager
{
private:
static constexpr int BreakpointTypeCount = 3; //Read, Write, Exec
static constexpr int CategoryCount = 4; //CPU, VRAM, OAM, CGRAM
static constexpr int CategoryCount = 5; //CPU, VRAM, OAM, CGRAM, SPC
Debugger *_debugger;

View file

@ -1,8 +1,10 @@
#include "stdafx.h"
#include "CodeDataLogger.h"
#include "MemoryManager.h"
CodeDataLogger::CodeDataLogger(uint32_t prgSize)
CodeDataLogger::CodeDataLogger(uint32_t prgSize, MemoryManager* memoryManager)
{
_memoryManager = memoryManager;
_prgSize = prgSize;
_cdlData = new uint8_t[prgSize];
Reset();
@ -132,3 +134,15 @@ void CodeDataLogger::SetCdlData(uint8_t *cdlData, uint32_t length)
CalculateStats();
}
}
void CodeDataLogger::GetCdlData(uint32_t offset, uint32_t length, SnesMemoryType memoryType, uint8_t *cdlData)
{
if(memoryType == SnesMemoryType::PrgRom) {
memcpy(cdlData, _cdlData + offset, length);
} else if(memoryType == SnesMemoryType::CpuMemory) {
for(uint32_t i = 0; i < length; i++) {
AddressInfo info = _memoryManager->GetAbsoluteAddress(offset + i);
cdlData[i] = (info.Type == SnesMemoryType::PrgRom && info.Address >= 0) ? _cdlData[info.Address] : 0;
}
}
}

View file

@ -2,9 +2,12 @@
#include "stdafx.h"
#include "DebugTypes.h"
class MemoryManager;
class CodeDataLogger
{
private:
MemoryManager *_memoryManager;
uint8_t *_cdlData = nullptr;
uint32_t _prgSize = 0;
uint32_t _codeSize = 0;
@ -13,7 +16,7 @@ private:
void CalculateStats();
public:
CodeDataLogger(uint32_t prgSize);
CodeDataLogger(uint32_t prgSize, MemoryManager* memoryManager);
~CodeDataLogger();
void Reset();
@ -32,4 +35,5 @@ public:
uint8_t GetCpuFlags(uint32_t absoluteAddr);
void SetCdlData(uint8_t *cdlData, uint32_t length);
void GetCdlData(uint32_t offset, uint32_t length, SnesMemoryType memoryType, uint8_t *cdlData);
};

View file

@ -572,6 +572,20 @@ void Console::ProcessPpuWrite(uint32_t addr, uint8_t value, SnesMemoryType memor
}
}
void Console::ProcessSpcRead(uint32_t addr, uint8_t value, MemoryOperationType type)
{
if(_debugger) {
_debugger->ProcessSpcRead(addr, value, type);
}
}
void Console::ProcessSpcWrite(uint32_t addr, uint8_t value, MemoryOperationType type)
{
if(_debugger) {
_debugger->ProcessSpcWrite(addr, value, type);
}
}
void Console::ProcessWorkRamRead(uint32_t addr, uint8_t value)
{
if(_debugger) {

View file

@ -124,6 +124,8 @@ public:
void ProcessCpuWrite(uint32_t addr, uint8_t value, MemoryOperationType type);
void ProcessPpuRead(uint32_t addr, uint8_t value, SnesMemoryType memoryType);
void ProcessPpuWrite(uint32_t addr, uint8_t value, SnesMemoryType memoryType);
void ProcessSpcRead(uint32_t addr, uint8_t value, MemoryOperationType type);
void ProcessSpcWrite(uint32_t addr, uint8_t value, MemoryOperationType type);
void ProcessWorkRamRead(uint32_t addr, uint8_t value);
void ProcessWorkRamWrite(uint32_t addr, uint8_t value);
void ProcessPpuCycle();

View file

@ -70,6 +70,7 @@
<ClInclude Include="EventManager.h" />
<ClInclude Include="EventType.h" />
<ClInclude Include="ExpressionEvaluator.h" />
<ClInclude Include="MemoryAccessCounter.h" />
<ClInclude Include="NtscFilter.h" />
<ClInclude Include="PpuTools.h" />
<ClInclude Include="RegisterHandlerB.h" />
@ -157,6 +158,7 @@
<ClCompile Include="ExpressionEvaluator.cpp" />
<ClCompile Include="InternalRegisters.cpp" />
<ClCompile Include="KeyManager.cpp" />
<ClCompile Include="MemoryAccessCounter.cpp" />
<ClCompile Include="MemoryDumper.cpp" />
<ClCompile Include="MemoryManager.cpp" />
<ClCompile Include="MessageManager.cpp" />

View file

@ -254,6 +254,9 @@
<ClInclude Include="CallstackManager.h">
<Filter>Debugger</Filter>
</ClInclude>
<ClInclude Include="MemoryAccessCounter.h">
<Filter>Debugger</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp" />
@ -405,6 +408,9 @@
<ClCompile Include="CallstackManager.cpp">
<Filter>Debugger</Filter>
</ClCompile>
<ClCompile Include="MemoryAccessCounter.cpp">
<Filter>Debugger</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="SNES">

View file

@ -5,6 +5,7 @@
struct DebugState
{
uint64_t MasterClock;
CpuState Cpu;
PpuState Ppu;
};
@ -18,8 +19,8 @@ enum class SnesMemoryType
VideoRam,
SpriteRam,
CGRam,
Register,
SpcRam,
Register,
};
struct AddressInfo
@ -72,7 +73,8 @@ enum class BreakpointCategory
Cpu = 0,
VideoRam = 1,
Oam = 2,
CgRam = 3
CgRam = 3,
Spc = 4
};
namespace CdlFlags

View file

@ -12,6 +12,7 @@
#include "DisassemblyInfo.h"
#include "TraceLogger.h"
#include "MemoryDumper.h"
#include "MemoryAccessCounter.h"
#include "CodeDataLogger.h"
#include "Disassembler.h"
#include "BreakpointManager.h"
@ -31,16 +32,19 @@ Debugger::Debugger(shared_ptr<Console> console)
_memoryManager = console->GetMemoryManager();
_watchExpEval.reset(new ExpressionEvaluator(this));
_codeDataLogger.reset(new CodeDataLogger(console->GetCartridge()->DebugGetPrgRomSize()));
_codeDataLogger.reset(new CodeDataLogger(console->GetCartridge()->DebugGetPrgRomSize(), _memoryManager.get()));
_disassembler.reset(new Disassembler(console, _codeDataLogger));
_traceLogger.reset(new TraceLogger(this, _console));
_memoryDumper.reset(new MemoryDumper(_ppu, console->GetSpc(), _memoryManager, console->GetCartridge()));
_memoryAccessCounter.reset(new MemoryAccessCounter(this, _memoryManager.get()));
_breakpointManager.reset(new BreakpointManager(this));
_ppuTools.reset(new PpuTools(_console.get(), _ppu.get()));
_eventManager.reset(new EventManager(this, _cpu.get(), _ppu.get()));
_callstackManager.reset(new CallstackManager(this));
_cpuStepCount = -1;
_ppuStepCount = -1;
_breakAddress = -1;
_executionStopped = false;
_breakRequestCount = 0;
@ -132,6 +136,8 @@ void Debugger::ProcessCpuRead(uint32_t addr, uint8_t value, MemoryOperationType
}
}
_memoryAccessCounter->ProcessMemoryAccess(addressInfo, type, _memoryManager->GetMasterClock());
if(_memoryManager->IsRegister(addr)) {
_eventManager->AddEvent(DebugEventType::Register, operation);
}
@ -151,6 +157,8 @@ void Debugger::ProcessCpuWrite(uint32_t addr, uint8_t value, MemoryOperationType
_eventManager->AddEvent(DebugEventType::Register, operation);
}
_memoryAccessCounter->ProcessMemoryAccess(addressInfo, type, _memoryManager->GetMasterClock());
ProcessBreakConditions(operation, addressInfo);
}
@ -170,11 +178,31 @@ void Debugger::ProcessWorkRamWrite(uint32_t addr, uint8_t value)
ProcessBreakConditions(operation, addressInfo);
}
void Debugger::ProcessSpcRead(uint16_t addr, uint8_t value, MemoryOperationType type)
{
AddressInfo addressInfo(addr, SnesMemoryType::SpcRam);
MemoryOperationInfo operation(addr, value, type);
ProcessBreakConditions(operation, addressInfo);
_memoryAccessCounter->ProcessMemoryAccess(addressInfo, type, _memoryManager->GetMasterClock());
}
void Debugger::ProcessSpcWrite(uint16_t addr, uint8_t value, MemoryOperationType type)
{
AddressInfo addressInfo(addr, SnesMemoryType::SpcRam);
MemoryOperationInfo operation(addr, value, type);
ProcessBreakConditions(operation, addressInfo);
_memoryAccessCounter->ProcessMemoryAccess(addressInfo, type, _memoryManager->GetMasterClock());
}
void Debugger::ProcessPpuRead(uint16_t addr, uint8_t value, SnesMemoryType memoryType)
{
AddressInfo addressInfo(addr, memoryType);
MemoryOperationInfo operation(addr, value, MemoryOperationType::Read);
ProcessBreakConditions(operation, addressInfo);
_memoryAccessCounter->ProcessMemoryAccess(addressInfo, MemoryOperationType::Read, _memoryManager->GetMasterClock());
}
void Debugger::ProcessPpuWrite(uint16_t addr, uint8_t value, SnesMemoryType memoryType)
@ -182,6 +210,8 @@ void Debugger::ProcessPpuWrite(uint16_t addr, uint8_t value, SnesMemoryType memo
AddressInfo addressInfo(addr, memoryType);
MemoryOperationInfo operation(addr, value, MemoryOperationType::Write);
ProcessBreakConditions(operation, addressInfo);
_memoryAccessCounter->ProcessMemoryAccess(addressInfo, MemoryOperationType::Write, _memoryManager->GetMasterClock());
}
void Debugger::ProcessPpuCycle()
@ -320,6 +350,7 @@ void Debugger::BreakRequest(bool release)
void Debugger::GetState(DebugState &state)
{
state.MasterClock = _memoryManager->GetMasterClock();
state.Cpu = _cpu->GetState();
state.Ppu = _ppu->GetState();
}
@ -334,6 +365,16 @@ shared_ptr<MemoryDumper> Debugger::GetMemoryDumper()
return _memoryDumper;
}
shared_ptr<MemoryAccessCounter> Debugger::GetMemoryAccessCounter()
{
return _memoryAccessCounter;
}
shared_ptr<CodeDataLogger> Debugger::GetCodeDataLogger()
{
return _codeDataLogger;
}
shared_ptr<Disassembler> Debugger::GetDisassembler()
{
return _disassembler;

View file

@ -13,6 +13,7 @@ class MemoryManager;
class TraceLogger;
class ExpressionEvaluator;
class MemoryDumper;
class MemoryAccessCounter;
class Disassembler;
class BreakpointManager;
class PpuTools;
@ -34,6 +35,7 @@ private:
shared_ptr<TraceLogger> _traceLogger;
shared_ptr<MemoryDumper> _memoryDumper;
shared_ptr<MemoryAccessCounter> _memoryAccessCounter;
shared_ptr<CodeDataLogger> _codeDataLogger;
shared_ptr<Disassembler> _disassembler;
shared_ptr<BreakpointManager> _breakpointManager;
@ -68,6 +70,9 @@ public:
void ProcessWorkRamRead(uint32_t addr, uint8_t value);
void ProcessWorkRamWrite(uint32_t addr, uint8_t value);
void ProcessSpcRead(uint16_t addr, uint8_t value, MemoryOperationType type);
void ProcessSpcWrite(uint16_t addr, uint8_t value, MemoryOperationType type);
void ProcessPpuRead(uint16_t addr, uint8_t value, SnesMemoryType memoryType);
void ProcessPpuWrite(uint16_t addr, uint8_t value, SnesMemoryType memoryType);
void ProcessPpuCycle();
@ -87,6 +92,8 @@ public:
shared_ptr<TraceLogger> GetTraceLogger();
shared_ptr<MemoryDumper> GetMemoryDumper();
shared_ptr<MemoryAccessCounter> GetMemoryAccessCounter();
shared_ptr<CodeDataLogger> GetCodeDataLogger();
shared_ptr<Disassembler> GetDisassembler();
shared_ptr<BreakpointManager> GetBreakpointManager();
shared_ptr<PpuTools> GetPpuTools();

View file

@ -0,0 +1,142 @@
#include "stdafx.h"
#include "MemoryAccessCounter.h"
#include "MemoryManager.h"
#include "DebugBreakHelper.h"
#include "Debugger.h"
#include "MemoryDumper.h"
MemoryAccessCounter::MemoryAccessCounter(Debugger* debugger, MemoryManager* memoryManager)
{
_debugger = debugger;
_memoryManager = memoryManager;
for(int i = 0; i < (int)SnesMemoryType::Register; i++) {
uint32_t memSize = _debugger->GetMemoryDumper()->GetMemorySize((SnesMemoryType)i);
_readCounts[i].insert(_readCounts[i].end(), memSize, 0);
_writeCounts[i].insert(_writeCounts[i].end(), memSize, 0);
_execCounts[i].insert(_execCounts[i].end(), memSize, 0);
_readStamps[i].insert(_readStamps[i].end(), memSize, 0);
_writeStamps[i].insert(_writeStamps[i].end(), memSize, 0);
_execStamps[i].insert(_execStamps[i].end(), memSize, 0);
_uninitReads[i].insert(_uninitReads[i].end(), memSize, false);
}
}
vector<uint32_t>& MemoryAccessCounter::GetCountArray(MemoryOperationType operationType, SnesMemoryType memType)
{
switch(operationType) {
case MemoryOperationType::DmaRead:
case MemoryOperationType::Read: return _readCounts[(int)memType];
case MemoryOperationType::DmaWrite:
case MemoryOperationType::Write: return _writeCounts[(int)memType];
default:
case MemoryOperationType::ExecOpCode:
case MemoryOperationType::ExecOperand: return _execCounts[(int)memType];
}
}
vector<uint64_t>& MemoryAccessCounter::GetStampArray(MemoryOperationType operationType, SnesMemoryType memType)
{
switch(operationType) {
case MemoryOperationType::DmaRead:
case MemoryOperationType::Read: return _readStamps[(int)memType];
case MemoryOperationType::DmaWrite:
case MemoryOperationType::Write: return _writeStamps[(int)memType];
default:
case MemoryOperationType::ExecOpCode:
case MemoryOperationType::ExecOperand: return _execStamps[(int)memType];
}
}
bool MemoryAccessCounter::IsAddressUninitialized(AddressInfo &addressInfo)
{
if(addressInfo.Type != SnesMemoryType::PrgRom && addressInfo.Type != SnesMemoryType::SaveRam) {
return _writeCounts[(int)addressInfo.Type][addressInfo.Address] == 0;
}
return false;
}
bool MemoryAccessCounter::ProcessMemoryAccess(AddressInfo &addressInfo, MemoryOperationType operation, uint64_t masterClock)
{
if(addressInfo.Address < 0) {
return false;
}
vector<uint32_t> &counts = GetCountArray(operation, addressInfo.Type);
counts[addressInfo.Address]++;
vector<uint64_t> &stamps = GetStampArray(operation, addressInfo.Type);
stamps[addressInfo.Address] = masterClock;
if(operation == MemoryOperationType::Read && IsAddressUninitialized(addressInfo)) {
//Mark address as read before being written to (if trying to read/execute)
_uninitReads[(int)addressInfo.Type][addressInfo.Address] = true;
return true;
}
return false;
}
void MemoryAccessCounter::ResetCounts()
{
DebugBreakHelper helper(_debugger);
for(int i = 0; i < (int)SnesMemoryType::Register; i++) {
memset(_readCounts[i].data(), 0, _readCounts[i].size() * sizeof(uint32_t));
memset(_writeCounts[i].data(), 0, _writeCounts[i].size() * sizeof(uint32_t));
memset(_execCounts[i].data(), 0, _execCounts[i].size() * sizeof(uint32_t));
memset(_readStamps[i].data(), 0, _readStamps[i].size() * sizeof(uint64_t));
memset(_writeStamps[i].data(), 0, _writeStamps[i].size() * sizeof(uint64_t));
memset(_execStamps[i].data(), 0, _execStamps[i].size() * sizeof(uint64_t));
}
}
void MemoryAccessCounter::GetAccessStamps(uint32_t offset, uint32_t length, SnesMemoryType memoryType, MemoryOperationType operationType, uint64_t stamps[])
{
switch(memoryType) {
case SnesMemoryType::CpuMemory:
for(uint32_t i = 0; i < length; i++) {
AddressInfo info = _memoryManager->GetAbsoluteAddress(offset + i);
if(info.Address >= 0) {
stamps[i] = GetStampArray(operationType, info.Type)[info.Address];
}
}
break;
default:
memcpy(stamps, GetStampArray(operationType, memoryType).data() + offset, length * sizeof(uint64_t));
break;
}
}
void MemoryAccessCounter::GetAccessCounts(uint32_t offset, uint32_t length, SnesMemoryType memoryType, MemoryOperationType operationType, uint32_t counts[])
{
switch(memoryType) {
case SnesMemoryType::CpuMemory:
for(uint32_t i = 0; i < length; i++) {
AddressInfo info = _memoryManager->GetAbsoluteAddress(offset + i);
if(info.Address >= 0) {
counts[i] = GetCountArray(operationType, info.Type)[info.Address];
}
}
break;
default:
memcpy(counts, GetCountArray(operationType, memoryType).data() + offset, length * sizeof(uint32_t));
break;
}
}
void MemoryAccessCounter::GetUninitMemoryReads(SnesMemoryType memoryType, bool uninitReads[])
{
for(size_t i = 0, len = _uninitReads[(int)memoryType].size(); i < len; i++) {
uninitReads[i] = _uninitReads[(int)memoryType][i];
}
}

View file

@ -0,0 +1,37 @@
#pragma once
#include "stdafx.h"
#include "DebugTypes.h"
class Debugger;
class MemoryManager;
class MemoryAccessCounter
{
private:
vector<uint32_t> _readCounts[(int)SnesMemoryType::Register];
vector<uint32_t> _writeCounts[(int)SnesMemoryType::Register];
vector<uint32_t> _execCounts[(int)SnesMemoryType::Register];
vector<uint64_t> _readStamps[(int)SnesMemoryType::Register];
vector<uint64_t> _writeStamps[(int)SnesMemoryType::Register];
vector<uint64_t> _execStamps[(int)SnesMemoryType::Register];
vector<bool> _uninitReads[(int)SnesMemoryType::Register];
Debugger* _debugger;
MemoryManager* _memoryManager;
vector<uint32_t>& GetCountArray(MemoryOperationType operationType, SnesMemoryType memType);
vector<uint64_t>& GetStampArray(MemoryOperationType operationType, SnesMemoryType memType);
bool IsAddressUninitialized(AddressInfo &addressInfo);
public:
MemoryAccessCounter(Debugger *debugger, MemoryManager* memoryManager);
bool ProcessMemoryAccess(AddressInfo &addressInfo, MemoryOperationType operation, uint64_t masterClock);
void ResetCounts();
void GetAccessStamps(uint32_t offset, uint32_t length, SnesMemoryType memoryType, MemoryOperationType operationType, uint64_t stamps[]);
void GetAccessCounts(uint32_t offset, uint32_t length, SnesMemoryType memoryType, MemoryOperationType operationType, uint32_t counts[]);
void GetUninitMemoryReads(SnesMemoryType memoryType, bool uninitReads[]);
};

View file

@ -118,7 +118,9 @@ uint8_t Spc::Read(uint16_t addr, MemoryOperationType type)
case 0xFF: return _state.Timer2.GetOutput();
}
return _ram[addr];
uint8_t value = _ram[addr];
_console->ProcessSpcRead(addr, value, type);
return value;
}
void Spc::Write(uint16_t addr, uint8_t value, MemoryOperationType type)
@ -127,6 +129,7 @@ void Spc::Write(uint16_t addr, uint8_t value, MemoryOperationType type)
//Writes always affect the underlying RAM
if(_state.WriteEnabled) {
_console->ProcessSpcWrite(addr, value, type);
_ram[addr] = value;
}

View file

@ -3,11 +3,13 @@
#include "../Core/Debugger.h"
#include "../Core/TraceLogger.h"
#include "../Core/MemoryDumper.h"
#include "../Core/MemoryAccessCounter.h"
#include "../Core/Disassembler.h"
#include "../Core/DebugTypes.h"
#include "../Core/Breakpoint.h"
#include "../Core/BreakpointManager.h"
#include "../Core/PpuTools.h"
#include "../Core/CodeDataLogger.h"
#include "../Core/EventManager.h"
#include "../Core/CallstackManager.h"
@ -63,6 +65,10 @@ extern "C"
DllExport void __stdcall SetMemoryValue(SnesMemoryType type, uint32_t address, uint8_t value) { return GetDebugger()->GetMemoryDumper()->SetMemoryValue(type, address, value); }
DllExport void __stdcall SetMemoryValues(SnesMemoryType type, uint32_t address, uint8_t* data, int32_t length) { return GetDebugger()->GetMemoryDumper()->SetMemoryValues(type, address, data, length); }
DllExport void __stdcall GetMemoryAccessStamps(uint32_t offset, uint32_t length, SnesMemoryType memoryType, MemoryOperationType operationType, uint64_t* stamps) { GetDebugger()->GetMemoryAccessCounter()->GetAccessStamps(offset, length, memoryType, operationType, stamps); }
DllExport void __stdcall GetMemoryAccessCounts(uint32_t offset, uint32_t length, SnesMemoryType memoryType, MemoryOperationType operationType, uint32_t* counts) { GetDebugger()->GetMemoryAccessCounter()->GetAccessCounts(offset, length, memoryType, operationType, counts); }
DllExport void __stdcall GetCdlData(uint32_t offset, uint32_t length, SnesMemoryType memoryType, uint8_t* cdlData) { GetDebugger()->GetCodeDataLogger()->GetCdlData(offset, length, memoryType, cdlData); }
DllExport void __stdcall GetTilemap(GetTilemapOptions options, uint32_t *buffer) { GetDebugger()->GetPpuTools()->GetTilemap(options, buffer); }
DllExport void __stdcall GetTileView(GetTileViewOptions options, uint32_t *buffer) { GetDebugger()->GetPpuTools()->GetTileView(options, buffer); }
DllExport void __stdcall SetViewerUpdateTiming(uint32_t viewerId, uint16_t scanline, uint16_t cycle) { GetDebugger()->GetPpuTools()->SetViewerUpdateTiming(viewerId, scanline, cycle); }

View file

@ -0,0 +1,193 @@
using System;
using System.Drawing;
using System.Linq;
using Be.Windows.Forms;
using Mesen.GUI.Config;
namespace Mesen.GUI.Debugger
{
public class ByteColorProvider : IByteColorProvider
{
SnesMemoryType _memoryType;
UInt64[] _readStamps;
UInt64[] _writeStamps;
UInt64[] _execStamps;
UInt32[] _readCounts;
UInt32[] _writeCounts;
UInt32[] _execCounts;
byte[] _cdlData;
//bool[] _hasLabel;
DebugState _state = new DebugState();
bool _showExec;
bool _showWrite;
bool _showRead;
int _framesToFade;
bool _hideUnusedBytes;
bool _hideReadBytes;
bool _hideWrittenBytes;
bool _hideExecutedBytes;
bool _highlightDataBytes;
bool _highlightCodeBytes;
//bool _highlightLabelledBytes;
bool _highlightBreakpoints;
ByteColors _colors = new ByteColors();
BreakpointTypeFlags[] _breakpointTypes;
public ByteColorProvider(SnesMemoryType memoryType, bool showExec, bool showWrite, bool showRead, int framesToFade, bool hideUnusedBytes, bool hideReadBytes, bool hideWrittenBytes, bool hideExecutedBytes, bool highlightDataBytes, bool highlightCodeBytes, bool highlightLabelledBytes, bool highlightBreakpoints)
{
_memoryType = memoryType;
_showExec = showExec;
_showWrite = showWrite;
_showRead = showRead;
_framesToFade = framesToFade;
_hideUnusedBytes = hideUnusedBytes;
_hideReadBytes = hideReadBytes;
_hideWrittenBytes = hideWrittenBytes;
_hideExecutedBytes = hideExecutedBytes;
_highlightDataBytes = highlightDataBytes;
_highlightCodeBytes = highlightCodeBytes;
//_highlightLabelledBytes = highlightLabelledBytes;
_highlightBreakpoints = highlightBreakpoints;
}
public void Prepare(long firstByteIndex, long lastByteIndex)
{
int visibleByteCount = (int)(lastByteIndex - firstByteIndex + 1);
if(_highlightBreakpoints) {
Breakpoint[] breakpoints = BreakpointManager.Breakpoints.ToArray();
_breakpointTypes = new BreakpointTypeFlags[visibleByteCount];
for(int i = 0; i < visibleByteCount; i++) {
int byteIndex = i + (int)firstByteIndex;
foreach(Breakpoint bp in breakpoints) {
if(bp.Enabled && bp.Matches((uint)byteIndex, _memoryType)) {
_breakpointTypes[i] = bp.BreakOnExec ? BreakpointTypeFlags.Execute : (bp.BreakOnWrite ? BreakpointTypeFlags.Write : BreakpointTypeFlags.Read);
break;
}
}
}
} else {
_breakpointTypes = null;
}
_readStamps = DebugApi.GetMemoryAccessStamps((UInt32)firstByteIndex, (UInt32)visibleByteCount, _memoryType, MemoryOperationType.Read);
_writeStamps = DebugApi.GetMemoryAccessStamps((UInt32)firstByteIndex, (UInt32)visibleByteCount, _memoryType, MemoryOperationType.Write);
_execStamps = DebugApi.GetMemoryAccessStamps((UInt32)firstByteIndex, (UInt32)visibleByteCount, _memoryType, MemoryOperationType.ExecOpCode);
_readCounts = DebugApi.GetMemoryAccessCounts((UInt32)firstByteIndex, (UInt32)visibleByteCount, _memoryType, MemoryOperationType.Read);
_writeCounts = DebugApi.GetMemoryAccessCounts((UInt32)firstByteIndex, (UInt32)visibleByteCount, _memoryType, MemoryOperationType.Write);
_execCounts = DebugApi.GetMemoryAccessCounts((UInt32)firstByteIndex, (UInt32)visibleByteCount, _memoryType, MemoryOperationType.ExecOpCode);
_cdlData = null;
if(_highlightDataBytes || _highlightCodeBytes) {
switch(_memoryType) {
case SnesMemoryType.CpuMemory:
case SnesMemoryType.PrgRom:
_cdlData = DebugApi.GetCdlData((UInt32)firstByteIndex, (UInt32)visibleByteCount, _memoryType);
break;
}
}
//TODO LABELS
/*_hasLabel = new bool[visibleByteCount];
if(_highlightLabelledBytes) {
if(_memoryType == DebugMemoryType.CpuMemory) {
for(long i = 0; i < _hasLabel.Length; i++) {
_hasLabel[i] = (
!string.IsNullOrWhiteSpace(LabelManager.GetLabel((UInt16)(i + firstByteIndex))?.Label) ||
!string.IsNullOrWhiteSpace(LabelManager.GetLabel((uint)(i + firstByteIndex), AddressType.Register)?.Label)
);
}
} else if(_memoryType == DebugMemoryType.PrgRom || _memoryType == DebugMemoryType.WorkRam || _memoryType == DebugMemoryType.SaveRam) {
for(long i = 0; i < _hasLabel.Length; i++) {
_hasLabel[i] = !string.IsNullOrWhiteSpace(LabelManager.GetLabel((uint)(firstByteIndex + i), _memoryType.ToAddressType())?.Label);
}
}
}*/
_state = DebugApi.GetState();
}
public static Color DarkerColor(Color input, double brightnessPercentage)
{
if(double.IsInfinity(brightnessPercentage)) {
brightnessPercentage = 1.0;
}
if(brightnessPercentage < 0.20) {
brightnessPercentage *= 5;
} else {
brightnessPercentage = 1.0;
}
return Color.FromArgb((int)(input.R * brightnessPercentage), (int)(input.G * brightnessPercentage), (int)(input.B * brightnessPercentage));
}
public ByteColors GetByteColor(long firstByteIndex, long byteIndex)
{
HexEditorInfo cfg = ConfigManager.Config.Debug.HexEditor;
const int CyclesPerFrame = 357368;
long index = byteIndex - firstByteIndex;
double framesSinceExec = (double)(_state.MasterClock - _execStamps[index]) / CyclesPerFrame;
double framesSinceWrite = (double)(_state.MasterClock - _writeStamps[index]) / CyclesPerFrame;
double framesSinceRead = (double)(_state.MasterClock - _readStamps[index]) / CyclesPerFrame;
bool isRead = _readCounts[index] > 0;
bool isWritten = _writeCounts[index] > 0;
bool isExecuted = _execCounts[index] > 0;
bool isUnused = !isRead && !isWritten && !isExecuted;
int alpha = 0;
if(isRead && _hideReadBytes || isWritten && _hideWrittenBytes || isExecuted && _hideExecutedBytes || isUnused && _hideUnusedBytes) {
alpha = 128;
}
if(isRead && !_hideReadBytes || isWritten && !_hideWrittenBytes || isExecuted && !_hideExecutedBytes || isUnused && !_hideUnusedBytes) {
alpha = 255;
}
_colors.BackColor = Color.Transparent;
if(_cdlData != null) {
if((_cdlData[index] & (byte)CdlFlags.Code) != 0 && _highlightCodeBytes) {
//Code
_colors.BackColor = cfg.CodeByteColor;
} else if((_cdlData[index] & (byte)CdlFlags.Data) != 0 && _highlightDataBytes) {
//Data
_colors.BackColor = cfg.DataByteColor;
}
}
//TODO LABELS
/*if(_hasLabel[index]) {
//Labels/comments
_colors.BackColor = cfg.LabelledByteColor;
}*/
_colors.BorderColor = Color.Empty;
if(_breakpointTypes != null) {
switch(_breakpointTypes[index]) {
case BreakpointTypeFlags.Execute:
_colors.BorderColor = ConfigManager.Config.Debug.CodeExecBreakpointColor;
break;
case BreakpointTypeFlags.Write:
_colors.BorderColor = ConfigManager.Config.Debug.CodeWriteBreakpointColor;
break;
case BreakpointTypeFlags.Read:
_colors.BorderColor = ConfigManager.Config.Debug.CodeReadBreakpointColor;
break;
}
}
if(_showExec && _execStamps[index] != 0 && framesSinceExec >= 0 && (framesSinceExec < _framesToFade || _framesToFade == 0)) {
_colors.ForeColor = Color.FromArgb(alpha, DarkerColor(cfg.ExecColor, (_framesToFade - framesSinceExec) / _framesToFade));
} else if(_showWrite && _writeStamps[index] != 0 && framesSinceWrite >= 0 && (framesSinceWrite < _framesToFade || _framesToFade == 0)) {
_colors.ForeColor = Color.FromArgb(alpha, DarkerColor(cfg.WriteColor, (_framesToFade - framesSinceWrite) / _framesToFade));
} else if(_showRead && _readStamps[index] != 0 && framesSinceRead >= 0 && (framesSinceRead < _framesToFade || _framesToFade == 0)) {
_colors.ForeColor = Color.FromArgb(alpha, DarkerColor(cfg.ReadColor, (_framesToFade - framesSinceRead) / _framesToFade));
} else {
_colors.ForeColor = Color.FromArgb(alpha, Color.Black);
}
return _colors;
}
}
}

View file

@ -166,7 +166,6 @@ namespace Mesen.GUI.Debugger
cboMemoryType.EndUpdate();
UpdateMemoryType();
}
private void UpdateFlags()
{
@ -285,52 +284,21 @@ namespace Mesen.GUI.Debugger
private void UpdateByteColorProvider()
{
//TODO
/*switch(this._memoryType) {
case SnesMemoryType.CpuMemory:
case SnesMemoryType.PrgRom:
case SnesMemoryType.WorkRam:
case SnesMemoryType.SaveRam:
this.ctrlHexViewer.ByteColorProvider = new ByteColorProvider(
this._memoryType,
mnuHighlightExecution.Checked,
mnuHighlightWrites.Checked,
mnuHightlightReads.Checked,
ConfigManager.Config.Debug.RamFadeSpeed,
mnuHideUnusedBytes.Checked,
mnuHideReadBytes.Checked,
mnuHideWrittenBytes.Checked,
mnuHideExecutedBytes.Checked,
mnuHighlightDataBytes.Checked,
mnuHighlightCodeBytes.Checked,
mnuHighlightLabelledBytes.Checked,
mnuHighlightBreakpoints.Checked
);
break;
case SnesMemoryType.VideoRam:
case DebugMemoryType.ChrRom:
case DebugMemoryType.ChrRam:
case DebugMemoryType.PaletteMemory:
case DebugMemoryType.NametableRam:
this.ctrlHexViewer.ByteColorProvider = new ChrByteColorProvider(
this._memoryType,
mnuHighlightWrites.Checked,
mnuHightlightReads.Checked,
ConfigManager.Config.Debug.RamFadeSpeed,
mnuHideUnusedBytes.Checked,
mnuHideReadBytes.Checked,
mnuHideWrittenBytes.Checked,
mnuHighlightChrDrawnBytes.Checked,
mnuHighlightChrReadBytes.Checked,
mnuHighlightBreakpoints.Checked
);
break;
default:
this.ctrlHexViewer.ByteColorProvider = null;
break;
}*/
this.ctrlHexViewer.ByteColorProvider = new ByteColorProvider(
this._memoryType,
mnuHighlightExecution.Checked,
mnuHighlightWrites.Checked,
mnuHightlightReads.Checked,
ConfigManager.Config.Debug.HexEditor.FadeSpeed,
mnuHideUnusedBytes.Checked,
mnuHideReadBytes.Checked,
mnuHideWrittenBytes.Checked,
mnuHideExecutedBytes.Checked,
mnuHighlightDataBytes.Checked,
mnuHighlightCodeBytes.Checked,
mnuHighlightLabelledBytes.Checked,
mnuHighlightBreakpoints.Checked
);
}
private void mnuRefresh_Click(object sender, EventArgs e)
@ -547,12 +515,11 @@ namespace Mesen.GUI.Debugger
private void mnuConfigureColors_Click(object sender, EventArgs e)
{
//TODO
//using(frmMemoryViewerColors frm = new frmMemoryViewerColors()) {
// if(frm.ShowDialog(this, this) == DialogResult.OK) {
// this.RefreshData();
// }
//}
using(frmMemoryToolsColors frm = new frmMemoryToolsColors()) {
if(frm.ShowDialog(this, this) == DialogResult.OK) {
this.RefreshData();
}
}
}
/*private frmCodeTooltip _tooltip = null;

View file

@ -63,10 +63,6 @@
this.toolStripMenuItem8 = new System.Windows.Forms.ToolStripSeparator();
this.mnuHighlightCodeBytes = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHighlightDataBytes = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHighlightDmcDataBytes = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem11 = new System.Windows.Forms.ToolStripSeparator();
this.mnuHighlightChrDrawnBytes = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHighlightChrReadBytes = new System.Windows.Forms.ToolStripMenuItem();
this.fadeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHideUnusedBytes = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHideReadBytes = new System.Windows.Forms.ToolStripMenuItem();
@ -276,7 +272,7 @@
//
this.mnuHighlightExecution.CheckOnClick = true;
this.mnuHighlightExecution.Name = "mnuHighlightExecution";
this.mnuHighlightExecution.Size = new System.Drawing.Size(133, 22);
this.mnuHighlightExecution.Size = new System.Drawing.Size(152, 22);
this.mnuHighlightExecution.Text = "Execution";
this.mnuHighlightExecution.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
//
@ -284,7 +280,7 @@
//
this.mnuHighlightWrites.CheckOnClick = true;
this.mnuHighlightWrites.Name = "mnuHighlightWrites";
this.mnuHighlightWrites.Size = new System.Drawing.Size(133, 22);
this.mnuHighlightWrites.Size = new System.Drawing.Size(152, 22);
this.mnuHighlightWrites.Text = "Writes";
this.mnuHighlightWrites.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
//
@ -292,14 +288,14 @@
//
this.mnuHightlightReads.CheckOnClick = true;
this.mnuHightlightReads.Name = "mnuHightlightReads";
this.mnuHightlightReads.Size = new System.Drawing.Size(133, 22);
this.mnuHightlightReads.Size = new System.Drawing.Size(152, 22);
this.mnuHightlightReads.Text = "Reads";
this.mnuHightlightReads.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
//
// toolStripMenuItem6
//
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
this.toolStripMenuItem6.Size = new System.Drawing.Size(130, 6);
this.toolStripMenuItem6.Size = new System.Drawing.Size(149, 6);
//
// fadeSpeedToolStripMenuItem
//
@ -311,13 +307,13 @@
this.toolStripMenuItem7,
this.mnuCustomFadeSpeed});
this.fadeSpeedToolStripMenuItem.Name = "fadeSpeedToolStripMenuItem";
this.fadeSpeedToolStripMenuItem.Size = new System.Drawing.Size(133, 22);
this.fadeSpeedToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.fadeSpeedToolStripMenuItem.Text = "Fade speed";
//
// mnuFadeSlow
//
this.mnuFadeSlow.Name = "mnuFadeSlow";
this.mnuFadeSlow.Size = new System.Drawing.Size(136, 22);
this.mnuFadeSlow.Size = new System.Drawing.Size(152, 22);
this.mnuFadeSlow.Text = "Slow";
this.mnuFadeSlow.Click += new System.EventHandler(this.mnuFadeSpeed_Click);
//
@ -326,33 +322,33 @@
this.mnuFadeNormal.Checked = true;
this.mnuFadeNormal.CheckState = System.Windows.Forms.CheckState.Checked;
this.mnuFadeNormal.Name = "mnuFadeNormal";
this.mnuFadeNormal.Size = new System.Drawing.Size(136, 22);
this.mnuFadeNormal.Size = new System.Drawing.Size(152, 22);
this.mnuFadeNormal.Text = "Normal";
this.mnuFadeNormal.Click += new System.EventHandler(this.mnuFadeSpeed_Click);
//
// mnuFadeFast
//
this.mnuFadeFast.Name = "mnuFadeFast";
this.mnuFadeFast.Size = new System.Drawing.Size(136, 22);
this.mnuFadeFast.Size = new System.Drawing.Size(152, 22);
this.mnuFadeFast.Text = "Fast";
this.mnuFadeFast.Click += new System.EventHandler(this.mnuFadeSpeed_Click);
//
// mnuFadeNever
//
this.mnuFadeNever.Name = "mnuFadeNever";
this.mnuFadeNever.Size = new System.Drawing.Size(136, 22);
this.mnuFadeNever.Size = new System.Drawing.Size(152, 22);
this.mnuFadeNever.Text = "Do not fade";
this.mnuFadeNever.Click += new System.EventHandler(this.mnuFadeSpeed_Click);
//
// toolStripMenuItem7
//
this.toolStripMenuItem7.Name = "toolStripMenuItem7";
this.toolStripMenuItem7.Size = new System.Drawing.Size(133, 6);
this.toolStripMenuItem7.Size = new System.Drawing.Size(149, 6);
//
// mnuCustomFadeSpeed
//
this.mnuCustomFadeSpeed.Name = "mnuCustomFadeSpeed";
this.mnuCustomFadeSpeed.Size = new System.Drawing.Size(136, 22);
this.mnuCustomFadeSpeed.Size = new System.Drawing.Size(152, 22);
this.mnuCustomFadeSpeed.Text = "Custom...";
this.mnuCustomFadeSpeed.Click += new System.EventHandler(this.mnuCustomFadeSpeed_Click);
//
@ -363,11 +359,7 @@
this.mnuHighlightBreakpoints,
this.toolStripMenuItem8,
this.mnuHighlightCodeBytes,
this.mnuHighlightDataBytes,
this.mnuHighlightDmcDataBytes,
this.toolStripMenuItem11,
this.mnuHighlightChrDrawnBytes,
this.mnuHighlightChrReadBytes});
this.mnuHighlightDataBytes});
this.dataTypeHighlightingToolStripMenuItem.Name = "dataTypeHighlightingToolStripMenuItem";
this.dataTypeHighlightingToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
this.dataTypeHighlightingToolStripMenuItem.Text = "Data Type Highlighting";
@ -376,7 +368,7 @@
//
this.mnuHighlightLabelledBytes.CheckOnClick = true;
this.mnuHighlightLabelledBytes.Name = "mnuHighlightLabelledBytes";
this.mnuHighlightLabelledBytes.Size = new System.Drawing.Size(236, 22);
this.mnuHighlightLabelledBytes.Size = new System.Drawing.Size(196, 22);
this.mnuHighlightLabelledBytes.Text = "Labeled bytes";
this.mnuHighlightLabelledBytes.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
//
@ -384,20 +376,20 @@
//
this.mnuHighlightBreakpoints.CheckOnClick = true;
this.mnuHighlightBreakpoints.Name = "mnuHighlightBreakpoints";
this.mnuHighlightBreakpoints.Size = new System.Drawing.Size(236, 22);
this.mnuHighlightBreakpoints.Size = new System.Drawing.Size(196, 22);
this.mnuHighlightBreakpoints.Text = "Breakpoints";
this.mnuHighlightBreakpoints.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
//
// toolStripMenuItem8
//
this.toolStripMenuItem8.Name = "toolStripMenuItem8";
this.toolStripMenuItem8.Size = new System.Drawing.Size(233, 6);
this.toolStripMenuItem8.Size = new System.Drawing.Size(193, 6);
//
// mnuHighlightCodeBytes
//
this.mnuHighlightCodeBytes.CheckOnClick = true;
this.mnuHighlightCodeBytes.Name = "mnuHighlightCodeBytes";
this.mnuHighlightCodeBytes.Size = new System.Drawing.Size(236, 22);
this.mnuHighlightCodeBytes.Size = new System.Drawing.Size(196, 22);
this.mnuHighlightCodeBytes.Text = "Code bytes (PRG ROM)";
this.mnuHighlightCodeBytes.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
//
@ -405,39 +397,10 @@
//
this.mnuHighlightDataBytes.CheckOnClick = true;
this.mnuHighlightDataBytes.Name = "mnuHighlightDataBytes";
this.mnuHighlightDataBytes.Size = new System.Drawing.Size(236, 22);
this.mnuHighlightDataBytes.Size = new System.Drawing.Size(196, 22);
this.mnuHighlightDataBytes.Text = "Data bytes (PRG ROM)";
this.mnuHighlightDataBytes.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
//
// mnuHighlightDmcDataBytes
//
this.mnuHighlightDmcDataBytes.CheckOnClick = true;
this.mnuHighlightDmcDataBytes.Name = "mnuHighlightDmcDataBytes";
this.mnuHighlightDmcDataBytes.Size = new System.Drawing.Size(236, 22);
this.mnuHighlightDmcDataBytes.Text = "DMC sample bytes (PRG ROM)";
this.mnuHighlightDmcDataBytes.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
//
// toolStripMenuItem11
//
this.toolStripMenuItem11.Name = "toolStripMenuItem11";
this.toolStripMenuItem11.Size = new System.Drawing.Size(233, 6);
//
// mnuHighlightChrDrawnBytes
//
this.mnuHighlightChrDrawnBytes.CheckOnClick = true;
this.mnuHighlightChrDrawnBytes.Name = "mnuHighlightChrDrawnBytes";
this.mnuHighlightChrDrawnBytes.Size = new System.Drawing.Size(236, 22);
this.mnuHighlightChrDrawnBytes.Text = "Drawn bytes (CHR ROM)";
this.mnuHighlightChrDrawnBytes.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
//
// mnuHighlightChrReadBytes
//
this.mnuHighlightChrReadBytes.CheckOnClick = true;
this.mnuHighlightChrReadBytes.Name = "mnuHighlightChrReadBytes";
this.mnuHighlightChrReadBytes.Size = new System.Drawing.Size(236, 22);
this.mnuHighlightChrReadBytes.Text = "Read bytes (CHR ROM)";
this.mnuHighlightChrReadBytes.Click += new System.EventHandler(this.mnuColorProviderOptions_Click);
//
// fadeToolStripMenuItem
//
this.fadeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -769,7 +732,7 @@
this.tpgAccessCounters.Text = "Access Counters";
this.tpgAccessCounters.UseVisualStyleBackColor = true;
//
// frmMemoryViewer
// frmMemoryTools
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
@ -778,7 +741,7 @@
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.MinimumSize = new System.Drawing.Size(429, 337);
this.Name = "frmMemoryViewer";
this.Name = "frmMemoryTools";
this.Text = "Memory Tools";
this.flowLayoutPanel1.ResumeLayout(false);
this.flowLayoutPanel1.PerformLayout();
@ -847,14 +810,10 @@
private System.Windows.Forms.ToolStripMenuItem dataTypeHighlightingToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuHighlightCodeBytes;
private System.Windows.Forms.ToolStripMenuItem mnuHighlightDataBytes;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem11;
private System.Windows.Forms.ToolStripMenuItem mnuHighlightChrDrawnBytes;
private System.Windows.Forms.ToolStripMenuItem mnuHighlightChrReadBytes;
private System.Windows.Forms.ToolStripMenuItem mnuConfigureColors;
private System.Windows.Forms.ToolStripMenuItem mnuShowLabelInfoOnMouseOver;
private System.Windows.Forms.ToolStripMenuItem mnuHighlightLabelledBytes;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem8;
private System.Windows.Forms.ToolStripMenuItem mnuHighlightDmcDataBytes;
private System.Windows.Forms.ToolStripMenuItem autorefreshSpeedToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuAutoRefreshLow;
private System.Windows.Forms.ToolStripMenuItem mnuAutoRefreshNormal;

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View file

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Config;
using Mesen.GUI.Forms;
namespace Mesen.GUI.Debugger
{
public partial class frmMemoryToolsColors : BaseConfigForm
{
public frmMemoryToolsColors()
{
InitializeComponent();
Entity = ConfigManager.Config.Debug.HexEditor;
AddBinding(nameof(HexEditorInfo.ReadColor), picRead);
AddBinding(nameof(HexEditorInfo.WriteColor), picWrite);
AddBinding(nameof(HexEditorInfo.ExecColor), picExecute);
AddBinding(nameof(HexEditorInfo.LabelledByteColor), picLabelledByte);
AddBinding(nameof(HexEditorInfo.CodeByteColor), picCodeByte);
AddBinding(nameof(HexEditorInfo.DataByteColor), picDataByte);
}
private void btnReset_Click(object sender, EventArgs e)
{
picRead.BackColor = Color.Blue;
picWrite.BackColor = Color.Red;
picExecute.BackColor = Color.Green;
picLabelledByte.BackColor = Color.LightPink;
picCodeByte.BackColor = Color.DarkSeaGreen;
picDataByte.BackColor = Color.LightSteelBlue;
}
}
}

View file

@ -0,0 +1,269 @@
namespace Mesen.GUI.Debugger
{
partial class frmMemoryToolsColors
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.lblCodeByte = new System.Windows.Forms.Label();
this.lblWrite = new System.Windows.Forms.Label();
this.picCodeByte = new ctrlColorPicker();
this.picWrite = new ctrlColorPicker();
this.picDataByte = new ctrlColorPicker();
this.lblDataByte = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.picLabelledByte = new ctrlColorPicker();
this.lblRead = new System.Windows.Forms.Label();
this.lblExecute = new System.Windows.Forms.Label();
this.picRead = new ctrlColorPicker();
this.picExecute = new ctrlColorPicker();
this.btnReset = new System.Windows.Forms.Button();
this.baseConfigPanel.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picCodeByte)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picWrite)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picDataByte)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picLabelledByte)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picRead)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picExecute)).BeginInit();
this.SuspendLayout();
//
// baseConfigPanel
//
this.baseConfigPanel.Controls.Add(this.btnReset);
this.baseConfigPanel.Location = new System.Drawing.Point(0, 128);
this.baseConfigPanel.Size = new System.Drawing.Size(453, 29);
this.baseConfigPanel.Controls.SetChildIndex(this.btnReset, 0);
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 8;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.lblCodeByte, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.lblWrite, 3, 0);
this.tableLayoutPanel1.Controls.Add(this.picCodeByte, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.picWrite, 4, 0);
this.tableLayoutPanel1.Controls.Add(this.picDataByte, 4, 2);
this.tableLayoutPanel1.Controls.Add(this.lblDataByte, 3, 2);
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.picLabelledByte, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.lblRead, 6, 0);
this.tableLayoutPanel1.Controls.Add(this.lblExecute, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.picRead, 7, 0);
this.tableLayoutPanel1.Controls.Add(this.picExecute, 1, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 7;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(453, 157);
this.tableLayoutPanel1.TabIndex = 2;
//
// lblCodeByte
//
this.lblCodeByte.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblCodeByte.AutoSize = true;
this.lblCodeByte.Location = new System.Drawing.Point(3, 88);
this.lblCodeByte.Name = "lblCodeByte";
this.lblCodeByte.Size = new System.Drawing.Size(59, 13);
this.lblCodeByte.TabIndex = 2;
this.lblCodeByte.Text = "Code Byte:";
//
// lblWrite
//
this.lblWrite.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblWrite.AutoSize = true;
this.lblWrite.Location = new System.Drawing.Point(160, 12);
this.lblWrite.Name = "lblWrite";
this.lblWrite.Size = new System.Drawing.Size(35, 13);
this.lblWrite.TabIndex = 10;
this.lblWrite.Text = "Write:";
//
// picCodeByte
//
this.picCodeByte.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picCodeByte.Cursor = System.Windows.Forms.Cursors.Hand;
this.picCodeByte.Location = new System.Drawing.Point(102, 79);
this.picCodeByte.Name = "picCodeByte";
this.picCodeByte.Size = new System.Drawing.Size(32, 32);
this.picCodeByte.TabIndex = 6;
this.picCodeByte.TabStop = false;
//
// picWrite
//
this.picWrite.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picWrite.Cursor = System.Windows.Forms.Cursors.Hand;
this.picWrite.Location = new System.Drawing.Point(259, 3);
this.picWrite.Name = "picWrite";
this.picWrite.Size = new System.Drawing.Size(32, 32);
this.picWrite.TabIndex = 8;
this.picWrite.TabStop = false;
//
// picDataByte
//
this.picDataByte.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picDataByte.Cursor = System.Windows.Forms.Cursors.Hand;
this.picDataByte.Location = new System.Drawing.Point(259, 79);
this.picDataByte.Name = "picDataByte";
this.picDataByte.Size = new System.Drawing.Size(32, 32);
this.picDataByte.TabIndex = 12;
this.picDataByte.TabStop = false;
//
// lblDataByte
//
this.lblDataByte.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblDataByte.AutoSize = true;
this.lblDataByte.Location = new System.Drawing.Point(160, 88);
this.lblDataByte.Name = "lblDataByte";
this.lblDataByte.Size = new System.Drawing.Size(57, 13);
this.lblDataByte.TabIndex = 1;
this.lblDataByte.Text = "Data Byte:";
//
// label1
//
this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 50);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(74, 13);
this.label1.TabIndex = 14;
this.label1.Text = "Labelled Byte:";
//
// picLabelledByte
//
this.picLabelledByte.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picLabelledByte.Cursor = System.Windows.Forms.Cursors.Hand;
this.picLabelledByte.Location = new System.Drawing.Point(102, 41);
this.picLabelledByte.Name = "picLabelledByte";
this.picLabelledByte.Size = new System.Drawing.Size(32, 32);
this.picLabelledByte.TabIndex = 15;
this.picLabelledByte.TabStop = false;
//
// lblRead
//
this.lblRead.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblRead.AutoSize = true;
this.lblRead.Location = new System.Drawing.Point(317, 12);
this.lblRead.Name = "lblRead";
this.lblRead.Size = new System.Drawing.Size(36, 13);
this.lblRead.TabIndex = 0;
this.lblRead.Text = "Read:";
//
// lblExecute
//
this.lblExecute.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblExecute.AutoSize = true;
this.lblExecute.Location = new System.Drawing.Point(3, 12);
this.lblExecute.Name = "lblExecute";
this.lblExecute.Size = new System.Drawing.Size(49, 13);
this.lblExecute.TabIndex = 11;
this.lblExecute.Text = "Execute:";
//
// picRead
//
this.picRead.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picRead.Cursor = System.Windows.Forms.Cursors.Hand;
this.picRead.Location = new System.Drawing.Point(416, 3);
this.picRead.Name = "picRead";
this.picRead.Size = new System.Drawing.Size(32, 32);
this.picRead.TabIndex = 5;
this.picRead.TabStop = false;
//
// picExecute
//
this.picExecute.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picExecute.Cursor = System.Windows.Forms.Cursors.Hand;
this.picExecute.Location = new System.Drawing.Point(102, 3);
this.picExecute.Name = "picExecute";
this.picExecute.Size = new System.Drawing.Size(32, 32);
this.picExecute.TabIndex = 9;
this.picExecute.TabStop = false;
//
// btnReset
//
this.btnReset.Location = new System.Drawing.Point(3, 3);
this.btnReset.Name = "btnReset";
this.btnReset.Size = new System.Drawing.Size(102, 23);
this.btnReset.TabIndex = 3;
this.btnReset.Text = "Use default colors";
this.btnReset.UseVisualStyleBackColor = true;
this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
//
// frmMemoryToolsColors
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(453, 157);
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "frmMemoryToolsColors";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Configure Colors...";
this.Controls.SetChildIndex(this.tableLayoutPanel1, 0);
this.Controls.SetChildIndex(this.baseConfigPanel, 0);
this.baseConfigPanel.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picCodeByte)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picWrite)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picDataByte)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picLabelledByte)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picRead)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picExecute)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label lblCodeByte;
private System.Windows.Forms.Label lblRead;
private System.Windows.Forms.Label lblDataByte;
private ctrlColorPicker picExecute;
private ctrlColorPicker picWrite;
private ctrlColorPicker picCodeByte;
private ctrlColorPicker picRead;
private System.Windows.Forms.Label lblWrite;
private System.Windows.Forms.Label lblExecute;
private ctrlColorPicker picDataByte;
private System.Windows.Forms.Button btnReset;
private System.Windows.Forms.Label label1;
private ctrlColorPicker picLabelledByte;
}
}

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View file

@ -114,6 +114,30 @@ namespace Mesen.GUI
return callstack;
}
[DllImport(DllPath, EntryPoint = "GetMemoryAccessStamps")] private static extern void GetMemoryAccessStampsWrapper(UInt32 offset, UInt32 length, SnesMemoryType type, MemoryOperationType operationType, [In,Out]UInt64[] stamps);
public static UInt64[] GetMemoryAccessStamps(UInt32 offset, UInt32 length, SnesMemoryType type, MemoryOperationType operationType)
{
UInt64[] stamps = new UInt64[length];
DebugApi.GetMemoryAccessStampsWrapper(offset, length, type, operationType, stamps);
return stamps;
}
[DllImport(DllPath, EntryPoint = "GetMemoryAccessCounts")] private static extern void GetMemoryAccessCountsWrapper(UInt32 offset, UInt32 length, SnesMemoryType type, MemoryOperationType operationType, [In,Out]UInt32[] counts);
public static UInt32[] GetMemoryAccessCounts(UInt32 offset, UInt32 length, SnesMemoryType type, MemoryOperationType operationType)
{
UInt32[] counts = new UInt32[length];
DebugApi.GetMemoryAccessCountsWrapper(offset, length, type, operationType, counts);
return counts;
}
[DllImport(DllPath, EntryPoint = "GetCdlData")] private static extern void GetCdlDataWrapper(UInt32 offset, UInt32 length, SnesMemoryType memType, [In,Out] byte[] cdlData);
public static byte[] GetCdlData(UInt32 offset, UInt32 length, SnesMemoryType memType)
{
byte[] cdlData = new byte[length];
DebugApi.GetCdlDataWrapper(offset, length, memType, cdlData);
return cdlData;
}
}
public enum SnesMemoryType
@ -125,8 +149,8 @@ namespace Mesen.GUI
VideoRam,
SpriteRam,
CGRam,
Register,
SpcRam
SpcRam,
Register
}
public class AddressInfo
@ -230,6 +254,7 @@ namespace Mesen.GUI
public struct DebugState
{
public UInt64 MasterClock;
public CpuState Cpu;
public PpuState Ppu;
}
@ -383,4 +408,16 @@ namespace Mesen.GUI
CpuStepOver,
PpuStep,
}
public enum CdlFlags : byte
{
None = 0x00,
Code = 0x01,
Data = 0x02,
JumpTarget = 0x04,
SubEntryPoint = 0x08,
IndexMode8 = 0x10,
MemoryMode8 = 0x20,
}
}

View file

@ -347,10 +347,11 @@
<Compile Include="Debugger\Controls\ctrlDisassemblyView.Designer.cs">
<DependentUpon>ctrlDisassemblyView.cs</DependentUpon>
</Compile>
<Compile Include="Debugger\Controls\ctrlHexViewer.cs">
<Compile Include="Debugger\MemoryTools\ByteColorProvider.cs" />
<Compile Include="Debugger\MemoryTools\ctrlHexViewer.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Debugger\Controls\ctrlHexViewer.designer.cs">
<Compile Include="Debugger\MemoryTools\ctrlHexViewer.designer.cs">
<DependentUpon>ctrlHexViewer.cs</DependentUpon>
</Compile>
<Compile Include="Debugger\Controls\ctrlWatch.cs">
@ -405,10 +406,10 @@
<Compile Include="Debugger\frmDebugger.Designer.cs">
<DependentUpon>frmDebugger.cs</DependentUpon>
</Compile>
<Compile Include="Debugger\frmFadeSpeed.cs">
<Compile Include="Debugger\MemoryTools\frmFadeSpeed.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Debugger\frmFadeSpeed.designer.cs">
<Compile Include="Debugger\MemoryTools\frmFadeSpeed.designer.cs">
<DependentUpon>frmFadeSpeed.cs</DependentUpon>
</Compile>
<Compile Include="Debugger\frmGoToLine.cs">
@ -417,13 +418,19 @@
<Compile Include="Debugger\frmGoToLine.designer.cs">
<DependentUpon>frmGoToLine.cs</DependentUpon>
</Compile>
<Compile Include="Debugger\frmMemoryTools.cs">
<Compile Include="Debugger\MemoryTools\frmMemoryTools.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Debugger\frmMemoryTools.designer.cs">
<Compile Include="Debugger\MemoryTools\frmMemoryTools.designer.cs">
<DependentUpon>frmMemoryTools.cs</DependentUpon>
</Compile>
<Compile Include="Debugger\GraphicsExtensions.cs" />
<Compile Include="Debugger\MemoryTools\frmMemoryViewerColors.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Debugger\MemoryTools\frmMemoryViewerColors.designer.cs">
<DependentUpon>frmMemoryViewerColors.cs</DependentUpon>
</Compile>
<Compile Include="Debugger\PpuViewer\ctrlPaletteViewer.cs">
<SubType>UserControl</SubType>
</Compile>
@ -483,7 +490,7 @@
<Compile Include="Debugger\HexBox\StaticByteProvider.cs" />
<Compile Include="Debugger\HexBox\TblByteCharConverter.cs" />
<Compile Include="Debugger\HexBox\Util.cs" />
<Compile Include="Debugger\TblLoader.cs" />
<Compile Include="Debugger\MemoryTools\TblLoader.cs" />
<Compile Include="Debugger\DebugWindowManager.cs" />
<Compile Include="Debugger\Tooltips\frmInfoTooltip.cs">
<SubType>Form</SubType>
@ -704,7 +711,7 @@
<EmbeddedResource Include="Debugger\Controls\ctrlDisassemblyView.resx">
<DependentUpon>ctrlDisassemblyView.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Debugger\Controls\ctrlHexViewer.resx">
<EmbeddedResource Include="Debugger\MemoryTools\ctrlHexViewer.resx">
<DependentUpon>ctrlHexViewer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Debugger\Controls\ctrlWatch.resx">
@ -728,15 +735,18 @@
<EmbeddedResource Include="Debugger\frmDebugger.resx">
<DependentUpon>frmDebugger.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Debugger\frmFadeSpeed.resx">
<EmbeddedResource Include="Debugger\MemoryTools\frmFadeSpeed.resx">
<DependentUpon>frmFadeSpeed.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Debugger\frmGoToLine.resx">
<DependentUpon>frmGoToLine.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Debugger\frmMemoryTools.resx">
<EmbeddedResource Include="Debugger\MemoryTools\frmMemoryTools.resx">
<DependentUpon>frmMemoryTools.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Debugger\MemoryTools\frmMemoryViewerColors.resx">
<DependentUpon>frmMemoryViewerColors.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Debugger\PpuViewer\ctrlPaletteViewer.resx">
<DependentUpon>ctrlPaletteViewer.cs</DependentUpon>
</EmbeddedResource>