Misc cleanups

This commit is contained in:
adelikat 2017-05-24 09:06:31 -05:00
parent 4d1dd215e6
commit 47f2371953
12 changed files with 115 additions and 145 deletions

View File

@ -1,10 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
@ -21,7 +15,8 @@ namespace BizHawk.Client.EmuHawk
AddressMask = 0xFFFFFFFF; AddressMask = 0xFFFFFFFF;
} }
public AddBreakpointDialog(BreakpointOperation op, uint address, uint mask, MemoryCallbackType type):this(op) public AddBreakpointDialog(BreakpointOperation op, uint address, uint mask, MemoryCallbackType type)
: this(op)
{ {
AddressMaskBox.SetHexProperties(0xFFFFFFFF); AddressMaskBox.SetHexProperties(0xFFFFFFFF);
Address = address; Address = address;
@ -37,6 +32,7 @@ namespace BizHawk.Client.EmuHawk
{ {
return _operation; return _operation;
} }
set set
{ {
switch (value) switch (value)
@ -51,6 +47,7 @@ namespace BizHawk.Client.EmuHawk
Text = "Edit Breakpoint"; Text = "Edit Breakpoint";
break; break;
} }
_operation = value; _operation = value;
} }
} }
@ -63,7 +60,6 @@ namespace BizHawk.Client.EmuHawk
} }
ExecuteRadio.Enabled = false; ExecuteRadio.Enabled = false;
} }
public MemoryCallbackType BreakType public MemoryCallbackType BreakType
@ -124,6 +120,7 @@ namespace BizHawk.Client.EmuHawk
{ {
return AddressBox.GetMax(); return AddressBox.GetMax();
} }
set set
{ {
AddressBox.SetHexProperties(value); AddressBox.SetHexProperties(value);
@ -145,13 +142,11 @@ namespace BizHawk.Client.EmuHawk
private void AddBreakpointDialog_Load(object sender, EventArgs e) private void AddBreakpointDialog_Load(object sender, EventArgs e)
{ {
} }
public enum BreakpointOperation public enum BreakpointOperation
{ {
Add, Edit, Duplicate Add, Edit, Duplicate
} }
} }
} }

View File

@ -1,8 +1,7 @@
using BizHawk.Emulation.Common; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text; using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
@ -34,6 +33,7 @@ namespace BizHawk.Client.EmuHawk
breakpoint.ReadOnly = false; breakpoint.ReadOnly = false;
breakpoint.Active = false; breakpoint.Active = false;
} }
return base.Remove(b); return base.Remove(b);
} }
@ -59,6 +59,7 @@ namespace BizHawk.Client.EmuHawk
removeCount++; removeCount++;
} }
} }
return removeCount; return removeCount;
} }
} }
@ -106,11 +107,11 @@ namespace BizHawk.Client.EmuHawk
ReadOnly = readOnly; ReadOnly = readOnly;
} }
public Action Callback { get; set; } public Action Callback { get; }
public uint? Address { get; set; } public uint? Address { get; set; }
public uint? AddressMask { get; set; } public uint? AddressMask { get; set; }
public MemoryCallbackType Type { get; set; } public MemoryCallbackType Type { get; set; }
public string Name { get; set; } public string Name { get; }
internal bool ReadOnly { get; set; } internal bool ReadOnly { get; set; }

View File

@ -1,4 +1,4 @@
namespace BizHawk.Client.EmuHawk.tools.Debugger namespace BizHawk.Client.EmuHawk
{ {
partial class BreakpointControl partial class BreakpointControl
{ {

View File

@ -1,19 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data;
using System.Linq; using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Common.NumberExtensions; using BizHawk.Common.NumberExtensions;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
using BizHawk.Emulation.Common.IEmulatorExtensions;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.WinFormExtensions; using BizHawk.Client.EmuHawk.WinFormExtensions;
namespace BizHawk.Client.EmuHawk.tools.Debugger namespace BizHawk.Client.EmuHawk
{ {
public partial class BreakpointControl : UserControl public partial class BreakpointControl : UserControl
{ {
@ -21,7 +16,8 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
public IMemoryCallbackSystem MCS { get; set; } public IMemoryCallbackSystem MCS { get; set; }
public GenericDebugger ParentDebugger { get; set; } public GenericDebugger ParentDebugger { get; set; }
public IMemoryDomains MemoryDomains { get; set; } public IMemoryDomains MemoryDomains { get; set; }
private readonly BreakpointList Breakpoints = new BreakpointList();
private readonly BreakpointList _breakpoints = new BreakpointList();
public BreakpointControl() public BreakpointControl()
{ {
@ -29,7 +25,7 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
BreakpointView.QueryItemText += BreakPointView_QueryItemText; BreakpointView.QueryItemText += BreakPointView_QueryItemText;
BreakpointView.QueryItemBkColor += BreakPointView_QueryItemBkColor; BreakpointView.QueryItemBkColor += BreakPointView_QueryItemBkColor;
BreakpointView.VirtualMode = true; BreakpointView.VirtualMode = true;
Breakpoints.Callback = BreakpointCallback; _breakpoints.Callback = BreakpointCallback;
} }
private void BreakpointControl_Load(object sender, EventArgs e) private void BreakpointControl_Load(object sender, EventArgs e)
@ -43,24 +39,24 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
switch (column) switch (column)
{ {
case 0: case 0:
text = string.Format("{0:X}", Breakpoints[index].Address); text = $"{_breakpoints[index].Address:X}";
break; break;
case 1: case 1:
text = string.Format("{0:X}", Breakpoints[index].AddressMask); text = $"{_breakpoints[index].AddressMask:X}";
break; break;
case 2: case 2:
text = Breakpoints[index].Type.ToString(); text = _breakpoints[index].Type.ToString();
break; break;
case 3: case 3:
text = Breakpoints[index].Name; text = _breakpoints[index].Name;
break; break;
} }
} }
private void BreakPointView_QueryItemBkColor(int index, int column, ref Color color) private void BreakPointView_QueryItemBkColor(int index, int column, ref Color color)
{ {
color = Breakpoints[index].ReadOnly ? SystemColors.Control color = _breakpoints[index].ReadOnly ? SystemColors.Control
: Breakpoints[index].Active ? Color.LightCyan : _breakpoints[index].Active ? Color.LightCyan
: Color.White; : Color.White;
} }
@ -75,11 +71,11 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
{ {
BreakpointCallback(); BreakpointCallback();
var seekBreakpoint = Breakpoints.FirstOrDefault(x => x.Name.StartsWith(SeekName)); var seekBreakpoint = _breakpoints.FirstOrDefault(x => x.Name.StartsWith(SeekName));
if (seekBreakpoint != null) if (seekBreakpoint != null)
{ {
Breakpoints.Remove(seekBreakpoint); _breakpoints.Remove(seekBreakpoint);
UpdateValues(); UpdateValues();
} }
@ -94,30 +90,26 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
{ {
CheckForNewBreakpoints(); CheckForNewBreakpoints();
BreakpointView.ItemCount = Breakpoints.Count; BreakpointView.ItemCount = _breakpoints.Count;
UpdateStatsLabel(); UpdateStatsLabel();
} }
} }
/// <summary> // Did any breakpoints get added from other sources such as lua?
/// Did any breakpoints get added from other sources such as lua?
/// </summary>
private void CheckForNewBreakpoints() private void CheckForNewBreakpoints()
{ {
if (MCS != null) if (MCS != null)
{ {
foreach (var callback in MCS) foreach (var callback in MCS)
{ {
if (!Breakpoints.Any(b => if (!_breakpoints.Any(b =>
b.Type == callback.Type && b.Type == callback.Type &&
b.Address == callback.Address && b.Address == callback.Address &&
b.AddressMask == callback.AddressMask && b.AddressMask == callback.AddressMask &&
b.Name == callback.Name && b.Name == callback.Name &&
b.Callback == callback.Callback b.Callback == callback.Callback))
))
{ {
Breakpoints.Add(new Breakpoint(Core, callback)); _breakpoints.Add(new Breakpoint(Core, callback));
} }
} }
} }
@ -129,32 +121,32 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
{ {
foreach (var callback in MCS) foreach (var callback in MCS)
{ {
Breakpoints.Add(new Breakpoint(Core, callback)); _breakpoints.Add(new Breakpoint(Core, callback));
} }
BreakpointView.ItemCount = Breakpoints.Count; BreakpointView.ItemCount = _breakpoints.Count;
BreakpointView.Refresh(); BreakpointView.Refresh();
UpdateBreakpointRemoveButton(); UpdateBreakpointRemoveButton();
UpdateStatsLabel(); UpdateStatsLabel();
} }
else else
{ {
this.Enabled = false; Enabled = false;
ParentDebugger.DisableBreakpointBox(); ParentDebugger.DisableBreakpointBox();
} }
} }
public void Shutdown() public void Shutdown()
{ {
Breakpoints.Clear(); _breakpoints.Clear();
UpdateStatsLabel(); UpdateStatsLabel();
} }
public void AddBreakpoint(uint address, uint mask, MemoryCallbackType type) public void AddBreakpoint(uint address, uint mask, MemoryCallbackType type)
{ {
Breakpoints.Add(Core, address, mask, type); _breakpoints.Add(Core, address, mask, type);
BreakpointView.ItemCount = Breakpoints.Count; BreakpointView.ItemCount = _breakpoints.Count;
UpdateBreakpointRemoveButton(); UpdateBreakpointRemoveButton();
UpdateStatsLabel(); UpdateStatsLabel();
} }
@ -165,10 +157,10 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
if (b.ShowHawkDialog() == DialogResult.OK) if (b.ShowHawkDialog() == DialogResult.OK)
{ {
Breakpoints.Add(Core, b.Address, b.AddressMask, b.BreakType); _breakpoints.Add(Core, b.Address, b.AddressMask, b.BreakType);
} }
BreakpointView.ItemCount = Breakpoints.Count; BreakpointView.ItemCount = _breakpoints.Count;
UpdateBreakpointRemoveButton(); UpdateBreakpointRemoveButton();
UpdateStatsLabel(); UpdateStatsLabel();
} }
@ -177,29 +169,26 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
public void AddSeekBreakpoint(uint pcVal, int pcBitSize) public void AddSeekBreakpoint(uint pcVal, int pcBitSize)
{ {
var Name = SeekName + pcVal.ToHexString(pcBitSize / 4); var name = SeekName + pcVal.ToHexString(pcBitSize / 4);
Breakpoints.Add(new Breakpoint(Name, true, Core, SeekCallback, pcVal, 0xFFFFFFFF, MemoryCallbackType.Execute)); _breakpoints.Add(new Breakpoint(name, true, Core, SeekCallback, pcVal, 0xFFFFFFFF, MemoryCallbackType.Execute));
} }
public void RemoveCurrentSeek() public void RemoveCurrentSeek()
{ {
var seekBreakpoint = Breakpoints.FirstOrDefault(x => x.Name.StartsWith(SeekName)); var seekBreakpoint = _breakpoints.FirstOrDefault(x => x.Name.StartsWith(SeekName));
if (seekBreakpoint != null) if (seekBreakpoint != null)
{ {
Breakpoints.Remove(seekBreakpoint); _breakpoints.Remove(seekBreakpoint);
UpdateValues(); UpdateValues();
} }
} }
private IEnumerable<int> SelectedIndices private IEnumerable<int> SelectedIndices => BreakpointView.SelectedIndices.Cast<int>();
{
get { return BreakpointView.SelectedIndices.Cast<int>(); }
}
private IEnumerable<Breakpoint> SelectedItems private IEnumerable<Breakpoint> SelectedItems
{ {
get { return SelectedIndices.Select(index => Breakpoints[index]); } get { return SelectedIndices.Select(index => _breakpoints[index]); }
} }
private IEnumerable<Breakpoint> EditableItems private IEnumerable<Breakpoint> EditableItems
@ -216,10 +205,10 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
{ {
foreach (var item in items) foreach (var item in items)
{ {
Breakpoints.Remove(item); _breakpoints.Remove(item);
} }
BreakpointView.ItemCount = Breakpoints.Count; BreakpointView.ItemCount = _breakpoints.Count;
UpdateBreakpointRemoveButton(); UpdateBreakpointRemoveButton();
UpdateStatsLabel(); UpdateStatsLabel();
} }
@ -254,7 +243,7 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
item.Active ^= true; item.Active ^= true;
} }
BreakpointView.ItemCount = Breakpoints.Count; BreakpointView.ItemCount = _breakpoints.Count;
UpdateBreakpointRemoveButton(); UpdateBreakpointRemoveButton();
UpdateStatsLabel(); UpdateStatsLabel();
} }
@ -271,7 +260,7 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
private void UpdateStatsLabel() private void UpdateStatsLabel()
{ {
BreakpointStatsLabel.Text = string.Format("{0} Total / {1} Active", Breakpoints.Count(), Breakpoints.Count(x => x.Active)); BreakpointStatsLabel.Text = $"{_breakpoints.Count} Total / {_breakpoints.Count(b => b.Active)} Active";
} }
private void ToggleButton_Click(object sender, EventArgs e) private void ToggleButton_Click(object sender, EventArgs e)
@ -281,7 +270,7 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
item.Active ^= true; item.Active ^= true;
} }
BreakpointView.ItemCount = Breakpoints.Count; BreakpointView.ItemCount = _breakpoints.Count;
UpdateStatsLabel(); UpdateStatsLabel();
} }
@ -295,11 +284,11 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
if (b.ShowHawkDialog() == DialogResult.OK) if (b.ShowHawkDialog() == DialogResult.OK)
{ {
Breakpoints.Add(new Breakpoint(Core, breakpoint.Callback, b.Address, b.AddressMask, b.BreakType, breakpoint.Active)); _breakpoints.Add(new Breakpoint(Core, breakpoint.Callback, b.Address, b.AddressMask, b.BreakType, breakpoint.Active));
} }
} }
BreakpointView.ItemCount = Breakpoints.Count; BreakpointView.ItemCount = _breakpoints.Count;
UpdateBreakpointRemoveButton(); UpdateBreakpointRemoveButton();
UpdateStatsLabel(); UpdateStatsLabel();
} }
@ -321,7 +310,7 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
} }
} }
BreakpointView.ItemCount = Breakpoints.Count; BreakpointView.ItemCount = _breakpoints.Count;
UpdateBreakpointRemoveButton(); UpdateBreakpointRemoveButton();
UpdateStatsLabel(); UpdateStatsLabel();
} }
@ -358,7 +347,7 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
return b; return b;
} }
public enum BreakpointOperation private enum BreakpointOperation
{ {
Add, Edit, Duplicate Add, Edit, Duplicate
} }

View File

@ -42,7 +42,7 @@
this.RegistersGroupBox = new System.Windows.Forms.GroupBox(); this.RegistersGroupBox = new System.Windows.Forms.GroupBox();
this.RegisterPanel = new BizHawk.Client.EmuHawk.RegisterBoxControl(); this.RegisterPanel = new BizHawk.Client.EmuHawk.RegisterBoxControl();
this.BreakpointsGroupBox = new System.Windows.Forms.GroupBox(); this.BreakpointsGroupBox = new System.Windows.Forms.GroupBox();
this.BreakPointControl1 = new BizHawk.Client.EmuHawk.tools.Debugger.BreakpointControl(); this.BreakPointControl1 = new BizHawk.Client.EmuHawk.BreakpointControl();
this.DisassemblerBox = new System.Windows.Forms.GroupBox(); this.DisassemblerBox = new System.Windows.Forms.GroupBox();
this.ToPCBtn = new System.Windows.Forms.Button(); this.ToPCBtn = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
@ -409,7 +409,7 @@
private System.Windows.Forms.GroupBox RegistersGroupBox; private System.Windows.Forms.GroupBox RegistersGroupBox;
private RegisterBoxControl RegisterPanel; private RegisterBoxControl RegisterPanel;
private System.Windows.Forms.GroupBox BreakpointsGroupBox; private System.Windows.Forms.GroupBox BreakpointsGroupBox;
private tools.Debugger.BreakpointControl BreakPointControl1; private BreakpointControl BreakPointControl1;
private System.Windows.Forms.GroupBox DisassemblerBox; private System.Windows.Forms.GroupBox DisassemblerBox;
private VirtualListView DisassemblerView; private VirtualListView DisassemblerView;
private System.Windows.Forms.ColumnHeader Address; private System.Windows.Forms.ColumnHeader Address;

View File

@ -9,37 +9,31 @@ namespace BizHawk.Client.EmuHawk
{ {
public partial class GenericDebugger public partial class GenericDebugger
{ {
private readonly List<DisasmOp> DisassemblyLines = new List<DisasmOp>(); private readonly List<DisasmOp> _disassemblyLines = new List<DisasmOp>();
int PCRegisterSize = 4; private int _pcRegisterSize = 4;
uint currentDisassemblerAddress = 0; private uint _currentDisassemblerAddress;
private class DisasmOp private class DisasmOp
{ {
public DisasmOp(uint address, int s, string m) public DisasmOp(uint address, int size, string mnemonic)
{ {
Address = address; Address = address;
Size = s; Size = size;
Mnemonic = m; Mnemonic = mnemonic;
} }
public uint Address { get; private set; } public uint Address { get; }
public int Size { get; private set; } public int Size { get; }
public string Mnemonic { get; private set; } public string Mnemonic { get; }
} }
private long BusMaxValue private long BusMaxValue => MemoryDomains.SystemBus.Size;
{
get
{
return MemoryDomains.SystemBus.Size;
}
}
public void UpdatePC() private void UpdatePC()
{ {
if (CanDisassemble) if (CanDisassemble)
{ {
currentDisassemblerAddress = (uint)PCRegister.Value; _currentDisassemblerAddress = (uint)PCRegister.Value;
} }
} }
@ -56,15 +50,15 @@ namespace BizHawk.Client.EmuHawk
private void Disassemble() private void Disassemble()
{ {
int line_count = DisassemblerView.NumberOfVisibleRows; int lineCount = DisassemblerView.NumberOfVisibleRows;
DisassemblyLines.Clear(); _disassemblyLines.Clear();
uint a = currentDisassemblerAddress; uint a = _currentDisassemblerAddress;
for (int i = 0; i <= line_count; ++i) for (int i = 0; i <= lineCount; ++i)
{ {
int advance; int advance;
string line = Disassembler.Disassemble(MemoryDomains.SystemBus, a, out advance); string line = Disassembler.Disassemble(MemoryDomains.SystemBus, a, out advance);
DisassemblyLines.Add(new DisasmOp(a, advance, line)); _disassemblyLines.Add(new DisasmOp(a, advance, line));
a += (uint)advance; a += (uint)advance;
if (a > BusMaxValue) if (a > BusMaxValue)
{ {
@ -77,24 +71,24 @@ namespace BizHawk.Client.EmuHawk
{ {
text = ""; text = "";
if (index < DisassemblyLines.Count) if (index < _disassemblyLines.Count)
{ {
if (column == 0) if (column == 0)
{ {
text = string.Format("{0:X" + PCRegisterSize + "}", DisassemblyLines[index].Address); text = string.Format("{0:X" + _pcRegisterSize + "}", _disassemblyLines[index].Address);
} }
else if (column == 1) else if (column == 1)
{ {
text = DisassemblyLines[index].Mnemonic; text = _disassemblyLines[index].Mnemonic;
} }
} }
} }
private void DisassemblerView_QueryItemBkColor(int index, int column, ref Color color) private void DisassemblerView_QueryItemBkColor(int index, int column, ref Color color)
{ {
if (DisassemblyLines.Any() && index < DisassemblyLines.Count) if (_disassemblyLines.Any() && index < _disassemblyLines.Count)
{ {
if (DisassemblyLines[index].Address == currentDisassemblerAddress) if (_disassemblyLines[index].Address == _currentDisassemblerAddress)
{ {
color = Color.LightCyan; color = Color.LightCyan;
} }
@ -103,15 +97,16 @@ namespace BizHawk.Client.EmuHawk
private void DecrementCurrentAddress() private void DecrementCurrentAddress()
{ {
uint newaddress = currentDisassemblerAddress; uint newaddress = _currentDisassemblerAddress;
while (true) while (true)
{ {
int bytestoadvance; int bytestoadvance;
Disassembler.Disassemble(MemoryDomains.SystemBus, newaddress, out bytestoadvance); Disassembler.Disassemble(MemoryDomains.SystemBus, newaddress, out bytestoadvance);
if (newaddress + bytestoadvance == currentDisassemblerAddress) if (newaddress + bytestoadvance == _currentDisassemblerAddress)
{ {
break; break;
} }
newaddress--; newaddress--;
if (newaddress < 0) if (newaddress < 0)
@ -121,22 +116,22 @@ namespace BizHawk.Client.EmuHawk
} }
// Just in case // Just in case
if (currentDisassemblerAddress - newaddress > 5) if (_currentDisassemblerAddress - newaddress > 5)
{ {
newaddress = currentDisassemblerAddress - 1; newaddress = _currentDisassemblerAddress - 1;
break; break;
} }
} }
currentDisassemblerAddress = newaddress; _currentDisassemblerAddress = newaddress;
} }
private void IncrementCurrentAddress() private void IncrementCurrentAddress()
{ {
currentDisassemblerAddress += (uint)DisassemblyLines.First().Size; _currentDisassemblerAddress += (uint)_disassemblyLines.First().Size;
if (currentDisassemblerAddress >= BusMaxValue) if (_currentDisassemblerAddress >= BusMaxValue)
{ {
currentDisassemblerAddress = (uint)(BusMaxValue - 1); _currentDisassemblerAddress = (uint)(BusMaxValue - 1);
} }
} }
@ -188,12 +183,16 @@ namespace BizHawk.Client.EmuHawk
var blob = new StringBuilder(); var blob = new StringBuilder();
foreach (int index in indices) foreach (int index in indices)
{ {
if (blob.Length != 0) blob.AppendLine(); if (blob.Length != 0)
{
blob.AppendLine();
}
blob.Append(string.Format("{0:X" + PCRegisterSize + "}", DisassemblyLines[index].Address)) blob.Append(string.Format("{0:X" + _pcRegisterSize + "}", _disassemblyLines[index].Address))
.Append(" ") .Append(" ")
.Append(DisassemblyLines[index].Mnemonic); .Append(_disassemblyLines[index].Mnemonic);
} }
Clipboard.SetDataObject(blob.ToString()); Clipboard.SetDataObject(blob.ToString());
} }
} }
@ -201,7 +200,9 @@ namespace BizHawk.Client.EmuHawk
private void OnPauseChanged(object sender, MainForm.PauseChangedEventArgs e) private void OnPauseChanged(object sender, MainForm.PauseChangedEventArgs e)
{ {
if (e.Paused) if (e.Paused)
{
FullUpdate(); FullUpdate();
}
} }
private void DisassemblerContextMenu_Opening(object sender, EventArgs e) private void DisassemblerContextMenu_Opening(object sender, EventArgs e)
@ -215,7 +216,7 @@ namespace BizHawk.Client.EmuHawk
if (indices.Count > 0) if (indices.Count > 0)
{ {
var line = DisassemblyLines[indices[0]]; var line = _disassemblyLines[indices[0]];
BreakPointControl1.AddBreakpoint(line.Address, 0xFFFFFFFF, Emulation.Common.MemoryCallbackType.Execute); BreakPointControl1.AddBreakpoint(line.Address, 0xFFFFFFFF, Emulation.Common.MemoryCallbackType.Execute);
} }
} }

View File

@ -1,14 +1,9 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
using BizHawk.Emulation.Common.IEmulatorExtensions;
using BizHawk.Client.Common; using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
@ -27,12 +22,11 @@ namespace BizHawk.Client.EmuHawk
private void GenericDebugger_Load(object sender, EventArgs e) private void GenericDebugger_Load(object sender, EventArgs e)
{ {
} }
private void EngageDebugger() private void EngageDebugger()
{ {
DisassemblyLines.Clear(); _disassemblyLines.Clear();
GlobalWin.MainForm.OnPauseChanged += OnPauseChanged; GlobalWin.MainForm.OnPauseChanged += OnPauseChanged;
CancelSeekBtn.Enabled = false; CancelSeekBtn.Enabled = false;
if (CanDisassemble) if (CanDisassemble)
@ -74,7 +68,7 @@ namespace BizHawk.Client.EmuHawk
}); });
} }
PCRegisterSize = Debuggable.GetCpuFlagsAndRegisters()[Disassembler.PCRegisterName].BitSize / 4; _pcRegisterSize = Debuggable.GetCpuFlagsAndRegisters()[Disassembler.PCRegisterName].BitSize / 4;
SetDisassemblerItemCount(); SetDisassemblerItemCount();
UpdateDisassembler(); UpdateDisassembler();
} }
@ -187,7 +181,6 @@ namespace BizHawk.Client.EmuHawk
private void DebugSubMenu_DropDownOpened(object sender, EventArgs e) private void DebugSubMenu_DropDownOpened(object sender, EventArgs e)
{ {
} }
private void RunBtn_Click(object sender, EventArgs e) private void RunBtn_Click(object sender, EventArgs e)
@ -231,23 +224,24 @@ namespace BizHawk.Client.EmuHawk
StepIntoMenuItem_Click(null, null); StepIntoMenuItem_Click(null, null);
return true; return true;
} }
else if (keyData == (Keys.F11 | Keys.Shift))
if (keyData == (Keys.F11 | Keys.Shift))
{ {
StepOutMenuItem_Click(null, null); StepOutMenuItem_Click(null, null);
return true; return true;
} }
else if (keyData == Keys.F10)
if (keyData == Keys.F10)
{ {
StepOverMenuItem_Click(null, null); StepOverMenuItem_Click(null, null);
return true; return true;
} }
else
{ return base.ProcessCmdKey(ref msg, keyData);
return base.ProcessCmdKey(ref msg, keyData);
}
} }
private Control _currentToolTipControl = null; private Control _currentToolTipControl = null;
private void GenericDebugger_MouseMove(object sender, MouseEventArgs e) private void GenericDebugger_MouseMove(object sender, MouseEventArgs e)
{ {
var control = GetChildAtPoint(e.Location); var control = GetChildAtPoint(e.Location);

View File

@ -1,10 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data;
using System.Linq; using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Client.Common; using BizHawk.Client.Common;
@ -30,7 +26,6 @@ namespace BizHawk.Client.EmuHawk
private void RegisterBoxControl_Load(object sender, EventArgs e) private void RegisterBoxControl_Load(object sender, EventArgs e)
{ {
} }
public void NewUpdate(ToolFormUpdateType type) { } public void NewUpdate(ToolFormUpdateType type) { }
@ -63,7 +58,6 @@ namespace BizHawk.Client.EmuHawk
if (_canSetCpuRegisters) if (_canSetCpuRegisters)
{ {
Controls Controls
.OfType<TextBox>() .OfType<TextBox>()
.ToList() .ToList()
@ -192,7 +186,6 @@ namespace BizHawk.Client.EmuHawk
} }
catch (FormatException) catch (FormatException)
{ {
} }
} }
}; };
@ -230,10 +223,10 @@ namespace BizHawk.Client.EmuHawk
{ {
var c = new CheckBox var c = new CheckBox
{ {
Appearance = System.Windows.Forms.Appearance.Button, Appearance = Appearance.Button,
Name = flag.Key, Name = flag.Key,
Text = flag.Key.Replace("Flag", "").Trim(), // Hack Text = flag.Key.Replace("Flag", "").Trim(), // Hack
Checked = flag.Value.Value == 1 ? true : false, Checked = flag.Value.Value == 1,
Location = new Point(UIHelper.ScaleX(40), y), Location = new Point(UIHelper.ScaleX(40), y),
Dock = DockStyle.Left, Dock = DockStyle.Left,
Size = new Size(UIHelper.ScaleX(23), UIHelper.ScaleY(23)), Size = new Size(UIHelper.ScaleX(23), UIHelper.ScaleY(23)),

View File

@ -1,6 +1,5 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
@ -44,14 +43,13 @@ namespace BizHawk.Client.EmuHawk
{ {
return FindBox.Text; return FindBox.Text;
} }
var bytes = GlobalWin.Tools.HexEditor.ConvertTextToBytes(FindBox.Text); var bytes = GlobalWin.Tools.HexEditor.ConvertTextToBytes(FindBox.Text);
var bytestring = new StringBuilder(); var bytestring = new StringBuilder();
foreach (var b in bytes) foreach (var b in bytes)
{ {
bytestring.Append(string.Format("{0:X2}", b)); bytestring.Append($"{b:X2}");
} }
return bytestring.ToString(); return bytestring.ToString();
@ -77,7 +75,6 @@ namespace BizHawk.Client.EmuHawk
if (HexRadio.Checked) if (HexRadio.Checked)
{ {
FindBox = new HexTextBox FindBox = new HexTextBox
{ {
CharacterCasing = CharacterCasing.Upper, CharacterCasing = CharacterCasing.Upper,

View File

@ -121,7 +121,7 @@ namespace BizHawk.Client.EmuHawk
if (Global.Config.RecentLuaSession.AutoLoad && !Global.Config.RecentLuaSession.Empty) if (Global.Config.RecentLuaSession.AutoLoad && !Global.Config.RecentLuaSession.Empty)
{ {
LoadSessionFromRecent(Global.Config.RecentLuaSession.MostRecent); LoadSessionFromRecent(Global.Config.RecentLuaSession.MostRecent);
} }
else if (Global.Config.RecentLua.AutoLoad) else if (Global.Config.RecentLua.AutoLoad)
{ {

View File

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Windows.Forms;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Calculators; using BizHawk.Emulation.Cores.Calculators;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
@ -39,9 +38,9 @@ namespace BizHawk.Client.EmuHawk
#region Public API #region Public API
public bool AskSaveChanges() { return true; } public bool AskSaveChanges() { return true; }
public bool UpdateBefore { get { return false; } } public bool UpdateBefore => false;
public void NewUpdate(ToolFormUpdateType type) { } public void NewUpdate(ToolFormUpdateType type) { }
public void UpdateValues() public void UpdateValues()
{ {

View File

@ -89,6 +89,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TAS/@EntryIndexedValue">TAS</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TAS/@EntryIndexedValue">TAS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TI/@EntryIndexedValue">TI</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TI/@EntryIndexedValue">TI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TIA/@EntryIndexedValue">TIA</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TIA/@EntryIndexedValue">TIA</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UI/@EntryIndexedValue">UI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VBA/@EntryIndexedValue">VBA</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VBA/@EntryIndexedValue">VBA</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ROM/@EntryIndexedValue">ROM</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ROM/@EntryIndexedValue">ROM</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=MethodPropertyEvent/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" /&gt;</s:String></wpf:ResourceDictionary> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=MethodPropertyEvent/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" /&gt;</s:String></wpf:ResourceDictionary>