From 61351cba7f5c8904cfea6a05a4f22f059f114a58 Mon Sep 17 00:00:00 2001 From: kylethomson Date: Sat, 19 Feb 2011 22:07:52 +0000 Subject: [PATCH] Added Gameboy. --- BizHawk.MultiClient/Config.cs | 28 ++++++++- BizHawk.MultiClient/config/InputConfig.cs | 69 +++++++++++++++++++++-- 2 files changed, 92 insertions(+), 5 deletions(-) diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index ca58322e8e..e33aff2707 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -95,8 +95,12 @@ public string GenP1A = "J1 B1, Z"; public string GenP1B = "J1 B2, X"; public string GenP1C = "J1 B9, C"; - public string GenP1Start = "J1 B10, Return"; + public string GenP1Start = "J1 B10, Return"; + + //GameBoy Settings + public NESControllerTemplate GameBoyController = new NESControllerTemplate(1); } + public class SMSControllerTemplate { public string Up; @@ -137,5 +141,27 @@ Select = string.Format("J{0} Select", i); } } + public class NESControllerTemplate + { + public string Up; + public string Down; + public string Left; + public string Right; + public string A; + public string B; + public string Start; + public string Select; + public NESControllerTemplate(int i) + { + Up = string.Format("J{0} Up", i); + Down = string.Format("J{0} Down", i); + Left = string.Format("J{0} Left", i); + Right = string.Format("J{0} Right", i); + A = string.Format("J{0} A", i); + B = string.Format("J{0} B", i); + Start = string.Format("J{0} Start", i); + Select = string.Format("J{0} Select", i); + } + } } \ No newline at end of file diff --git a/BizHawk.MultiClient/config/InputConfig.cs b/BizHawk.MultiClient/config/InputConfig.cs index 434603e798..e03e4b5f82 100644 --- a/BizHawk.MultiClient/config/InputConfig.cs +++ b/BizHawk.MultiClient/config/InputConfig.cs @@ -16,7 +16,7 @@ namespace BizHawk.MultiClient public static string[] SMSControlList = new string[] { "Up", "Down", "Left", "Right", "B1", "B2", "Pause", "Reset" }; 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[] GameboyControlList = new string[] { "Up", "Down", "Left", "Right", "A", "B", "Start", "Select" }; + public static string[] NESControlList = new string[] { "Up", "Down", "Left", "Right", "A", "B", "Start", "Select" }; private ArrayList Labels; private ArrayList TextBoxes; private string CurSelectConsole; @@ -111,7 +111,7 @@ namespace BizHawk.MultiClient TempBox = TextBoxes[7] as InputWidget; Global.Config.SmsReset = AppendButtonMapping(TempBox.Text, Global.Config.SmsReset); TempBox.Dispose(); - for (int i = 0; i < 8; i++) + for (int i = 0; i < SMSControlList.Length; i++) { TempLabel = Labels[i] as Label; TempLabel.Dispose(); @@ -179,7 +179,7 @@ namespace BizHawk.MultiClient TempBox = TextBoxes[7] as InputWidget; Global.Config.PCEController[prev].Select = AppendButtonMapping(TempBox.Text, Global.Config.PCEController[prev].Select); TempBox.Dispose(); - for (int i = 0; i < 8; i++) + for (int i = 0; i < PCEControlList.Length; i++) { TempLabel = Labels[i] as Label; TempLabel.Dispose(); @@ -198,10 +198,71 @@ namespace BizHawk.MultiClient private void DoGameBoy() { + Label TempLabel; + InputWidget TempTextBox; this.Text = ControllerStr + "Gameboy"; ControllerImage.Image = BizHawk.MultiClient.Properties.Resources.GBController; + string[] ButtonMappings = new string[NESControlList.Length]; + ButtonMappings[0] = TruncateButtonMapping(Global.Config.GameBoyController.Up); + ButtonMappings[1] = TruncateButtonMapping(Global.Config.GameBoyController.Down); + ButtonMappings[2] = TruncateButtonMapping(Global.Config.GameBoyController.Left); + ButtonMappings[3] = TruncateButtonMapping(Global.Config.GameBoyController.Right); + ButtonMappings[4] = TruncateButtonMapping(Global.Config.GameBoyController.A); + ButtonMappings[5] = TruncateButtonMapping(Global.Config.GameBoyController.B); + ButtonMappings[6] = TruncateButtonMapping(Global.Config.GameBoyController.Start); + ButtonMappings[7] = TruncateButtonMapping(Global.Config.GameBoyController.Select); + Changed = true; + Labels.Clear(); + TextBoxes.Clear(); + for (int i = 0; i < NESControlList.Length; i++) + { + TempLabel = new Label(); + TempLabel.Text = NESControlList[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 UpdateGameBoy() + { + InputWidget TempBox; + Label TempLabel; + TempBox = TextBoxes[0] as InputWidget; + Global.Config.GameBoyController.Up = AppendButtonMapping(TempBox.Text, Global.Config.GameBoyController.Up); + TempBox.Dispose(); + TempBox = TextBoxes[1] as InputWidget; + Global.Config.GameBoyController.Down = AppendButtonMapping(TempBox.Text, Global.Config.GameBoyController.Down); + TempBox.Dispose(); + TempBox = TextBoxes[2] as InputWidget; + Global.Config.GameBoyController.Left = AppendButtonMapping(TempBox.Text, Global.Config.GameBoyController.Left); + TempBox.Dispose(); + TempBox = TextBoxes[3] as InputWidget; + Global.Config.GameBoyController.Right = AppendButtonMapping(TempBox.Text, Global.Config.GameBoyController.Right); + TempBox.Dispose(); + TempBox = TextBoxes[4] as InputWidget; + Global.Config.GameBoyController.A = AppendButtonMapping(TempBox.Text, Global.Config.GameBoyController.A); + TempBox.Dispose(); + TempBox = TextBoxes[5] as InputWidget; + Global.Config.GameBoyController.B = AppendButtonMapping(TempBox.Text, Global.Config.GameBoyController.B); + TempBox.Dispose(); + TempBox = TextBoxes[6] as InputWidget; + Global.Config.GameBoyController.Start = AppendButtonMapping(TempBox.Text, Global.Config.GameBoyController.Start); + TempBox.Dispose(); + TempBox = TextBoxes[7] as InputWidget; + Global.Config.GameBoyController.Select = AppendButtonMapping(TempBox.Text, Global.Config.GameBoyController.Select); + TempBox.Dispose(); + for (int i = 0; i < NESControlList.Length; i++) + { + TempLabel = Labels[i] as Label; + TempLabel.Dispose(); + } } - private void InputConfig_Load(object sender, EventArgs e) { //SystemComboBox = new ComboBox();