Hook up TI83 to controller config + snazzy "controller" image

This commit is contained in:
andres.delikat 2011-04-24 02:01:36 +00:00
parent cb6e6d2d13
commit b79d179760
11 changed files with 284 additions and 32 deletions

View File

@ -454,6 +454,8 @@
<None Include="images\ToolBox.png" />
<None Include="images\Pause.png" />
<None Include="images\Play.png" />
<None Include="config\ControllerImages\TI83Calculator.png" />
<None Include="config\ControllerImages\TI83CalculatorCrop.png" />
<Content Include="output\gamedb.txt" />
<Content Include="output\gamedb_neshomebrew.txt" />
<None Include="images\Refresh.bmp" />

View File

@ -15,6 +15,7 @@
NESController[1] = new NESControllerTemplate(false);
NESController[2] = new NESControllerTemplate(false);
NESController[3] = new NESControllerTemplate(false);
TI83Controller[0] = new TI83ControllerTemplate(true);
}
// General Client Settings
@ -232,8 +233,12 @@
//GameBoy Settings
public NESControllerTemplate GameBoyController = new NESControllerTemplate(true);
public string NESReset = "Backspace";
//NES settings
public string NESReset = "Backspace";
public NESControllerTemplate[] NESController = new NESControllerTemplate[4];
//TI 83 settings
public TI83ControllerTemplate[] TI83Controller = new TI83ControllerTemplate[1];
}
public class SMSControllerTemplate
@ -352,4 +357,87 @@
}
}
}
public class TI83ControllerTemplate
{
public string _0;
public string _1;
public string _2;
public string _3;
public string _4;
public string _5;
public string _6;
public string _7;
public string _8;
public string _9;
public string DOT;
public string ON;
public string ENTER;
public string DOWN;
public string UP;
public string LEFT;
public string RIGHT;
public string PLUS;
public string MINUS;
public string MULTIPLY;
public string DIVIDE;
public string CLEAR;
public TI83ControllerTemplate() { }
public bool Enabled;
public TI83ControllerTemplate(bool defaults)
{
if (defaults)
{
Enabled = true;
_0 = "NumberPad0";
_1 = "NumberPad1";
_2 = "NumberPad2";
_3 = "NumberPad3";
_4 = "NumberPad4";
_5 = "NumberPad5";
_6 = "NumberPad6";
_7 = "NumberPad7";
_8 = "NumberPad8";
_9 = "NumberPad9";
DOT = "NumberPadPeriod";
ON = "Space";
ENTER = "Return";
UP = "UpArrow";
DOWN = "DownArrow";
LEFT = "LeftArrow";
RIGHT = "RightArrow";
PLUS = "NumberPadPlus";
MINUS = "NumberPadMinus";
MULTIPLY = "NumberPadStar";
DIVIDE = "NumberPadSlash";
CLEAR = "Escape";
}
else
{
Enabled = false;
_0 = "";
_1 = "";
_2 = "";
_3 = "";
_4 = "";
_5 = "";
_6 = "";
_7 = "";
_8 = "";
_9 = "";
DOT = "";
ON = "";
ENTER = "";
UP = "";
DOWN = "";
LEFT = "";
RIGHT = "";
PLUS = "";
MINUS = "";
MULTIPLY = "";
DIVIDE = "";
CLEAR = "";
}
}
}
}

View File

@ -37,7 +37,6 @@ namespace BizHawk.MultiClient
if (control.StartsWith("J2 ")) return GetGamePad(1, control.Substring(3));
if (control.StartsWith("J3 ")) return GetGamePad(2, control.Substring(3));
if (control.StartsWith("J4 ")) return GetGamePad(3, control.Substring(3));
Key k = (Key) Enum.Parse(typeof(Key), control, true);
return KeyInput.IsPressed(k);
}

View File

@ -383,28 +383,28 @@ namespace BizHawk.MultiClient
Global.GenControls = genControls;
var TI83Controls = new Controller(TI83.TI83Controller);
TI83Controls.BindMulti("0", "D0"); //numpad 4,8,6,2 (up/down/left/right) dont work in slimdx!! wtf!!
TI83Controls.BindMulti("1", "D1");
TI83Controls.BindMulti("2", "D2");
TI83Controls.BindMulti("3", "D3");
TI83Controls.BindMulti("4", "D4");
TI83Controls.BindMulti("5", "D5");
TI83Controls.BindMulti("6", "D6");
TI83Controls.BindMulti("7", "D7");
TI83Controls.BindMulti("8", "D8");
TI83Controls.BindMulti("9", "D9");
TI83Controls.BindMulti("ON", "Space");
TI83Controls.BindMulti("ENTER", "NumberPadEnter");
TI83Controls.BindMulti("DOWN", "DownArrow");
TI83Controls.BindMulti("LEFT", "LeftArrow");
TI83Controls.BindMulti("RIGHT", "RightArrow");
TI83Controls.BindMulti("UP", "UpArrow");
TI83Controls.BindMulti("PLUS", "NumberPadPlus");
TI83Controls.BindMulti("MINUS", "NumberPadMinus");
TI83Controls.BindMulti("MULTIPLY", "NumberPadStar");
TI83Controls.BindMulti("DIVIDE", "NumberPadSlash");
TI83Controls.BindMulti("CLEAR", "Escape");
TI83Controls.BindMulti("DOT", "NumberPadPeriod");
TI83Controls.BindMulti("0", Global.Config.TI83Controller[0]._0); //TODO numpad 4,8,6,2 (up/down/left/right) dont work in slimdx!! wtf!!
TI83Controls.BindMulti("1", Global.Config.TI83Controller[0]._1);
TI83Controls.BindMulti("2", Global.Config.TI83Controller[0]._2);
TI83Controls.BindMulti("3", Global.Config.TI83Controller[0]._3);
TI83Controls.BindMulti("4", Global.Config.TI83Controller[0]._4);
TI83Controls.BindMulti("5", Global.Config.TI83Controller[0]._5);
TI83Controls.BindMulti("6", Global.Config.TI83Controller[0]._6);
TI83Controls.BindMulti("7", Global.Config.TI83Controller[0]._7);
TI83Controls.BindMulti("8", Global.Config.TI83Controller[0]._8);
TI83Controls.BindMulti("9", Global.Config.TI83Controller[0]._9);
TI83Controls.BindMulti("ON", Global.Config.TI83Controller[0].ON);
TI83Controls.BindMulti("ENTER", Global.Config.TI83Controller[0].ENTER);
TI83Controls.BindMulti("DOWN", Global.Config.TI83Controller[0].DOWN);
TI83Controls.BindMulti("LEFT", Global.Config.TI83Controller[0].LEFT);
TI83Controls.BindMulti("RIGHT", Global.Config.TI83Controller[0].RIGHT);
TI83Controls.BindMulti("UP", Global.Config.TI83Controller[0].UP);
TI83Controls.BindMulti("PLUS", Global.Config.TI83Controller[0].PLUS);
TI83Controls.BindMulti("MINUS", Global.Config.TI83Controller[0].MINUS);
TI83Controls.BindMulti("MULTIPLY", Global.Config.TI83Controller[0].MULTIPLY);
TI83Controls.BindMulti("DIVIDE", Global.Config.TI83Controller[0].DIVIDE);
TI83Controls.BindMulti("CLEAR", Global.Config.TI83Controller[0].CLEAR);
TI83Controls.BindMulti("DOT", Global.Config.TI83Controller[0].DOT);
Global.TI83Controls = TI83Controls;
}

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3615
// Runtime Version:2.0.50727.3620
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -206,6 +206,20 @@ namespace BizHawk.MultiClient.Properties {
}
}
internal static System.Drawing.Bitmap TI83Calculator {
get {
object obj = ResourceManager.GetObject("TI83Calculator", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap TI83CalculatorCrop {
get {
object obj = ResourceManager.GetObject("TI83CalculatorCrop", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap ToolBox {
get {
object obj = ResourceManager.GetObject("ToolBox", resourceCulture);

View File

@ -618,4 +618,10 @@
<data name="ToolBox" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\ToolBox.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="TI83Calculator" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\config\ControllerImages\TI83Calculator.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="TI83CalculatorCrop" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\config\ControllerImages\TI83CalculatorCrop.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -68,6 +68,9 @@
//
// 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.Location = new System.Drawing.Point(12, 68);
this.ButtonsGroupBox.Name = "ButtonsGroupBox";
this.ButtonsGroupBox.Size = new System.Drawing.Size(240, 239);
@ -77,10 +80,13 @@
//
// 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(258, 73);
this.ControllerImage.Name = "ControllerImage";
this.ControllerImage.Size = new System.Drawing.Size(169, 195);
this.ControllerImage.Size = new System.Drawing.Size(169, 202);
this.ControllerImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.ControllerImage.TabIndex = 3;
this.ControllerImage.TabStop = false;

View File

@ -10,6 +10,8 @@ using System.Windows.Forms;
namespace BizHawk.MultiClient
{
//TODO: Multi column for TI83
//TODO: keep track of size of dynamic inputwidget creation and resize the dialog + groupbox accordingly
public partial class InputConfig : Form
{
const string ControllerStr = "Configure Controllers - ";
@ -17,6 +19,7 @@ namespace BizHawk.MultiClient
public static string[] PCEControlList = new string[] { "Up", "Down", "Left", "Right", "I", "II", "Run", "Select" };
public static string[] GenesisControlList = new string[] { "Up", "Down", "Left", "Right", "A", "B", "C", "Start", "X", "Y", "Z" };
public static string[] NESControlList = new string[] { "Up", "Down", "Left", "Right", "A", "B", "Start", "Select" };
public static string[] TI83ControlList = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "Dot", "On", "Enter", "Up", "Down", "Left", "Right", "Plus", "Minus", "Multiply", "Divide", "Clear"};
private ArrayList Labels;
private ArrayList TextBoxes;
private string CurSelectConsole;
@ -198,7 +201,130 @@ namespace BizHawk.MultiClient
private void DoTI83()
{
Label TempLabel;
InputWidget TempTextBox;
this.Text = ControllerStr + "TI-83";
ControllerImage.Image = BizHawk.MultiClient.Properties.Resources.TI83CalculatorCrop;
int jpad = this.ControllComboBox.SelectedIndex;
string[] ButtonMappings = new string[TI83ControlList.Length];
ButtonMappings[0] = Global.Config.TI83Controller[jpad]._0;
ButtonMappings[1] = Global.Config.TI83Controller[jpad]._1;
ButtonMappings[2] = Global.Config.TI83Controller[jpad]._2;
ButtonMappings[3] = Global.Config.TI83Controller[jpad]._3;
ButtonMappings[4] = Global.Config.TI83Controller[jpad]._4;
ButtonMappings[5] = Global.Config.TI83Controller[jpad]._5;
ButtonMappings[6] = Global.Config.TI83Controller[jpad]._6;
ButtonMappings[7] = Global.Config.TI83Controller[jpad]._7;
ButtonMappings[8] = Global.Config.TI83Controller[jpad]._8;
ButtonMappings[9] = Global.Config.TI83Controller[jpad]._9;
ButtonMappings[10] = Global.Config.TI83Controller[jpad].DOT;
ButtonMappings[11] = Global.Config.TI83Controller[jpad].ON;
ButtonMappings[12] = Global.Config.TI83Controller[jpad].ENTER;
ButtonMappings[13] = Global.Config.TI83Controller[jpad].UP;
ButtonMappings[14] = Global.Config.TI83Controller[jpad].DOWN;
ButtonMappings[15] = Global.Config.TI83Controller[jpad].LEFT;
ButtonMappings[16] = Global.Config.TI83Controller[jpad].RIGHT;
ButtonMappings[17] = Global.Config.TI83Controller[jpad].PLUS;
ButtonMappings[18] = Global.Config.TI83Controller[jpad].MINUS;
ButtonMappings[19] = Global.Config.TI83Controller[jpad].MULTIPLY;
ButtonMappings[20] = Global.Config.TI83Controller[jpad].DIVIDE;
ButtonMappings[21] = Global.Config.TI83Controller[jpad].CLEAR;
IDX_CONTROLLERENABLED.Checked = Global.Config.TI83Controller[jpad].Enabled;
Changed = true;
Labels.Clear();
TextBoxes.Clear();
for (int i = 0; i < TI83ControlList.Length; i++)
{
TempLabel = new Label();
TempLabel.Text = TI83ControlList[i];
TempLabel.Location = new Point(8, 20 + (i * 24));
Labels.Add(TempLabel);
TempTextBox = new InputWidget();
TempTextBox.Location = new Point(48, 20 + (i * 24));
TextBoxes.Add(TempTextBox);
TempTextBox.Text = ButtonMappings[i];
ButtonsGroupBox.Controls.Add(TempTextBox);
ButtonsGroupBox.Controls.Add(TempLabel);
}
Changed = true;
}
private void UpdateTI83()
{
ButtonsGroupBox.Controls.Clear();
InputWidget TempBox;
Label TempLabel;
TempBox = TextBoxes[0] as InputWidget;
Global.Config.TI83Controller[0]._0 = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0]._0);
TempBox.Dispose();
TempBox = TextBoxes[1] as InputWidget;
Global.Config.TI83Controller[0]._1 = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0]._1);
TempBox.Dispose();
TempBox = TextBoxes[2] as InputWidget;
Global.Config.TI83Controller[0]._2 = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0]._2);
TempBox.Dispose();
TempBox = TextBoxes[3] as InputWidget;
Global.Config.TI83Controller[0]._3 = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0]._3);
TempBox.Dispose();
TempBox = TextBoxes[4] as InputWidget;
Global.Config.TI83Controller[0]._4 = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0]._4);
TempBox.Dispose();
TempBox = TextBoxes[5] as InputWidget;
Global.Config.TI83Controller[0]._5 = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0]._5);
TempBox.Dispose();
TempBox = TextBoxes[6] as InputWidget;
Global.Config.TI83Controller[0]._6 = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0]._6);
TempBox.Dispose();
TempBox = TextBoxes[7] as InputWidget;
Global.Config.TI83Controller[0]._7 = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0]._7);
TempBox.Dispose();
TempBox = TextBoxes[8] as InputWidget;
Global.Config.TI83Controller[0]._8 = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0]._8);
TempBox.Dispose();
TempBox = TextBoxes[9] as InputWidget;
Global.Config.TI83Controller[0]._9 = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0]._9);
TempBox.Dispose();
TempBox = TextBoxes[10] as InputWidget;
Global.Config.TI83Controller[0].DOT = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0].DOT);
TempBox.Dispose();
TempBox = TextBoxes[11] as InputWidget;
Global.Config.TI83Controller[0].ENTER = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0].ENTER);
TempBox.Dispose();
TempBox = TextBoxes[12] as InputWidget;
Global.Config.TI83Controller[0].UP = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0].UP);
TempBox.Dispose();
TempBox = TextBoxes[13] as InputWidget;
Global.Config.TI83Controller[0].DOWN = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0].DOWN);
TempBox.Dispose();
TempBox = TextBoxes[14] as InputWidget;
Global.Config.TI83Controller[0].LEFT = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0].LEFT);
TempBox.Dispose();
TempBox = TextBoxes[15] as InputWidget;
Global.Config.TI83Controller[0].RIGHT = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0].RIGHT);
TempBox.Dispose();
TempBox = TextBoxes[16] as InputWidget;
Global.Config.TI83Controller[0].PLUS = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0].PLUS);
TempBox.Dispose();
TempBox = TextBoxes[17] as InputWidget;
Global.Config.TI83Controller[0].MINUS = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0].MINUS);
TempBox.Dispose();
TempBox = TextBoxes[18] as InputWidget;
Global.Config.TI83Controller[0].MULTIPLY = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0].MULTIPLY);
TempBox.Dispose();
TempBox = TextBoxes[19] as InputWidget;
Global.Config.TI83Controller[0].DIVIDE = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0].DIVIDE);
TempBox.Dispose();
TempBox = TextBoxes[20] as InputWidget;
Global.Config.TI83Controller[0].CLEAR = AppendButtonMapping(TempBox.Text, Global.Config.TI83Controller[0].CLEAR);
TempBox.Dispose();
for (int i = 0; i < TI83ControlList.Length; i++)
{
TempLabel = Labels[i] as Label;
TempLabel.Dispose();
}
IDX_CONTROLLERENABLED.Enabled = true;
}
private void DoGameBoy()
@ -358,15 +484,16 @@ namespace BizHawk.MultiClient
case "SGX":
this.SystemComboBox.SelectedIndex = 1;
break;
case "GEN":
case "GB":
this.SystemComboBox.SelectedIndex = 2;
break;
case "TI83":
this.SystemComboBox.SelectedIndex = 3;
case "GEN":
this.SystemComboBox.SelectedIndex = 3;
break;
case "GB":
case "TI83":
this.SystemComboBox.SelectedIndex = 4;
break;
case "NES":
this.SystemComboBox.SelectedIndex = 5;
break;
@ -473,7 +600,7 @@ namespace BizHawk.MultiClient
//UpdateGenesis();
break;
case "TI-83":
//Update TI-83();
UpdateTI83();
break;
case "NES":
UpdateNES(CurSelectController);

View File

@ -93,8 +93,18 @@ namespace BizHawk.MultiClient
if ((modifiers & Keys.Alt) != 0)
str += "LeftAlt + ";
str += key.ToString();
if (str.Substring(0, 6) == "NumPad")
if (str.Length >= 6 && str.Substring(0, 6) == "NumPad")
str = str.Insert(3, "ber");
if (str.Length == 7 && str.Substring(0, 7) == "Decimal")
str = "NumberPadPeriod";
if (str.Length == 6 && str.Substring(0, 6) == "Divide")
str = "NumberPadSlash";
if (str.Length == 8 && str.Substring(0, 8) == "Multiply")
str = "NumberPadStar";
if (str.Length == 8 && str.Substring(0, 8) == "Subtract")
str = "NumberPadMinus";
if (str.Length == 3 && str.Substring(0, 3) == "Add")
str = "NumberPadPlus";
if (str.Length > 3)
{
if (str.Substring(0, 3) == "Oem")