Debugger: Added tile editor feature in PPU viewer

This commit is contained in:
Souryo 2017-03-04 21:50:19 -05:00
parent b48ba789bd
commit 485e8cc2ce
23 changed files with 707 additions and 257 deletions

View file

@ -756,6 +756,13 @@ uint8_t BaseMapper::InternalReadVRAM(uint16_t addr)
return 0;
}
void BaseMapper::InternalWriteVRAM(uint16_t addr, uint8_t value)
{
if(_chrPages[addr >> 8]) {
_chrPages[addr >> 8][addr & 0xFF] = value;
}
}
uint8_t BaseMapper::ReadVRAM(uint16_t addr, MemoryOperationType operationType)
{
return InternalReadVRAM(addr);
@ -765,8 +772,6 @@ void BaseMapper::WriteVRAM(uint16_t addr, uint8_t value)
{
if(_chrPageAccessType[addr >> 8] & MemoryAccessType::Write) {
_chrPages[addr >> 8][addr & 0xFF] = value;
} else {
//assert(false);
}
}
@ -827,6 +832,19 @@ uint32_t BaseMapper::GetMemorySize(DebugMemoryType type)
}
}
uint8_t BaseMapper::GetMemoryValue(DebugMemoryType memoryType, uint32_t address)
{
switch(memoryType) {
case DebugMemoryType::ChrRom: return _chrRom[address];
case DebugMemoryType::ChrRam: return _chrRam[address];
case DebugMemoryType::SaveRam: return _saveRam[address];
case DebugMemoryType::PrgRom: return _prgRom[address];
case DebugMemoryType::WorkRam: return _workRam[address];
}
return 0;
}
void BaseMapper::SetMemoryValue(DebugMemoryType memoryType, uint32_t address, uint8_t value)
{
switch(memoryType) {

View file

@ -217,6 +217,7 @@ public:
uint8_t InternalReadVRAM(uint16_t addr);
virtual uint8_t ReadVRAM(uint16_t addr, MemoryOperationType type = MemoryOperationType::Read);
void InternalWriteVRAM(uint16_t addr, uint8_t value);
void WriteVRAM(uint16_t addr, uint8_t value);
static void InitializeRam(void* data, uint32_t length);
@ -226,6 +227,7 @@ public:
uint8_t* GetPrgRom();
uint8_t* GetWorkRam();
uint8_t GetMemoryValue(DebugMemoryType memoryType, uint32_t address);
void SetMemoryValue(DebugMemoryType memoryType, uint32_t address, uint8_t value);
uint32_t GetMemorySize(DebugMemoryType type);

View file

@ -592,11 +592,6 @@ string* Debugger::GetCode()
return &_outputCache;
}
uint8_t Debugger::GetMemoryValue(uint32_t addr)
{
return _memoryManager->DebugRead(addr);
}
int32_t Debugger::GetRelativeAddress(uint32_t addr, AddressType type)
{
switch(type) {

View file

@ -146,7 +146,6 @@ public:
string GenerateOutput();
string* GetCode();
uint8_t GetMemoryValue(uint32_t addr);
int32_t GetRelativeAddress(uint32_t addr, AddressType type);
int32_t GetAbsoluteAddress(uint32_t addr);
void GetAbsoluteAddressAndType(uint32_t relativeAddr, AddressTypeInfo* info);

View file

@ -4,6 +4,7 @@
#include "ExpressionEvaluator.h"
#include "Console.h"
#include "Debugger.h"
#include "MemoryDumper.h"
#include "LabelManager.h"
#include "../Utilities/HexUtilities.h"
@ -342,8 +343,8 @@ int32_t ExpressionEvaluator::Evaluate(vector<int> *rpnList, DebugState &state, E
case EvalOperators::Minus: token = -right; break;
case EvalOperators::BinaryNot: token = ~right; break;
case EvalOperators::LogicalNot: token = !right; break;
case EvalOperators::Bracket: token = _debugger->GetMemoryValue(right); break;
case EvalOperators::Braces: token = _debugger->GetMemoryValue(right) | (_debugger->GetMemoryValue(right+1) << 8); break;
case EvalOperators::Bracket: token = _debugger->GetMemoryDumper()->GetMemoryValue(DebugMemoryType::CpuMemory, right); break;
case EvalOperators::Braces: token = _debugger->GetMemoryDumper()->GetMemoryValue(DebugMemoryType::CpuMemory, right) | (_debugger->GetMemoryDumper()->GetMemoryValue(DebugMemoryType::CpuMemory, right+1) << 8); break;
default: throw std::runtime_error("Invalid operator");
}
}

View file

@ -42,40 +42,6 @@ void MemoryDumper::SetMemoryState(DebugMemoryType type, uint8_t *buffer)
}
}
void MemoryDumper::SetMemoryValue(DebugMemoryType memoryType, uint32_t address, uint8_t value)
{
switch(memoryType) {
case DebugMemoryType::CpuMemory:
AddressTypeInfo info;
_debugger->GetAbsoluteAddressAndType(address, &info);
if(info.Address >= 0) {
switch(info.Type) {
case AddressType::InternalRam: SetMemoryValue(DebugMemoryType::InternalRam, info.Address, value); break;
case AddressType::PrgRom: SetMemoryValue(DebugMemoryType::PrgRom, info.Address, value); break;
case AddressType::WorkRam: SetMemoryValue(DebugMemoryType::WorkRam, info.Address, value); break;
case AddressType::SaveRam: SetMemoryValue(DebugMemoryType::SaveRam, info.Address, value); break;
}
}
break;
case DebugMemoryType::InternalRam: _memoryManager->DebugWrite(address, value); break;
case DebugMemoryType::PaletteMemory: _ppu->WritePaletteRAM(address, value); break;
case DebugMemoryType::SpriteMemory: _ppu->GetSpriteRam()[address] = value; break;
case DebugMemoryType::SecondarySpriteMemory: _ppu->GetSecondarySpriteRam()[address] = value; break;
case DebugMemoryType::PpuMemory: _mapper->WriteVRAM(address, value); break;
case DebugMemoryType::ChrRam:
case DebugMemoryType::WorkRam:
case DebugMemoryType::SaveRam:
case DebugMemoryType::PrgRom:
case DebugMemoryType::ChrRom:
_mapper->SetMemoryValue(memoryType, address, value);
break;
}
}
uint32_t MemoryDumper::GetMemoryState(DebugMemoryType type, uint8_t *buffer)
{
switch(type) {
@ -121,6 +87,75 @@ uint32_t MemoryDumper::GetMemoryState(DebugMemoryType type, uint8_t *buffer)
return 0;
}
void MemoryDumper::SetMemoryValue(DebugMemoryType memoryType, uint32_t address, uint8_t value)
{
switch(memoryType) {
case DebugMemoryType::CpuMemory:
AddressTypeInfo info;
_debugger->GetAbsoluteAddressAndType(address, &info);
if(info.Address >= 0) {
switch(info.Type) {
case AddressType::InternalRam: SetMemoryValue(DebugMemoryType::InternalRam, info.Address, value); break;
case AddressType::PrgRom: SetMemoryValue(DebugMemoryType::PrgRom, info.Address, value); break;
case AddressType::WorkRam: SetMemoryValue(DebugMemoryType::WorkRam, info.Address, value); break;
case AddressType::SaveRam: SetMemoryValue(DebugMemoryType::SaveRam, info.Address, value); break;
}
}
break;
case DebugMemoryType::InternalRam: _memoryManager->DebugWrite(address, value); break;
case DebugMemoryType::PaletteMemory: _ppu->WritePaletteRAM(address, value); break;
case DebugMemoryType::SpriteMemory: _ppu->GetSpriteRam()[address] = value; break;
case DebugMemoryType::SecondarySpriteMemory: _ppu->GetSecondarySpriteRam()[address] = value; break;
case DebugMemoryType::PpuMemory: _mapper->InternalWriteVRAM(address, value); break;
case DebugMemoryType::ChrRam:
case DebugMemoryType::WorkRam:
case DebugMemoryType::SaveRam:
case DebugMemoryType::PrgRom:
case DebugMemoryType::ChrRom:
_mapper->SetMemoryValue(memoryType, address, value);
break;
}
}
uint8_t MemoryDumper::GetMemoryValue(DebugMemoryType memoryType, uint32_t address)
{
switch(memoryType) {
case DebugMemoryType::CpuMemory:
AddressTypeInfo info;
_debugger->GetAbsoluteAddressAndType(address, &info);
if(info.Address >= 0) {
switch(info.Type) {
case AddressType::InternalRam: return GetMemoryValue(DebugMemoryType::InternalRam, info.Address);
case AddressType::PrgRom: return GetMemoryValue(DebugMemoryType::PrgRom, info.Address);
case AddressType::WorkRam: return GetMemoryValue(DebugMemoryType::WorkRam, info.Address);
case AddressType::SaveRam: return GetMemoryValue(DebugMemoryType::SaveRam, info.Address);
}
}
break;
case DebugMemoryType::InternalRam: return _memoryManager->DebugRead(address);
case DebugMemoryType::PaletteMemory: return _ppu->ReadPaletteRAM(address);
case DebugMemoryType::SpriteMemory: return _ppu->GetSpriteRam()[address];
case DebugMemoryType::SecondarySpriteMemory: return _ppu->GetSecondarySpriteRam()[address];
case DebugMemoryType::PpuMemory: return _mapper->InternalReadVRAM(address);
case DebugMemoryType::ChrRam:
case DebugMemoryType::WorkRam:
case DebugMemoryType::SaveRam:
case DebugMemoryType::PrgRom:
case DebugMemoryType::ChrRom:
return _mapper->GetMemoryValue(memoryType, address);
}
return 0;
}
void MemoryDumper::GetNametable(int nametableIndex, uint32_t* frameBuffer, uint8_t* tileData, uint8_t* paletteData)
{
uint16_t *screenBuffer = new uint16_t[256 * 240];

View file

@ -26,6 +26,7 @@ public:
void GetSprites(uint32_t* frameBuffer);
void GetPalette(uint32_t* frameBuffer);
uint8_t GetMemoryValue(DebugMemoryType memoryType, uint32_t address);
void SetMemoryValue(DebugMemoryType memoryType, uint32_t address, uint8_t value);
void SetMemoryState(DebugMemoryType type, uint8_t *buffer);
};

View file

@ -40,8 +40,8 @@ namespace Mesen.GUI.Debugger.Controls
private List<StackInfo> GetStackInfo()
{
int nmiHandler = InteropEmu.DebugGetMemoryValue(0xFFFA) | (InteropEmu.DebugGetMemoryValue(0xFFFB) << 8);
int irqHandler = InteropEmu.DebugGetMemoryValue(0xFFFE) | (InteropEmu.DebugGetMemoryValue(0xFFFF) << 8);
int nmiHandler = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFA) | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFB) << 8);
int irqHandler = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFE) | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFF) << 8);
InteropEmu.DebugGetCallstack(out _absoluteCallstack, out _relativeCallstack);
DebugState state = new DebugState();

