nJoy: This should fix the non-working R shoulder button and the analog troubles.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@48 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
8d0c11e564
commit
698d2a3abe
|
@ -421,7 +421,9 @@ void SetControllerAll(HWND hDlg, int controller)
|
|||
SetButton(hDlg, IDTEXT_Y, joysticks[controller].buttons[CTL_Y_BUTTON]);
|
||||
SetButton(hDlg, IDTEXT_Z, joysticks[controller].buttons[CTL_Z_TRIGGER]);
|
||||
SetButton(hDlg, IDTEXT_START, joysticks[controller].buttons[CTL_START]);
|
||||
|
||||
SetButton(hDlg, IDTEXT_DPAD, joysticks[controller].dpad);
|
||||
|
||||
SetButton(hDlg, IDTEXT_MX, joysticks[controller].axis[CTL_MAIN_X]);
|
||||
SetButton(hDlg, IDTEXT_MY, joysticks[controller].axis[CTL_MAIN_Y]);
|
||||
SetButton(hDlg, IDTEXT_SX, joysticks[controller].axis[CTL_SUB_X]);
|
||||
|
@ -439,15 +441,14 @@ void GetControllerAll(HWND hDlg, int controller)
|
|||
joysticks[controller].ID = (int)SendMessage(GetDlgItem(hDlg, IDC_JOYNAME), CB_GETCURSEL, 0, 0);
|
||||
|
||||
joysticks[controller].buttons[CTL_L_SHOULDER] = GetButton(hDlg, IDTEXT_SHOULDERL);
|
||||
joysticks[controller].buttons[CTL_L_SHOULDER] = GetButton(hDlg, IDTEXT_SHOULDERL);
|
||||
|
||||
joysticks[controller].buttons[CTL_R_SHOULDER] = GetButton(hDlg, IDTEXT_SHOULDERR);
|
||||
joysticks[controller].buttons[CTL_A_BUTTON] = GetButton(hDlg, IDTEXT_A);
|
||||
joysticks[controller].buttons[CTL_B_BUTTON] = GetButton(hDlg, IDTEXT_B);
|
||||
joysticks[controller].buttons[CTL_X_BUTTON] = GetButton(hDlg, IDTEXT_X);
|
||||
joysticks[controller].buttons[CTL_Y_BUTTON] = GetButton(hDlg, IDTEXT_Y);
|
||||
joysticks[controller].buttons[CTL_Z_TRIGGER] = GetButton(hDlg, IDTEXT_Z);
|
||||
|
||||
joysticks[controller].buttons[CTL_START] = GetButton(hDlg, IDTEXT_START);
|
||||
|
||||
joysticks[controller].dpad = GetButton(hDlg, IDTEXT_DPAD);
|
||||
|
||||
joysticks[controller].axis[CTL_MAIN_X] = GetButton(hDlg, IDTEXT_MX);
|
||||
|
|
|
@ -174,21 +174,21 @@ void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus)
|
|||
|
||||
// Adjust range
|
||||
// The value returned by SDL_JoystickGetAxis is a signed integer (-32768 to 32768)
|
||||
// -128 and 128
|
||||
int main_stick_x = joystate[_numPAD].axis[CTL_MAIN_X] / 256;
|
||||
int main_stick_y = joystate[_numPAD].axis[CTL_MAIN_Y] / 256;
|
||||
int sub_stick_x = joystate[_numPAD].axis[CTL_SUB_X] / 256;
|
||||
int sub_stick_y = joystate[_numPAD].axis[CTL_SUB_Y] / 256;
|
||||
// The value used for the gamecube controller is an unsigned char (0 to 255)
|
||||
int main_stick_x = (joystate[_numPAD].axis[CTL_MAIN_X]>>8)+127;
|
||||
int main_stick_y = (joystate[_numPAD].axis[CTL_MAIN_Y]>>8)+127;
|
||||
int sub_stick_x = (joystate[_numPAD].axis[CTL_SUB_X]>>8)+127;
|
||||
int sub_stick_y = (joystate[_numPAD].axis[CTL_SUB_Y]>>8)+127;
|
||||
|
||||
// TODO: fix, 128 would cause 0x00
|
||||
if(main_stick_x > 127)
|
||||
main_stick_x = 127;
|
||||
if(main_stick_y > 127)
|
||||
main_stick_y = 127;
|
||||
if(sub_stick_x > 127)
|
||||
sub_stick_x = 127;
|
||||
if(sub_stick_y > 127)
|
||||
sub_stick_y = 127;
|
||||
// Quick fix
|
||||
if(main_stick_x > 255)
|
||||
main_stick_x = 255;
|
||||
if(main_stick_y > 255)
|
||||
main_stick_y = 255;
|
||||
if(sub_stick_x > 255)
|
||||
sub_stick_x = 255;
|
||||
if(sub_stick_y > 255)
|
||||
sub_stick_y = 255;
|
||||
|
||||
// Send values to Dolpin
|
||||
if ((main_stick_x < deadzone2) || (main_stick_x > deadzone)) _pPADStatus->stickX += main_stick_x;
|
||||
|
|
Loading…
Reference in New Issue