add controller selection, auto-search

- fix bug in master volume control where the text input doesn't work
- fix bug in the Fan Club minigame where the player wouldn't jump when they were supposed to
This commit is contained in:
minenice55
2022-07-23 22:24:07 -04:00
parent ecbe84074f
commit 06fe482f3d
8 changed files with 144 additions and 35 deletions

View File

@ -60,6 +60,7 @@ namespace HeavenStudio
InputJoyshock joyshock = new InputJoyshock(i);
joyshock.InitializeController();
joyshock.SetPlayer(inputDevices.Count + 1);
inputDevices.Add(joyshock);
}
}
else
@ -99,6 +100,22 @@ namespace HeavenStudio
return null;
}
public static int GetInputControllerId(int player)
{
//select input controller id that has player field set to player
//this will return the first controller that has that player number in the case of controller pairs (eg. Joy-Cons)
//so such controllers should have a reference to the other controller in the pair
//controller IDs are determined by connection order (the Keyboard is always first)
for (int i = 0; i < inputDevices.Count; i++)
{
if (inputDevices[i].GetPlayer() == player)
{
return i;
}
}
return -1;
}
public static void UpdateInputControllers()
{
foreach (InputController i in inputDevices)