From 1e4eb41972e9fe4e58ef003521e5925861124c14 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 11 Jun 2017 12:03:51 -0500 Subject: [PATCH] Controller config - support up to 12 controllers --- .../config/ControllerConfig.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/BizHawk.Client.EmuHawk/config/ControllerConfig.cs b/BizHawk.Client.EmuHawk/config/ControllerConfig.cs index d704d2a32c..ab488b1724 100644 --- a/BizHawk.Client.EmuHawk/config/ControllerConfig.cs +++ b/BizHawk.Client.EmuHawk/config/ControllerConfig.cs @@ -14,7 +14,7 @@ namespace BizHawk.Client.EmuHawk { public partial class ControllerConfig : Form { - private const int MAXPLAYERS = 8; + private const int MaxPlayers = 12; private static readonly Dictionary ControllerImages = new Dictionary(); private readonly ControllerDefinition _theDefinition; @@ -109,7 +109,7 @@ namespace BizHawk.Client.EmuHawk } // split the list of all settings into buckets by player number - var buckets = new List[MAXPLAYERS + 1]; + var buckets = new List[MaxPlayers + 1]; var categoryBuckets = new WorkingDictionary>(); for (var i = 0; i < buckets.Length; i++) { @@ -122,7 +122,7 @@ namespace BizHawk.Client.EmuHawk foreach (var button in controllerButtons) { int i; - for (i = 1; i <= MAXPLAYERS; i++) + for (i = MaxPlayers; i > 0; i--) { if (button.StartsWith("P" + i)) { @@ -130,14 +130,19 @@ namespace BizHawk.Client.EmuHawk } } - if (i > MAXPLAYERS) // couldn't find + if (i > MaxPlayers) // couldn't find { i = 0; } if (categoryLabels.ContainsKey(button)) + { categoryBuckets[categoryLabels[button]].Add(button); - else buckets[i].Add(button); + } + else + { + buckets[i].Add(button); + } } if (buckets[0].Count == controllerButtons.Count) @@ -151,7 +156,7 @@ namespace BizHawk.Client.EmuHawk var tt = new TabControl { Dock = DockStyle.Fill }; dest.Controls.Add(tt); int pageidx = 0; - for (int i = 1; i <= MAXPLAYERS; i++) + for (int i = 1; i <= MaxPlayers; i++) { if (buckets[i].Count > 0) {