Skip to content

Commit

Permalink
Fix index selection.
Browse files Browse the repository at this point in the history
  • Loading branch information
tjaderxyz committed Apr 19, 2017
1 parent a798359 commit 11d9bcc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions mi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,11 @@ private static void ManageControllers(ScpBus scpBus)
device.ReadProduct(out product);


var usedIndexes = Gamepads.Select(g => g.Index);
var index = 1;
try
{
index = Gamepads.Select(g => g.Index).Min();
}
catch (InvalidOperationException)
while (usedIndexes.Contains(index))
{
index++;
}
Gamepads.Add(new Xiaomi_gamepad(device, scpBus, index));
}
Expand Down

0 comments on commit 11d9bcc

Please sign in to comment.