mirror of
https://github.com/libretro/RetroArch
synced 2025-03-01 16:13:40 +00:00
OpenDingux: Optimise rumble interface
This commit is contained in:
parent
c8f92d2247
commit
de146545af
@ -70,9 +70,9 @@ typedef struct
|
||||
#if defined(HAVE_LIBSHAKE)
|
||||
dingux_joypad_rumble_t rumble;
|
||||
#endif
|
||||
unsigned num_axes;
|
||||
uint16_t pad_state;
|
||||
int16_t analog_state[2][2];
|
||||
unsigned num_axes;
|
||||
bool connected;
|
||||
bool menu_toggle;
|
||||
} dingux_joypad_t;
|
||||
@ -171,8 +171,6 @@ static bool sdl_dingux_rumble_update(Shake_Device *device,
|
||||
dingux_joypad_rumble_effect_t *effect,
|
||||
uint16_t strength, uint16_t max_strength)
|
||||
{
|
||||
int id;
|
||||
|
||||
/* If strength is zero, halt rumble effect */
|
||||
if (strength == 0)
|
||||
{
|
||||
@ -180,8 +178,7 @@ static bool sdl_dingux_rumble_update(Shake_Device *device,
|
||||
{
|
||||
if (Shake_Stop(device, effect->id) == SHAKE_OK)
|
||||
{
|
||||
effect->active = false;
|
||||
effect->strength = 0;
|
||||
effect->active = false;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -191,20 +188,23 @@ static bool sdl_dingux_rumble_update(Shake_Device *device,
|
||||
return true;
|
||||
}
|
||||
|
||||
/* If strength is unchanged, do nothing */
|
||||
if (strength == effect->strength)
|
||||
return true;
|
||||
/* If strength has changed, update effect */
|
||||
if (strength != effect->strength)
|
||||
{
|
||||
int id;
|
||||
|
||||
/* Strength has changed - update effect */
|
||||
effect->effect.id = effect->id;
|
||||
effect->effect.u.periodic.magnitude = (max_strength * strength) / 0xFFFF;
|
||||
id = Shake_UploadEffect(device, &effect->effect);
|
||||
effect->effect.id = effect->id;
|
||||
effect->effect.u.periodic.magnitude = (max_strength * strength) / 0xFFFF;
|
||||
id = Shake_UploadEffect(device, &effect->effect);
|
||||
|
||||
if (id == SHAKE_ERROR)
|
||||
return false;
|
||||
if (id == SHAKE_ERROR)
|
||||
return false;
|
||||
|
||||
effect->id = id;
|
||||
effect->id = id;
|
||||
effect->strength = strength;
|
||||
}
|
||||
|
||||
/* If effect is currently idle, activate it */
|
||||
if (!effect->active)
|
||||
{
|
||||
if (Shake_Play(device, effect->id) == SHAKE_OK)
|
||||
|
@ -11807,7 +11807,7 @@ static bool setting_append_list(
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_COMBOBOX;
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint_special;
|
||||
menu_settings_list_current_add_range(list, list_info, 0, 100, 5, true, true);
|
||||
#endif
|
||||
CONFIG_UINT(
|
||||
|
Loading…
x
Reference in New Issue
Block a user