Debugger - update register values

This commit is contained in:
adelikat 2014-12-06 13:42:59 +00:00
parent 4b8f5b2962
commit 93692b0220
4 changed files with 83 additions and 12 deletions

View File

@ -44,6 +44,7 @@
this.Script = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.RegistersGroupBox = new System.Windows.Forms.GroupBox();
this.RegisterPanel = new BizHawk.Client.EmuHawk.RegisterBoxControl();
this.BreakpointsGroupBox = new System.Windows.Forms.GroupBox();
this.menuStrip1.SuspendLayout();
this.TracerBox.SuspendLayout();
this.RegistersGroupBox.SuspendLayout();
@ -57,7 +58,7 @@
this.OptionsSubMenu});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(746, 24);
this.menuStrip1.Size = new System.Drawing.Size(767, 24);
this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "menuStrip1";
//
@ -180,7 +181,7 @@
this.RegistersGroupBox.Controls.Add(this.RegisterPanel);
this.RegistersGroupBox.Location = new System.Drawing.Point(425, 27);
this.RegistersGroupBox.Name = "RegistersGroupBox";
this.RegistersGroupBox.Size = new System.Drawing.Size(309, 234);
this.RegistersGroupBox.Size = new System.Drawing.Size(330, 234);
this.RegistersGroupBox.TabIndex = 8;
this.RegistersGroupBox.TabStop = false;
this.RegistersGroupBox.Text = "Registers";
@ -195,14 +196,27 @@
this.RegisterPanel.Location = new System.Drawing.Point(8, 19);
this.RegisterPanel.Name = "RegisterPanel";
this.RegisterPanel.ParentDebugger = null;
this.RegisterPanel.Size = new System.Drawing.Size(295, 209);
this.RegisterPanel.Size = new System.Drawing.Size(316, 209);
this.RegisterPanel.TabIndex = 0;
//
// BreakpointsGroupBox
//
this.BreakpointsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.BreakpointsGroupBox.Location = new System.Drawing.Point(425, 267);
this.BreakpointsGroupBox.Name = "BreakpointsGroupBox";
this.BreakpointsGroupBox.Size = new System.Drawing.Size(239, 281);
this.BreakpointsGroupBox.TabIndex = 9;
this.BreakpointsGroupBox.TabStop = false;
this.BreakpointsGroupBox.Text = "Breakpoints";
//
// GenericDebugger
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(746, 560);
this.ClientSize = new System.Drawing.Size(767, 560);
this.Controls.Add(this.BreakpointsGroupBox);
this.Controls.Add(this.RegistersGroupBox);
this.Controls.Add(this.TracerBox);
this.Controls.Add(this.menuStrip1);
@ -238,5 +252,6 @@
public System.Windows.Forms.ColumnHeader Script;
private System.Windows.Forms.GroupBox RegistersGroupBox;
private RegisterBoxControl RegisterPanel;
private System.Windows.Forms.GroupBox BreakpointsGroupBox;
}
}

View File

@ -5,6 +5,7 @@
public void UpdateValues()
{
UpdateTraceLog();
RegisterPanel.UpdateValues();
}
public void FastUpdate()

View File

@ -103,6 +103,13 @@ namespace BizHawk.Client.EmuHawk
}
}
private void TraceView_QueryItemText(int index, int column, out string text)
{
text = index < _instructions.Count ? _instructions[index] : string.Empty;

View File

@ -30,6 +30,44 @@ namespace BizHawk.Client.EmuHawk
}
public void UpdateValues()
{
if (this.Enabled)
{
var registers = Core.GetCpuFlagsAndRegisters();
_supressChangeEvents = true;
foreach (var register in registers)
{
Controls
.OfType<CheckBox>()
.ToList()
.ForEach(checkbox =>
{
if (checkbox.Name == register.Key)
{
checkbox.Checked = register.Value == 1;
}
});
Controls
.OfType<TextBox>()
.ToList()
.ForEach(textbox =>
{
if (textbox.Name == register.Key)
{
textbox.Text = register.Value.ToString();
}
});
}
_supressChangeEvents = false;
}
}
private bool CanGetCpuRegisters
{
get
@ -84,9 +122,9 @@ namespace BizHawk.Client.EmuHawk
{
this.Controls.Add(new Label
{
Text = register.Key + (canset ? ": " : ""),
Text = register.Key.Replace("Flag ", "") + (canset ? ": " : ""),
Location = new Point(5, y + 2),
Width = 50
Width = 35
});
if (canset)
@ -98,7 +136,7 @@ namespace BizHawk.Client.EmuHawk
Name = register.Key,
Text = "",
Checked = register.Value == 1 ? true : false,
Location = new Point(55, y)
Location = new Point(40, y)
};
c.CheckedChanged += (o, e) =>
@ -127,13 +165,23 @@ namespace BizHawk.Client.EmuHawk
{
Name = register.Key,
Text = register.Value.ToString(),
Width = 75,
Location = new Point(55, y),
Width = 45,
Location = new Point(40, y),
};
t.TextChanged += (o, e) =>
{
Core.SetCpuRegister(t.Name, int.Parse(t.Text));
if (!_supressChangeEvents)
{
try
{
Core.SetCpuRegister(t.Name, int.Parse(t.Text));
}
catch (InvalidOperationException)
{
t.Enabled = false;
}
}
};
this.Controls.Add(t);
@ -145,8 +193,8 @@ namespace BizHawk.Client.EmuHawk
{
Name = register.Key,
Text = register.Value.ToString(),
Width = 75,
Location = new Point(55, y)
Width = 45,
Location = new Point(40, y)
});
}