2011-01-29 00:10:08 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2011-02-19 20:31:32 +00:00
|
|
|
|
using System.Collections;
|
2011-01-29 00:10:08 +00:00
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.MultiClient
|
|
|
|
|
{
|
|
|
|
|
public partial class InputConfig : Form
|
|
|
|
|
{
|
2011-01-29 01:25:57 +00:00
|
|
|
|
const string ControllerStr = "Configure Controllers - ";
|
2011-02-19 20:31:32 +00:00
|
|
|
|
public static string[] SMSList = new string[] { "Up", "Down", "Left", "Right", "B1", "B2", "Pause", "Reset" };
|
|
|
|
|
public static string[] GenesisList = new string[] { "Up", "Down", "Left", "Right", "A", "B", "C", "Start", "X", "Y", "Z" };
|
|
|
|
|
private ArrayList Labels;
|
|
|
|
|
private ArrayList TextBoxes;
|
2011-01-29 00:10:08 +00:00
|
|
|
|
public InputConfig()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2011-02-19 20:31:32 +00:00
|
|
|
|
Labels = new ArrayList();
|
|
|
|
|
TextBoxes = new ArrayList();
|
2011-01-29 00:10:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-30 16:15:39 +00:00
|
|
|
|
private string TruncateButtonMapping(string button)
|
|
|
|
|
{
|
|
|
|
|
//all config button mappings have the name followed by a comma & space, then key mapping, remove up through the space
|
2011-02-19 20:31:32 +00:00
|
|
|
|
int x = button.LastIndexOf(',');
|
|
|
|
|
if (x != -1)
|
|
|
|
|
return button.Substring(x + 2, button.Length - (x + 2));
|
|
|
|
|
else
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
private string AppendButtonMapping(string button, string oldmap)
|
|
|
|
|
{
|
|
|
|
|
int x = oldmap.LastIndexOf(',');
|
|
|
|
|
if (x != -1)
|
|
|
|
|
return oldmap.Substring(0, x + 2) + button;
|
|
|
|
|
else
|
|
|
|
|
return oldmap + ", " + button;
|
2011-01-30 16:15:39 +00:00
|
|
|
|
}
|
2011-01-29 01:25:57 +00:00
|
|
|
|
private void DoSMS()
|
|
|
|
|
{
|
2011-02-19 20:31:32 +00:00
|
|
|
|
Label TempLabel;
|
|
|
|
|
InputWidget TempTextBox;
|
2011-01-29 01:25:57 +00:00
|
|
|
|
this.Text = ControllerStr + "SMS / GG / SG-1000";
|
2011-01-29 19:06:34 +00:00
|
|
|
|
ControllerImage.Image = BizHawk.MultiClient.Properties.Resources.SMSController;
|
2011-02-19 20:31:32 +00:00
|
|
|
|
this.SystemComboBox.SelectedIndex = 0;
|
|
|
|
|
int jpad = this.ControllComboBox.SelectedIndex;
|
|
|
|
|
string[] ButtonMappings = new string[SMSList.Length];
|
|
|
|
|
ButtonMappings[0] = TruncateButtonMapping(Global.Config.SMSController[jpad].Up);
|
|
|
|
|
ButtonMappings[1] = TruncateButtonMapping(Global.Config.SMSController[jpad].Down);
|
|
|
|
|
ButtonMappings[2] = TruncateButtonMapping(Global.Config.SMSController[jpad].Left);
|
|
|
|
|
ButtonMappings[3] = TruncateButtonMapping(Global.Config.SMSController[jpad].Right);
|
|
|
|
|
ButtonMappings[4] = TruncateButtonMapping(Global.Config.SMSController[jpad].B1);
|
|
|
|
|
ButtonMappings[5] = TruncateButtonMapping(Global.Config.SMSController[jpad].B2);
|
|
|
|
|
ButtonMappings[6] = TruncateButtonMapping(Global.Config.SmsPause);
|
|
|
|
|
ButtonMappings[7] = TruncateButtonMapping(Global.Config.SmsReset);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Labels.Clear();
|
|
|
|
|
for (int i = 0; i < SMSList.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
TempLabel = new Label();
|
|
|
|
|
TempLabel.Text = SMSList[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);
|
|
|
|
|
}
|
2011-01-29 01:25:57 +00:00
|
|
|
|
}
|
|
|
|
|
private void DoPCE()
|
|
|
|
|
{
|
|
|
|
|
this.Text = ControllerStr + "PCEjin / SGX";
|
2011-01-29 18:56:27 +00:00
|
|
|
|
ControllerImage.Image = BizHawk.MultiClient.Properties.Resources.PCEngineController;
|
2011-01-29 01:25:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DoGen()
|
|
|
|
|
{
|
|
|
|
|
this.Text = ControllerStr + "Sega Genesis";
|
2011-01-29 19:06:34 +00:00
|
|
|
|
ControllerImage.Image = BizHawk.MultiClient.Properties.Resources.GENController;
|
2011-01-29 01:25:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DoTI83()
|
|
|
|
|
{
|
|
|
|
|
this.Text = ControllerStr + "TI-83";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DoGameBoy()
|
|
|
|
|
{
|
|
|
|
|
this.Text = ControllerStr + "Gameboy";
|
2011-01-29 03:09:31 +00:00
|
|
|
|
ControllerImage.Image = BizHawk.MultiClient.Properties.Resources.GBController;
|
2011-01-29 01:25:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-29 00:10:08 +00:00
|
|
|
|
private void InputConfig_Load(object sender, EventArgs e)
|
2011-02-19 20:31:32 +00:00
|
|
|
|
{
|
|
|
|
|
//SystemComboBox = new ComboBox();
|
|
|
|
|
//Determine the System currently loaded, and set that one up first, if null emulator set, what is the default?
|
|
|
|
|
/*
|
2011-01-29 01:25:57 +00:00
|
|
|
|
if (!(Global.Emulator is NullEmulator))
|
|
|
|
|
{
|
|
|
|
|
switch (Global.Game.System)
|
|
|
|
|
{
|
|
|
|
|
case "SMS":
|
|
|
|
|
case "SG":
|
|
|
|
|
case "GG":
|
2011-02-19 20:31:32 +00:00
|
|
|
|
joypads = 2;
|
2011-01-29 01:25:57 +00:00
|
|
|
|
break;
|
|
|
|
|
case "PCE":
|
|
|
|
|
case "SGX":
|
2011-02-19 20:31:32 +00:00
|
|
|
|
joypads = 5;
|
2011-01-29 01:25:57 +00:00
|
|
|
|
break;
|
|
|
|
|
case "GEN":
|
2011-02-19 20:31:32 +00:00
|
|
|
|
joypads = 8;
|
2011-01-29 01:25:57 +00:00
|
|
|
|
break;
|
|
|
|
|
case "TI83":
|
2011-02-19 20:31:32 +00:00
|
|
|
|
joypads = 1;
|
2011-01-29 01:25:57 +00:00
|
|
|
|
break;
|
|
|
|
|
case "GB":
|
2011-02-19 20:31:32 +00:00
|
|
|
|
joypads = 1;
|
2011-01-29 01:25:57 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
2011-02-19 20:31:32 +00:00
|
|
|
|
joypads = 2;
|
2011-01-29 01:25:57 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2011-02-19 20:31:32 +00:00
|
|
|
|
{
|
|
|
|
|
joypads = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ControllComboBox.Items.Clear();
|
|
|
|
|
for (int i = 0; i < joypads; i++)
|
|
|
|
|
{
|
|
|
|
|
ControllComboBox.Items.Add(string.Format("Joypad {0}", i + 1));
|
|
|
|
|
}
|
|
|
|
|
ControllComboBox.SelectedIndex = 0;*/
|
2011-01-29 00:10:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OK_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Cancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
2011-01-29 01:25:57 +00:00
|
|
|
|
|
|
|
|
|
private void SystemComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2011-02-19 20:31:32 +00:00
|
|
|
|
int joypads = 0;
|
|
|
|
|
switch (this.SystemComboBox.SelectedItem.ToString())
|
2011-01-29 01:25:57 +00:00
|
|
|
|
{
|
|
|
|
|
case "SMS / GG / SG-1000":
|
2011-02-19 20:31:32 +00:00
|
|
|
|
joypads = 2;
|
2011-01-29 01:25:57 +00:00
|
|
|
|
break;
|
|
|
|
|
case "PC Engine / SGX":
|
2011-02-19 20:31:32 +00:00
|
|
|
|
joypads = 5;
|
2011-01-29 01:25:57 +00:00
|
|
|
|
break;
|
|
|
|
|
case "Gameboy":
|
2011-02-19 20:31:32 +00:00
|
|
|
|
joypads = 1;
|
2011-01-29 01:25:57 +00:00
|
|
|
|
break;
|
|
|
|
|
case "Sega Genesis":
|
2011-02-19 20:31:32 +00:00
|
|
|
|
joypads = 8;
|
2011-01-29 01:25:57 +00:00
|
|
|
|
break;
|
|
|
|
|
case "TI-83":
|
2011-02-19 20:31:32 +00:00
|
|
|
|
joypads = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
ControllComboBox.Items.Clear();
|
|
|
|
|
for (int i = 0; i < joypads; i++)
|
|
|
|
|
{
|
|
|
|
|
ControllComboBox.Items.Add(string.Format("Joypad {0}", i + 1));
|
|
|
|
|
}
|
|
|
|
|
ControllComboBox.SelectedIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
private void ControllComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
switch (SystemComboBox.SelectedItem.ToString())
|
|
|
|
|
{
|
|
|
|
|
case "SMS / GG / SG-1000":
|
|
|
|
|
DoSMS();
|
|
|
|
|
break;
|
|
|
|
|
case "PC Engine / SGX":
|
|
|
|
|
DoPCE();
|
|
|
|
|
break;
|
|
|
|
|
case "Gameboy":
|
|
|
|
|
DoGameBoy();
|
|
|
|
|
break;
|
|
|
|
|
case "Sega Genesis":
|
|
|
|
|
DoGen();
|
|
|
|
|
break;
|
|
|
|
|
case "TI-83":
|
|
|
|
|
DoTI83();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2011-01-29 01:25:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2011-01-29 00:10:08 +00:00
|
|
|
|
}
|
2011-02-19 20:31:32 +00:00
|
|
|
|
|