fix xinput > 2 devices, and change how xinput devices are numbered in configuration (by player number and not index-of-connected-xinput-device-plus-one)
This commit is contained in:
parent
9a05512a48
commit
144f08cfc3
|
@ -87,10 +87,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
var c3 = new Controller(UserIndex.Three);
|
||||
var c4 = new Controller(UserIndex.Four);
|
||||
|
||||
if (c1.IsConnected) Devices.Add(new GamePad360(c1));
|
||||
if (c2.IsConnected) Devices.Add(new GamePad360(c2));
|
||||
if (c3.IsConnected) Devices.Add(new GamePad360(c3));
|
||||
if (c4.IsConnected) Devices.Add(new GamePad360(c4));
|
||||
if (c1.IsConnected) Devices.Add(new GamePad360(0,c1));
|
||||
if (c2.IsConnected) Devices.Add(new GamePad360(1,c2));
|
||||
if (c3.IsConnected) Devices.Add(new GamePad360(2,c3));
|
||||
if (c4.IsConnected) Devices.Add(new GamePad360(3,c4));
|
||||
}
|
||||
|
||||
public static void UpdateAll()
|
||||
|
@ -103,10 +103,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
// ********************************** Instance Members **********************************
|
||||
|
||||
readonly Controller controller;
|
||||
uint index0;
|
||||
XINPUT_STATE state;
|
||||
|
||||
GamePad360(Controller c)
|
||||
public int PlayerNumber { get { return (int)index0 + 1; } }
|
||||
|
||||
GamePad360(uint index0, Controller c)
|
||||
{
|
||||
this.index0 = index0;
|
||||
controller = c;
|
||||
InitializeButtons();
|
||||
Update();
|
||||
|
@ -120,7 +124,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (XInputGetStateExProc != null)
|
||||
{
|
||||
state = new XINPUT_STATE();
|
||||
XInputGetStateExProc(0, out state);
|
||||
XInputGetStateExProc(index0, out state);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -341,7 +341,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
for (int i = 0; i < GamePad360.Devices.Count; i++)
|
||||
{
|
||||
var pad = GamePad360.Devices[i];
|
||||
string xname = "X" + (i + 1) + " ";
|
||||
string xname = "X" + (pad.PlayerNumber) + " ";
|
||||
for (int b = 0; b < pad.NumButtons; b++)
|
||||
HandleButton(xname + pad.ButtonName(b), pad.Pressed(b));
|
||||
foreach (var sv in pad.GetFloats())
|
||||
|
|
Loading…
Reference in New Issue