2011-08-09 23:42:30 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
2013-10-25 00:57:23 +00:00
|
|
|
|
using BizHawk.Client.Common;
|
|
|
|
|
|
2013-11-03 03:54:37 +00:00
|
|
|
|
namespace BizHawk.Client.EmuHawk
|
2011-08-09 23:42:30 +00:00
|
|
|
|
{
|
|
|
|
|
public partial class AutofireConfig : Form
|
|
|
|
|
{
|
2019-12-17 00:22:41 +00:00
|
|
|
|
private readonly Config _config;
|
|
|
|
|
private readonly AutofireController _autoFireController;
|
|
|
|
|
private readonly AutoFireStickyXorAdapter _stickyXorAdapter;
|
|
|
|
|
|
|
|
|
|
public AutofireConfig(
|
|
|
|
|
Config config,
|
|
|
|
|
AutofireController autoFireController,
|
|
|
|
|
AutoFireStickyXorAdapter stickyXorAdapter)
|
2011-08-09 23:42:30 +00:00
|
|
|
|
{
|
2019-12-17 00:22:41 +00:00
|
|
|
|
_config = config;
|
|
|
|
|
_autoFireController = autoFireController;
|
|
|
|
|
_stickyXorAdapter = stickyXorAdapter;
|
2011-08-09 23:42:30 +00:00
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AutofireConfig_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
2019-12-17 00:22:41 +00:00
|
|
|
|
if (_config.AutofireOn < OnNumeric.Minimum)
|
2013-11-28 01:33:38 +00:00
|
|
|
|
{
|
2011-08-09 23:42:30 +00:00
|
|
|
|
OnNumeric.Value = OnNumeric.Minimum;
|
2013-11-28 01:33:38 +00:00
|
|
|
|
}
|
2019-12-17 00:22:41 +00:00
|
|
|
|
else if (_config.AutofireOn > OnNumeric.Maximum)
|
2013-11-28 01:33:38 +00:00
|
|
|
|
{
|
2011-08-09 23:42:30 +00:00
|
|
|
|
OnNumeric.Value = OnNumeric.Maximum;
|
2013-11-28 01:33:38 +00:00
|
|
|
|
}
|
2011-08-09 23:42:30 +00:00
|
|
|
|
else
|
2013-11-28 01:33:38 +00:00
|
|
|
|
{
|
2019-12-17 00:22:41 +00:00
|
|
|
|
OnNumeric.Value = _config.AutofireOn;
|
2013-11-28 01:33:38 +00:00
|
|
|
|
}
|
2011-08-09 23:42:30 +00:00
|
|
|
|
|
2019-12-17 00:22:41 +00:00
|
|
|
|
if (_config.AutofireOff < OffNumeric.Minimum)
|
2013-11-28 01:33:38 +00:00
|
|
|
|
{
|
2011-08-09 23:42:30 +00:00
|
|
|
|
OffNumeric.Value = OffNumeric.Minimum;
|
2013-11-28 01:33:38 +00:00
|
|
|
|
}
|
2019-12-17 00:22:41 +00:00
|
|
|
|
else if (_config.AutofireOff > OffNumeric.Maximum)
|
2013-11-28 01:33:38 +00:00
|
|
|
|
{
|
2011-08-09 23:42:30 +00:00
|
|
|
|
OffNumeric.Value = OffNumeric.Maximum;
|
2013-11-28 01:33:38 +00:00
|
|
|
|
}
|
2011-08-09 23:42:30 +00:00
|
|
|
|
else
|
2013-11-28 01:33:38 +00:00
|
|
|
|
{
|
2019-12-17 00:22:41 +00:00
|
|
|
|
OffNumeric.Value = _config.AutofireOff;
|
2013-11-28 01:33:38 +00:00
|
|
|
|
}
|
2011-08-29 22:25:40 +00:00
|
|
|
|
|
2019-12-17 00:22:41 +00:00
|
|
|
|
LagFrameCheck.Checked = _config.AutofireLagFrames;
|
2011-08-09 23:42:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Ok_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2019-12-17 00:22:41 +00:00
|
|
|
|
_autoFireController.On = _config.AutofireOn = (int)OnNumeric.Value;
|
|
|
|
|
_autoFireController.Off = _config.AutofireOff = (int)OffNumeric.Value;
|
|
|
|
|
_config.AutofireLagFrames = LagFrameCheck.Checked;
|
|
|
|
|
_stickyXorAdapter.SetOnOffPatternFromConfig();
|
2012-09-26 01:28:48 +00:00
|
|
|
|
|
2013-11-28 01:33:38 +00:00
|
|
|
|
Close();
|
2011-08-09 23:42:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Cancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2013-11-28 01:33:38 +00:00
|
|
|
|
Close();
|
2011-08-09 23:42:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|