62 lines
1.5 KiB
C#
62 lines
1.5 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
using BizHawk.Emulation.Cores.Atari.A7800Hawk;
|
|
|
|
namespace BizHawk.Client.EmuHawk
|
|
{
|
|
public partial class A7800ControllerSettings : Form
|
|
{
|
|
private readonly MainForm _mainForm;
|
|
private readonly A7800Hawk.A7800SyncSettings _syncSettings;
|
|
|
|
public A7800ControllerSettings(
|
|
MainForm mainForm,
|
|
A7800Hawk.A7800SyncSettings syncSettings)
|
|
{
|
|
_mainForm = mainForm;
|
|
_syncSettings = syncSettings;
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void IntvControllerSettings_Load(object sender, EventArgs e)
|
|
{
|
|
var possibleControllers = A7800HawkControllerDeck.ValidControllerTypes.Select(t => t.Key);
|
|
|
|
foreach (var val in possibleControllers)
|
|
{
|
|
Port1ComboBox.Items.Add(val);
|
|
Port2ComboBox.Items.Add(val);
|
|
}
|
|
|
|
Port1ComboBox.SelectedItem = _syncSettings.Port1;
|
|
Port2ComboBox.SelectedItem = _syncSettings.Port2;
|
|
}
|
|
|
|
private void OkBtn_Click(object sender, EventArgs e)
|
|
{
|
|
bool changed =
|
|
_syncSettings.Port1 != Port1ComboBox.SelectedItem.ToString()
|
|
|| _syncSettings.Port2 != Port2ComboBox.SelectedItem.ToString();
|
|
|
|
if (changed)
|
|
{
|
|
_syncSettings.Port1 = Port1ComboBox.SelectedItem.ToString();
|
|
_syncSettings.Port2 = Port2ComboBox.SelectedItem.ToString();
|
|
|
|
_mainForm.PutCoreSyncSettings(_syncSettings);
|
|
}
|
|
|
|
DialogResult = DialogResult.OK;
|
|
Close();
|
|
}
|
|
|
|
private void CancelBtn_Click(object sender, EventArgs e)
|
|
{
|
|
_mainForm.AddOnScreenMessage("Controller settings aborted");
|
|
DialogResult = DialogResult.Cancel;
|
|
Close();
|
|
}
|
|
}
|
|
}
|