diff --git a/src/BizHawk.Client.Common/display/InputDisplayGenerator.cs b/src/BizHawk.Client.Common/display/InputDisplayGenerator.cs index ed53992d24..ff713e9191 100644 --- a/src/BizHawk.Client.Common/display/InputDisplayGenerator.cs +++ b/src/BizHawk.Client.Common/display/InputDisplayGenerator.cs @@ -16,15 +16,9 @@ namespace BizHawk.Client.Common throw new InvalidOperationException("Can't generate input display string with empty mnemonics cache"); var sb = new StringBuilder(); - var controls = source.Definition.ControlsOrdered.ToList(); - // index 0 is for controls that don't belong to any indexed player - if (controls.ElementAtOrDefault(0) != null) - { - controls.Add(controls[0]); - controls.RemoveAt(0); - } - - foreach ((string buttonName, AxisSpec? axisSpec) in controls.SelectMany(x => x)) + var players = source.Definition.ControlsOrdered; + var playersNewOrder = players.Skip(1).Concat(players.Take(1)); // move first ("player 0") to end + foreach ((string buttonName, AxisSpec? axisSpec) in playersNewOrder.SelectMany(static x => x)) { if (axisSpec.HasValue) { diff --git a/src/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs b/src/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs index 999ba29d81..f676f2f036 100644 --- a/src/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs +++ b/src/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs @@ -114,6 +114,7 @@ namespace BizHawk.Emulation.Common if (!_mutable) throw new InvalidOperationException(ERR_MSG); } + /// implementors should include empty lists for empty players, including "player 0", to match this base implementation protected virtual IReadOnlyList> GenOrderedControls() { var ret = new List<(string, AxisSpec?)>[PlayerCount + 1]; diff --git a/src/BizHawk.Emulation.Cores/Libretro/Libretro.IEmulator.cs b/src/BizHawk.Emulation.Cores/Libretro/Libretro.IEmulator.cs index fd05f8c14e..75a7441d63 100644 --- a/src/BizHawk.Emulation.Cores/Libretro/Libretro.IEmulator.cs +++ b/src/BizHawk.Emulation.Cores/Libretro/Libretro.IEmulator.cs @@ -111,29 +111,6 @@ namespace BizHawk.Emulation.Cores.Libretro MakeImmutable(); } - - protected override IReadOnlyList> GenOrderedControls() - { - // all this is to remove the keyboard buttons from P0 and put them in P3 so they appear at the end of the input display - var players = base.GenOrderedControls().ToList(); - List<(string, AxisSpec?)> retroKeyboard = new(); - var p0 = (List<(string, AxisSpec?)>) players[0]; - for (var i = 0; i < p0.Count; /* incremented in body */) - { - (string ButtonName, AxisSpec?) button = p0[i]; - if (CategoryLabels.TryGetValue(button.ButtonName, out var v) && v is CAT_KEYBOARD) - { - retroKeyboard.Add(button); - p0.RemoveAt(i); - } - else - { - i++; - } - } - players.Add(retroKeyboard); - return players; - } } public ControllerDefinition ControllerDefinition { get; }