View file

@ -27,18 +27,9 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.grpTileInfo = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.txtTileAddress = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.txtTileIndex = new System.Windows.Forms.TextBox();
this.picTile = new System.Windows.Forms.PictureBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.picChrBank1 = new System.Windows.Forms.PictureBox();
this.picChrBank2 = new System.Windows.Forms.PictureBox();
this.grpDisplayOptions = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.lblPalette = new System.Windows.Forms.Label();
@ -50,19 +41,39 @@
this.flpHighlight = new System.Windows.Forms.FlowLayoutPanel();
this.lblHighlight = new System.Windows.Forms.Label();
this.cboHighlightType = new System.Windows.Forms.ComboBox();
this.grpDisplayOptions = new System.Windows.Forms.GroupBox();
this.grpTileInfo = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.txtTileAddress = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.txtTileIndex = new System.Windows.Forms.TextBox();
this.picTile = new System.Windows.Forms.PictureBox();
this.picPaletteSelection = new System.Windows.Forms.PictureBox();
this.label3 = new System.Windows.Forms.Label();
this.picColorTooltip = new System.Windows.Forms.PictureBox();
this.picTileTooltip = new System.Windows.Forms.PictureBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.picChrBank1 = new System.Windows.Forms.PictureBox();
this.picChrBank2 = new System.Windows.Forms.PictureBox();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.picPaletteTooltip = new System.Windows.Forms.PictureBox();
this.tableLayoutPanel3.SuspendLayout();
this.grpTileInfo.SuspendLayout();
this.tableLayoutPanel4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picTile)).BeginInit();
this.tableLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picChrBank1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picChrBank2)).BeginInit();
this.grpDisplayOptions.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.flowLayoutPanel2.SuspendLayout();
this.flpHighlight.SuspendLayout();
this.grpDisplayOptions.SuspendLayout();
this.grpTileInfo.SuspendLayout();
this.tableLayoutPanel4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picTile)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picPaletteSelection)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picColorTooltip)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picTileTooltip)).BeginInit();
this.tableLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picChrBank1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picChrBank2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picPaletteTooltip)).BeginInit();
this.SuspendLayout();
//
// tableLayoutPanel3
@ -83,133 +94,16 @@
this.tableLayoutPanel3.Size = new System.Drawing.Size(534, 525);
this.tableLayoutPanel3.TabIndex = 3;
//
// grpTileInfo
// grpDisplayOptions
//
this.grpTileInfo.Controls.Add(this.tableLayoutPanel4);
this.grpTileInfo.Dock = System.Windows.Forms.DockStyle.Top;
this.grpTileInfo.Location = new System.Drawing.Point(267, 3);
this.grpTileInfo.Name = "grpTileInfo";
this.grpTileInfo.Size = new System.Drawing.Size(264, 152);
this.grpTileInfo.TabIndex = 4;
this.grpTileInfo.TabStop = false;
this.grpTileInfo.Text = "Tile Info";
//
// tableLayoutPanel4
//
this.tableLayoutPanel4.ColumnCount = 2;
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel4.Controls.Add(this.txtTileAddress, 1, 1);
this.tableLayoutPanel4.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel4.Controls.Add(this.label2, 0, 1);
this.tableLayoutPanel4.Controls.Add(this.label6, 0, 2);
this.tableLayoutPanel4.Controls.Add(this.txtTileIndex, 1, 0);
this.tableLayoutPanel4.Controls.Add(this.picTile, 1, 2);
this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 4;
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel4.Size = new System.Drawing.Size(258, 123);
this.tableLayoutPanel4.TabIndex = 0;
//
// txtTileAddress
//
this.txtTileAddress.Location = new System.Drawing.Point(77, 29);
this.txtTileAddress.Name = "txtTileAddress";
this.txtTileAddress.ReadOnly = true;
this.txtTileAddress.Size = new System.Drawing.Size(42, 20);
this.txtTileAddress.TabIndex = 8;
//
// label1
//
this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 6);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Tile Index:";
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 32);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(68, 13);
this.label2.TabIndex = 1;
this.label2.Text = "Tile Address:";
//
// label6
//
this.label6.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(3, 81);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(27, 13);
this.label6.TabIndex = 6;
this.label6.Text = "Tile:";
//
// txtTileIndex
//
this.txtTileIndex.Location = new System.Drawing.Point(77, 3);
this.txtTileIndex.Name = "txtTileIndex";
this.txtTileIndex.ReadOnly = true;
this.txtTileIndex.Size = new System.Drawing.Size(26, 20);
this.txtTileIndex.TabIndex = 7;
//
// picTile
//
this.picTile.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picTile.Location = new System.Drawing.Point(77, 55);
this.picTile.Name = "picTile";
this.picTile.Size = new System.Drawing.Size(66, 66);
this.picTile.TabIndex = 12;
this.picTile.TabStop = false;
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 1;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Controls.Add(this.picChrBank1, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.picChrBank2, 0, 1);
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 2;
this.tableLayoutPanel3.SetRowSpan(this.tableLayoutPanel2, 2);
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(258, 519);
this.tableLayoutPanel2.TabIndex = 7;
//
// picChrBank1
//
this.picChrBank1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picChrBank1.Location = new System.Drawing.Point(1, 1);
this.picChrBank1.Margin = new System.Windows.Forms.Padding(1);
this.picChrBank1.Name = "picChrBank1";
this.picChrBank1.Size = new System.Drawing.Size(256, 257);
this.picChrBank1.TabIndex = 0;
this.picChrBank1.TabStop = false;
this.picChrBank1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picChrBank_MouseMove);
//
// picChrBank2
//
this.picChrBank2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picChrBank2.Location = new System.Drawing.Point(1, 260);
this.picChrBank2.Margin = new System.Windows.Forms.Padding(1);
this.picChrBank2.Name = "picChrBank2";
this.picChrBank2.Size = new System.Drawing.Size(256, 257);
this.picChrBank2.TabIndex = 1;
this.picChrBank2.TabStop = false;
this.picChrBank2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picChrBank_MouseMove);
this.grpDisplayOptions.Controls.Add(this.tableLayoutPanel1);
this.grpDisplayOptions.Dock = System.Windows.Forms.DockStyle.Top;
this.grpDisplayOptions.Location = new System.Drawing.Point(267, 300);
this.grpDisplayOptions.Name = "grpDisplayOptions";
this.grpDisplayOptions.Size = new System.Drawing.Size(264, 133);
this.grpDisplayOptions.TabIndex = 4;
this.grpDisplayOptions.TabStop = false;
this.grpDisplayOptions.Text = "Display Options";
//
// tableLayoutPanel1
//
@ -235,6 +129,7 @@
//
this.flowLayoutPanel1.Controls.Add(this.lblPalette);
this.flowLayoutPanel1.Controls.Add(this.cboPalette);
this.flowLayoutPanel1.Controls.Add(this.picPaletteTooltip);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 27);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
@ -349,16 +244,210 @@
this.cboHighlightType.TabIndex = 1;
this.cboHighlightType.SelectedIndexChanged += new System.EventHandler(this.cboHighlightType_SelectedIndexChanged);
//
// grpDisplayOptions
// grpTileInfo
//
this.grpDisplayOptions.Controls.Add(this.tableLayoutPanel1);
this.grpDisplayOptions.Dock = System.Windows.Forms.DockStyle.Top;
this.grpDisplayOptions.Location = new System.Drawing.Point(267, 151);
this.grpDisplayOptions.Name = "grpDisplayOptions";
this.grpDisplayOptions.Size = new System.Drawing.Size(264, 133);
this.grpDisplayOptions.TabIndex = 4;
this.grpDisplayOptions.TabStop = false;
this.grpDisplayOptions.Text = "Display Options";
this.grpTileInfo.Controls.Add(this.tableLayoutPanel4);
this.grpTileInfo.Dock = System.Windows.Forms.DockStyle.Top;
this.grpTileInfo.Location = new System.Drawing.Point(267, 3);
this.grpTileInfo.Name = "grpTileInfo";
this.grpTileInfo.Size = new System.Drawing.Size(264, 291);
this.grpTileInfo.TabIndex = 4;
this.grpTileInfo.TabStop = false;
this.grpTileInfo.Text = "Tile Info";
//
// tableLayoutPanel4
//
this.tableLayoutPanel4.ColumnCount = 3;
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel4.Controls.Add(this.txtTileAddress, 1, 1);
this.tableLayoutPanel4.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel4.Controls.Add(this.label2, 0, 1);
this.tableLayoutPanel4.Controls.Add(this.label6, 0, 2);
this.tableLayoutPanel4.Controls.Add(this.txtTileIndex, 1, 0);
this.tableLayoutPanel4.Controls.Add(this.picTile, 1, 2);
this.tableLayoutPanel4.Controls.Add(this.picPaletteSelection, 1, 3);
this.tableLayoutPanel4.Controls.Add(this.label3, 0, 3);
this.tableLayoutPanel4.Controls.Add(this.picColorTooltip, 2, 3);
this.tableLayoutPanel4.Controls.Add(this.picTileTooltip, 2, 2);
this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 5;
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel4.Size = new System.Drawing.Size(258, 272);
this.tableLayoutPanel4.TabIndex = 0;
//
// txtTileAddress
//
this.txtTileAddress.BackColor = System.Drawing.SystemColors.Window;
this.txtTileAddress.Location = new System.Drawing.Point(77, 29);
this.txtTileAddress.Name = "txtTileAddress";
this.txtTileAddress.ReadOnly = true;
this.txtTileAddress.Size = new System.Drawing.Size(42, 20);
this.txtTileAddress.TabIndex = 8;
//
// label1
//
this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 6);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Tile Index:";
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 32);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(68, 13);
this.label2.TabIndex = 1;
this.label2.Text = "Tile Address:";
//
// label6
//
this.label6.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(3, 113);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(27, 13);
this.label6.TabIndex = 6;
this.label6.Text = "Tile:";
//
// txtTileIndex
//
this.txtTileIndex.BackColor = System.Drawing.SystemColors.Window;
this.txtTileIndex.Location = new System.Drawing.Point(77, 3);
this.txtTileIndex.Name = "txtTileIndex";
this.txtTileIndex.ReadOnly = true;
this.txtTileIndex.Size = new System.Drawing.Size(26, 20);
this.txtTileIndex.TabIndex = 7;
//
// picTile
//
this.picTile.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picTile.Location = new System.Drawing.Point(77, 55);
this.picTile.Name = "picTile";
this.picTile.Size = new System.Drawing.Size(130, 130);
this.picTile.TabIndex = 12;
this.picTile.TabStop = false;
this.picTile.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picTile_MouseDown);
this.picTile.MouseLeave += new System.EventHandler(this.picTile_MouseLeave);
this.picTile.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picTile_MouseMove);
this.picTile.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picTile_MouseUp);
//
// picPaletteSelection
//
this.picPaletteSelection.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picPaletteSelection.Location = new System.Drawing.Point(77, 191);
this.picPaletteSelection.Name = "picPaletteSelection";
this.picPaletteSelection.Size = new System.Drawing.Size(130, 34);
this.picPaletteSelection.TabIndex = 13;
this.picPaletteSelection.TabStop = false;
this.picPaletteSelection.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picPaletteSelection_MouseDown);
this.picPaletteSelection.MouseLeave += new System.EventHandler(this.picPaletteSelection_MouseLeave);
this.picPaletteSelection.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picPaletteSelection_MouseMove);
//
// label3
//
this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 201);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(67, 13);
this.label3.TabIndex = 14;
this.label3.Text = "Color Picker:";
//
// picColorTooltip
//
this.picColorTooltip.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.picColorTooltip.Image = global::Mesen.GUI.Properties.Resources.Help;
this.picColorTooltip.Location = new System.Drawing.Point(213, 201);
this.picColorTooltip.Name = "picColorTooltip";
this.picColorTooltip.Size = new System.Drawing.Size(14, 14);
this.picColorTooltip.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.picColorTooltip.TabIndex = 15;
this.picColorTooltip.TabStop = false;
//
// picTileTooltip
//
this.picTileTooltip.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.picTileTooltip.Image = global::Mesen.GUI.Properties.Resources.Help;
this.picTileTooltip.Location = new System.Drawing.Point(213, 113);
this.picTileTooltip.Name = "picTileTooltip";
this.picTileTooltip.Size = new System.Drawing.Size(14, 14);
this.picTileTooltip.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.picTileTooltip.TabIndex = 16;
this.picTileTooltip.TabStop = false;
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 1;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Controls.Add(this.picChrBank1, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.picChrBank2, 0, 1);
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 2;
this.tableLayoutPanel3.SetRowSpan(this.tableLayoutPanel2, 2);
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(258, 519);
this.tableLayoutPanel2.TabIndex = 7;
//
// picChrBank1
//
this.picChrBank1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picChrBank1.Cursor = System.Windows.Forms.Cursors.Hand;
this.picChrBank1.Location = new System.Drawing.Point(1, 1);
this.picChrBank1.Margin = new System.Windows.Forms.Padding(1);
this.picChrBank1.Name = "picChrBank1";
this.picChrBank1.Size = new System.Drawing.Size(256, 257);
this.picChrBank1.TabIndex = 0;
this.picChrBank1.TabStop = false;
this.picChrBank1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picChrBank_MouseDown);
this.picChrBank1.MouseLeave += new System.EventHandler(this.picChrBank_MouseLeave);
this.picChrBank1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picChrBank_MouseMove);
//
// picChrBank2
//
this.picChrBank2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picChrBank2.Cursor = System.Windows.Forms.Cursors.Hand;
this.picChrBank2.Location = new System.Drawing.Point(1, 260);
this.picChrBank2.Margin = new System.Windows.Forms.Padding(1);
this.picChrBank2.Name = "picChrBank2";
this.picChrBank2.Size = new System.Drawing.Size(256, 257);
this.picChrBank2.TabIndex = 1;
this.picChrBank2.TabStop = false;
this.picChrBank2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picChrBank_MouseDown);
this.picChrBank2.MouseLeave += new System.EventHandler(this.picChrBank_MouseLeave);
this.picChrBank2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picChrBank_MouseMove);
//
// toolTip
//
this.toolTip.AutoPopDelay = 32700;
this.toolTip.InitialDelay = 10;
this.toolTip.ReshowDelay = 10;
//
// picPaletteTooltip
//
this.picPaletteTooltip.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.picPaletteTooltip.Image = global::Mesen.GUI.Properties.Resources.Help;
this.picPaletteTooltip.Location = new System.Drawing.Point(103, 7);
this.picPaletteTooltip.Margin = new System.Windows.Forms.Padding(3, 4, 3, 3);
this.picPaletteTooltip.Name = "picPaletteTooltip";
this.picPaletteTooltip.Size = new System.Drawing.Size(14, 14);
this.picPaletteTooltip.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.picPaletteTooltip.TabIndex = 16;
this.picPaletteTooltip.TabStop = false;
//
// ctrlChrViewer
//
@ -368,13 +457,7 @@
this.Name = "ctrlChrViewer";
this.Size = new System.Drawing.Size(534, 525);
this.tableLayoutPanel3.ResumeLayout(false);
this.grpTileInfo.ResumeLayout(false);
this.tableLayoutPanel4.ResumeLayout(false);
this.tableLayoutPanel4.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picTile)).EndInit();
this.tableLayoutPanel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picChrBank1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picChrBank2)).EndInit();
this.grpDisplayOptions.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.flowLayoutPanel1.ResumeLayout(false);
@ -383,7 +466,17 @@
this.flowLayoutPanel2.PerformLayout();
this.flpHighlight.ResumeLayout(false);
this.flpHighlight.PerformLayout();
this.grpDisplayOptions.ResumeLayout(false);
this.grpTileInfo.ResumeLayout(false);
this.tableLayoutPanel4.ResumeLayout(false);
this.tableLayoutPanel4.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picTile)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picPaletteSelection)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picColorTooltip)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picTileTooltip)).EndInit();
this.tableLayoutPanel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picChrBank1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picChrBank2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picPaletteTooltip)).EndInit();
this.ResumeLayout(false);
}
@ -414,5 +507,11 @@
private System.Windows.Forms.PictureBox picChrBank2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.GroupBox grpDisplayOptions;
private System.Windows.Forms.PictureBox picPaletteSelection;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.PictureBox picColorTooltip;
private System.Windows.Forms.PictureBox picTileTooltip;
private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.PictureBox picPaletteTooltip;
}
}

