multiclient: rework everything controller config related. there is still some transitional cruft and whatnot, so be patient.

This commit is contained in:
goyuken 2013-07-14 01:48:05 +00:00
parent 9ef3100753
commit 0825c4181c
11 changed files with 569 additions and 56 deletions

View File

@ -178,6 +178,9 @@
<Compile Include="config\ControllerConfig\ControllerConfigPanel.Designer.cs">
<DependentUpon>ControllerConfigPanel.cs</DependentUpon>
</Compile>
<Compile Include="config\ControllerConfig\NewControllerConfigPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="config\GifAnimator.cs">
<SubType>Form</SubType>
</Compile>
@ -193,6 +196,12 @@
<Compile Include="config\MessageConfig.Designer.cs">
<DependentUpon>MessageConfig.cs</DependentUpon>
</Compile>
<Compile Include="config\NewControllerConfig.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="config\NewControllerConfig.Designer.cs">
<DependentUpon>NewControllerConfig.cs</DependentUpon>
</Compile>
<Compile Include="config\PathConfig.cs">
<SubType>Form</SubType>
</Compile>
@ -572,6 +581,9 @@
<EmbeddedResource Include="config\GifAnimator.resx">
<DependentUpon>GifAnimator.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="config\NewControllerConfig.resx">
<DependentUpon>NewControllerConfig.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="config\PathInfo.resx">
<DependentUpon>PathInfo.cs</DependentUpon>
</EmbeddedResource>

View File

