Rip out old input config dialog code
This commit is contained in:
parent
99c7c132f1
commit
796c6b8773
|
@ -184,12 +184,6 @@
|
|||
<Compile Include="config\GifAnimator.Designer.cs">
|
||||
<DependentUpon>GifAnimator.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="config\InputConfig.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="config\InputConfig.Designer.cs">
|
||||
<DependentUpon>InputConfig.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="config\InputWidget.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
@ -764,10 +758,6 @@
|
|||
<EmbeddedResource Include="config\AutofireConfig.resx">
|
||||
<DependentUpon>AutofireConfig.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="config\InputConfig.resx">
|
||||
<DependentUpon>InputConfig.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="config\MessageConfig.resx">
|
||||
<DependentUpon>MessageConfig.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
|
|
@ -2212,7 +2212,6 @@ namespace BizHawk.MultiClient
|
|||
if (Form.ActiveForm == this) return true;
|
||||
|
||||
//modals that need to capture input for binding purposes get input, of course
|
||||
if (Form.ActiveForm is InputConfig) return true;
|
||||
if (Form.ActiveForm is HotkeyWindow) return true;
|
||||
if (Form.ActiveForm is ControllerConfig) return true;
|
||||
if (Form.ActiveForm is TAStudio) return true;
|
||||
|
|
|
@ -1,265 +0,0 @@
|
|||
namespace BizHawk.MultiClient
|
||||
{
|
||||
partial class InputConfig
|
||||
{
|
||||
/// <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.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InputConfig));
|
||||
this.OK = new System.Windows.Forms.Button();
|
||||
this.Cancel = new System.Windows.Forms.Button();
|
||||
this.ButtonsGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.clearMappingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ControllerImage = new System.Windows.Forms.PictureBox();
|
||||
this.ControllerSelectGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.IDX_CONTROLLERENABLED = new System.Windows.Forms.CheckBox();
|
||||
this.ControllComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.SystemGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.SystemComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.AllowLR = new System.Windows.Forms.CheckBox();
|
||||
this.AutoTab = new System.Windows.Forms.CheckBox();
|
||||
this.label38 = new System.Windows.Forms.Label();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ControllerImage)).BeginInit();
|
||||
this.ControllerSelectGroupBox.SuspendLayout();
|
||||
this.SystemGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// OK
|
||||
//
|
||||
this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.OK.Location = new System.Drawing.Point(391, 372);
|
||||
this.OK.Name = "OK";
|
||||
this.OK.Size = new System.Drawing.Size(60, 23);
|
||||
this.OK.TabIndex = 0;
|
||||
this.OK.Text = "&Ok";
|
||||
this.OK.UseVisualStyleBackColor = true;
|
||||
this.OK.Click += new System.EventHandler(this.OK_Click);
|
||||
//
|
||||
// Cancel
|
||||
//
|
||||
this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.Cancel.Location = new System.Drawing.Point(457, 372);
|
||||
this.Cancel.Name = "Cancel";
|
||||
this.Cancel.Size = new System.Drawing.Size(60, 23);
|
||||
this.Cancel.TabIndex = 1;
|
||||
this.Cancel.Text = "&Cancel";
|
||||
this.Cancel.UseVisualStyleBackColor = true;
|
||||
this.Cancel.Click += new System.EventHandler(this.Cancel_Click);
|
||||
//
|
||||
// ButtonsGroupBox
|
||||
//
|
||||
this.ButtonsGroupBox.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.ButtonsGroupBox.ContextMenuStrip = this.contextMenuStrip1;
|
||||
this.ButtonsGroupBox.Location = new System.Drawing.Point(12, 84);
|
||||
this.ButtonsGroupBox.Name = "ButtonsGroupBox";
|
||||
this.ButtonsGroupBox.Size = new System.Drawing.Size(238, 311);
|
||||
this.ButtonsGroupBox.TabIndex = 2;
|
||||
this.ButtonsGroupBox.TabStop = false;
|
||||
this.ButtonsGroupBox.Text = "Buttons";
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.clearMappingsToolStripMenuItem});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(158, 26);
|
||||
//
|
||||
// clearMappingsToolStripMenuItem
|
||||
//
|
||||
this.clearMappingsToolStripMenuItem.Name = "clearMappingsToolStripMenuItem";
|
||||
this.clearMappingsToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
|
||||
this.clearMappingsToolStripMenuItem.Text = "&Clear Mappings";
|
||||
this.clearMappingsToolStripMenuItem.Click += new System.EventHandler(this.clearMappingsToolStripMenuItem_Click);
|
||||
//
|
||||
// ControllerImage
|
||||
//
|
||||
this.ControllerImage.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.ControllerImage.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.ControllerImage.Location = new System.Drawing.Point(256, 84);
|
||||
this.ControllerImage.Name = "ControllerImage";
|
||||
this.ControllerImage.Size = new System.Drawing.Size(261, 282);
|
||||
this.ControllerImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
|
||||
this.ControllerImage.TabIndex = 3;
|
||||
this.ControllerImage.TabStop = false;
|
||||
//
|
||||
// ControllerSelectGroupBox
|
||||
//
|
||||
this.ControllerSelectGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ControllerSelectGroupBox.Controls.Add(this.IDX_CONTROLLERENABLED);
|
||||
this.ControllerSelectGroupBox.Controls.Add(this.ControllComboBox);
|
||||
this.ControllerSelectGroupBox.Location = new System.Drawing.Point(13, 28);
|
||||
this.ControllerSelectGroupBox.Name = "ControllerSelectGroupBox";
|
||||
this.ControllerSelectGroupBox.Size = new System.Drawing.Size(237, 50);
|
||||
this.ControllerSelectGroupBox.TabIndex = 4;
|
||||
this.ControllerSelectGroupBox.TabStop = false;
|
||||
this.ControllerSelectGroupBox.Text = "Controller";
|
||||
//
|
||||
// IDX_CONTROLLERENABLED
|
||||
//
|
||||
this.IDX_CONTROLLERENABLED.AutoSize = true;
|
||||
this.IDX_CONTROLLERENABLED.Checked = true;
|
||||
this.IDX_CONTROLLERENABLED.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.IDX_CONTROLLERENABLED.Location = new System.Drawing.Point(169, 23);
|
||||
this.IDX_CONTROLLERENABLED.Name = "IDX_CONTROLLERENABLED";
|
||||
this.IDX_CONTROLLERENABLED.Size = new System.Drawing.Size(65, 17);
|
||||
this.IDX_CONTROLLERENABLED.TabIndex = 1;
|
||||
this.IDX_CONTROLLERENABLED.Text = "Enabled";
|
||||
this.IDX_CONTROLLERENABLED.UseVisualStyleBackColor = true;
|
||||
this.IDX_CONTROLLERENABLED.Visible = false;
|
||||
//
|
||||
// ControllComboBox
|
||||
//
|
||||
this.ControllComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.ControllComboBox.FormattingEnabled = true;
|
||||
this.ControllComboBox.Location = new System.Drawing.Point(6, 19);
|
||||
this.ControllComboBox.Name = "ControllComboBox";
|
||||
this.ControllComboBox.Size = new System.Drawing.Size(157, 21);
|
||||
this.ControllComboBox.TabIndex = 0;
|
||||
this.ControllComboBox.SelectedIndexChanged += new System.EventHandler(this.ControllComboBox_SelectedIndexChanged);
|
||||
//
|
||||
// SystemGroupBox
|
||||
//
|
||||
this.SystemGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.SystemGroupBox.Controls.Add(this.SystemComboBox);
|
||||
this.SystemGroupBox.Location = new System.Drawing.Point(256, 28);
|
||||
this.SystemGroupBox.Name = "SystemGroupBox";
|
||||
this.SystemGroupBox.Size = new System.Drawing.Size(158, 50);
|
||||
this.SystemGroupBox.TabIndex = 6;
|
||||
this.SystemGroupBox.TabStop = false;
|
||||
this.SystemGroupBox.Text = "System";
|
||||
//
|
||||
// SystemComboBox
|
||||
//
|
||||
this.SystemComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.SystemComboBox.FormattingEnabled = true;
|
||||
this.SystemComboBox.Items.AddRange(new object[] {
|
||||
"NES",
|
||||
"SNES",
|
||||
"Gameboy",
|
||||
"SMS / GG / SG-1000",
|
||||
"Sega Genesis",
|
||||
"PC Engine / SuperGrafx",
|
||||
"TI-83"});
|
||||
this.SystemComboBox.Location = new System.Drawing.Point(6, 19);
|
||||
this.SystemComboBox.Name = "SystemComboBox";
|
||||
this.SystemComboBox.Size = new System.Drawing.Size(146, 21);
|
||||
this.SystemComboBox.TabIndex = 2;
|
||||
this.SystemComboBox.SelectedIndexChanged += new System.EventHandler(this.SystemComboBox_SelectedIndexChanged);
|
||||
//
|
||||
// AllowLR
|
||||
//
|
||||
this.AllowLR.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.AllowLR.AutoSize = true;
|
||||
this.AllowLR.Location = new System.Drawing.Point(262, 376);
|
||||
this.AllowLR.Name = "AllowLR";
|
||||
this.AllowLR.Size = new System.Drawing.Size(107, 17);
|
||||
this.AllowLR.TabIndex = 7;
|
||||
this.AllowLR.Text = "Allow L+R / U+D";
|
||||
this.AllowLR.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// AutoTab
|
||||
//
|
||||
this.AutoTab.AutoSize = true;
|
||||
this.AutoTab.Location = new System.Drawing.Point(19, 5);
|
||||
this.AutoTab.Name = "AutoTab";
|
||||
this.AutoTab.Size = new System.Drawing.Size(70, 17);
|
||||
this.AutoTab.TabIndex = 8;
|
||||
this.AutoTab.Text = "Auto Tab";
|
||||
this.AutoTab.UseVisualStyleBackColor = true;
|
||||
this.AutoTab.CheckedChanged += new System.EventHandler(this.AutoTab_CheckedChanged);
|
||||
//
|
||||
// label38
|
||||
//
|
||||
this.label38.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label38.AutoSize = true;
|
||||
this.label38.Location = new System.Drawing.Point(9, 399);
|
||||
this.label38.Name = "label38";
|
||||
this.label38.Size = new System.Drawing.Size(153, 13);
|
||||
this.label38.TabIndex = 9;
|
||||
this.label38.Text = "* Escape clears a key mapping";
|
||||
//
|
||||
// InputConfig
|
||||
//
|
||||
this.AcceptButton = this.OK;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.Cancel;
|
||||
this.ClientSize = new System.Drawing.Size(529, 421);
|
||||
this.Controls.Add(this.label38);
|
||||
this.Controls.Add(this.AutoTab);
|
||||
this.Controls.Add(this.ControllerSelectGroupBox);
|
||||
this.Controls.Add(this.ControllerImage);
|
||||
this.Controls.Add(this.SystemGroupBox);
|
||||
this.Controls.Add(this.AllowLR);
|
||||
this.Controls.Add(this.ButtonsGroupBox);
|
||||
this.Controls.Add(this.Cancel);
|
||||
this.Controls.Add(this.OK);
|
||||
this.DoubleBuffered = true;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(418, 202);
|
||||
this.Name = "InputConfig";
|
||||
this.Text = "Configure Controllers";
|
||||
this.Load += new System.EventHandler(this.InputConfig_Load);
|
||||
this.Shown += new System.EventHandler(this.InputConfig_Shown);
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.ControllerImage)).EndInit();
|
||||
this.ControllerSelectGroupBox.ResumeLayout(false);
|
||||
this.ControllerSelectGroupBox.PerformLayout();
|
||||
this.SystemGroupBox.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button OK;
|
||||
private System.Windows.Forms.Button Cancel;
|
||||
private System.Windows.Forms.GroupBox ButtonsGroupBox;
|
||||
private System.Windows.Forms.PictureBox ControllerImage;
|
||||
private System.Windows.Forms.GroupBox ControllerSelectGroupBox;
|
||||
private System.Windows.Forms.ComboBox ControllComboBox;
|
||||
private System.Windows.Forms.CheckBox IDX_CONTROLLERENABLED;
|
||||
private System.Windows.Forms.GroupBox SystemGroupBox;
|
||||
private System.Windows.Forms.ComboBox SystemComboBox;
|
||||
private System.Windows.Forms.CheckBox AllowLR;
|
||||
private System.Windows.Forms.CheckBox AutoTab;
|
||||
private System.Windows.Forms.Label label38;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem clearMappingsToolStripMenuItem;
|
||||
}
|
||||
}
|
|
@ -1,601 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
public partial class InputConfig : Form
|
||||
{
|
||||
int prevWidth;
|
||||
int prevHeight;
|
||||
const string ControllerStr = "Configure Controllers - ";
|
||||
public static readonly Dictionary<string, string[]> CONTROLS = new Dictionary<string, string[]>()
|
||||
{
|
||||
{"Atari", new string[5] { "Up", "Down", "Left", "Right", "Button" } },
|
||||
{"AtariConsoleButtons", new string[2] { "Reset", "Select" } },
|
||||
{"Gameboy", new string[8] { "Up", "Down", "Left", "Right", "A", "B", "Select", "Start" } },
|
||||
{"NES", new string[8] { "Up", "Down", "Left", "Right", "A", "B", "Select", "Start" } },
|
||||
{"SNES", new string[] { "Up", "Down", "Left", "Right", "B", "A", "X", "Y", "L", "R", "Select", "Start" } },
|
||||
{"PC Engine / SuperGrafx", new string[8] { "Up", "Down", "Left", "Right", "I", "II", "Run", "Select" } },
|
||||
{"Sega Genesis", new string[8] { "Up", "Down", "Left", "Right", "A", "B", "C", "Start" } },
|
||||
{"SMS / GG / SG-1000", new string[8] { "Up", "Down", "Left", "Right", "B1", "B2", "Pause", "Reset" } },
|
||||
|
||||
{
|
||||
// TODO: display shift / alpha names too, Also order these like on the calculator
|
||||
"TI-83", new string[50] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "ON",
|
||||
"ENTER", "Up", "Down", "Left", "Right", "+", "-", "Multiply", "Divide", "CLEAR", "^", "-", "(", ")", "TAN",
|
||||
"VARS", "COS", "PRGM", "STAT", "Matrix", "X", "STO->", "LN", "LOG", "^2", "^-1", "MATH", "ALPHA", "GRAPH",
|
||||
"TRACE", "ZOOM", "WINDOW", "Y", "2nd", "MODE", "Del", ",", "SIN" }
|
||||
}
|
||||
};
|
||||
|
||||
public static readonly string[] TI83CONTROLS = new string[50] {
|
||||
"_0", "_1", "_2", "_3", "_4", "_5", "_6", "_7", "_8", "_9", "DOT", "ON", "ENTER", "UP", "DOWN", "LEFT", "RIGHT",
|
||||
"PLUS", "MINUS", "MULTIPLY", "DIVIDE", "CLEAR", "EXP", "DASH", "PARAOPEN", "PARACLOSE", "TAN", "VARS", "COS",
|
||||
"PRGM", "STAT", "MATRIX", "X", "STO", "LN", "LOG", "SQUARED", "NEG1", "MATH", "ALPHA", "GRAPH", "TRACE", "ZOOM",
|
||||
"WINDOW", "Y", "SECOND", "MODE", "DEL", "COMMA", "SIN"
|
||||
};
|
||||
|
||||
public static readonly Dictionary<string, int> PADS = new Dictionary<string, int>()
|
||||
{
|
||||
{"Atari", 2}, {"Gameboy", 1}, {"NES", 4}, {"PC Engine / SuperGrafx", 5}, {"Sega Genesis", 1}, {"SMS / GG / SG-1000", 2},
|
||||
{"SNES", 4},
|
||||
{"TI-83", 1}
|
||||
};
|
||||
|
||||
private List<KeyValuePair<string, string>> HotkeyMappingList = new List<KeyValuePair<string, string>>(); //A list of all button mappings and the hotkey they are assigned to
|
||||
|
||||
private ArrayList Labels;
|
||||
private ArrayList TextBoxes;
|
||||
private string CurSelectConsole;
|
||||
private int CurSelectController;
|
||||
private bool Changed;
|
||||
|
||||
public InputConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
Labels = new ArrayList();
|
||||
TextBoxes = new ArrayList();
|
||||
Changed = false;
|
||||
}
|
||||
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
//Input.Instance.EnableIgnoreModifiers = true;
|
||||
base.OnShown(e);
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
base.OnClosed(e);
|
||||
//Input.Instance.EnableIgnoreModifiers = false;
|
||||
}
|
||||
|
||||
private void Do(string platform)
|
||||
{
|
||||
Label TempLabel;
|
||||
InputWidget TempTextBox;
|
||||
this.Text = ControllerStr + platform;
|
||||
object[] controller = null;
|
||||
object[] mainController = null;
|
||||
object[] autoController = null;
|
||||
switch (platform)
|
||||
{
|
||||
case "Atari":
|
||||
ControllerImage.Image = BizHawk.MultiClient.Properties.Resources.atari_controller;
|
||||
controller = Global.Config.Atari2600Controller;
|
||||
autoController = Global.Config.Atari2600AutoController;
|
||||
break;
|
||||
case "Gameboy":
|
||||
ControllerImage.Image = BizHawk.MultiClient.Properties.Resources.GBController;
|
||||
controller = Global.Config.GBController;
|
||||
autoController = Global.Config.GBAutoController;
|
||||
break;
|
||||
case "NES":
|
||||
ControllerImage.Image = BizHawk.MultiClient.Properties.Resources.NES_Controller;
|
||||
controller = Global.Config.NESController;
|
||||
autoController = Global.Config.NESAutoController;
|
||||
break;
|
||||
case "PC Engine / SuperGrafx":
|
||||
ControllerImage.Image = BizHawk.MultiClient.Properties.Resources.PCEngineController;
|
||||
controller = Global.Config.PCEController;
|
||||
autoController = Global.Config.PCEAutoController;
|
||||
break;
|
||||
case "Sega Genesis":
|
||||
ControllerImage.Image = BizHawk.MultiClient.Properties.Resources.GENController;
|
||||
controller = Global.Config.GenesisController;
|
||||
autoController = Global.Config.GenesisAutoController;
|
||||
break;
|
||||
case "SMS / GG / SG-1000":
|
||||
ControllerImage.Image = BizHawk.MultiClient.Properties.Resources.SMSController;
|
||||
controller = Global.Config.SMSController;
|
||||
autoController = Global.Config.SMSAutoController;
|
||||
break;
|
||||
case "TI-83":
|
||||
ControllerImage.Image = BizHawk.MultiClient.Properties.Resources.TI83_Controller;
|
||||
controller = Global.Config.TI83Controller;
|
||||
break;
|
||||
case "SNES":
|
||||
ControllerImage.Image = BizHawk.MultiClient.Properties.Resources.SNES_Controller;
|
||||
controller = Global.Config.SNESController;
|
||||
autoController = Global.Config.SNESAutoController;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
mainController = controller;
|
||||
int jpad = this.ControllComboBox.SelectedIndex;
|
||||
if (jpad >= PADS[platform] * 2) //Not joypad or auto-joypad, must be special category (adelikat: I know this is hacky but so is the rest of this file)
|
||||
{
|
||||
switch (platform)
|
||||
{
|
||||
case "Atari":
|
||||
IDX_CONTROLLERENABLED.Checked = Global.Config.Atari2600ConsoleButtons[0].Enabled;
|
||||
controller = Global.Config.Atari2600ConsoleButtons;
|
||||
break;
|
||||
}
|
||||
platform += "ConsoleButtons";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (jpad >= PADS[platform])
|
||||
{
|
||||
jpad -= PADS[platform];
|
||||
controller = autoController;
|
||||
}
|
||||
switch (platform)
|
||||
{
|
||||
case "Atari":
|
||||
IDX_CONTROLLERENABLED.Checked = ((SingleButtonJoyStickTemplate)mainController[jpad]).Enabled;
|
||||
break;
|
||||
case "Gameboy":
|
||||
IDX_CONTROLLERENABLED.Checked = ((GBControllerTemplate)mainController[jpad]).Enabled;
|
||||
break;
|
||||
case "NES":
|
||||
IDX_CONTROLLERENABLED.Checked = ((NESControllerTemplate)mainController[jpad]).Enabled;
|
||||
break;
|
||||
case "SNES":
|
||||
IDX_CONTROLLERENABLED.Checked = ((SNESControllerTemplate)mainController[jpad]).Enabled;
|
||||
break;
|
||||
case "PC Engine / SuperGrafx":
|
||||
IDX_CONTROLLERENABLED.Checked = ((PCEControllerTemplate)mainController[jpad]).Enabled;
|
||||
break;
|
||||
case "Sega Genesis":
|
||||
IDX_CONTROLLERENABLED.Checked = ((GenControllerTemplate)mainController[jpad]).Enabled;
|
||||
break;
|
||||
case "SMS / GG / SG-1000":
|
||||
IDX_CONTROLLERENABLED.Checked = ((SMSControllerTemplate)mainController[jpad]).Enabled;
|
||||
break;
|
||||
case "TI-83":
|
||||
IDX_CONTROLLERENABLED.Checked = ((TI83ControllerTemplate)mainController[jpad]).Enabled;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Labels.Clear();
|
||||
TextBoxes.Clear();
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
for (int button = 0; button < CONTROLS[platform].Length; button++)
|
||||
{
|
||||
TempLabel = new Label();
|
||||
TempLabel.Text = CONTROLS[platform][button];
|
||||
int xoffset = (col * 156);
|
||||
int yoffset = (row * 24);
|
||||
TempLabel.Location = new Point(8 + xoffset, 20 + yoffset);
|
||||
Labels.Add(TempLabel);
|
||||
TempTextBox = new InputWidget();
|
||||
TempTextBox.Location = new Point(64 + xoffset, 20 + yoffset);
|
||||
TextBoxes.Add(TempTextBox);
|
||||
object field = null;
|
||||
string fieldName = CONTROLS[platform][button];
|
||||
switch (platform)
|
||||
{
|
||||
case "AtariConsoleButtons":
|
||||
Atari2600ConsoleButtonsTemplate o = (Atari2600ConsoleButtonsTemplate)controller[0];
|
||||
field = o.GetType().GetField(fieldName).GetValue(o);
|
||||
break;
|
||||
case "Atari":
|
||||
{
|
||||
SingleButtonJoyStickTemplate obj = (SingleButtonJoyStickTemplate)controller[jpad];
|
||||
field = obj.GetType().GetField(fieldName).GetValue(obj);
|
||||
break;
|
||||
}
|
||||
case "Gameboy":
|
||||
{
|
||||
GBControllerTemplate obj = (GBControllerTemplate)controller[jpad];
|
||||
field = obj.GetType().GetField(fieldName).GetValue(obj);
|
||||
break;
|
||||
}
|
||||
case "NES":
|
||||
{
|
||||
NESControllerTemplate obj = (NESControllerTemplate)controller[jpad];
|
||||
field = obj.GetType().GetField(fieldName).GetValue(obj);
|
||||
break;
|
||||
}
|
||||
case "SNES":
|
||||
{
|
||||
SNESControllerTemplate obj = (SNESControllerTemplate)controller[jpad];
|
||||
field = obj.GetType().GetField(fieldName).GetValue(obj);
|
||||
break;
|
||||
}
|
||||
case "PC Engine / SuperGrafx":
|
||||
{
|
||||
PCEControllerTemplate obj = (PCEControllerTemplate)controller[jpad];
|
||||
field = obj.GetType().GetField(fieldName).GetValue(obj);
|
||||
break;
|
||||
}
|
||||
case "Sega Genesis":
|
||||
{
|
||||
GenControllerTemplate obj = (GenControllerTemplate)controller[jpad];
|
||||
field = obj.GetType().GetField(fieldName).GetValue(obj);
|
||||
break;
|
||||
}
|
||||
case "SMS / GG / SG-1000":
|
||||
{
|
||||
if (button < 6)
|
||||
{
|
||||
SMSControllerTemplate obj = (SMSControllerTemplate)controller[jpad];
|
||||
field = obj.GetType().GetField(fieldName).GetValue(obj);
|
||||
}
|
||||
else if (button == 6)
|
||||
field = Global.Config.SMSConsoleButtons.Pause;
|
||||
else
|
||||
field = Global.Config.SMSConsoleButtons.Reset;
|
||||
break;
|
||||
}
|
||||
case "TI-83":
|
||||
{
|
||||
TI83ControllerTemplate obj = (TI83ControllerTemplate)controller[jpad];
|
||||
field = obj.GetType().GetField(TI83CONTROLS[button]).GetValue(obj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
TempTextBox.SetBindings((string)field);
|
||||
ButtonsGroupBox.Controls.Add(TempTextBox);
|
||||
ButtonsGroupBox.Controls.Add(TempLabel);
|
||||
row++;
|
||||
if (row > 16)
|
||||
{
|
||||
row = 0;
|
||||
col++;
|
||||
}
|
||||
}
|
||||
Changed = true;
|
||||
}
|
||||
|
||||
private void Update(int prev, string platform)
|
||||
{
|
||||
if (platform == "Atari" && prev == 4) //adelikat: very hacky I know
|
||||
platform += "ConsoleButtons";
|
||||
ButtonsGroupBox.Controls.Clear();
|
||||
object[] controller = null;
|
||||
object[] mainController = null;
|
||||
object[] autoController = null;
|
||||
switch (platform)
|
||||
{
|
||||
case "AtariConsoleButtons":
|
||||
controller = Global.Config.Atari2600ConsoleButtons;
|
||||
break;
|
||||
case "Atari":
|
||||
controller = Global.Config.Atari2600Controller;
|
||||
autoController = Global.Config.Atari2600AutoController;
|
||||
break;
|
||||
case "Gameboy":
|
||||
controller = Global.Config.GBController;
|
||||
autoController = Global.Config.GBAutoController;
|
||||
break;
|
||||
case "NES":
|
||||
controller = Global.Config.NESController;
|
||||
autoController = Global.Config.NESAutoController;
|
||||
break;
|
||||
case "SNES":
|
||||
controller = Global.Config.SNESController;
|
||||
autoController = Global.Config.SNESAutoController;
|
||||
break;
|
||||
case "PC Engine / SuperGrafx":
|
||||
controller = Global.Config.PCEController;
|
||||
autoController = Global.Config.PCEAutoController;
|
||||
break;
|
||||
case "Sega Genesis":
|
||||
controller = Global.Config.GenesisController;
|
||||
autoController = Global.Config.GenesisAutoController;
|
||||
break;
|
||||
case "SMS / GG / SG-1000":
|
||||
controller = Global.Config.SMSController;
|
||||
autoController = Global.Config.SMSAutoController;
|
||||
break;
|
||||
case "TI-83":
|
||||
controller = Global.Config.TI83Controller;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
mainController = controller;
|
||||
if (platform == "AtariConsoleButtons")
|
||||
{
|
||||
prev = 0;
|
||||
}
|
||||
else if (prev >= PADS[platform])
|
||||
{
|
||||
prev -= PADS[platform];
|
||||
controller = autoController;
|
||||
}
|
||||
switch (platform)
|
||||
{
|
||||
case "AtariConsoleButtons":
|
||||
((Atari2600ConsoleButtonsTemplate)mainController[0]).Enabled = IDX_CONTROLLERENABLED.Checked;
|
||||
break;
|
||||
case "Atari":
|
||||
((SingleButtonJoyStickTemplate)mainController[prev]).Enabled = IDX_CONTROLLERENABLED.Checked;
|
||||
break;
|
||||
case "Gameboy":
|
||||
((GBControllerTemplate)mainController[prev]).Enabled = IDX_CONTROLLERENABLED.Checked;
|
||||
break;
|
||||
case "NES":
|
||||
((NESControllerTemplate)mainController[prev]).Enabled = IDX_CONTROLLERENABLED.Checked;
|
||||
break;
|
||||
case "SNES":
|
||||
((SNESControllerTemplate)mainController[prev]).Enabled = IDX_CONTROLLERENABLED.Checked;
|
||||
break;
|
||||
case "PC Engine / SuperGrafx":
|
||||
((PCEControllerTemplate)mainController[prev]).Enabled = IDX_CONTROLLERENABLED.Checked;
|
||||
break;
|
||||
case "Sega Genesis":
|
||||
((GenControllerTemplate)mainController[prev]).Enabled = IDX_CONTROLLERENABLED.Checked;
|
||||
break;
|
||||
case "SMS / GG / SG-1000":
|
||||
((SMSControllerTemplate)mainController[prev]).Enabled = IDX_CONTROLLERENABLED.Checked;
|
||||
break;
|
||||
case "TI-83":
|
||||
((TI83ControllerTemplate)mainController[prev]).Enabled = IDX_CONTROLLERENABLED.Checked;
|
||||
break;
|
||||
}
|
||||
for (int button = 0; button < CONTROLS[platform].Length; button++)
|
||||
{
|
||||
InputWidget TempBox = TextBoxes[button] as InputWidget;
|
||||
object field = null;
|
||||
string fieldName = CONTROLS[platform][button];
|
||||
switch (platform)
|
||||
{
|
||||
case "AtariConsoleButtons":
|
||||
Atari2600ConsoleButtonsTemplate o = (Atari2600ConsoleButtonsTemplate)controller[0];
|
||||
FieldInfo buttonF = o.GetType().GetField(fieldName);
|
||||
field = buttonF.GetValue(o);
|
||||
buttonF.SetValue(o, TempBox.Text);
|
||||
break;
|
||||
case "Atari":
|
||||
{
|
||||
SingleButtonJoyStickTemplate obj = (SingleButtonJoyStickTemplate)controller[prev];
|
||||
FieldInfo buttonField = obj.GetType().GetField(fieldName);
|
||||
field = buttonField.GetValue(obj);
|
||||
buttonField.SetValue(obj, TempBox.Text);
|
||||
break;
|
||||
}
|
||||
case "Gameboy":
|
||||
{
|
||||
GBControllerTemplate obj = (GBControllerTemplate)controller[prev];
|
||||
FieldInfo buttonField = obj.GetType().GetField(fieldName);
|
||||
field = buttonField.GetValue(obj);
|
||||
buttonField.SetValue(obj, TempBox.Text);
|
||||
break;
|
||||
}
|
||||
case "NES":
|
||||
{
|
||||
NESControllerTemplate obj = (NESControllerTemplate)controller[prev];
|
||||
FieldInfo buttonField = obj.GetType().GetField(fieldName);
|
||||
field = buttonField.GetValue(obj);
|
||||
buttonField.SetValue(obj, TempBox.Text);
|
||||
break;
|
||||
}
|
||||
case "SNES":
|
||||
{
|
||||
SNESControllerTemplate obj = (SNESControllerTemplate)controller[prev];
|
||||
FieldInfo buttonField = obj.GetType().GetField(fieldName);
|
||||
field = buttonField.GetValue(obj);
|
||||
buttonField.SetValue(obj, TempBox.Text);
|
||||
break;
|
||||
}
|
||||
case "PC Engine / SuperGrafx":
|
||||
{
|
||||
PCEControllerTemplate obj = (PCEControllerTemplate)controller[prev];
|
||||
FieldInfo buttonField = obj.GetType().GetField(fieldName);
|
||||
field = buttonField.GetValue(obj);
|
||||
buttonField.SetValue(obj, TempBox.Text);
|
||||
break;
|
||||
}
|
||||
case "Sega Genesis":
|
||||
{
|
||||
GenControllerTemplate obj = (GenControllerTemplate)controller[prev];
|
||||
FieldInfo buttonField = obj.GetType().GetField(fieldName);
|
||||
field = buttonField.GetValue(obj);
|
||||
buttonField.SetValue(obj, TempBox.Text);
|
||||
break;
|
||||
}
|
||||
case "SMS / GG / SG-1000":
|
||||
{
|
||||
if (button < 6)
|
||||
{
|
||||
SMSControllerTemplate obj = (SMSControllerTemplate)controller[prev];
|
||||
FieldInfo buttonField = obj.GetType().GetField(fieldName);
|
||||
field = buttonField.GetValue(obj);
|
||||
buttonField.SetValue(obj, TempBox.Text);
|
||||
}
|
||||
else if (button == 6)
|
||||
Global.Config.SMSConsoleButtons.Pause = TempBox.Text;
|
||||
else
|
||||
Global.Config.SMSConsoleButtons.Reset = TempBox.Text;
|
||||
break;
|
||||
}
|
||||
case "TI-83":
|
||||
{
|
||||
TI83ControllerTemplate obj = (TI83ControllerTemplate)controller[prev];
|
||||
FieldInfo buttonField = obj.GetType().GetField(TI83CONTROLS[button]);
|
||||
field = buttonField.GetValue(obj);
|
||||
buttonField.SetValue(obj, TempBox.Text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
TempBox.Dispose();
|
||||
Label TempLabel = Labels[button] as Label;
|
||||
TempLabel.Dispose();
|
||||
}
|
||||
|
||||
Global.OSD.AddMessage("Controller settings saved");
|
||||
}
|
||||
|
||||
private void InputConfig_Load(object sender, EventArgs e)
|
||||
{
|
||||
SystemComboBox.Items.Add("Atari"); //TODO: add this to the designer instead
|
||||
|
||||
HotkeyMappingList = Global.ClientControls.MappingList();
|
||||
|
||||
AutoTab.Checked = Global.Config.InputConfigAutoTab;
|
||||
SetAutoTab();
|
||||
prevWidth = Size.Width;
|
||||
prevHeight = Size.Height;
|
||||
AllowLR.Checked = Global.Config.AllowUD_LR;
|
||||
|
||||
if (Global.Game != null)
|
||||
{
|
||||
Dictionary<string, string> systems = new Dictionary<string, string>()
|
||||
{
|
||||
{"A26", "Atari"}, {"GB", "Gameboy"}, {"GEN", "Sega Genesis"}, {"GG", "SMS / GG / SG-1000"}, {"NES", "NES"},
|
||||
{"SNES", "SNES"}, {"GBC", "Gameboy"},
|
||||
{"PCE", "PC Engine / SuperGrafx"}, {"SG", "SMS / GG / SG-1000"}, {"SGX", "PC Engine / SuperGrafx"},
|
||||
{"SMS", "SMS / GG / SG-1000"}, {"TI83", "TI-83"}
|
||||
};
|
||||
if (systems.ContainsKey(Global.Game.System))
|
||||
this.SystemComboBox.SelectedIndex = SystemComboBox.Items.IndexOf(systems[Global.Game.System]);
|
||||
else
|
||||
this.SystemComboBox.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void OK_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Changed)
|
||||
{
|
||||
UpdateAll();
|
||||
}
|
||||
this.DialogResult = DialogResult.OK;
|
||||
Global.Config.AllowUD_LR = AllowLR.Checked;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.OSD.AddMessage("Controller config aborted");
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void SystemComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Changed)
|
||||
{
|
||||
UpdateAll();
|
||||
}
|
||||
int joypads = PADS[this.SystemComboBox.SelectedItem.ToString()];
|
||||
if (this.SystemComboBox.SelectedItem.ToString() != "TI-83")
|
||||
{
|
||||
this.Width = prevWidth;
|
||||
this.Height = prevHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.Width < 700)
|
||||
this.Width = 700;
|
||||
if (this.Height < 580)
|
||||
this.Height = 580;
|
||||
}
|
||||
ControllComboBox.Items.Clear();
|
||||
for (int i = 0; i < joypads; i++)
|
||||
{
|
||||
ControllComboBox.Items.Add(string.Format("Joypad {0}", i + 1));
|
||||
}
|
||||
for (int i = 0; i < joypads; i++)
|
||||
{
|
||||
if (this.SystemComboBox.SelectedItem.ToString() != "TI-83")
|
||||
ControllComboBox.Items.Add(string.Format("Autofire Joypad {0}", i + 1));
|
||||
}
|
||||
if (this.SystemComboBox.SelectedItem.ToString() == "Atari")
|
||||
{
|
||||
ControllComboBox.Items.Add("Console");
|
||||
}
|
||||
ControllComboBox.SelectedIndex = 0;
|
||||
CurSelectConsole = this.SystemComboBox.SelectedItem.ToString();
|
||||
CurSelectController = 0;
|
||||
SetFocus();
|
||||
SetAutoTab();
|
||||
}
|
||||
private void ControllComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Changed)
|
||||
{
|
||||
UpdateAll();
|
||||
}
|
||||
Do(SystemComboBox.SelectedItem.ToString());
|
||||
CurSelectController = ControllComboBox.SelectedIndex;
|
||||
SetFocus();
|
||||
SetAutoTab();
|
||||
}
|
||||
private void UpdateAll()
|
||||
{
|
||||
Update(CurSelectController, CurSelectConsole);
|
||||
Changed = false;
|
||||
}
|
||||
|
||||
private void AutoTab_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.HotkeyConfigAutoTab = AutoTab.Checked;
|
||||
SetAutoTab();
|
||||
}
|
||||
|
||||
private void SetFocus()
|
||||
{
|
||||
for (int x = 0; x < ButtonsGroupBox.Controls.Count; x++)
|
||||
{
|
||||
if (ButtonsGroupBox.Controls[x] is InputWidget)
|
||||
{
|
||||
ButtonsGroupBox.Controls[x].Focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetAutoTab()
|
||||
{
|
||||
for (int x = 0; x < ButtonsGroupBox.Controls.Count; x++)
|
||||
{
|
||||
if (ButtonsGroupBox.Controls[x] is InputWidget)
|
||||
{
|
||||
InputWidget w = ButtonsGroupBox.Controls[x] as InputWidget;
|
||||
w.AutoTab = AutoTab.Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clearMappingsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < ButtonsGroupBox.Controls.Count; i++)
|
||||
{
|
||||
if (ButtonsGroupBox.Controls[i] is InputWidget)
|
||||
{
|
||||
InputWidget w = ButtonsGroupBox.Controls[i] as InputWidget;
|
||||
w.EraseMappings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InputConfig_Shown(object sender, EventArgs e)
|
||||
{
|
||||
SetFocus();
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue