Debugger: Display labels in tooltips for addresses when a matching label exists
This commit is contained in:
parent
7939f73f82
commit
9bfdad8b9b
1 changed files with 42 additions and 19 deletions
|
@ -234,6 +234,34 @@ namespace Mesen.GUI.Debugger
|
|||
if(word.StartsWith("$")) {
|
||||
try {
|
||||
UInt32 address = UInt32.Parse(word.Substring(1), System.Globalization.NumberStyles.AllowHexSpecifier);
|
||||
|
||||
AddressTypeInfo info = new AddressTypeInfo();
|
||||
InteropEmu.DebugGetAbsoluteAddressAndType(address, ref info);
|
||||
|
||||
if(info.Address >= 0) {
|
||||
CodeLabel label = LabelManager.GetLabel((UInt32)info.Address, info.Type);
|
||||
if(label == null) {
|
||||
DisplayAddressTooltip(word, address);
|
||||
} else {
|
||||
DisplayLabelTooltip(word, label);
|
||||
}
|
||||
} else {
|
||||
DisplayAddressTooltip(word, address);
|
||||
}
|
||||
} catch { }
|
||||
} else {
|
||||
CodeLabel label = LabelManager.GetLabel(word);
|
||||
|
||||
if(label != null) {
|
||||
DisplayLabelTooltip(word, label);
|
||||
}
|
||||
}
|
||||
_previousLocation = e.Location;
|
||||
}
|
||||
}
|
||||
|
||||
private void DisplayAddressTooltip(string word, UInt32 address)
|
||||
{
|
||||
byte byteValue = InteropEmu.DebugGetMemoryValue(address);
|
||||
UInt16 wordValue = (UInt16)(byteValue | (InteropEmu.DebugGetMemoryValue(address+1) << 8));
|
||||
|
||||
|
@ -243,11 +271,10 @@ namespace Mesen.GUI.Debugger
|
|||
};
|
||||
|
||||
ShowTooltip(word, values);
|
||||
} catch { }
|
||||
} else {
|
||||
CodeLabel label = LabelManager.GetLabel(word);
|
||||
}
|
||||
|
||||
if(label != null) {
|
||||
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;
|
||||
|
@ -263,10 +290,6 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
ShowTooltip(word, values);
|
||||
}
|
||||
}
|
||||
_previousLocation = e.Location;
|
||||
}
|
||||
}
|
||||
|
||||
UInt32 _lastClickedAddress = UInt32.MaxValue;
|
||||
string _newWatchValue = string.Empty;
|
||||
|
|
Loading…
Add table
Reference in a new issue