2015-01-31 20:24:06 +00:00
|
|
|
|
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;
|
|
|
|
|
|
2015-02-01 03:19:23 +00:00
|
|
|
|
using BizHawk.Common;
|
2015-01-31 20:24:06 +00:00
|
|
|
|
using BizHawk.Emulation.Cores.Sony.PSX;
|
|
|
|
|
using BizHawk.Client.Common;
|
2015-02-01 03:19:23 +00:00
|
|
|
|
using BizHawk.Client.EmuHawk.WinFormExtensions;
|
|
|
|
|
using BizHawk.Common.ReflectionExtensions;
|
2015-01-31 20:24:06 +00:00
|
|
|
|
|
|
|
|
|
namespace BizHawk.Client.EmuHawk
|
|
|
|
|
{
|
|
|
|
|
public partial class PSXControllerConfig : Form
|
|
|
|
|
{
|
|
|
|
|
public PSXControllerConfig()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PSXControllerConfig_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var psxSettings = ((Octoshock)Global.Emulator).GetSyncSettings();
|
|
|
|
|
for (int i = 0; i < psxSettings.Controllers.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
Controls.Add(new Label
|
|
|
|
|
{
|
|
|
|
|
Text = "Controller " + (i + 1),
|
2015-02-01 03:19:23 +00:00
|
|
|
|
Location = new Point(15, 19 + (i * 25)),
|
|
|
|
|
Width = 85
|
2015-01-31 20:24:06 +00:00
|
|
|
|
});
|
|
|
|
|
Controls.Add(new CheckBox
|
|
|
|
|
{
|
|
|
|
|
Text = "Connected",
|
|
|
|
|
Name = "Controller" + i,
|
2015-02-01 03:19:23 +00:00
|
|
|
|
Location = new Point(105, 15 + (i * 25)),
|
|
|
|
|
Checked = psxSettings.Controllers[i].IsConnected,
|
|
|
|
|
Width = 90
|
2015-01-31 20:24:06 +00:00
|
|
|
|
});
|
2015-02-01 03:19:23 +00:00
|
|
|
|
|
|
|
|
|
var dropdown = new ComboBox
|
|
|
|
|
{
|
|
|
|
|
Name = "Controller" + i,
|
|
|
|
|
DropDownStyle = ComboBoxStyle.DropDownList,
|
|
|
|
|
Location = new Point(200, 15 + (i * 25))
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
dropdown.PopulateFromEnum<Octoshock.ControllerSetting.ControllerType>(psxSettings.Controllers[i].Type);
|
|
|
|
|
|
|
|
|
|
Controls.Add(dropdown);
|
2015-01-31 20:24:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OkBtn_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var psxSettings = ((Octoshock)Global.Emulator).GetSyncSettings();
|
|
|
|
|
|
|
|
|
|
Controls
|
|
|
|
|
.OfType<CheckBox>()
|
|
|
|
|
.OrderBy(c => c.Name)
|
|
|
|
|
.ToList()
|
|
|
|
|
.ForEach(c =>
|
|
|
|
|
{
|
|
|
|
|
var index = int.Parse(c.Name.Replace("Controller", ""));
|
|
|
|
|
psxSettings.Controllers[index].IsConnected = c.Checked;
|
|
|
|
|
});
|
2015-02-01 03:19:23 +00:00
|
|
|
|
|
|
|
|
|
Controls
|
|
|
|
|
.OfType<ComboBox>()
|
|
|
|
|
.OrderBy(c => c.Name)
|
|
|
|
|
.ToList()
|
|
|
|
|
.ForEach(c =>
|
|
|
|
|
{
|
|
|
|
|
var index = int.Parse(c.Name.Replace("Controller", ""));
|
|
|
|
|
psxSettings.Controllers[index].Type = c.SelectedItem.ToString().GetEnumFromDescription<Octoshock.ControllerSetting.ControllerType>();
|
|
|
|
|
});
|
|
|
|
|
|
2015-01-31 20:24:06 +00:00
|
|
|
|
GlobalWin.MainForm.PutCoreSyncSettings(psxSettings);
|
|
|
|
|
DialogResult = DialogResult.OK;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CancelBtn_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DialogResult = DialogResult.Cancel;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
2015-07-27 17:18:21 +00:00
|
|
|
|
|
|
|
|
|
private void btnTest_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
new PSXControllerConfigNew().ShowDialog();
|
|
|
|
|
}
|
2015-01-31 20:24:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|