2019-03-03 16:34:23 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Mesen.GUI.Config;
|
|
|
|
|
|
|
|
|
|
namespace Mesen.GUI.Debugger.Controls
|
|
|
|
|
{
|
|
|
|
|
public partial class ctrlScanlineCycleSelect : UserControl
|
|
|
|
|
{
|
|
|
|
|
private static int _nextViewerId = 0;
|
|
|
|
|
|
|
|
|
|
private int _viewerId = 0;
|
|
|
|
|
private int _scanline = 241;
|
|
|
|
|
private int _cycle = 0;
|
|
|
|
|
|
|
|
|
|
public int Scanline { get { return _scanline; } }
|
|
|
|
|
public int Cycle { get { return _cycle; } }
|
|
|
|
|
public int ViewerId { get { return _viewerId; } }
|
|
|
|
|
|
|
|
|
|
public ctrlScanlineCycleSelect()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
_viewerId = GetNextViewerId();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int GetNextViewerId()
|
|
|
|
|
{
|
|
|
|
|
return _nextViewerId++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Initialize(int scanline, int cycle)
|
|
|
|
|
{
|
|
|
|
|
_scanline = scanline;
|
|
|
|
|
_cycle = cycle;
|
|
|
|
|
|
|
|
|
|
this.nudScanline.Value = _scanline;
|
|
|
|
|
this.nudCycle.Value = _cycle;
|
|
|
|
|
|
2020-05-18 16:10:53 -04:00
|
|
|
|
RefreshSettings();
|
2019-03-03 16:34:23 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RefreshSettings()
|
|
|
|
|
{
|
2020-05-18 16:10:53 -04:00
|
|
|
|
bool isGameboy = EmuApi.GetRomInfo().CoprocessorType == CoprocessorType.Gameboy;
|
|
|
|
|
DebugApi.SetViewerUpdateTiming(_viewerId, Math.Min(_scanline, isGameboy ? 153 : 312), _cycle);
|
2019-03-03 16:34:23 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SetUpdateScanlineCycle(int scanline, int cycle)
|
|
|
|
|
{
|
|
|
|
|
_scanline = scanline;
|
|
|
|
|
_cycle = cycle;
|
|
|
|
|
RefreshSettings();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void nudScanlineCycle_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
SetUpdateScanlineCycle((int)this.nudScanline.Value, (int)this.nudCycle.Value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnReset_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2020-05-18 16:10:53 -04:00
|
|
|
|
bool isGameboy = EmuApi.GetRomInfo().CoprocessorType == CoprocessorType.Gameboy;
|
|
|
|
|
this.nudScanline.Value = isGameboy ? 144 : 241;
|
2019-03-03 16:34:23 -05:00
|
|
|
|
this.nudCycle.Value = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|