Debugger: Hex Editor - Implemented "highlight labeled bytes" option

This commit is contained in:
Sour 2019-05-01 23:01:18 -04:00
parent 006290a95b
commit 642f72a2f9
3 changed files with 18 additions and 20 deletions

View file

@ -184,7 +184,7 @@ namespace Mesen.GUI.Debugger.Labels
LabelManager.SetLabel(0x2107, SnesMemoryType.Register, "BG1SC", "BG Tilemap Address Registers (BG1)");
LabelManager.SetLabel(0x2108, SnesMemoryType.Register, "BG2SC", "BG Tilemap Address Registers (BG2)");
LabelManager.SetLabel(0x2109, SnesMemoryType.Register, "BG3SC", "BG Tilemap Address Registers (BG3)");
LabelManager.SetLabel(0x210A, SnesMemoryType.Register, "BG3SC", "BG Tilemap Address Registers (BG4)");
LabelManager.SetLabel(0x210A, SnesMemoryType.Register, "BG4SC", "BG Tilemap Address Registers (BG4)");
LabelManager.SetLabel(0x210B, SnesMemoryType.Register, "BG12NBA", "BG Character Address Registers (BG1&2)");
LabelManager.SetLabel(0x210C, SnesMemoryType.Register, "BG34NBA", "BG Character Address Registers (BG3&4)");
LabelManager.SetLabel(0x210D, SnesMemoryType.Register, "BG1HOFS", "BG Scroll Registers (BG1)");

View file

@ -3,6 +3,7 @@ using System.Drawing;
using System.Linq;
using Be.Windows.Forms;
using Mesen.GUI.Config;
using Mesen.GUI.Debugger.Labels;
namespace Mesen.GUI.Debugger
{
@ -16,7 +17,7 @@ namespace Mesen.GUI.Debugger
UInt32[] _writeCounts;
UInt32[] _execCounts;
byte[] _cdlData;
//bool[] _hasLabel;
bool[] _hasLabel;
DebugState _state = new DebugState();
bool _showExec;
bool _showWrite;
@ -28,7 +29,7 @@ namespace Mesen.GUI.Debugger
bool _hideExecutedBytes;
bool _highlightDataBytes;
bool _highlightCodeBytes;
//bool _highlightLabelledBytes;
bool _highlightLabelledBytes;
bool _highlightBreakpoints;
ByteColors _colors = new ByteColors();
BreakpointTypeFlags[] _breakpointTypes;
@ -46,7 +47,7 @@ namespace Mesen.GUI.Debugger
_hideExecutedBytes = hideExecutedBytes;
_highlightDataBytes = highlightDataBytes;
_highlightCodeBytes = highlightCodeBytes;
//_highlightLabelledBytes = highlightLabelledBytes;
_highlightLabelledBytes = highlightLabelledBytes;
_highlightBreakpoints = highlightBreakpoints;
}
@ -89,22 +90,21 @@ namespace Mesen.GUI.Debugger
}
}
//TODO LABELS
/*_hasLabel = new bool[visibleByteCount];
_hasLabel = new bool[visibleByteCount];
if(_highlightLabelledBytes) {
if(_memoryType == DebugMemoryType.CpuMemory) {
if(_memoryType <= SnesMemoryType.SpcMemory) {
AddressInfo addr = new AddressInfo();
addr.Type = _memoryType;
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)
);
addr.Address = (int)(firstByteIndex + i);
_hasLabel[i] = !string.IsNullOrWhiteSpace(LabelManager.GetLabel(addr)?.Label);
}
} else if(_memoryType == DebugMemoryType.PrgRom || _memoryType == DebugMemoryType.WorkRam || _memoryType == DebugMemoryType.SaveRam) {
} else if(_memoryType == SnesMemoryType.PrgRom || _memoryType == SnesMemoryType.WorkRam || _memoryType == SnesMemoryType.SaveRam) {
for(long i = 0; i < _hasLabel.Length; i++) {
_hasLabel[i] = !string.IsNullOrWhiteSpace(LabelManager.GetLabel((uint)(firstByteIndex + i), _memoryType.ToAddressType())?.Label);
_hasLabel[i] = !string.IsNullOrWhiteSpace(LabelManager.GetLabel((uint)(firstByteIndex + i), _memoryType)?.Label);
}
}
}*/
}
_state = DebugApi.GetState();
}
@ -156,11 +156,10 @@ namespace Mesen.GUI.Debugger
}
}
//TODO LABELS
/*if(_hasLabel[index]) {
if(_hasLabel[index]) {
//Labels/comments
_colors.BackColor = cfg.LabelledByteColor;
}*/
}
_colors.BorderColor = Color.Empty;
if(_breakpointTypes != null) {

View file

@ -150,8 +150,9 @@ namespace Mesen.GUI.Debugger
cboMemoryType.Items.Clear();
cboMemoryType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.CpuMemory));
cboMemoryType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.PrgRom));
cboMemoryType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.SpcMemory));
cboMemoryType.Items.Add("-");
cboMemoryType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.PrgRom));
cboMemoryType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.WorkRam));
if(DebugApi.GetMemorySize(SnesMemoryType.SaveRam) > 0) {
cboMemoryType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.SaveRam));
@ -160,8 +161,6 @@ namespace Mesen.GUI.Debugger
cboMemoryType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.VideoRam));
cboMemoryType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.CGRam));
cboMemoryType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.SpriteRam));
cboMemoryType.Items.Add("-");
cboMemoryType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.SpcMemory));
cboMemoryType.SelectedIndex = 0;
cboMemoryType.SetEnumValue(originalValue);