@ -1,4 +1,5 @@
using System.IO;
using System;
using System.IO;
using System.Drawing;
using System.Collections.Generic;
@ -8,6 +9,7 @@ namespace BizHawk.MultiClient
{
public Config()
{
/*
SMSController[0] = new SMSControllerTemplate(true);
SMSController[1] = new SMSControllerTemplate(false);
PCEController[0] = new PCEControllerTemplate(true);
@ -102,6 +104,7 @@ namespace BizHawk.MultiClient
SNESConsoleButtons = new NESConsoleButtonTemplate();
SMSConsoleButtons = new SMSConsoleButtonTemplate();
GenesisConsoleButtons = new GenConsoleButtonTemplate();
*/
}
// Directories
@ -843,6 +846,10 @@ namespace BizHawk.MultiClient
public const int NESNoiseMax = 247;
public const int NESDMCMax = 167;
// [ControllerType][ControllerName] => Bind
public Dictionary<string, Dictionary<string, string>> AllTrollers = new Dictionary<string, Dictionary<string, string>>();
public Dictionary<string, Dictionary<string, string>> AllTrollersAutoFire = new Dictionary<string, Dictionary<string, string>>();
// SMS / GameGear Settings
public bool SmsEnableFM = true;
public bool SmsAllowOverlock = false;
@ -851,66 +858,66 @@ namespace BizHawk.MultiClient
public bool GGShowClippedRegions = false;
public bool GGHighlightActiveDisplayRegion = false;
public SMSControllerTemplate[] SMSController = new SMSControllerTemplate[2];
public SMSControllerTemplate[] SMSAutoController = new SMSControllerTemplate[2];
public SMSConsoleButtonTemplate SMSConsoleButtons = new SMSConsoleButtonTemplate();
//public SMSControllerTemplate[] SMSController = new SMSControllerTemplate[2];
//public SMSControllerTemplate[] SMSAutoController = new SMSControllerTemplate[2];
//public SMSConsoleButtonTemplate SMSConsoleButtons = new SMSConsoleButtonTemplate();
// PCEngine Settings
public bool PceSpriteLimit = false;
public bool PceEqualizeVolume = false;
public bool PceArcadeCardRewindHack = true;
public PCEControllerTemplate[] PCEController = new PCEControllerTemplate[5];
public PCEControllerTemplate[] PCEAutoController = new PCEControllerTemplate[5];
//public PCEControllerTemplate[] PCEController = new PCEControllerTemplate[5];
//public PCEControllerTemplate[] PCEAutoController = new PCEControllerTemplate[5];
// Genesis Settings
public GenControllerTemplate[] GenesisController = new GenControllerTemplate[1];
public GenControllerTemplate[] GenesisAutoController = new GenControllerTemplate[1];
public GenConsoleButtonTemplate GenesisConsoleButtons = new GenConsoleButtonTemplate();
//public GenControllerTemplate[] GenesisController = new GenControllerTemplate[1];
//public GenControllerTemplate[] GenesisAutoController = new GenControllerTemplate[1];
//public GenConsoleButtonTemplate GenesisConsoleButtons = new GenConsoleButtonTemplate();
//Atari 2600 Settings
public SingleButtonJoyStickTemplate[] Atari2600Controller = new SingleButtonJoyStickTemplate[2];
public SingleButtonJoyStickTemplate[] Atari2600AutoController = new SingleButtonJoyStickTemplate[2];
public Atari2600ConsoleButtonsTemplate[] Atari2600ConsoleButtons = new Atari2600ConsoleButtonsTemplate[1];
//public SingleButtonJoyStickTemplate[] Atari2600Controller = new SingleButtonJoyStickTemplate[2];
//public SingleButtonJoyStickTemplate[] Atari2600AutoController = new SingleButtonJoyStickTemplate[2];
//public Atari2600ConsoleButtonsTemplate[] Atari2600ConsoleButtons = new Atari2600ConsoleButtonsTemplate[1];
public bool Atari2600_BW = false;
public bool Atari2600_LeftDifficulty = true;
public bool Atari2600_RightDifficulty = true;
//Atari 7800 Settings
public DoubleButtonJoyStickTemplate[] Atari7800Controller = new DoubleButtonJoyStickTemplate[2];
public DoubleButtonJoyStickTemplate[] Atari7800AutoController = new DoubleButtonJoyStickTemplate[2];
public Atari7800ConsoleButtonsTemplate[] Atari7800ConsoleButtons = new Atari7800ConsoleButtonsTemplate[1];
//public DoubleButtonJoyStickTemplate[] Atari7800Controller = new DoubleButtonJoyStickTemplate[2];
//public DoubleButtonJoyStickTemplate[] Atari7800AutoController = new DoubleButtonJoyStickTemplate[2];
//public Atari7800ConsoleButtonsTemplate[] Atari7800ConsoleButtons = new Atari7800ConsoleButtonsTemplate[1];
//ColecoVision
public ColecoVisionControllerTemplate[] ColecoController = new ColecoVisionControllerTemplate[2];
public ColecoVisionControllerTemplate[] ColecoAutoController = new ColecoVisionControllerTemplate[2];
//public ColecoVisionControllerTemplate[] ColecoController = new ColecoVisionControllerTemplate[2];
//public ColecoVisionControllerTemplate[] ColecoAutoController = new ColecoVisionControllerTemplate[2];
//Intellivision
public IntellivisionControllerTemplate[] IntellivisionController = new IntellivisionControllerTemplate[2];
public IntellivisionControllerTemplate[] IntellivisionAutoController = new IntellivisionControllerTemplate[2];
//public IntellivisionControllerTemplate[] IntellivisionController = new IntellivisionControllerTemplate[2];
//public IntellivisionControllerTemplate[] IntellivisionAutoController = new IntellivisionControllerTemplate[2];
//NES settings
public NESControllerTemplate[] NESController = new NESControllerTemplate[4];
public NESControllerTemplate[] NESAutoController = new NESControllerTemplate[4];
public NESConsoleButtonTemplate NESConsoleButtons = new NESConsoleButtonTemplate();
//public NESControllerTemplate[] NESController = new NESControllerTemplate[4];
//public NESControllerTemplate[] NESAutoController = new NESControllerTemplate[4];
//public NESConsoleButtonTemplate NESConsoleButtons = new NESConsoleButtonTemplate();
//SNES settings
public SNESControllerTemplate[] SNESController = new SNESControllerTemplate[4];
public SNESControllerTemplate[] SNESAutoController = new SNESControllerTemplate[4];
public NESConsoleButtonTemplate SNESConsoleButtons = new NESConsoleButtonTemplate();
//public SNESControllerTemplate[] SNESController = new SNESControllerTemplate[4];
//public SNESControllerTemplate[] SNESAutoController = new SNESControllerTemplate[4];
//public NESConsoleButtonTemplate SNESConsoleButtons = new NESConsoleButtonTemplate();
public string SNESProfile = "Compatibility";
public bool SNESUseRingBuffer = true;
public bool SNESAlwaysDoubleSize = false;
public N64ButtonsTemplate[] N64Controller = new N64ButtonsTemplate[4];
public N64ButtonsTemplate[] N64AutoController = new N64ButtonsTemplate[4];
public Standard2ButtonConsoleTemplate N64ConsoleButtons = new Standard2ButtonConsoleTemplate();
//public N64ButtonsTemplate[] N64Controller = new N64ButtonsTemplate[4];
//public N64ButtonsTemplate[] N64AutoController = new N64ButtonsTemplate[4];
//public Standard2ButtonConsoleTemplate N64ConsoleButtons = new Standard2ButtonConsoleTemplate();
//TI 83 settings
public TI83ControllerTemplate[] TI83Controller = new TI83ControllerTemplate[1];
//public TI83ControllerTemplate[] TI83Controller = new TI83ControllerTemplate[1];
//GB settings
public GBControllerTemplate[] GBController = new GBControllerTemplate[1];
public GBControllerTemplate[] GBAutoController = new GBControllerTemplate[1];
//public GBControllerTemplate[] GBController = new GBControllerTemplate[1];
//public GBControllerTemplate[] GBAutoController = new GBControllerTemplate[1];
public bool GB_ForceDMG = false;
public bool GB_GBACGB = false;
public bool GB_MulticartCompat = false;
@ -919,23 +926,23 @@ namespace BizHawk.MultiClient
public Emulation.Consoles.GB.GBColors.ColorType CGBColors = Emulation.Consoles.GB.GBColors.ColorType.gambatte;
//Dual Gb
public DualGBControllerTemplate[] DualGBController = new DualGBControllerTemplate[1];
public DualGBControllerTemplate[] AutoDualGBController = new DualGBControllerTemplate[1];
//public DualGBControllerTemplate[] DualGBController = new DualGBControllerTemplate[1];
//public DualGBControllerTemplate[] AutoDualGBController = new DualGBControllerTemplate[1];
//GBA settings
public GBAControllerTemplate[] GBAController = new GBAControllerTemplate[1];
public GBAControllerTemplate[] GBAAutoController = new GBAControllerTemplate[1];
//public GBAControllerTemplate[] GBAController = new GBAControllerTemplate[1];
//public GBAControllerTemplate[] GBAAutoController = new GBAControllerTemplate[1];
//Saturn
public SaturnControllerTemplate[] SaturnController = new SaturnControllerTemplate[2];
public SaturnControllerTemplate[] SaturnAutoController = new SaturnControllerTemplate[2];
public SaturnConsoleButtonTemplate SaturnConsoleButtons = new SaturnConsoleButtonTemplate();
//public SaturnControllerTemplate[] SaturnController = new SaturnControllerTemplate[2];
//public SaturnControllerTemplate[] SaturnAutoController = new SaturnControllerTemplate[2];
//public SaturnConsoleButtonTemplate SaturnConsoleButtons = new SaturnConsoleButtonTemplate();
//Commodore 64 Settings
public SingleButtonJoyStickTemplate[] C64Joysticks = new SingleButtonJoyStickTemplate[2];
public SingleButtonJoyStickTemplate[] C64AutoJoysticks = new SingleButtonJoyStickTemplate[2];
public C64KeyboardTemplate C64Keyboard = new C64KeyboardTemplate();
public C64KeyboardTemplate C64AutofireKeyboard = new C64KeyboardTemplate();
//public SingleButtonJoyStickTemplate[] C64Joysticks = new SingleButtonJoyStickTemplate[2];
//public SingleButtonJoyStickTemplate[] C64AutoJoysticks = new SingleButtonJoyStickTemplate[2];
//public C64KeyboardTemplate C64Keyboard = new C64KeyboardTemplate();
//public C64KeyboardTemplate C64AutofireKeyboard = new C64KeyboardTemplate();
//GIF Animator Settings
public int GifAnimatorNumFrames;
@ -975,6 +982,7 @@ namespace BizHawk.MultiClient
public bool Atari2600_ShowPlayfield = true;
}
/*
public class NESConsoleButtonTemplate : iControllerConfigObject
{
public string Reset = "";
@ -1949,12 +1957,12 @@ namespace BizHawk.MultiClient
SIN = "Period"; //49
}
}
*/
public interface iControllerConfigObject
{
void SetDefaults();
}
public enum PLUGINTYPE { RICE, GLIDE };

