Skip to content

Commit

Permalink
input OSD: fix potentially absent P0
Browse files Browse the repository at this point in the history
I don't know if there's any core that lacks non-player controls but this feels like the right thing to do anyway (for the future too)
  • Loading branch information
vadosnaprimer committed Dec 22, 2024
1 parent fcff79e commit 3384ce8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/BizHawk.Client.Common/display/InputDisplayGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ public static string Generate(IController source)
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
controls.Add(controls[0]);
controls.RemoveAt(0);
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))
{
Expand Down

0 comments on commit 3384ce8

Please sign in to comment.