View file

@ -19,6 +19,19 @@ namespace Mesen.GUI.Debugger.Controls
private int _chrSelection = 0;
private CdlHighlightType _highlightType = CdlHighlightType.None;
private bool _useLargeSprites = false;
private Bitmap _tilePreview;
private Bitmap[] _chrBanks = new Bitmap[2];
private bool _bottomBank = false;
private int _tileIndex = 0;
private bool _hoverBottomBank = false;
private int _hoverTileIndex = -1;
private int _selectedColor = 1;
private int _hoverColor = -1;
private int _tilePosX = -1;
private int _tilePosY = -1;
public ctrlChrViewer()
{
@ -28,6 +41,13 @@ namespace Mesen.GUI.Debugger.Controls
if(!designMode) {
this.cboPalette.SelectedIndex = 0;
this.cboHighlightType.SelectedIndex = 0;
this.picTile.Cursor = new Cursor(Properties.Resources.Pencil.GetHicon());
this.picPaletteSelection.Cursor = new Cursor(Properties.Resources.Pipette.GetHicon());
this.toolTip.SetToolTip(this.picTileTooltip, "Click on the tile to draw with the selected color." + Environment.NewLine + "Right button draws the background color.");
this.toolTip.SetToolTip(this.picColorTooltip, "Click on a color (or press 1-4) to select it.");
this.toolTip.SetToolTip(this.picPaletteTooltip, "Press Shift-1 to Shift-8 to select the palette.");
}
}
@ -59,11 +79,40 @@ namespace Mesen.GUI.Debugger.Controls
g.ScaleTransform(2, 2);
g.DrawImageUnscaled(source, 0, 0);
}
chrBanks[i].Image = target;
_chrBanks[i] = target;
Bitmap chrBankImage = new Bitmap(256, 256);
using(Graphics g = Graphics.FromImage(chrBankImage)) {
g.DrawImage(_chrBanks[i], 0, 0);
if((_bottomBank && i == 1) || (!_bottomBank && i == 0)) {
int tileX = _tileIndex % 16;
int tileY = _tileIndex / 16;
using(Brush brush = new SolidBrush(Color.FromArgb(192, Color.White))) {
g.FillRectangle(brush, tileX * 16, tileY * 16, 16, 16);
g.DrawRectangle(Pens.Black, tileX * 16, tileY * 16, 16, 16);
}
}
if(_hoverTileIndex >= 0) {
if((_hoverBottomBank && i == 1) || (!_hoverBottomBank && i == 0)) {
int tileX = _hoverTileIndex % 16;
int tileY = _hoverTileIndex / 16;
using(Brush brush = new SolidBrush(Color.FromArgb(192, Color.LightBlue))) {
g.FillRectangle(brush, tileX * 16, tileY * 16, 16, 16);
g.DrawRectangle(Pens.Black, tileX * 16 - 1, tileY * 16 - 1, 18, 18);
}
}
}
}
chrBanks[i].Image = chrBankImage;
} finally {
handle.Free();
}
}
this.RefreshPreview(_tileIndex, _bottomBank);
this.RefreshPalettePicker();
}
private UInt32 _chrSize;
@ -103,57 +152,253 @@ namespace Mesen.GUI.Debugger.Controls
private void cboPalette_SelectedIndexChanged(object sender, EventArgs e)
{
this._selectedPalette = this.cboPalette.SelectedIndex;
this.GetData();
this.RefreshViewer();
}
private void chkLargeSprites_Click(object sender, EventArgs e)
{
this._useLargeSprites = this.chkLargeSprites.Checked;
this.GetData();
this.RefreshViewer();
}
private void cboHighlightType_SelectedIndexChanged(object sender, EventArgs e)
{
this._highlightType = (CdlHighlightType)this.cboHighlightType.SelectedIndex;
this.GetData();
this.RefreshViewer();
}
private void cboChrSelection_SelectionChangeCommitted(object sender, EventArgs e)
{
this._chrSelection = this.cboChrSelection.SelectedIndex;
this.GetData();
this.RefreshViewer();
}
private void picChrBank_MouseMove(object sender, MouseEventArgs e)
{
List<PictureBox> chrBanks = new List<PictureBox>() { this.picChrBank1, this.picChrBank2 };
int bankIndex = chrBanks.IndexOf((PictureBox)sender);
int baseAddress = bankIndex == 0 ? 0x0000 : 0x1000;
int tileX = Math.Min(e.X / 16, 15);
int tileY = Math.Min(e.Y / 16, 15);
_hoverBottomBank = sender == this.picChrBank2;
_hoverTileIndex = tileY * 16 + tileX;
RefreshViewer();
RefreshPreview(_hoverTileIndex, _hoverBottomBank);
}
private void picChrBank_MouseDown(object sender, MouseEventArgs e)
{
int tileX = Math.Min(e.X / 16, 15);
int tileY = Math.Min(e.Y / 16, 15);
_tileIndex = tileY * 16 + tileX;
_bottomBank = sender == this.picChrBank2;
}
private void picChrBank_MouseLeave(object sender, EventArgs e)
{
_hoverTileIndex = -1;
RefreshPreview(_tileIndex, _bottomBank);
}
private void RefreshPreview(int tileIndex, bool bottomBank)
{
int baseAddress = bottomBank ? 0x1000 : 0x0000;
if(this.cboChrSelection.SelectedIndex > 1) {
baseAddress += (this.cboChrSelection.SelectedIndex - 1) * 0x2000;
}
int tileX = Math.Min(e.X / 16, 15);
int tileY = Math.Min(e.Y / 16, 15);
int tileX = tileIndex % 16;
int tileY = tileIndex / 16;
int tileIndex = tileY * 16 + tileX;
int realIndex = GetLargeSpriteIndex(tileIndex);
this.txtTileIndex.Text = realIndex.ToString("X2");
this.txtTileAddress.Text = (baseAddress + realIndex * 16).ToString("X4");
this.txtTileIndex.Text = tileIndex.ToString("X2");
this.txtTileAddress.Text = (baseAddress + tileIndex * 16).ToString("X4");
Bitmap tile = new Bitmap(64, 64);
Bitmap tilePreview = new Bitmap(16, 16);
using(Graphics g = Graphics.FromImage(tilePreview)) {
g.DrawImage(((PictureBox)sender).Image, new Rectangle(0, 0, 16, 16), new Rectangle(tileX*16, tileY*16, 16, 16), GraphicsUnit.Pixel);
_tilePreview = new Bitmap(128, 128);
Bitmap source = new Bitmap(16, 16);
using(Graphics g = Graphics.FromImage(source)) {
g.DrawImage(bottomBank ? this._chrBanks[1]: this._chrBanks[0], new Rectangle(0, 0, 16, 16), new Rectangle(tileX*16, tileY*16, 16, 16), GraphicsUnit.Pixel);
}
using(Graphics g = Graphics.FromImage(tile)) {
using(Graphics g = Graphics.FromImage(_tilePreview)) {
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
g.ScaleTransform(4, 4);
g.DrawImageUnscaled(tilePreview, 0, 0);
g.ScaleTransform(8, 8);
g.DrawImageUnscaled(source, 0, 0);
}
Bitmap tile = new Bitmap(128, 128);
using(Graphics g = Graphics.FromImage(tile)) {
g.DrawImageUnscaled(_tilePreview, 0, 0);
using(Brush brush = new SolidBrush(Color.FromArgb(128, Color.White))) {
g.FillRectangle(brush, _tilePosX*16, _tilePosY*16, 16, 16);
}
}
this.picTile.Image = tile;
}
private void picTile_MouseMove(object sender, MouseEventArgs e)
{
_tilePosX = Math.Max(0, Math.Min(e.X / 16, 7));
_tilePosY = Math.Max(0, Math.Min(e.Y / 16, 7));
RefreshPreview(_tileIndex, _bottomBank);
if(_drawing) {
DrawPixel(e.Button == MouseButtons.Left, _tilePosX, _tilePosY);
}
}
private void picTile_MouseLeave(object sender, EventArgs e)
{
_tilePosX = -1;
_tilePosY = -1;
}
private int GetLargeSpriteIndex(int tileIndex)
{
if(chkLargeSprites.Checked) {
int tileY = tileIndex / 16;
int tileX = tileIndex % 16;
int newX = (tileX * 2) % 16 + ((tileY & 0x01) == 0x01 ? 1 : 0);
int newY = (tileY & 0xFE) + ((tileX >= 8) ? 1 : 0);
return newY * 16 + newX;
} else {
return tileIndex;
}
}
private void DrawPixel(bool leftButton, int x, int y)
{
int baseAddress = _bottomBank ? 0x1000 : 0x0000;
bool ppuMemory = this.cboChrSelection.SelectedIndex == 0;
if(this.cboChrSelection.SelectedIndex > 1) {
baseAddress += (this.cboChrSelection.SelectedIndex - 1) * 0x2000;
}
int tileIndex = GetLargeSpriteIndex(_tileIndex);
byte orgByte1 = InteropEmu.DebugGetMemoryValue(ppuMemory ? DebugMemoryType.PpuMemory : DebugMemoryType.ChrRom, (UInt32)(baseAddress + tileIndex * 16 + y));
byte orgByte2 = InteropEmu.DebugGetMemoryValue(ppuMemory ? DebugMemoryType.PpuMemory : DebugMemoryType.ChrRom, (UInt32)(baseAddress + tileIndex * 16 + y + 8));
byte byte1 = (byte)(orgByte1 & ~(0x80 >> x));
byte byte2 = (byte)(orgByte2 & ~(0x80 >> x));
byte value = 0;
if(leftButton) {
value = (byte)_selectedColor;
byte1 |= (byte)(((value << 7) & 0x80) >> x);
byte2 |= (byte)(((value << 6) & 0x80) >> x);
}
if(byte1 != orgByte1 || byte2 != orgByte2) {
InteropEmu.DebugSetMemoryValue(ppuMemory ? DebugMemoryType.PpuMemory : DebugMemoryType.ChrRom, (UInt32)(baseAddress + tileIndex * 16 + y), byte1);
InteropEmu.DebugSetMemoryValue(ppuMemory ? DebugMemoryType.PpuMemory : DebugMemoryType.ChrRom, (UInt32)(baseAddress + tileIndex * 16 + y + 8), byte2);
GetData();
RefreshViewer();
}
}
private bool _drawing = false;
private void picTile_MouseDown(object sender, MouseEventArgs e)
{
_drawing = true;
int x = Math.Max(0, Math.Min(e.X / 16, 7));
int y = Math.Max(0, Math.Min(e.Y / 16, 7));
DrawPixel(e.Button == MouseButtons.Left, x, y);
}
private void picTile_MouseUp(object sender, MouseEventArgs e)
{
_drawing = false;
}
private void RefreshPalettePicker()
{
byte[] palette = InteropEmu.DebugGetPalette();
byte[] currentPalette = new byte[16];
Array.Copy(palette, cboPalette.SelectedIndex * 16, currentPalette, 0, 16);
GCHandle handle = GCHandle.Alloc(currentPalette, GCHandleType.Pinned);
try {
Bitmap source = new Bitmap(4, 1, 4*4, System.Drawing.Imaging.PixelFormat.Format32bppArgb, handle.AddrOfPinnedObject());
Bitmap target = new Bitmap(128, 32);
using(Graphics g = Graphics.FromImage(target)) {
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
g.ScaleTransform(32, 32);
g.DrawImageUnscaled(source, 0, 0);
g.ResetTransform();
DrawString("1", 5, 2, g);
DrawString("2", 37, 2, g);
DrawString("3", 69, 2, g);
DrawString("4", 101, 2, g);
using(Pen pen = new Pen(Color.LightBlue, 3)) {
g.DrawRectangle(pen, _selectedColor * 32 + 2, 2, 29, 29);
}
if(_hoverColor >= 0) {
using(Pen pen = new Pen(Color.DarkGray, 3)) {
g.DrawRectangle(pen, _hoverColor * 32 + 2, 2, 29, 29);
}
}
}
this.picPaletteSelection.Image = target;
} finally {
handle.Free();
}
}
private void DrawString(string number, int x, int y, Graphics g)
{
using(Font font = new Font(BaseControl.MonospaceFontFamily, 10)) {
for(int i = -1; i < 2; i++) {
for(int j = -1; j < 2; j++) {
if(i != 0 || j != 0) {
g.DrawString(number, font, Brushes.Black, j+x, i+y);
}
}
}
g.DrawString(number, font, Brushes.White, x, y);
}
}
private void picPaletteSelection_MouseMove(object sender, MouseEventArgs e)
{
_hoverColor = e.X / 32;
RefreshPalettePicker();
}
private void picPaletteSelection_MouseDown(object sender, MouseEventArgs e)
{
_selectedColor = e.X / 32;
RefreshPalettePicker();
}
private void picPaletteSelection_MouseLeave(object sender, EventArgs e)
{
_hoverColor = -1;
RefreshPalettePicker();
}
public void SelectPalette(int palette)
{
cboPalette.SelectedIndex = palette;
}
public void SelectColor(int color)
{
_selectedColor = color;
RefreshPalettePicker();
}
}
}