View File

@ -463,7 +463,8 @@ namespace BizHawk.MultiClient
private void OpenControllerConfig()
{
ControllerConfig c = new ControllerConfig();
//ControllerConfig c = new ControllerConfig();
config.NewControllerConfig c = new config.NewControllerConfig(Global.Emulator.ControllerDefinition);
c.ShowDialog();
if (c.DialogResult == DialogResult.OK)
{

View File

@ -804,7 +804,7 @@ namespace BizHawk.MultiClient
Global.NullControls = new Controller(NullEmulator.NullController);
Global.AutofireNullControls = new AutofireController(NullEmulator.NullController);
/*
var smsControls = new Controller(SMS.SmsController);
smsControls.BindMulti("Reset", Global.Config.SMSConsoleButtons.Reset);
smsControls.BindMulti("Pause", Global.Config.SMSConsoleButtons.Pause);
@ -905,7 +905,7 @@ namespace BizHawk.MultiClient
Global.AutofireSNESControls = asnesControls;
var nesControls = new Controller(NES.NESController);
for (int i = 0; i < 2 /*TODO*/; i++)
for (int i = 0; i < 2; i++) // TODO: more than 2
{
nesControls.BindMulti("P" + (i + 1) + " Up", Global.Config.NESController[i].Up);
nesControls.BindMulti("P" + (i + 1) + " Down", Global.Config.NESController[i].Down);
@ -927,7 +927,7 @@ namespace BizHawk.MultiClient
var anesControls = new AutofireController(NES.NESController) {Autofire = true};
for (int i = 0; i < 2 /*TODO*/; i++)
for (int i = 0; i < 2; i++) // TODO: more than 2
{
anesControls.BindMulti("P" + (i + 1) + " Up", Global.Config.NESAutoController[i].Up);
anesControls.BindMulti("P" + (i + 1) + " Down", Global.Config.NESAutoController[i].Down);
@ -1634,6 +1634,8 @@ namespace BizHawk.MultiClient
N64AControls.BindMulti("P4 R", Global.Config.N64AutoController[3].R);
Global.AutofireN64Controls = N64AControls;
*/
}
private static void FormDragEnter(object sender, DragEventArgs e)
@ -1905,8 +1907,47 @@ namespace BizHawk.MultiClient
}
}
static Controller BindToDefinition(ControllerDefinition def, Dictionary<string, Dictionary<string, string>> allbinds)
{
var ret = new Controller(def);
Dictionary<string, string> binds;
if (allbinds.TryGetValue(def.Name, out binds))
{
foreach (string cbutton in def.BoolButtons)
{
string bind;
if (binds.TryGetValue(cbutton, out bind))
ret.BindMulti(cbutton, bind);
}
}
return ret;
}
// could merge these two methods...
static AutofireController BindToDefinitionAF(ControllerDefinition def, Dictionary<string, Dictionary<string, string>> allbinds)
{
var ret = new AutofireController(def);
Dictionary<string, string> binds;
if (allbinds.TryGetValue(def.Name, out binds))
{
foreach (string cbutton in def.BoolButtons)
{
string bind;
if (binds.TryGetValue(cbutton, out bind))
ret.BindMulti(cbutton, bind);
}
}
return ret;
}
void SyncControls()
{
var def = Global.Emulator.ControllerDefinition;
Global.ActiveController = BindToDefinition(def, Global.Config.AllTrollers);
Global.AutoFireController = BindToDefinitionAF(def, Global.Config.AllTrollersAutoFire);
/*
if (Global.Game == null) return;
switch (Global.Game.System)
{
@ -1989,6 +2030,7 @@ namespace BizHawk.MultiClient
Global.ActiveController = Global.NullControls;
break;
}
*/
// allow propogating controls that are in the current controller definition but not in the prebaked one
Global.ActiveController.ForceType(new ControllerDefinition(Global.Emulator.ControllerDefinition));
Global.ClickyVirtualPadController.Type = new ControllerDefinition(Global.Emulator.ControllerDefinition);
@ -2763,6 +2805,7 @@ namespace BizHawk.MultiClient
//modals that need to capture input for binding purposes get input, of course
if (ActiveForm is HotkeyWindow) return true;
if (ActiveForm is ControllerConfig) return true;
if (ActiveForm is config.NewControllerConfig) return true;
if (ActiveForm is TAStudio) return true;
//if no form is active on this process, then the background input setting applies
if (ActiveForm == null && Global.Config.AcceptBackgroundInput) return true;
@ -2881,7 +2924,6 @@ namespace BizHawk.MultiClient
}
} //foreach event
}
private void ClearAutohold()

