diff --git a/Core/Breakpoint.cpp b/Core/Breakpoint.cpp
index 6378868..92891a2 100644
--- a/Core/Breakpoint.cpp
+++ b/Core/Breakpoint.cpp
@@ -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;
diff --git a/Core/BreakpointManager.h b/Core/BreakpointManager.h
index 422c098..b403610 100644
--- a/Core/BreakpointManager.h
+++ b/Core/BreakpointManager.h
@@ -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;
diff --git a/Core/CodeDataLogger.cpp b/Core/CodeDataLogger.cpp
index 1c26aee..7902ce0 100644
--- a/Core/CodeDataLogger.cpp
+++ b/Core/CodeDataLogger.cpp
@@ -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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Core/CodeDataLogger.h b/Core/CodeDataLogger.h
index df5c374..8256864 100644
--- a/Core/CodeDataLogger.h
+++ b/Core/CodeDataLogger.h
@@ -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);
};
\ No newline at end of file
diff --git a/Core/Console.cpp b/Core/Console.cpp
index ec9cbba..602c6d2 100644
--- a/Core/Console.cpp
+++ b/Core/Console.cpp
@@ -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) {
diff --git a/Core/Console.h b/Core/Console.h
index 06eabf3..3bfc96b 100644
--- a/Core/Console.h
+++ b/Core/Console.h
@@ -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();
diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj
index a975d63..5b3509b 100644
--- a/Core/Core.vcxproj
+++ b/Core/Core.vcxproj
@@ -70,6 +70,7 @@
+
@@ -157,6 +158,7 @@
+
diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters
index f89aa4f..29914c6 100644
--- a/Core/Core.vcxproj.filters
+++ b/Core/Core.vcxproj.filters
@@ -254,6 +254,9 @@
Debugger
+
+ Debugger
+
@@ -405,6 +408,9 @@
Debugger
+
+ Debugger
+
diff --git a/Core/DebugTypes.h b/Core/DebugTypes.h
index 249795c..1908052 100644
--- a/Core/DebugTypes.h
+++ b/Core/DebugTypes.h
@@ -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
diff --git a/Core/Debugger.cpp b/Core/Debugger.cpp
index a24e4c0..a5ead4b 100644
--- a/Core/Debugger.cpp
+++ b/Core/Debugger.cpp
@@ -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)
_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 Debugger::GetMemoryDumper()
return _memoryDumper;
}
+shared_ptr Debugger::GetMemoryAccessCounter()
+{
+ return _memoryAccessCounter;
+}
+
+shared_ptr Debugger::GetCodeDataLogger()
+{
+ return _codeDataLogger;
+}
+
shared_ptr Debugger::GetDisassembler()
{
return _disassembler;
diff --git a/Core/Debugger.h b/Core/Debugger.h
index e37430c..58e530a 100644
--- a/Core/Debugger.h
+++ b/Core/Debugger.h
@@ -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;
shared_ptr _memoryDumper;
+ shared_ptr _memoryAccessCounter;
shared_ptr _codeDataLogger;
shared_ptr _disassembler;
shared_ptr _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 GetTraceLogger();
shared_ptr GetMemoryDumper();
+ shared_ptr GetMemoryAccessCounter();
+ shared_ptr GetCodeDataLogger();
shared_ptr GetDisassembler();
shared_ptr GetBreakpointManager();
shared_ptr GetPpuTools();
diff --git a/Core/MemoryAccessCounter.cpp b/Core/MemoryAccessCounter.cpp
new file mode 100644
index 0000000..ba6492b
--- /dev/null
+++ b/Core/MemoryAccessCounter.cpp
@@ -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& 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& 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 &counts = GetCountArray(operation, addressInfo.Type);
+ counts[addressInfo.Address]++;
+
+ vector &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];
+ }
+}
diff --git a/Core/MemoryAccessCounter.h b/Core/MemoryAccessCounter.h
new file mode 100644
index 0000000..efb1977
--- /dev/null
+++ b/Core/MemoryAccessCounter.h
@@ -0,0 +1,37 @@
+#pragma once
+#include "stdafx.h"
+#include "DebugTypes.h"
+
+class Debugger;
+class MemoryManager;
+
+class MemoryAccessCounter
+{
+private:
+ vector _readCounts[(int)SnesMemoryType::Register];
+ vector _writeCounts[(int)SnesMemoryType::Register];
+ vector _execCounts[(int)SnesMemoryType::Register];
+
+ vector _readStamps[(int)SnesMemoryType::Register];
+ vector _writeStamps[(int)SnesMemoryType::Register];
+ vector _execStamps[(int)SnesMemoryType::Register];
+
+ vector _uninitReads[(int)SnesMemoryType::Register];
+
+ Debugger* _debugger;
+ MemoryManager* _memoryManager;
+
+ vector& GetCountArray(MemoryOperationType operationType, SnesMemoryType memType);
+ vector& 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[]);
+};
\ No newline at end of file
diff --git a/Core/Spc.cpp b/Core/Spc.cpp
index af99d5a..ae91d60 100644
--- a/Core/Spc.cpp
+++ b/Core/Spc.cpp
@@ -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;
}
diff --git a/InteropDLL/DebugApiWrapper.cpp b/InteropDLL/DebugApiWrapper.cpp
index 920d72d..5c06579 100644
--- a/InteropDLL/DebugApiWrapper.cpp
+++ b/InteropDLL/DebugApiWrapper.cpp
@@ -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); }
diff --git a/UI/Debugger/MemoryTools/ByteColorProvider.cs b/UI/Debugger/MemoryTools/ByteColorProvider.cs
new file mode 100644
index 0000000..6776c8c
--- /dev/null
+++ b/UI/Debugger/MemoryTools/ByteColorProvider.cs
@@ -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;
+ }
+ }
+}
diff --git a/UI/Debugger/TblLoader.cs b/UI/Debugger/MemoryTools/TblLoader.cs
similarity index 100%
rename from UI/Debugger/TblLoader.cs
rename to UI/Debugger/MemoryTools/TblLoader.cs
diff --git a/UI/Debugger/Controls/ctrlHexViewer.cs b/UI/Debugger/MemoryTools/ctrlHexViewer.cs
similarity index 100%
rename from UI/Debugger/Controls/ctrlHexViewer.cs
rename to UI/Debugger/MemoryTools/ctrlHexViewer.cs
diff --git a/UI/Debugger/Controls/ctrlHexViewer.designer.cs b/UI/Debugger/MemoryTools/ctrlHexViewer.designer.cs
similarity index 100%
rename from UI/Debugger/Controls/ctrlHexViewer.designer.cs
rename to UI/Debugger/MemoryTools/ctrlHexViewer.designer.cs
diff --git a/UI/Debugger/Controls/ctrlHexViewer.resx b/UI/Debugger/MemoryTools/ctrlHexViewer.resx
similarity index 100%
rename from UI/Debugger/Controls/ctrlHexViewer.resx
rename to UI/Debugger/MemoryTools/ctrlHexViewer.resx
diff --git a/UI/Debugger/frmFadeSpeed.cs b/UI/Debugger/MemoryTools/frmFadeSpeed.cs
similarity index 100%
rename from UI/Debugger/frmFadeSpeed.cs
rename to UI/Debugger/MemoryTools/frmFadeSpeed.cs
diff --git a/UI/Debugger/frmFadeSpeed.designer.cs b/UI/Debugger/MemoryTools/frmFadeSpeed.designer.cs
similarity index 100%
rename from UI/Debugger/frmFadeSpeed.designer.cs
rename to UI/Debugger/MemoryTools/frmFadeSpeed.designer.cs
diff --git a/UI/Debugger/frmFadeSpeed.resx b/UI/Debugger/MemoryTools/frmFadeSpeed.resx
similarity index 100%
rename from UI/Debugger/frmFadeSpeed.resx
rename to UI/Debugger/MemoryTools/frmFadeSpeed.resx
diff --git a/UI/Debugger/frmMemoryTools.cs b/UI/Debugger/MemoryTools/frmMemoryTools.cs
similarity index 92%
rename from UI/Debugger/frmMemoryTools.cs
rename to UI/Debugger/MemoryTools/frmMemoryTools.cs
index 722aada..91c5b3b 100644
--- a/UI/Debugger/frmMemoryTools.cs
+++ b/UI/Debugger/MemoryTools/frmMemoryTools.cs
@@ -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;
diff --git a/UI/Debugger/frmMemoryTools.designer.cs b/UI/Debugger/MemoryTools/frmMemoryTools.designer.cs
similarity index 92%
rename from UI/Debugger/frmMemoryTools.designer.cs
rename to UI/Debugger/MemoryTools/frmMemoryTools.designer.cs
index 9bdd35a..26da339 100644
--- a/UI/Debugger/frmMemoryTools.designer.cs
+++ b/UI/Debugger/MemoryTools/frmMemoryTools.designer.cs
@@ -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;
diff --git a/UI/Debugger/frmMemoryTools.resx b/UI/Debugger/MemoryTools/frmMemoryTools.resx
similarity index 100%
rename from UI/Debugger/frmMemoryTools.resx
rename to UI/Debugger/MemoryTools/frmMemoryTools.resx
diff --git a/UI/Debugger/MemoryTools/frmMemoryToolsColors.resx b/UI/Debugger/MemoryTools/frmMemoryToolsColors.resx
new file mode 100644
index 0000000..8766f29
--- /dev/null
+++ b/UI/Debugger/MemoryTools/frmMemoryToolsColors.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/UI/Debugger/MemoryTools/frmMemoryViewerColors.cs b/UI/Debugger/MemoryTools/frmMemoryViewerColors.cs
new file mode 100644
index 0000000..0eee87a
--- /dev/null
+++ b/UI/Debugger/MemoryTools/frmMemoryViewerColors.cs
@@ -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;
+ }
+ }
+}
diff --git a/UI/Debugger/MemoryTools/frmMemoryViewerColors.designer.cs b/UI/Debugger/MemoryTools/frmMemoryViewerColors.designer.cs
new file mode 100644
index 0000000..ea70c0d
--- /dev/null
+++ b/UI/Debugger/MemoryTools/frmMemoryViewerColors.designer.cs
@@ -0,0 +1,269 @@
+namespace Mesen.GUI.Debugger
+{
+ partial class frmMemoryToolsColors
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if(disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ 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;
+ }
+}
\ No newline at end of file
diff --git a/UI/Debugger/MemoryTools/frmMemoryViewerColors.resx b/UI/Debugger/MemoryTools/frmMemoryViewerColors.resx
new file mode 100644
index 0000000..8766f29
--- /dev/null
+++ b/UI/Debugger/MemoryTools/frmMemoryViewerColors.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/UI/Interop/DebugApi.cs b/UI/Interop/DebugApi.cs
index 36f655b..570c971 100644
--- a/UI/Interop/DebugApi.cs
+++ b/UI/Interop/DebugApi.cs
@@ -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,
+ }
}
diff --git a/UI/UI.csproj b/UI/UI.csproj
index 97edeee..27d1ede 100644
--- a/UI/UI.csproj
+++ b/UI/UI.csproj
@@ -347,10 +347,11 @@
ctrlDisassemblyView.cs
-
+
+
UserControl
-
+
ctrlHexViewer.cs
@@ -405,10 +406,10 @@
frmDebugger.cs
-
+
Form
-
+
frmFadeSpeed.cs
@@ -417,13 +418,19 @@
frmGoToLine.cs
-
+
Form
-
+
frmMemoryTools.cs
+
+ Form
+
+
+ frmMemoryViewerColors.cs
+
UserControl
@@ -483,7 +490,7 @@
-
+
Form
@@ -704,7 +711,7 @@
ctrlDisassemblyView.cs
-
+
ctrlHexViewer.cs
@@ -728,15 +735,18 @@
frmDebugger.cs
-
+
frmFadeSpeed.cs
frmGoToLine.cs
-
+
frmMemoryTools.cs
+
+ frmMemoryViewerColors.cs
+
ctrlPaletteViewer.cs