PSX - ui for controller type config

This commit is contained in:
adelikat 2015-02-01 03:19:23 +00:00
parent c2621e798d
commit c299f46439
2 changed files with 34 additions and 8 deletions

View File

@ -37,7 +37,7 @@
// //
this.CancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.CancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.CancelBtn.Location = new System.Drawing.Point(212, 227); this.CancelBtn.Location = new System.Drawing.Point(294, 227);
this.CancelBtn.Name = "CancelBtn"; this.CancelBtn.Name = "CancelBtn";
this.CancelBtn.Size = new System.Drawing.Size(60, 23); this.CancelBtn.Size = new System.Drawing.Size(60, 23);
this.CancelBtn.TabIndex = 5; this.CancelBtn.TabIndex = 5;
@ -48,7 +48,7 @@
// OkBtn // OkBtn
// //
this.OkBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.OkBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OkBtn.Location = new System.Drawing.Point(146, 227); this.OkBtn.Location = new System.Drawing.Point(228, 227);
this.OkBtn.Name = "OkBtn"; this.OkBtn.Name = "OkBtn";
this.OkBtn.Size = new System.Drawing.Size(60, 23); this.OkBtn.Size = new System.Drawing.Size(60, 23);
this.OkBtn.TabIndex = 4; this.OkBtn.TabIndex = 4;
@ -62,11 +62,12 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.CancelBtn; this.CancelButton = this.CancelBtn;
this.ClientSize = new System.Drawing.Size(284, 262); this.ClientSize = new System.Drawing.Size(366, 262);
this.Controls.Add(this.CancelBtn); this.Controls.Add(this.CancelBtn);
this.Controls.Add(this.OkBtn); this.Controls.Add(this.OkBtn);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "PSXControllerConfig"; this.Name = "PSXControllerConfig";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Controller Settings"; this.Text = "Controller Settings";
this.Load += new System.EventHandler(this.PSXControllerConfig_Load); this.Load += new System.EventHandler(this.PSXControllerConfig_Load);
this.ResumeLayout(false); this.ResumeLayout(false);

View File

@ -7,10 +7,11 @@ using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Common;
using BizHawk.Emulation.Cores.Sony.PSX; using BizHawk.Emulation.Cores.Sony.PSX;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Common; using BizHawk.Client.EmuHawk.WinFormExtensions;
using BizHawk.Common.ReflectionExtensions;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
@ -29,15 +30,28 @@ namespace BizHawk.Client.EmuHawk
Controls.Add(new Label Controls.Add(new Label
{ {
Text = "Controller " + (i + 1), Text = "Controller " + (i + 1),
Location = new Point(15, 15 + (i * 25)) Location = new Point(15, 19 + (i * 25)),
Width = 85
}); });
Controls.Add(new CheckBox Controls.Add(new CheckBox
{ {
Text = "Connected", Text = "Connected",
Name = "Controller" + i, Name = "Controller" + i,
Location = new Point(135, 15 + (i * 25)), Location = new Point(105, 15 + (i * 25)),
Checked = psxSettings.Controllers[i].IsConnected Checked = psxSettings.Controllers[i].IsConnected,
Width = 90
}); });
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);
} }
} }
@ -54,6 +68,17 @@ namespace BizHawk.Client.EmuHawk
var index = int.Parse(c.Name.Replace("Controller", "")); var index = int.Parse(c.Name.Replace("Controller", ""));
psxSettings.Controllers[index].IsConnected = c.Checked; psxSettings.Controllers[index].IsConnected = c.Checked;
}); });
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>();
});
GlobalWin.MainForm.PutCoreSyncSettings(psxSettings); GlobalWin.MainForm.PutCoreSyncSettings(psxSettings);
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();