View file

@ -117,4 +117,7 @@
<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

@ -99,7 +99,7 @@ namespace Mesen.GUI.Debugger
{
lstStack.Items.Clear();
for(UInt32 i = (UInt32)0x100 + stackPointer; i < 0x200; i++) {
lstStack.Items.Add("$" + InteropEmu.DebugGetMemoryValue(i).ToString("X2"));
lstStack.Items.Add("$" + InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, i).ToString("X2"));
}
}
@ -200,9 +200,9 @@ namespace Mesen.GUI.Debugger
private void UpdateVectorAddresses()
{
int nmiHandler = InteropEmu.DebugGetMemoryValue(0xFFFA) | (InteropEmu.DebugGetMemoryValue(0xFFFB) << 8);
int resetHandler = InteropEmu.DebugGetMemoryValue(0xFFFC) | (InteropEmu.DebugGetMemoryValue(0xFFFD) << 8);
int irqHandler = InteropEmu.DebugGetMemoryValue(0xFFFE) | (InteropEmu.DebugGetMemoryValue(0xFFFF) << 8);
int nmiHandler = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFA) | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFB) << 8);
int resetHandler = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFC) | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFD) << 8);
int irqHandler = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFE) | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFF) << 8);
mnuGoToNmiHandler.Text = "NMI Handler ($" + nmiHandler.ToString("X4") + ")";
mnuGoToResetHandler.Text = "Reset Handler ($" + resetHandler.ToString("X4") + ")";
@ -216,19 +216,19 @@ namespace Mesen.GUI.Debugger
private void mnuGoToIrqHandler_Click(object sender, EventArgs e)
{
int address = (InteropEmu.DebugGetMemoryValue(0xFFFF) << 8) | InteropEmu.DebugGetMemoryValue(0xFFFE);
int address = (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFF) << 8) | InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFE);
this.OnGotoLocation?.Invoke(address, null);
}
private void mnuGoToNmiHandler_Click(object sender, EventArgs e)
{
int address = (InteropEmu.DebugGetMemoryValue(0xFFFB) << 8) | InteropEmu.DebugGetMemoryValue(0xFFFA);
int address = (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFB) << 8) | InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFA);
this.OnGotoLocation?.Invoke(address, null);
}
private void mnuGoToResetHandler_Click(object sender, EventArgs e)
{
int address = (InteropEmu.DebugGetMemoryValue(0xFFFD) << 8) | InteropEmu.DebugGetMemoryValue(0xFFFC);
int address = (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFD) << 8) | InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFC);
this.OnGotoLocation?.Invoke(address, null);
}

