Reimplement XDK set_rumble function

This commit is contained in:
twinaphex 2020-08-29 22:25:51 +02:00
parent 84a312535e
commit c5099a312c
2 changed files with 8 additions and 30 deletions

View File

@ -116,36 +116,10 @@ static uint64_t xdk_input_get_capabilities(void *data)
static bool xdk_input_set_rumble(void *data, unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
#ifdef _XBOX360
#if 0
XINPUT_VIBRATION rumble_state;
#endif
#endif
xdk_input_t *xdk = (xdk_input_t*)data;
bool val = false;
(void)xdk;
#if 0
#if defined(_XBOX360)
if (effect == RETRO_RUMBLE_STRONG)
rumble_state.wLeftMotorSpeed = strength;
else if (effect == RETRO_RUMBLE_WEAK)
rumble_state.wRightMotorSpeed = strength;
val = XInputSetState(port, &rumble_state) == ERROR_SUCCESS;
#elif defined(_XBOX1)
#if 0
XINPUT_FEEDBACK rumble_state;
if (effect == RETRO_RUMBLE_STRONG)
rumble_state.Rumble.wLeftMotorSpeed = strength;
else if (effect == RETRO_RUMBLE_WEAK)
rumble_state.Rumble.wRightMotorSpeed = strength;
val = XInputSetState(xdk->gamepads[port], &rumble_state) == ERROR_SUCCESS;
#endif
#endif
#endif
return val;
if (xdk)
return input_joypad_set_rumble(xdk->joypad, port, effect, strength);
return false;
}
static const input_device_driver_t *xdk_input_get_joypad_driver(void *data)

View File

@ -84,7 +84,11 @@ static bool g_xinput_guide_button_supported = false;
static unsigned g_xinput_num_buttons = 0;
static XInputSetState_t g_XInputSetState;
static XInputGetStateEx_t g_XInputGetStateEx;
#ifdef _XBOX1
static XINPUT_FEEDBACK g_xinput_rumble_states[4];
#else
static XINPUT_VIBRATION g_xinput_rumble_states[4];
#endif
static xinput_joypad_state g_xinput_states[4];
/* Buttons are provided by XInput as bits of a uint16.
@ -668,7 +672,7 @@ static bool xinput_joypad_rumble(unsigned pad,
/* Consider the low frequency (left) motor the "strong" one. */
if (effect == RETRO_RUMBLE_STRONG)
g_xinput_rumble_states[xuser].wLeftMotorSpeed = strength;
g_xinput_rumble_states[xuser].wLeftMotorSpeed = strength;
else if (effect == RETRO_RUMBLE_WEAK)
g_xinput_rumble_states[xuser].wRightMotorSpeed = strength;