nJoy: Fixed the 360 pad triggers with XInput, now they are separate triggers that work just like they should

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1953 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-01-20 14:25:33 +00:00
parent d6443478b0
commit a10c603255
8 changed files with 280 additions and 59 deletions

View File

@ -270,12 +270,18 @@ void ConfigBox::DoGetButtons(int GetId)
// Get the current controller
int Controller = notebookpage;
// Get the controller and trigger type
int ControllerType = joysticks[Controller].controllertype;
int TriggerType = joysticks[Controller].triggertype;
// Collect the accepted buttons for this slot
bool LeftRight = (GetId == IDB_SHOULDER_L || GetId == IDB_SHOULDER_R);
bool Axis = (GetId >= IDB_ANALOG_MAIN_X && GetId <= IDB_SHOULDER_R);
bool Axis = (GetId >= IDB_ANALOG_MAIN_X && GetId <= IDB_SHOULDER_R)
&& (TriggerType == CTL_TRIGGER_SDL);
bool XInput = (TriggerType == CTL_TRIGGER_XINPUT);
bool Button = (GetId >= IDB_BUTTON_A && GetId <= IDB_BUTTONHALFPRESS)
|| (GetId == IDB_SHOULDER_L || GetId == IDB_SHOULDER_R)
|| (GetId >= IDB_DPAD_UP && GetId <= IDB_DPAD_RIGHT && joysticks[Controller].controllertype == CTL_DPAD_CUSTOM);
|| (GetId >= IDB_DPAD_UP && GetId <= IDB_DPAD_RIGHT && ControllerType == CTL_DPAD_CUSTOM);
bool Hat = (GetId >= IDB_DPAD_UP && GetId <= IDB_DPAD_RIGHT)
&& (joysticks[Controller].controllertype == CTL_DPAD_HAT);
@ -383,6 +389,20 @@ void ConfigBox::DoGetButtons(int GetId)
}
}
// Check for a XInput trigger
if(XInput)
{
for(int i = 0; i <= XI_TRIGGER_R; i++)
{
if(XInput::GetXI(0, i))
{
pressed = i + 1000;
type = CTL_AXIS;
Succeed = true;
}
}
}
// Check for keyboard action
if (g_Pressed && Button)
{