mirror of
https://github.com/SourMesen/Mesen.git
synced 2025-04-02 10:52:48 -04:00
Debugger: Improved debugger window address fields usability
This commit is contained in:
parent
075b6fbeee
commit
ea99b8a792
2 changed files with 59 additions and 26 deletions
26
GUI.NET/Debugger/frmBreakpoint.Designer.cs
generated
26
GUI.NET/Debugger/frmBreakpoint.Designer.cs
generated
|
@ -28,6 +28,7 @@
|
|||
private void InitializeComponent()
|
||||
{
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.chkMarkOnEventViewer = new System.Windows.Forms.CheckBox();
|
||||
this.lblBreakpointType = new System.Windows.Forms.Label();
|
||||
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.chkRead = new System.Windows.Forms.CheckBox();
|
||||
|
@ -57,7 +58,6 @@
|
|||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.lblCondition = new System.Windows.Forms.Label();
|
||||
this.chkEnabled = new System.Windows.Forms.CheckBox();
|
||||
this.chkMarkOnEventViewer = new System.Windows.Forms.CheckBox();
|
||||
this.baseConfigPanel.SuspendLayout();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.flowLayoutPanel2.SuspendLayout();
|
||||
|
@ -104,6 +104,18 @@
|
|||
this.tableLayoutPanel1.Size = new System.Drawing.Size(426, 241);
|
||||
this.tableLayoutPanel1.TabIndex = 2;
|
||||
//
|
||||
// chkMarkOnEventViewer
|
||||
//
|
||||
this.chkMarkOnEventViewer.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.chkMarkOnEventViewer, 2);
|
||||
this.chkMarkOnEventViewer.Location = new System.Drawing.Point(6, 194);
|
||||
this.chkMarkOnEventViewer.Margin = new System.Windows.Forms.Padding(6, 6, 3, 3);
|
||||
this.chkMarkOnEventViewer.Name = "chkMarkOnEventViewer";
|
||||
this.chkMarkOnEventViewer.Size = new System.Drawing.Size(131, 17);
|
||||
this.chkMarkOnEventViewer.TabIndex = 15;
|
||||
this.chkMarkOnEventViewer.Text = "Mark on Event Viewer";
|
||||
this.chkMarkOnEventViewer.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// lblBreakpointType
|
||||
//
|
||||
this.lblBreakpointType.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
|
@ -459,18 +471,6 @@
|
|||
this.chkEnabled.Text = "Break Execution";
|
||||
this.chkEnabled.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chkMarkOnEventViewer
|
||||
//
|
||||
this.chkMarkOnEventViewer.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.chkMarkOnEventViewer, 2);
|
||||
this.chkMarkOnEventViewer.Location = new System.Drawing.Point(6, 194);
|
||||
this.chkMarkOnEventViewer.Margin = new System.Windows.Forms.Padding(6, 6, 3, 3);
|
||||
this.chkMarkOnEventViewer.Name = "chkMarkOnEventViewer";
|
||||
this.chkMarkOnEventViewer.Size = new System.Drawing.Size(131, 17);
|
||||
this.chkMarkOnEventViewer.TabIndex = 15;
|
||||
this.chkMarkOnEventViewer.Text = "Mark on Event Viewer";
|
||||
this.chkMarkOnEventViewer.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// frmBreakpoint
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
|
|
@ -69,7 +69,33 @@ namespace Mesen.GUI.Debugger
|
|||
this.toolTip.SetToolTip(this.picExpressionWarning, "Condition contains invalid syntax or symbols.");
|
||||
this.toolTip.SetToolTip(this.picHelp, frmBreakpoint.GetConditionTooltip(false));
|
||||
}
|
||||
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
Breakpoint bp = (Breakpoint)this.Entity;
|
||||
if(!BreakpointManager.Breakpoints.Contains(bp)) {
|
||||
//This is a new breakpoint, make sure address fields are empty instead of 0
|
||||
if(txtAddress.Text == "0") {
|
||||
txtAddress.Text = "";
|
||||
}
|
||||
if(txtFrom.Text == "0") {
|
||||
txtFrom.Text = "";
|
||||
}
|
||||
if(txtTo.Text == "0") {
|
||||
txtTo.Text = "";
|
||||
}
|
||||
}
|
||||
if(bp.Address == 0 && bp.AddressType != BreakpointAddressType.SingleAddress) {
|
||||
txtAddress.Text = "";
|
||||
}
|
||||
if(bp.StartAddress == 0 && bp.EndAddress == 0 && bp.AddressType != BreakpointAddressType.AddressRange) {
|
||||
txtFrom.Text = "";
|
||||
txtTo.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetConditionTooltip(bool forWatch)
|
||||
{
|
||||
string tooltip =
|
||||
|
@ -132,22 +158,17 @@ namespace Mesen.GUI.Debugger
|
|||
picExpressionWarning.Visible = false;
|
||||
|
||||
DebugMemoryType type = cboBreakpointType.GetEnumValue<DebugMemoryType>();
|
||||
|
||||
|
||||
int maxValue = InteropEmu.DebugGetMemorySize(type) - 1;
|
||||
|
||||
if(radRange.Checked) {
|
||||
int start = 0, end = 0;
|
||||
int.TryParse(txtFrom.Text, NumberStyles.HexNumber, null, out start);
|
||||
int.TryParse(txtTo.Text, NumberStyles.HexNumber, null, out end);
|
||||
if(end < start || end > maxValue || start > maxValue) {
|
||||
if(radSpecificAddress.Checked) {
|
||||
if(ValidateAddress(txtAddress, maxValue) < 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int address;
|
||||
if(int.TryParse(txtAddress.Text, NumberStyles.HexNumber, null, out address)) {
|
||||
if(address > maxValue) {
|
||||
} else if(radRange.Checked) {
|
||||
int start = ValidateAddress(txtFrom, maxValue);
|
||||
int end = ValidateAddress(txtTo, maxValue);
|
||||
|
||||
if(start < 0 || end < 0 || end < start) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -155,6 +176,18 @@ namespace Mesen.GUI.Debugger
|
|||
return chkRead.Checked || chkWrite.Checked || (chkExec.Checked && Breakpoint.IsTypeCpuBreakpoint(type)) || txtCondition.Text.Length > 0;
|
||||
}
|
||||
|
||||
private int ValidateAddress(TextBox field, int maxValue)
|
||||
{
|
||||
int value = -1;
|
||||
if(!int.TryParse(field.Text, NumberStyles.HexNumber, null, out value) || value > maxValue) {
|
||||
field.ForeColor = Color.Red;
|
||||
value = -1;
|
||||
} else {
|
||||
field.ForeColor = SystemColors.WindowText;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private void txtAddress_Enter(object sender, EventArgs e)
|
||||
{
|
||||
radSpecificAddress.Checked = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue