2019-03-30 22:58:57 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Mesen.GUI.Config;
|
|
|
|
|
using Mesen.GUI.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Mesen.GUI.Debugger
|
|
|
|
|
{
|
|
|
|
|
public partial class frmBreakIn : BaseConfigForm
|
|
|
|
|
{
|
2019-04-07 18:05:14 -04:00
|
|
|
|
private CpuType _cpuType;
|
|
|
|
|
|
|
|
|
|
public frmBreakIn(CpuType cpuType)
|
2019-03-30 22:58:57 -04:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
2019-04-07 18:05:14 -04:00
|
|
|
|
_cpuType = cpuType;
|
|
|
|
|
|
2019-03-31 09:11:56 -04:00
|
|
|
|
DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger;
|
|
|
|
|
nudCount.Value = cfg.BreakInCount;
|
|
|
|
|
radCpuInstructions.Checked = cfg.BreakInMetric == BreakInMetric.CpuInstructions;
|
|
|
|
|
radPpuCycles.Checked = cfg.BreakInMetric == BreakInMetric.PpuCycles;
|
|
|
|
|
radScanlines.Checked = cfg.BreakInMetric == BreakInMetric.Scanlines;
|
|
|
|
|
radFrames.Checked = cfg.BreakInMetric == BreakInMetric.Frames;
|
2019-03-30 22:58:57 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnShown(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnShown(e);
|
|
|
|
|
nudCount.Focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnFormClosed(FormClosedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnFormClosed(e);
|
|
|
|
|
if(this.DialogResult == DialogResult.OK) {
|
2019-03-31 09:11:56 -04:00
|
|
|
|
DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger;
|
2019-03-30 22:58:57 -04:00
|
|
|
|
int count = (int)nudCount.Value;
|
2019-03-31 09:11:56 -04:00
|
|
|
|
cfg.BreakInCount = (int)count;
|
2019-03-30 22:58:57 -04:00
|
|
|
|
if(radCpuInstructions.Checked) {
|
2019-07-25 22:22:09 -04:00
|
|
|
|
DebugApi.Step(_cpuType, count, StepType.Step);
|
2019-03-31 09:11:56 -04:00
|
|
|
|
cfg.BreakInMetric = BreakInMetric.CpuInstructions;
|
2019-03-30 22:58:57 -04:00
|
|
|
|
} else if(radPpuCycles.Checked) {
|
2019-07-25 22:22:09 -04:00
|
|
|
|
DebugApi.Step(_cpuType, count, StepType.PpuStep);
|
2019-03-31 09:11:56 -04:00
|
|
|
|
cfg.BreakInMetric = BreakInMetric.PpuCycles;
|
2019-03-30 22:58:57 -04:00
|
|
|
|
} else if(radScanlines.Checked) {
|
2019-07-25 22:22:09 -04:00
|
|
|
|
DebugApi.Step(_cpuType, count * 341, StepType.PpuStep);
|
2019-03-31 09:11:56 -04:00
|
|
|
|
cfg.BreakInMetric = BreakInMetric.Scanlines;
|
2019-03-30 22:58:57 -04:00
|
|
|
|
} else {
|
2019-07-25 22:22:09 -04:00
|
|
|
|
DebugApi.Step(_cpuType, count * 341 * 262, StepType.PpuStep);
|
2019-03-31 09:11:56 -04:00
|
|
|
|
cfg.BreakInMetric = BreakInMetric.Frames;
|
2019-03-30 22:58:57 -04:00
|
|
|
|
}
|
|
|
|
|
ConfigManager.ApplyChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|