mirror of
https://github.com/libretro/RetroArch
synced 2025-03-21 22:20:59 +00:00
Reimplement XDK set_rumble function
This commit is contained in:
parent
84a312535e
commit
c5099a312c
@ -116,36 +116,10 @@ static uint64_t xdk_input_get_capabilities(void *data)
|
|||||||
static bool xdk_input_set_rumble(void *data, unsigned port,
|
static bool xdk_input_set_rumble(void *data, unsigned port,
|
||||||
enum retro_rumble_effect effect, uint16_t strength)
|
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;
|
xdk_input_t *xdk = (xdk_input_t*)data;
|
||||||
bool val = false;
|
if (xdk)
|
||||||
|
return input_joypad_set_rumble(xdk->joypad, port, effect, strength);
|
||||||
(void)xdk;
|
return false;
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const input_device_driver_t *xdk_input_get_joypad_driver(void *data)
|
static const input_device_driver_t *xdk_input_get_joypad_driver(void *data)
|
||||||
|
@ -84,7 +84,11 @@ static bool g_xinput_guide_button_supported = false;
|
|||||||
static unsigned g_xinput_num_buttons = 0;
|
static unsigned g_xinput_num_buttons = 0;
|
||||||
static XInputSetState_t g_XInputSetState;
|
static XInputSetState_t g_XInputSetState;
|
||||||
static XInputGetStateEx_t g_XInputGetStateEx;
|
static XInputGetStateEx_t g_XInputGetStateEx;
|
||||||
|
#ifdef _XBOX1
|
||||||
|
static XINPUT_FEEDBACK g_xinput_rumble_states[4];
|
||||||
|
#else
|
||||||
static XINPUT_VIBRATION g_xinput_rumble_states[4];
|
static XINPUT_VIBRATION g_xinput_rumble_states[4];
|
||||||
|
#endif
|
||||||
static xinput_joypad_state g_xinput_states[4];
|
static xinput_joypad_state g_xinput_states[4];
|
||||||
|
|
||||||
/* Buttons are provided by XInput as bits of a uint16.
|
/* 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. */
|
/* Consider the low frequency (left) motor the "strong" one. */
|
||||||
if (effect == RETRO_RUMBLE_STRONG)
|
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)
|
else if (effect == RETRO_RUMBLE_WEAK)
|
||||||
g_xinput_rumble_states[xuser].wRightMotorSpeed = strength;
|
g_xinput_rumble_states[xuser].wRightMotorSpeed = strength;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user