View file

@ -333,8 +333,8 @@ namespace Mesen.GUI.Debugger
private void DisplayAddressTooltip(string word, UInt32 address)
{
byte byteValue = InteropEmu.DebugGetMemoryValue(address);
UInt16 wordValue = (UInt16)(byteValue | (InteropEmu.DebugGetMemoryValue(address+1) << 8));
byte byteValue = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, address);
UInt16 wordValue = (UInt16)(byteValue | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, address+1) << 8));
var values = new Dictionary<string, string>() {
{ "Address", "$" + address.ToString("X4") },
@ -347,8 +347,8 @@ namespace Mesen.GUI.Debugger
private void DisplayLabelTooltip(string word, CodeLabel label)
{
Int32 relativeAddress = InteropEmu.DebugGetRelativeAddress(label.Address, label.AddressType);
byte byteValue = relativeAddress >= 0 ? InteropEmu.DebugGetMemoryValue((UInt32)relativeAddress) : (byte)0;
UInt16 wordValue = relativeAddress >= 0 ? (UInt16)(byteValue | (InteropEmu.DebugGetMemoryValue((UInt32)relativeAddress+1) << 8)) : (UInt16)0;
byte byteValue = relativeAddress >= 0 ? InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, (UInt32)relativeAddress) : (byte)0;
UInt16 wordValue = relativeAddress >= 0 ? (UInt16)(byteValue | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, (UInt32)relativeAddress+1) << 8)) : (UInt16)0;
var values = new Dictionary<string, string>() {
{ "Label", label.Label },
{ "Address", "$" + InteropEmu.DebugGetRelativeAddress(label.Address, label.AddressType).ToString("X4") },

View file

@ -213,7 +213,7 @@ namespace Mesen.GUI.Debugger
this.ctrlSplitContainerTop.Panel2.Controls.Add(this.tlpFunctionLabelLists);
this.ctrlSplitContainerTop.Panel2MinSize = 150;
this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1260, 390);
this.ctrlSplitContainerTop.SplitterDistance = 939;
this.ctrlSplitContainerTop.SplitterDistance = 933;
this.ctrlSplitContainerTop.SplitterWidth = 7;
this.ctrlSplitContainerTop.TabIndex = 3;
this.ctrlSplitContainerTop.PanelCollapsed += new System.EventHandler(this.ctrlSplitContainerTop_PanelCollapsed);
@ -234,7 +234,7 @@ namespace Mesen.GUI.Debugger
this.tlpTop.Name = "tlpTop";
this.tlpTop.RowCount = 1;
this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tlpTop.Size = new System.Drawing.Size(939, 390);
this.tlpTop.Size = new System.Drawing.Size(933, 390);
this.tlpTop.TabIndex = 2;
//
// ctrlDebuggerCode
@ -243,7 +243,7 @@ namespace Mesen.GUI.Debugger
this.ctrlDebuggerCode.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlDebuggerCode.Location = new System.Drawing.Point(3, 3);
this.ctrlDebuggerCode.Name = "ctrlDebuggerCode";
this.ctrlDebuggerCode.Size = new System.Drawing.Size(501, 384);
this.ctrlDebuggerCode.Size = new System.Drawing.Size(495, 384);
this.ctrlDebuggerCode.TabIndex = 2;
this.ctrlDebuggerCode.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement);
this.ctrlDebuggerCode.Enter += new System.EventHandler(this.ctrlDebuggerCode_Enter);
@ -251,7 +251,7 @@ namespace Mesen.GUI.Debugger
// ctrlConsoleStatus
//
this.ctrlConsoleStatus.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlConsoleStatus.Location = new System.Drawing.Point(507, 0);
this.ctrlConsoleStatus.Location = new System.Drawing.Point(501, 0);
this.ctrlConsoleStatus.Margin = new System.Windows.Forms.Padding(0);
this.ctrlConsoleStatus.Name = "ctrlConsoleStatus";
this.ctrlConsoleStatus.Size = new System.Drawing.Size(432, 390);
@ -262,7 +262,7 @@ namespace Mesen.GUI.Debugger
//
this.ctrlDebuggerCodeSplit.Code = null;
this.ctrlDebuggerCodeSplit.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(510, 3);
this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(504, 3);
this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit";
this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 384);
this.ctrlDebuggerCodeSplit.TabIndex = 4;
@ -283,7 +283,7 @@ namespace Mesen.GUI.Debugger
this.tlpFunctionLabelLists.RowCount = 2;
this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tlpFunctionLabelLists.Size = new System.Drawing.Size(314, 390);
this.tlpFunctionLabelLists.Size = new System.Drawing.Size(320, 390);
this.tlpFunctionLabelLists.TabIndex = 5;
//
// grpLabels
@ -292,7 +292,7 @@ namespace Mesen.GUI.Debugger
this.grpLabels.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpLabels.Location = new System.Drawing.Point(3, 198);
this.grpLabels.Name = "grpLabels";
this.grpLabels.Size = new System.Drawing.Size(308, 189);
this.grpLabels.Size = new System.Drawing.Size(314, 189);
this.grpLabels.TabIndex = 6;
this.grpLabels.TabStop = false;
this.grpLabels.Text = "Labels";
@ -302,7 +302,7 @@ namespace Mesen.GUI.Debugger
this.ctrlLabelList.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlLabelList.Location = new System.Drawing.Point(3, 16);
this.ctrlLabelList.Name = "ctrlLabelList";
this.ctrlLabelList.Size = new System.Drawing.Size(302, 170);
this.ctrlLabelList.Size = new System.Drawing.Size(308, 170);
this.ctrlLabelList.TabIndex = 0;
this.ctrlLabelList.OnFindOccurrence += new System.EventHandler(this.ctrlLabelList_OnFindOccurrence);
this.ctrlLabelList.OnLabelSelected += new System.EventHandler(this.ctrlLabelList_OnLabelSelected);
@ -313,7 +313,7 @@ namespace Mesen.GUI.Debugger
this.grpFunctions.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpFunctions.Location = new System.Drawing.Point(3, 3);
this.grpFunctions.Name = "grpFunctions";
this.grpFunctions.Size = new System.Drawing.Size(308, 189);
this.grpFunctions.Size = new System.Drawing.Size(314, 189);
this.grpFunctions.TabIndex = 5;
this.grpFunctions.TabStop = false;
this.grpFunctions.Text = "Functions";
@ -323,7 +323,7 @@ namespace Mesen.GUI.Debugger
this.ctrlFunctionList.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlFunctionList.Location = new System.Drawing.Point(3, 16);
this.ctrlFunctionList.Name = "ctrlFunctionList";
this.ctrlFunctionList.Size = new System.Drawing.Size(302, 170);
this.ctrlFunctionList.Size = new System.Drawing.Size(308, 170);
this.ctrlFunctionList.TabIndex = 0;
this.ctrlFunctionList.OnFindOccurrence += new System.EventHandler(this.ctrlFunctionList_OnFindOccurrence);
this.ctrlFunctionList.OnFunctionSelected += new System.EventHandler(this.ctrlFunctionList_OnFunctionSelected);
@ -450,7 +450,7 @@ namespace Mesen.GUI.Debugger
this.mnuAutoLoadDbgFiles,
this.mnuDisableDefaultLabels});
this.mnuWorkspace.Name = "mnuWorkspace";
this.mnuWorkspace.Size = new System.Drawing.Size(152, 22);
this.mnuWorkspace.Size = new System.Drawing.Size(132, 22);
this.mnuWorkspace.Text = "Workspace";
//
// mnuImportLabels
@ -493,13 +493,13 @@ namespace Mesen.GUI.Debugger
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(149, 6);
this.toolStripMenuItem3.Size = new System.Drawing.Size(129, 6);
//
// mnuClose
//
this.mnuClose.Image = global::Mesen.GUI.Properties.Resources.Exit;
this.mnuClose.Name = "mnuClose";
this.mnuClose.Size = new System.Drawing.Size(152, 22);
this.mnuClose.Size = new System.Drawing.Size(132, 22);
this.mnuClose.Text = "Close";
this.mnuClose.Click += new System.EventHandler(this.mnuClose_Click);
//

