diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj
index bbc07b1dbe..e346ccf232 100644
--- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj
+++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj
@@ -172,9 +172,6 @@
ControllerConfigPanel.cs
-
- UserControl
-
Form
diff --git a/BizHawk.MultiClient/config/ControllerConfig/ControllerConfigPanel.cs b/BizHawk.MultiClient/config/ControllerConfig/ControllerConfigPanel.cs
index d74833c9f8..318b6b39df 100644
--- a/BizHawk.MultiClient/config/ControllerConfig/ControllerConfigPanel.cs
+++ b/BizHawk.MultiClient/config/ControllerConfig/ControllerConfigPanel.cs
@@ -11,7 +11,7 @@ namespace BizHawk.MultiClient
public partial class ControllerConfigPanel : UserControl
{
- iControllerConfigObject ControllerConfigObject; //Object that values will be saved to (In Config.cs)
+ Dictionary RealConfigObject;
public List buttons = new List();
@@ -76,52 +76,35 @@ namespace BizHawk.MultiClient
}
}
- virtual public void Save()
+ public void Save()
{
for (int button = 0; button < buttons.Count; button++)
- {
- FieldInfo buttonF = ControllerConfigObject.GetType().GetField(buttons[button]);
- buttonF.SetValue(ControllerConfigObject, Inputs[button].Text);
- }
+ RealConfigObject[buttons[button]] = Inputs[button].Text;
}
- virtual public void LoadSettings(iControllerConfigObject configobj)
+ public void LoadSettings(Dictionary configobj)
{
- ControllerConfigObject = configobj;
-
+ RealConfigObject = configobj;
SetButtonList();
Startup();
SetWidgetStrings();
}
- virtual protected void SetButtonList()
+ protected void SetButtonList()
{
buttons.Clear();
- MemberInfo[] members = ControllerConfigObject.GetType().GetMembers();
-
- foreach (MemberInfo member in members)
- {
- if (member.MemberType.ToString() == "Field" && member.ToString().Contains("System.String"))
- {
- buttons.Add(member.Name);
- }
- }
+ foreach (string s in RealConfigObject.Keys)
+ buttons.Add(s);
}
- virtual protected void SetWidgetStrings()
+ protected void SetWidgetStrings()
{
for (int button = 0; button < buttons.Count; button++)
{
- object field = ControllerConfigObject.GetType().GetField(buttons[button]).GetValue(ControllerConfigObject);
-
- if (field == null)
- {
- Inputs[button].SetBindings("");
- }
- else
- {
- Inputs[button].SetBindings(field.ToString());
- }
+ string s;
+ if (!RealConfigObject.TryGetValue(buttons[button], out s))
+ s = "";
+ Inputs[button].SetBindings(s);
}
}
@@ -177,9 +160,11 @@ namespace BizHawk.MultiClient
ClearAll();
}
- virtual protected void restoreDefaultsToolStripMenuItem_Click(object sender, EventArgs e)
+ protected void restoreDefaultsToolStripMenuItem_Click(object sender, EventArgs e)
{
- ControllerConfigObject.SetDefaults();
+ // 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();
}
}
diff --git a/BizHawk.MultiClient/config/ControllerConfig/NewControllerConfigPanel.cs b/BizHawk.MultiClient/config/ControllerConfig/NewControllerConfigPanel.cs
deleted file mode 100644
index d94f974d3d..0000000000
--- a/BizHawk.MultiClient/config/ControllerConfig/NewControllerConfigPanel.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace BizHawk.MultiClient.config.ControllerConfig
-{
- class NewControllerConfigPanel : ControllerConfigPanel
- {
- Dictionary RealConfigObject;
-
- public override void Save()
- {
- for (int button = 0; button < buttons.Count; button++)
- RealConfigObject[buttons[button]] = Inputs[button].Text;
- }
-
- public void LoadSettings(Dictionary 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();
- }
- }
-}
diff --git a/BizHawk.MultiClient/config/NewControllerConfig.cs b/BizHawk.MultiClient/config/NewControllerConfig.cs
index daf0d75d38..1125d78f9f 100644
--- a/BizHawk.MultiClient/config/NewControllerConfig.cs
+++ b/BizHawk.MultiClient/config/NewControllerConfig.cs
@@ -6,7 +6,6 @@ using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
-using BizHawk.MultiClient.config.ControllerConfig;
namespace BizHawk.MultiClient.config
{
@@ -38,10 +37,10 @@ namespace BizHawk.MultiClient.config
InitializeComponent();
}
- NewControllerConfigPanel normcontrls;
- NewControllerConfigPanel autofirecontrls;
+ ControllerConfigPanel normcontrls;
+ ControllerConfigPanel autofirecontrls;
- static void DoLoadSettings(NewControllerConfigPanel cp, ControllerDefinition def, Dictionary> settingsblock)
+ static void DoLoadSettings(ControllerConfigPanel cp, ControllerDefinition def, Dictionary> settingsblock)
{
cp.Spacing = 24;
cp.InputSize = 100;
@@ -68,12 +67,12 @@ namespace BizHawk.MultiClient.config
: this()
{
SuspendLayout();
- normcontrls = new NewControllerConfigPanel();
+ normcontrls = new ControllerConfigPanel();
normcontrls.Dock = DockStyle.Fill;
tabPage1.Controls.Add(normcontrls);
DoLoadSettings(normcontrls, def, Global.Config.AllTrollers);
- autofirecontrls = new NewControllerConfigPanel();
+ autofirecontrls = new ControllerConfigPanel();
autofirecontrls.Dock = DockStyle.Fill;
tabPage2.Controls.Add(autofirecontrls);
DoLoadSettings(autofirecontrls, def, Global.Config.AllTrollersAutoFire);