View File

@ -26,6 +26,9 @@ namespace BizHawk.MultiClient
private void SetToolTips()
{
//Set button hotkey mapping into tooltips
// TODO: REFIX this to work with the new controller system
// it isn't horribly difficult, but has to be done.
/*
toolTip1.SetToolTip(ZERO, Global.Config.TI83Controller[0]._0);
toolTip1.SetToolTip(ONE, Global.Config.TI83Controller[0]._1);
toolTip1.SetToolTip(TWO, Global.Config.TI83Controller[0]._2);
@ -76,6 +79,7 @@ namespace BizHawk.MultiClient
toolTip1.SetToolTip(DEL, Global.Config.TI83Controller[0].DEL);
toolTip1.SetToolTip(COMMA, Global.Config.TI83Controller[0].COMMA);
toolTip1.SetToolTip(SIN, Global.Config.TI83Controller[0].SIN);
*/
}
public void StopToolTips()

View File

@ -14,6 +14,7 @@ namespace BizHawk.MultiClient
private void ControllerConfig_Load(object sender, EventArgs e)
{
/*
AllowLR.Checked = Global.Config.AllowUD_LR;
NESController1Panel.LoadSettings(Global.Config.NESController[0]);
@ -208,7 +209,7 @@ namespace BizHawk.MultiClient
INTVAutofire2Panel.LabelWidth = 50;
INTVAutofire2Panel.ColumnWidth = 170;
INTVAutofire2Panel.LoadSettings(Global.Config.IntellivisionAutoController[1]);
*/
SetTabByPlatform();
if (!MainForm.INTERIM)

View File

@ -74,7 +74,7 @@ namespace BizHawk.MultiClient
}
}
public void Save()
virtual public void Save()
{
for (int button = 0; button < buttons.Count; button++)
{
@ -83,7 +83,7 @@ namespace BizHawk.MultiClient
}
}
public void LoadSettings(iControllerConfigObject configobj)
virtual public void LoadSettings(iControllerConfigObject configobj)
{
ControllerConfigObject = configobj;
@ -92,7 +92,7 @@ namespace BizHawk.MultiClient
SetWidgetStrings();
}
private void SetButtonList()
virtual protected void SetButtonList()
{
buttons.Clear();
MemberInfo[] members = ControllerConfigObject.GetType().GetMembers();
@ -106,7 +106,7 @@ namespace BizHawk.MultiClient
}
}
private void SetWidgetStrings()
virtual protected void SetWidgetStrings()
{
for (int button = 0; button < buttons.Count; button++)
{
@ -123,7 +123,7 @@ namespace BizHawk.MultiClient
}
}
private void Startup()
protected void Startup()
{
int x = InputMarginLeft;
int y = MarginTop - Spacing;
@ -175,7 +175,7 @@ namespace BizHawk.MultiClient
ClearAll();
}
private void restoreDefaultsToolStripMenuItem_Click(object sender, EventArgs e)
virtual protected void restoreDefaultsToolStripMenuItem_Click(object sender, EventArgs e)
{
ControllerConfigObject.SetDefaults();
SetWidgetStrings();

View File

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.MultiClient.config.ControllerConfig
{
class NewControllerConfigPanel : ControllerConfigPanel
{
Dictionary<string, string> RealConfigObject;
public override void Save()
{
for (int button = 0; button < buttons.Count; button++)
RealConfigObject[buttons[button]] = Inputs[button].Text;
}
public void LoadSettings(Dictionary<string, string> configobj)
{
RealConfigObject = configobj;
SetButtonList();
Startup();
SetWidgetStrings();
}
public override void LoadSettings(iControllerConfigObject configobj)
{
throw new InvalidOperationException();
}
protected override void SetButtonList()
{
buttons.Clear();
foreach (string s in RealConfigObject.Keys)
buttons.Add(s);
}
protected override void SetWidgetStrings()
{
for (int button = 0; button < buttons.Count; button++)
{
string s;
if (!RealConfigObject.TryGetValue(buttons[button], out s))
s = "";
Inputs[button].SetBindings(s);
}
}
protected override void restoreDefaultsToolStripMenuItem_Click(object sender, EventArgs e)
{
// this is a TODO: we have no concept of default values in our config system at the moment
// so for the moment, "defaults" = "no binds at all"
RealConfigObject.Clear();
SetWidgetStrings();
}
}
}

View File

@ -0,0 +1,173 @@
namespace BizHawk.MultiClient.config
{
partial class NewControllerConfig
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.label2 = new System.Windows.Forms.Label();
this.checkBoxAutoTab = new System.Windows.Forms.CheckBox();
this.checkBoxUDLR = new System.Windows.Forms.CheckBox();
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(107, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Currently Configuring:";
//
// tabControl1
//
this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(12, 25);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(840, 318);
this.tabControl1.TabIndex = 1;
//
// tabPage1
//
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(832, 292);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Normal Controls";
this.tabPage1.UseVisualStyleBackColor = true;
//
// tabPage2
//
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(832, 292);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Autofire Controls";
this.tabPage2.UseVisualStyleBackColor = true;
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(13, 457);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(140, 13);
this.label2.TabIndex = 2;
this.label2.Text = "Escape clears a keybinding.";
//
// checkBoxAutoTab
//
this.checkBoxAutoTab.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.checkBoxAutoTab.AutoSize = true;
this.checkBoxAutoTab.Location = new System.Drawing.Point(260, 456);
this.checkBoxAutoTab.Name = "checkBoxAutoTab";
this.checkBoxAutoTab.Size = new System.Drawing.Size(70, 17);
this.checkBoxAutoTab.TabIndex = 3;
this.checkBoxAutoTab.Text = "Auto Tab";
this.checkBoxAutoTab.UseVisualStyleBackColor = true;
this.checkBoxAutoTab.CheckedChanged += new System.EventHandler(this.checkBoxAutoTab_CheckedChanged);
//
// checkBoxUDLR
//
this.checkBoxUDLR.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.checkBoxUDLR.AutoSize = true;
this.checkBoxUDLR.Location = new System.Drawing.Point(336, 456);
this.checkBoxUDLR.Name = "checkBoxUDLR";
this.checkBoxUDLR.Size = new System.Drawing.Size(84, 17);
this.checkBoxUDLR.TabIndex = 4;
this.checkBoxUDLR.Text = "Allow UDLR";
this.checkBoxUDLR.UseVisualStyleBackColor = true;
this.checkBoxUDLR.CheckedChanged += new System.EventHandler(this.checkBoxUDLR_CheckedChanged);
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.Location = new System.Drawing.Point(696, 444);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 5;
this.buttonOK.Text = "OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.Location = new System.Drawing.Point(777, 444);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 6;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// NewControllerConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(864, 479);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.checkBoxUDLR);
this.Controls.Add(this.checkBoxAutoTab);
this.Controls.Add(this.label2);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.label1);
this.Name = "NewControllerConfig";
this.Text = "NewControllerConfig";
this.tabControl1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox checkBoxAutoTab;
private System.Windows.Forms.CheckBox checkBoxUDLR;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonCancel;
}
}