View file

@ -270,9 +270,9 @@ namespace Mesen.GUI.Debugger
private void UpdateVectorAddresses()
{
int nmiHandler = InteropEmu.DebugGetMemoryValue(0xFFFA) | (InteropEmu.DebugGetMemoryValue(0xFFFB) << 8);
int resetHandler = InteropEmu.DebugGetMemoryValue(0xFFFC) | (InteropEmu.DebugGetMemoryValue(0xFFFD) << 8);
int irqHandler = InteropEmu.DebugGetMemoryValue(0xFFFE) | (InteropEmu.DebugGetMemoryValue(0xFFFF) << 8);
int nmiHandler = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFA) | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFB) << 8);
int resetHandler = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFC) | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFD) << 8);
int irqHandler = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFE) | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFF) << 8);
mnuGoToNmiHandler.Text = "NMI Handler ($" + nmiHandler.ToString("X4") + ")";
mnuGoToResetHandler.Text = "Reset Handler ($" + resetHandler.ToString("X4") + ")";
@ -483,19 +483,19 @@ namespace Mesen.GUI.Debugger
private void mnuGoToIrqHandler_Click(object sender, EventArgs e)
{
int address = (InteropEmu.DebugGetMemoryValue(0xFFFF) << 8) | InteropEmu.DebugGetMemoryValue(0xFFFE);
int address = (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFF) << 8) | InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFE);
_lastCodeWindow.ScrollToLineNumber(address);
}
private void mnuGoToNmiHandler_Click(object sender, EventArgs e)
{
int address = (InteropEmu.DebugGetMemoryValue(0xFFFB) << 8) | InteropEmu.DebugGetMemoryValue(0xFFFA);
int address = (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFB) << 8) | InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFA);
_lastCodeWindow.ScrollToLineNumber(address);
}
private void mnuGoToResetHandler_Click(object sender, EventArgs e)
{
int address = (InteropEmu.DebugGetMemoryValue(0xFFFD) << 8) | InteropEmu.DebugGetMemoryValue(0xFFFC);
int address = (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFD) << 8) | InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFC);
_lastCodeWindow.ScrollToLineNumber(address);
}

View file

@ -136,5 +136,29 @@ namespace Mesen.GUI.Debugger
this.nudScanline.Value = 241;
this.nudCycle.Value = 0;
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
bool shift = keyData.HasFlag(Keys.Shift);
keyData &= ~Keys.Shift;
if(keyData >= Keys.D1 && keyData <= Keys.D8) {
if(shift) {
this.ctrlChrViewer.SelectPalette(keyData - Keys.D1);
} else {
this.ctrlChrViewer.SelectColor((keyData - Keys.D1) % 4);
}
return true;
}
if(keyData >= Keys.NumPad1 && keyData <= Keys.NumPad8) {
if(shift) {
this.ctrlChrViewer.SelectPalette(keyData - Keys.NumPad1);
} else {
this.ctrlChrViewer.SelectColor((keyData - Keys.NumPad1) % 4);
}
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
}
}

View file

@ -938,6 +938,8 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Icon.ico" />
<None Include="Resources\pencil.png" />
<None Include="Resources\pipette.png" />
<None Include="Resources\VideoRecorder.png" />
<None Include="Resources\Donate.png" />
<None Include="Resources\Dice.png" />

View file

@ -183,10 +183,10 @@ namespace Mesen.GUI
[DllImport(DLLPath)] public static extern void DebugRun();
[DllImport(DLLPath)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool DebugIsExecutionStopped();
[DllImport(DLLPath)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool DebugIsCodeChanged();
[DllImport(DLLPath)] public static extern Byte DebugGetMemoryValue(UInt32 addr);
[DllImport(DLLPath)] public static extern Int32 DebugGetRelativeAddress(UInt32 absoluteAddr, AddressType type);
[DllImport(DLLPath)] public static extern Int32 DebugGetAbsoluteAddress(UInt32 relativeAddr);
[DllImport(DLLPath)] public static extern Int32 DebugGetMemorySize(DebugMemoryType type);
[DllImport(DLLPath)] public static extern Byte DebugGetMemoryValue(DebugMemoryType type, UInt32 address);
[DllImport(DLLPath)] public static extern void DebugSetMemoryValue(DebugMemoryType type, UInt32 address, byte value);
[DllImport(DLLPath)] public static extern void DebugGetAbsoluteAddressAndType(UInt32 relativeAddr, ref AddressTypeInfo addressTypeInfo);
[DllImport(DLLPath)] public static extern void DebugSetPpuViewerScanlineCycle(Int32 scanline, Int32 cycle);

View file

@ -390,6 +390,26 @@ namespace Mesen.GUI.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Pencil {
get {
object obj = ResourceManager.GetObject("Pencil", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Pipette {
get {
object obj = ResourceManager.GetObject("Pipette", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View file

@ -250,4 +250,10 @@
<data name="Bug" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bug.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Pencil" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pencil.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Pipette" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pipette.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

View file

@ -62,7 +62,6 @@ extern "C"
DllExport void __stdcall DebugGetCallstack(int32_t *callstackAbsolute, int32_t *callstackRelative) { GetDebugger()->GetCallstack(callstackAbsolute, callstackRelative); }
DllExport void __stdcall DebugGetFunctionEntryPoints(int32_t *entryPoints) { GetDebugger()->GetFunctionEntryPoints(entryPoints); }
DllExport uint8_t __stdcall DebugGetMemoryValue(uint32_t addr) { return GetDebugger()->GetMemoryValue(addr); }
DllExport int32_t __stdcall DebugGetRelativeAddress(uint32_t addr, AddressType type) { return GetDebugger()->GetRelativeAddress(addr, type); }
DllExport int32_t __stdcall DebugGetAbsoluteAddress(uint32_t addr) { return GetDebugger()->GetAbsoluteAddress(addr); }
DllExport void __stdcall DebugGetAbsoluteAddressAndType(uint32_t relativeAddr, AddressTypeInfo* info) { return GetDebugger()->GetAbsoluteAddressAndType(relativeAddr, info); }
@ -79,6 +78,7 @@ extern "C"
DllExport void __stdcall DebugStopTraceLogger() { GetDebugger()->GetTraceLogger()->StopLogging(); }
DllExport const char* DebugGetExecutionTrace(uint32_t lineCount) { return GetDebugger()->GetTraceLogger()->GetExecutionTrace(lineCount); }
DllExport uint8_t __stdcall DebugGetMemoryValue(DebugMemoryType type, uint32_t address) { return GetDebugger()->GetMemoryDumper()->GetMemoryValue(type, address); }
DllExport void __stdcall DebugSetMemoryValue(DebugMemoryType type, uint32_t address, uint8_t value) { return GetDebugger()->GetMemoryDumper()->SetMemoryValue(type, address, value); }
DllExport int32_t __stdcall DebugGetMemorySize(DebugMemoryType type) { return GetDebugger()->GetMemorySize(type); }
DllExport void __stdcall DebugGetMemoryAccessCounts(AddressType memoryType, MemoryOperationType operationType, uint32_t* counts, bool forUninitReads) { GetDebugger()->GetMemoryAccessCounter()->GetAccessCounts(memoryType, operationType, counts, forUninitReads); }