View File

@ -0,0 +1,95 @@
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;
using BizHawk.MultiClient.config.ControllerConfig;
namespace BizHawk.MultiClient.config
{
public partial class NewControllerConfig : Form
{
private NewControllerConfig()
{
InitializeComponent();
}
NewControllerConfigPanel normcontrls;
NewControllerConfigPanel autofirecontrls;
static void DoLoadSettings(NewControllerConfigPanel cp, ControllerDefinition def, Dictionary<string, Dictionary<string, string>> settingsblock)
{
cp.Spacing = 24;
cp.InputSize = 100;
cp.LabelPadding = 5;
cp.ColumnWidth = 170;
cp.LabelWidth = 60;
Dictionary<string, string> settings;
if (!settingsblock.TryGetValue(def.Name, out settings))
{
settings = new Dictionary<string, string>();
settingsblock[def.Name] = settings;
}
// check to make sure that the settings object has all of the appropriate boolbuttons
foreach (string button in def.BoolButtons)
{
if (!settings.Keys.Contains(button))
settings[button] = "";
}
cp.LoadSettings(settings);
}
public NewControllerConfig(ControllerDefinition def)
: this()
{
SuspendLayout();
normcontrls = new NewControllerConfigPanel();
normcontrls.Dock = DockStyle.Fill;
tabPage1.Controls.Add(normcontrls);
DoLoadSettings(normcontrls, def, Global.Config.AllTrollers);
autofirecontrls = new NewControllerConfigPanel();
autofirecontrls.Dock = DockStyle.Fill;
tabPage2.Controls.Add(autofirecontrls);
DoLoadSettings(autofirecontrls, def, Global.Config.AllTrollersAutoFire);
label1.Text = "Currently Configuring: " + def.Name;
checkBoxUDLR.Checked = Global.Config.AllowUD_LR;
checkBoxAutoTab.Checked = Global.Config.InputConfigAutoTab;
ResumeLayout();
}
private void checkBoxAutoTab_CheckedChanged(object sender, EventArgs e)
{
normcontrls.SetAutoTab(checkBoxAutoTab.Checked);
autofirecontrls.SetAutoTab(checkBoxAutoTab.Checked);
}
private void checkBoxUDLR_CheckedChanged(object sender, EventArgs e)
{
}
private void buttonOK_Click(object sender, EventArgs e)
{
Global.Config.AllowUD_LR = checkBoxUDLR.Checked;
Global.Config.InputConfigAutoTab = checkBoxAutoTab.Checked;
normcontrls.Save();
autofirecontrls.Save();
Global.OSD.AddMessage("Controller settings saved");
DialogResult = DialogResult.OK;
Close();
}
private void buttonCancel_Click(object sender, EventArgs e)
{
Global.OSD.AddMessage("Controller config aborted");
Close();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>