From 303d17e2e6cc49e2a19a5f9637ea4e4ad3a92beb Mon Sep 17 00:00:00 2001 From: Michael Burgardt Date: Sat, 4 Sep 2021 16:29:54 +0200 Subject: [PATCH] Rebase 'Add generic rumble gain to input settings' by davidgfnet --- config.def.h | 4 +- configuration.c | 4 +- configuration.h | 2 +- input/drivers/psl1ght_input.c | 1 + input/drivers_joypad/android_joypad.c | 1 + input/drivers_joypad/ctr_joypad.c | 1 + input/drivers_joypad/dinput_joypad.c | 1 + input/drivers_joypad/dos_joypad.c | 1 + input/drivers_joypad/gx_joypad.c | 1 + input/drivers_joypad/hid_joypad.c | 1 + input/drivers_joypad/linuxraw_joypad.c | 1 + input/drivers_joypad/mfi_joypad.m | 1 + input/drivers_joypad/parport_joypad.c | 1 + input/drivers_joypad/ps2_joypad.c | 1 + input/drivers_joypad/ps3_joypad.c | 1 + input/drivers_joypad/ps4_joypad.c | 1 + input/drivers_joypad/psp_joypad.c | 1 + input/drivers_joypad/qnx_joypad.c | 1 + input/drivers_joypad/rwebpad_joypad.c | 1 + input/drivers_joypad/sdl_dingux_joypad.c | 38 +++++++++++++----- input/drivers_joypad/sdl_joypad.c | 1 + input/drivers_joypad/switch_joypad.c | 1 + input/drivers_joypad/udev_joypad.c | 43 +++++++++++++++++++++ input/drivers_joypad/wiiu/hidpad_driver.c | 1 + input/drivers_joypad/wiiu/kpad_driver.c | 1 + input/drivers_joypad/wiiu/wpad_driver.c | 1 + input/drivers_joypad/wiiu_joypad.c | 1 + input/drivers_joypad/xdk_joypad.c | 1 + input/drivers_joypad/xinput_hybrid_joypad.c | 1 + input/drivers_joypad/xinput_joypad.c | 1 + input/input_driver.c | 22 ++++++++++- input/input_driver.h | 13 +++++++ intl/msg_hash_ar.h | 2 - intl/msg_hash_ast.h | 2 - intl/msg_hash_chs.h | 6 +-- intl/msg_hash_cht.h | 2 - intl/msg_hash_cs.h | 2 - intl/msg_hash_cy.h | 2 - intl/msg_hash_da.h | 2 - intl/msg_hash_de.h | 6 +-- intl/msg_hash_el.h | 2 - intl/msg_hash_eo.h | 2 - intl/msg_hash_es.h | 6 +-- intl/msg_hash_fa.h | 2 - intl/msg_hash_fi.h | 6 +-- intl/msg_hash_fr.h | 6 +-- intl/msg_hash_gl.h | 2 - intl/msg_hash_he.h | 2 - intl/msg_hash_hu.h | 2 - intl/msg_hash_id.h | 6 +-- intl/msg_hash_it.h | 6 +-- intl/msg_hash_ja.h | 6 +-- intl/msg_hash_ko.h | 6 +-- intl/msg_hash_lbl.h | 6 +-- intl/msg_hash_nl.h | 2 - intl/msg_hash_oc.h | 2 - intl/msg_hash_pl.h | 6 +-- intl/msg_hash_pt_br.h | 6 +-- intl/msg_hash_pt_pt.h | 2 - intl/msg_hash_ru.h | 6 +-- intl/msg_hash_sk.h | 2 - intl/msg_hash_sv.h | 2 - intl/msg_hash_tr.h | 6 +-- intl/msg_hash_uk.h | 2 - intl/msg_hash_us.h | 8 ++-- intl/msg_hash_vn.h | 2 - menu/cbs/menu_cbs_sublabel.c | 10 ++--- menu/menu_displaylist.c | 10 ++--- menu/menu_setting.c | 36 +++++++++-------- msg_hash.h | 5 +-- retroarch.c | 27 ++++++++++++- retroarch.h | 2 + 72 files changed, 221 insertions(+), 150 deletions(-) diff --git a/config.def.h b/config.def.h index bd0fd0e9aa..7b50f5cb49 100644 --- a/config.def.h +++ b/config.def.h @@ -1464,7 +1464,9 @@ static const bool enable_device_vibration = false; /* Defines the strength of rumble effects * on OpenDingux devices */ #if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#define DEFAULT_DINGUX_RUMBLE_GAIN 50 +#define DEFAULT_RUMBLE_GAIN 50 +#else +#define DEFAULT_RUMBLE_GAIN 100 #endif #ifdef HAVE_VULKAN diff --git a/configuration.c b/configuration.c index cb3365c0d8..e3fe0ed52e 100644 --- a/configuration.c +++ b/configuration.c @@ -2080,9 +2080,7 @@ static struct config_uint_setting *populate_settings_uint( SETTING_UINT("input_mouse_scale", &settings->uints.input_mouse_scale, true, DEFAULT_MOUSE_SCALE, false); #endif SETTING_UINT("input_touch_scale", &settings->uints.input_touch_scale, true, DEFAULT_TOUCH_SCALE, false); -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) - SETTING_UINT("input_dingux_rumble_gain", &settings->uints.input_dingux_rumble_gain, true, DEFAULT_DINGUX_RUMBLE_GAIN, false); -#endif + SETTING_UINT("input_rumble_gain", &settings->uints.input_rumble_gain, true, DEFAULT_RUMBLE_GAIN, false); SETTING_UINT("input_auto_game_focus", &settings->uints.input_auto_game_focus, true, DEFAULT_INPUT_AUTO_GAME_FOCUS, false); SETTING_UINT("audio_latency", &settings->uints.audio_latency, false, 0 /* TODO */, false); SETTING_UINT("audio_resampler_quality", &settings->uints.audio_resampler_quality, true, audio_resampler_quality_level, false); diff --git a/configuration.h b/configuration.h index 3effb395cc..d2db2ed49c 100644 --- a/configuration.h +++ b/configuration.h @@ -190,7 +190,7 @@ typedef struct settings unsigned input_menu_toggle_gamepad_combo; unsigned input_keyboard_gamepad_mapping_type; unsigned input_poll_type_behavior; - unsigned input_dingux_rumble_gain; + unsigned input_rumble_gain; unsigned input_auto_game_focus; unsigned input_max_users; diff --git a/input/drivers/psl1ght_input.c b/input/drivers/psl1ght_input.c index d84743af5d..e8d067f298 100644 --- a/input/drivers/psl1ght_input.c +++ b/input/drivers/psl1ght_input.c @@ -550,6 +550,7 @@ input_device_driver_t ps3_joypad = { ps3_joypad_axis, ps3_joypad_poll, ps3_joypad_rumble, + NULL, ps3_joypad_name, "ps3", }; diff --git a/input/drivers_joypad/android_joypad.c b/input/drivers_joypad/android_joypad.c index 4c8b6a0fce..3f720fbe8a 100644 --- a/input/drivers_joypad/android_joypad.c +++ b/input/drivers_joypad/android_joypad.c @@ -253,6 +253,7 @@ input_device_driver_t android_joypad = { android_joypad_axis, android_joypad_poll, android_joypad_rumble, + NULL, android_joypad_name, "android", }; diff --git a/input/drivers_joypad/ctr_joypad.c b/input/drivers_joypad/ctr_joypad.c index 1eb718fdb9..5c954cf813 100644 --- a/input/drivers_joypad/ctr_joypad.c +++ b/input/drivers_joypad/ctr_joypad.c @@ -219,6 +219,7 @@ input_device_driver_t ctr_joypad = { ctr_joypad_axis, ctr_joypad_poll, NULL, + NULL, ctr_joypad_name, "ctr", }; diff --git a/input/drivers_joypad/dinput_joypad.c b/input/drivers_joypad/dinput_joypad.c index cab4d6916d..cfddb30181 100644 --- a/input/drivers_joypad/dinput_joypad.c +++ b/input/drivers_joypad/dinput_joypad.c @@ -56,6 +56,7 @@ input_device_driver_t dinput_joypad = { dinput_joypad_axis, dinput_joypad_poll, dinput_joypad_set_rumble, + NULL, dinput_joypad_name, "dinput", }; diff --git a/input/drivers_joypad/dos_joypad.c b/input/drivers_joypad/dos_joypad.c index 903f0bd944..54d4a4396c 100644 --- a/input/drivers_joypad/dos_joypad.c +++ b/input/drivers_joypad/dos_joypad.c @@ -271,6 +271,7 @@ input_device_driver_t dos_joypad = { dos_joypad_axis, dos_joypad_poll, NULL, + NULL, dos_joypad_name, "dos", }; diff --git a/input/drivers_joypad/gx_joypad.c b/input/drivers_joypad/gx_joypad.c index 56532af2be..4f4101ac6d 100644 --- a/input/drivers_joypad/gx_joypad.c +++ b/input/drivers_joypad/gx_joypad.c @@ -668,6 +668,7 @@ input_device_driver_t gx_joypad = { gx_joypad_axis, gx_joypad_poll, NULL, + NULL, gx_joypad_name, "gx", }; diff --git a/input/drivers_joypad/hid_joypad.c b/input/drivers_joypad/hid_joypad.c index b149613d7c..fd6e22b880 100644 --- a/input/drivers_joypad/hid_joypad.c +++ b/input/drivers_joypad/hid_joypad.c @@ -130,6 +130,7 @@ input_device_driver_t hid_joypad = { hid_joypad_axis, hid_joypad_poll, hid_joypad_rumble, + NULL, hid_joypad_name, "hid" }; diff --git a/input/drivers_joypad/linuxraw_joypad.c b/input/drivers_joypad/linuxraw_joypad.c index 9cf85a285a..846357b107 100644 --- a/input/drivers_joypad/linuxraw_joypad.c +++ b/input/drivers_joypad/linuxraw_joypad.c @@ -402,6 +402,7 @@ input_device_driver_t linuxraw_joypad = { linuxraw_joypad_axis, linuxraw_joypad_poll, NULL, + NULL, linuxraw_joypad_name, "linuxraw", }; diff --git a/input/drivers_joypad/mfi_joypad.m b/input/drivers_joypad/mfi_joypad.m index ea61dc010b..7a7bd56426 100644 --- a/input/drivers_joypad/mfi_joypad.m +++ b/input/drivers_joypad/mfi_joypad.m @@ -481,6 +481,7 @@ input_device_driver_t mfi_joypad = { apple_gamecontroller_joypad_axis, apple_gamecontroller_joypad_poll, NULL, + NULL, apple_gamecontroller_joypad_name, "mfi", }; diff --git a/input/drivers_joypad/parport_joypad.c b/input/drivers_joypad/parport_joypad.c index 8621a63ada..16adbe4b1b 100644 --- a/input/drivers_joypad/parport_joypad.c +++ b/input/drivers_joypad/parport_joypad.c @@ -412,6 +412,7 @@ input_device_driver_t parport_joypad = { parport_joypad_axis, parport_joypad_poll, NULL, + NULL, parport_joypad_name, "parport", }; diff --git a/input/drivers_joypad/ps2_joypad.c b/input/drivers_joypad/ps2_joypad.c index bf60f6062b..771d264b7e 100644 --- a/input/drivers_joypad/ps2_joypad.c +++ b/input/drivers_joypad/ps2_joypad.c @@ -261,6 +261,7 @@ input_device_driver_t ps2_joypad = { ps2_joypad_axis, ps2_joypad_poll, ps2_joypad_rumble, + NULL, ps2_joypad_name, "ps2", }; diff --git a/input/drivers_joypad/ps3_joypad.c b/input/drivers_joypad/ps3_joypad.c index 4c3f5d8190..64edd899d7 100644 --- a/input/drivers_joypad/ps3_joypad.c +++ b/input/drivers_joypad/ps3_joypad.c @@ -289,6 +289,7 @@ input_device_driver_t ps3_joypad = { ps3_joypad_axis, ps3_joypad_poll, ps3_joypad_rumble, + NULL, ps3_joypad_name, "ps3", }; diff --git a/input/drivers_joypad/ps4_joypad.c b/input/drivers_joypad/ps4_joypad.c index b54fe8eac0..4a0042e4c8 100644 --- a/input/drivers_joypad/ps4_joypad.c +++ b/input/drivers_joypad/ps4_joypad.c @@ -242,6 +242,7 @@ input_device_driver_t ps4_joypad = { ps4_joypad_axis, ps4_joypad_poll, ps4_joypad_rumble, + NULL, ps4_joypad_name, "ps4", }; diff --git a/input/drivers_joypad/psp_joypad.c b/input/drivers_joypad/psp_joypad.c index 6c708925ea..4e602e26ac 100644 --- a/input/drivers_joypad/psp_joypad.c +++ b/input/drivers_joypad/psp_joypad.c @@ -432,6 +432,7 @@ input_device_driver_t psp_joypad = { psp_joypad_axis, psp_joypad_poll, psp_joypad_rumble, + NULL, psp_joypad_name, #ifdef VITA "vita", diff --git a/input/drivers_joypad/qnx_joypad.c b/input/drivers_joypad/qnx_joypad.c index 1924959b15..e13c74dea1 100644 --- a/input/drivers_joypad/qnx_joypad.c +++ b/input/drivers_joypad/qnx_joypad.c @@ -163,6 +163,7 @@ input_device_driver_t qnx_joypad = { qnx_joypad_axis, qnx_joypad_poll, NULL, + NULL, qnx_joypad_name, "qnx", }; diff --git a/input/drivers_joypad/rwebpad_joypad.c b/input/drivers_joypad/rwebpad_joypad.c index 5ddc893d5d..41a80f8caa 100644 --- a/input/drivers_joypad/rwebpad_joypad.c +++ b/input/drivers_joypad/rwebpad_joypad.c @@ -219,6 +219,7 @@ input_device_driver_t rwebpad_joypad = { rwebpad_joypad_axis, rwebpad_joypad_poll, NULL, + NULL, rwebpad_joypad_name, "rwebpad", }; diff --git a/input/drivers_joypad/sdl_dingux_joypad.c b/input/drivers_joypad/sdl_dingux_joypad.c index a4c252b576..a9ca32b057 100644 --- a/input/drivers_joypad/sdl_dingux_joypad.c +++ b/input/drivers_joypad/sdl_dingux_joypad.c @@ -29,6 +29,7 @@ #if defined(HAVE_LIBSHAKE) #include #include "../../configuration.h" +#include "../../config.def.h" #endif #if defined(RS90) || defined (RETROFW) @@ -100,15 +101,11 @@ static dingux_joypad_t dingux_joypad; static bool sdl_dingux_rumble_init(dingux_joypad_rumble_t *rumble) { settings_t *settings = config_get_ptr(); - unsigned rumble_gain = settings ? settings->uints.input_dingux_rumble_gain : 0; + unsigned rumble_gain = settings ? settings->uints.input_rumble_gain + : DEFAULT_RUMBLE_GAIN; bool weak_uploaded = false; bool strong_uploaded = false; - /* If gain is zero, rumble is disabled - * > No need to initialise device */ - if (rumble_gain == 0) - goto error; - if (Shake_NumOfDevices() < 1) goto error; @@ -163,8 +160,7 @@ static bool sdl_dingux_rumble_init(dingux_joypad_rumble_t *rumble) return true; error: - if (rumble_gain != 0) - RARCH_WARN("[libShake]: Input device does not support rumble effects.\n"); + RARCH_WARN("[libShake]: Input device does not support rumble effects.\n"); if (rumble->device) { @@ -238,7 +234,8 @@ static bool sdl_dingux_joypad_set_rumble(unsigned pad, { dingux_joypad_t *joypad = (dingux_joypad_t*)&dingux_joypad; - if (!joypad->rumble.device) + if ((pad != 0) || + !joypad->rumble.device) return false; switch (effect) @@ -257,6 +254,27 @@ static bool sdl_dingux_joypad_set_rumble(unsigned pad, return false; } + +static bool sdl_dingux_joypad_set_rumble_gain(unsigned pad, unsigned gain) +{ + dingux_joypad_t *joypad = (dingux_joypad_t*)&dingux_joypad; + + if ((pad != 0) || + !joypad->rumble.device) + return false; + + /* Gain is automatically capped by Shake_SetGain(), + * but do it explicitly here for clarity */ + if (gain > 100) + gain = 100; + + /* Set gain */ + if (Shake_QueryGainSupport(joypad->rumble.device)) + if (Shake_SetGain(joypad->rumble.device, (int)gain) == SHAKE_OK) + return true; + + return false; +} #endif static const char *sdl_dingux_joypad_name(unsigned port) @@ -727,8 +745,10 @@ input_device_driver_t sdl_dingux_joypad = { sdl_dingux_joypad_poll, #if defined(HAVE_LIBSHAKE) sdl_dingux_joypad_set_rumble, + sdl_dingux_joypad_set_rumble_gain, #else NULL, + NULL, #endif sdl_dingux_joypad_name, "sdl_dingux", diff --git a/input/drivers_joypad/sdl_joypad.c b/input/drivers_joypad/sdl_joypad.c index 2d48aa3e20..1213037626 100644 --- a/input/drivers_joypad/sdl_joypad.c +++ b/input/drivers_joypad/sdl_joypad.c @@ -535,6 +535,7 @@ input_device_driver_t sdl_joypad = { #else NULL, #endif + NULL, sdl_joypad_name, #ifdef HAVE_SDL2 "sdl2", diff --git a/input/drivers_joypad/switch_joypad.c b/input/drivers_joypad/switch_joypad.c index fa68d34a43..1fa21b1662 100644 --- a/input/drivers_joypad/switch_joypad.c +++ b/input/drivers_joypad/switch_joypad.c @@ -456,6 +456,7 @@ input_device_driver_t switch_joypad = { #else NULL, /* set_rumble */ #endif + NULL, switch_joypad_name, "switch" }; diff --git a/input/drivers_joypad/udev_joypad.c b/input/drivers_joypad/udev_joypad.c index 3d0b2954c2..9412dc4aed 100644 --- a/input/drivers_joypad/udev_joypad.c +++ b/input/drivers_joypad/udev_joypad.c @@ -36,6 +36,9 @@ #include "../input_driver.h" +#include "../../configuration.h" +#include "../../config.def.h" + #include "../../tasks/tasks_internal.h" #include "../../verbosity.h" @@ -81,6 +84,7 @@ struct udev_joypad uint8_t axes_bind[ABS_MAX]; uint16_t strength[2]; uint16_t configured_strength[2]; + unsigned rumble_gain; char ident[255]; bool has_set_ff[2]; @@ -147,6 +151,35 @@ error: return -1; } +static bool udev_set_rumble_gain(unsigned i, unsigned gain) +{ + struct input_event ie; + struct udev_joypad *pad = (struct udev_joypad*)&udev_pads[i]; + + /* Does not support > 100 gains */ + if ((pad->fd < 0) || + (gain > 100)) + return false; + + if (pad->rumble_gain == gain) + return true; + + memset(&ie, 0, sizeof(ie)); + ie.type = EV_FF; + ie.code = FF_GAIN; + ie.value = 0xFFFF * (gain/100.0); + + if (write(pad->fd, &ie, sizeof(ie)) < (ssize_t)sizeof(ie)) + { + RARCH_ERR("[udev]: Failed to set rumble gain on pad #%u.\n", i); + return false; + } + + pad->rumble_gain = gain; + + return true; +} + static int udev_add_pad(struct udev_device *dev, unsigned p, int fd, const char *path) { int i; @@ -266,6 +299,15 @@ static int udev_add_pad(struct udev_device *dev, unsigned p, int fd, const char p, path, pad->num_effects); } + /* Set rumble gain here, if supported */ + if (test_bit(FF_RUMBLE, ffbit)) + { + settings_t *settings = config_get_ptr(); + unsigned rumble_gain = settings ? settings->uints.input_rumble_gain + : DEFAULT_RUMBLE_GAIN; + udev_set_rumble_gain(p, rumble_gain); + } + return ret; } @@ -748,6 +790,7 @@ input_device_driver_t udev_joypad = { udev_joypad_axis, udev_joypad_poll, udev_set_rumble, + udev_set_rumble_gain, udev_joypad_name, "udev", }; diff --git a/input/drivers_joypad/wiiu/hidpad_driver.c b/input/drivers_joypad/wiiu/hidpad_driver.c index 8813f62fd4..454b91d54a 100644 --- a/input/drivers_joypad/wiiu/hidpad_driver.c +++ b/input/drivers_joypad/wiiu/hidpad_driver.c @@ -130,6 +130,7 @@ input_device_driver_t hidpad_driver = hidpad_axis, hidpad_poll, NULL, + NULL, hidpad_name, "hid" }; diff --git a/input/drivers_joypad/wiiu/kpad_driver.c b/input/drivers_joypad/wiiu/kpad_driver.c index b51e5de00f..86e8bec846 100644 --- a/input/drivers_joypad/wiiu/kpad_driver.c +++ b/input/drivers_joypad/wiiu/kpad_driver.c @@ -299,6 +299,7 @@ input_device_driver_t kpad_driver = kpad_axis, kpad_poll, NULL, + NULL, kpad_name, "wiimote", }; diff --git a/input/drivers_joypad/wiiu/wpad_driver.c b/input/drivers_joypad/wiiu/wpad_driver.c index 8d1bd59f37..7fb4cf4047 100644 --- a/input/drivers_joypad/wiiu/wpad_driver.c +++ b/input/drivers_joypad/wiiu/wpad_driver.c @@ -370,6 +370,7 @@ input_device_driver_t wpad_driver = wpad_axis, wpad_poll, NULL, + NULL, wpad_name, "gamepad", }; diff --git a/input/drivers_joypad/wiiu_joypad.c b/input/drivers_joypad/wiiu_joypad.c index fe8ddc54bf..18eb5db822 100644 --- a/input/drivers_joypad/wiiu_joypad.c +++ b/input/drivers_joypad/wiiu_joypad.c @@ -153,6 +153,7 @@ input_device_driver_t wiiu_joypad = wiiu_joypad_axis, wiiu_joypad_poll, NULL, + NULL, wiiu_joypad_name, "wiiu", }; diff --git a/input/drivers_joypad/xdk_joypad.c b/input/drivers_joypad/xdk_joypad.c index b3c30ebceb..08b94b5107 100644 --- a/input/drivers_joypad/xdk_joypad.c +++ b/input/drivers_joypad/xdk_joypad.c @@ -325,6 +325,7 @@ input_device_driver_t xdk_joypad = { xdk_joypad_axis, xdk_joypad_poll, NULL, + NULL, xdk_joypad_name, "xdk", }; diff --git a/input/drivers_joypad/xinput_hybrid_joypad.c b/input/drivers_joypad/xinput_hybrid_joypad.c index 6bbf65805d..f14d3122db 100644 --- a/input/drivers_joypad/xinput_hybrid_joypad.c +++ b/input/drivers_joypad/xinput_hybrid_joypad.c @@ -695,6 +695,7 @@ input_device_driver_t xinput_joypad = { xinput_joypad_axis, xinput_joypad_poll, xinput_joypad_rumble, + NULL, xinput_joypad_name, "xinput", }; diff --git a/input/drivers_joypad/xinput_joypad.c b/input/drivers_joypad/xinput_joypad.c index 8402aa9fa7..9b1d0af761 100644 --- a/input/drivers_joypad/xinput_joypad.c +++ b/input/drivers_joypad/xinput_joypad.c @@ -395,6 +395,7 @@ input_device_driver_t xinput_joypad = { xinput_joypad_axis, xinput_joypad_poll, xinput_joypad_rumble, + NULL, xinput_joypad_name, "xinput", }; diff --git a/input/input_driver.c b/input/input_driver.c index b03014c026..bfabb8d4fa 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -78,7 +78,8 @@ static input_device_driver_t null_joypad = { NULL, /* get_buttons */ NULL, /* axis */ NULL, /* poll */ - NULL, + NULL, /* rumble */ + NULL, /* rumble_gain */ NULL, /* name */ "null", }; @@ -326,6 +327,25 @@ bool input_driver_set_rumble( /**************************************/ +bool input_driver_set_rumble_gain( + input_driver_state_t *driver_state, unsigned gain, + unsigned input_max_users) +{ + unsigned i; + + if (driver_state->primary_joypad + && driver_state->primary_joypad->set_rumble_gain) + { + for (i = 0; i < input_max_users; i++) + driver_state->primary_joypad->set_rumble_gain(i, gain); + return true; + } + else + return false; +} + +/**************************************/ + bool input_driver_set_sensor( input_driver_state_t *driver_state, unsigned port, bool sensors_enable, enum retro_sensor_action action, unsigned rate) diff --git a/input/input_driver.h b/input/input_driver.h index 4007dff4c3..c69685acef 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -340,6 +340,7 @@ struct rarch_joypad_driver int16_t (*axis)(unsigned, uint32_t); void (*poll)(void); bool (*set_rumble)(unsigned, enum retro_rumble_effect, uint16_t); + bool (*set_rumble_gain)(unsigned, unsigned); const char *(*name)(unsigned); const char *ident; @@ -381,6 +382,18 @@ const char* config_get_input_driver_options(void); bool input_driver_set_rumble( input_driver_state_t *driver_state, unsigned port, unsigned joy_idx, enum retro_rumble_effect effect, uint16_t strength); +/** + * Sets the rumble gain. + * + * @param driver_state + * @param gain Rumble gain, 0-100 [%] + * @param input_max_users + * + * @return true if the rumble gain has been successfully set + **/ +bool input_driver_set_rumble_gain( + input_driver_state_t *driver_state, unsigned gain, + unsigned input_max_users); /** * Sets the sensor state. diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 243e8ac6b4..27e8d36dfb 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -2018,8 +2018,6 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "تمكين اهتزاز الجهاز (للنواة المدعومة)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_ast.h b/intl/msg_hash_ast.h index 0610deb0f5..b33a289079 100644 --- a/intl/msg_hash_ast.h +++ b/intl/msg_hash_ast.h @@ -902,8 +902,6 @@ MSG_HASH( /* Settings > Input > Haptic Feedback/Vibration */ -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 49ce3e392b..00b2dc2c31 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -2230,16 +2230,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "启用设备振动 (对支持的核心)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_LABEL_VALUE_INPUT_RUMBLE_GAIN, "振动强度 (需要重启)" ) MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_SUBLABEL_INPUT_RUMBLE_GAIN, "指定触觉反馈效果的强弱。" ) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index f332b0ecd6..f80b8dfd96 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -1822,8 +1822,6 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "啟用設備振動(對於支援的內核)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_cs.h b/intl/msg_hash_cs.h index c85da70f06..e29bd1d6ed 100644 --- a/intl/msg_hash_cs.h +++ b/intl/msg_hash_cs.h @@ -1114,8 +1114,6 @@ MSG_HASH( /* Settings > Input > Haptic Feedback/Vibration */ -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_cy.h b/intl/msg_hash_cy.h index 4089ddae36..bdba9102f9 100644 --- a/intl/msg_hash_cy.h +++ b/intl/msg_hash_cy.h @@ -1098,8 +1098,6 @@ MSG_HASH( /* Settings > Input > Haptic Feedback/Vibration */ -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_da.h b/intl/msg_hash_da.h index 647d34cbb6..9940dd49ac 100644 --- a/intl/msg_hash_da.h +++ b/intl/msg_hash_da.h @@ -162,8 +162,6 @@ MSG_HASH( /* Settings > Input > Haptic Feedback/Vibration */ -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 2f99715f93..f66f2230a9 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -2190,16 +2190,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "Vibration aktivieren (für unterstützte Cores)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_LABEL_VALUE_INPUT_RUMBLE_GAIN, "Vibrationsstärke (Neustart erforderlich)" ) MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_SUBLABEL_INPUT_RUMBLE_GAIN, "Die Größenordnung der haptischen Feedback-Effekte angeben." ) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index 2c50ef0457..dfc885a148 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -1838,8 +1838,6 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "Ενεργοποίηση Δόνησης Συσκευής (Για Υποστηριζόμενους Πυρήνες)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index 289cd6fddc..e63473cffd 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -438,8 +438,6 @@ MSG_HASH( /* Settings > Input > Haptic Feedback/Vibration */ -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index 7abbeb0f02..d6793253e5 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -2290,16 +2290,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "Activar vibración de dispositivo (en núcleos compatibles)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_LABEL_VALUE_INPUT_RUMBLE_GAIN, "Intensidad de vibración (es necesario reiniciar)" ) MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_SUBLABEL_INPUT_RUMBLE_GAIN, "Especifica la fuerza de los efectos de respuesta háptica." ) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_fa.h b/intl/msg_hash_fa.h index 98a076b6d9..7021d8511d 100644 --- a/intl/msg_hash_fa.h +++ b/intl/msg_hash_fa.h @@ -382,8 +382,6 @@ MSG_HASH( /* Settings > Input > Haptic Feedback/Vibration */ -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_fi.h b/intl/msg_hash_fi.h index 783e5b01ca..b686937394 100644 --- a/intl/msg_hash_fi.h +++ b/intl/msg_hash_fi.h @@ -2246,16 +2246,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "Ota laitteen värinä käyttöön (tuetuille ytimille)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_LABEL_VALUE_INPUT_RUMBLE_GAIN, "Tärinän voimakkuus (Uudelleenkäynnistys vaaditaan)" ) MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_SUBLABEL_INPUT_RUMBLE_GAIN, "Määritä haptisen palautteen voimakkuus." ) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index a53243a850..1b75309efd 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -2278,16 +2278,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "Activer la vibration du périphérique (pour les cœurs pris en charge)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_LABEL_VALUE_INPUT_RUMBLE_GAIN, "Force de la vibration (Redémarrage requis)" ) MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_SUBLABEL_INPUT_RUMBLE_GAIN, "Spécifier l'ampleur des effets de retour haptique." ) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_gl.h b/intl/msg_hash_gl.h index 4d0e520df4..698745532e 100644 --- a/intl/msg_hash_gl.h +++ b/intl/msg_hash_gl.h @@ -1090,8 +1090,6 @@ MSG_HASH( /* Settings > Input > Haptic Feedback/Vibration */ -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_he.h b/intl/msg_hash_he.h index 15db8d7cd5..08d5b944ea 100644 --- a/intl/msg_hash_he.h +++ b/intl/msg_hash_he.h @@ -490,8 +490,6 @@ MSG_HASH( /* Settings > Input > Haptic Feedback/Vibration */ -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_hu.h b/intl/msg_hash_hu.h index f638b1ad11..d328e31801 100644 --- a/intl/msg_hash_hu.h +++ b/intl/msg_hash_hu.h @@ -370,8 +370,6 @@ MSG_HASH( /* Settings > Input > Haptic Feedback/Vibration */ -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_id.h b/intl/msg_hash_id.h index e6cae7d0cc..eca89464fd 100644 --- a/intl/msg_hash_id.h +++ b/intl/msg_hash_id.h @@ -2022,16 +2022,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "Aktifkan Getaran Perangkat (Untuk Core yang Didukung)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_LABEL_VALUE_INPUT_RUMBLE_GAIN, "Kekuatan Getaran (Diperlukan Restart)" ) MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_SUBLABEL_INPUT_RUMBLE_GAIN, "Tentukan besarnya efek umpan balik haptic." ) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 49e9a9d8fe..1b062b2d93 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -2266,16 +2266,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "Abilita Vibrazione Dispositivo (Per i Core Supportati)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_LABEL_VALUE_INPUT_RUMBLE_GAIN, "Forza Vibrazione (Richiesta)" ) MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_SUBLABEL_INPUT_RUMBLE_GAIN, "Specifica l'entità degli effetti di feedback tattili." ) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index f2ea6de2c4..5d4452269f 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -2182,16 +2182,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "(対応コアで)デバイスの振動を有効" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_LABEL_VALUE_INPUT_RUMBLE_GAIN, "振動の強さ (再起動が必要)" ) MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_SUBLABEL_INPUT_RUMBLE_GAIN, "触覚フィードバック効果の大きさを指定します." ) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 8999d9d44a..2d164dd4bd 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -2318,16 +2318,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "장치 진동 사용 (지원 코어 한정)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_LABEL_VALUE_INPUT_RUMBLE_GAIN, "진동 세기 (재시작 필요)" ) MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_SUBLABEL_INPUT_RUMBLE_GAIN, "햅틱 피드백으로 사용될 진동의 세기를 설정합니다." ) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 9f81cbd6ae..21467bc466 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -5038,12 +5038,10 @@ MSG_HASH( MENU_ENUM_LABEL_INPUT_HAPTIC_FEEDBACK_SETTINGS, "input_haptic_feedback_settings" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) MSG_HASH( - MENU_ENUM_LABEL_INPUT_DINGUX_RUMBLE_GAIN, - "input_dingux_rumble_gain" + MENU_ENUM_LABEL_INPUT_RUMBLE_GAIN, + "input_rumble_gain" ) -#endif MSG_HASH( MENU_ENUM_LABEL_INPUT_TURBO_MODE, "input_turbo_mode" diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index cb6ddf0c40..0d14002b99 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -1798,8 +1798,6 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "Toestel trillen inschakelen (voor ondersteunde Cores)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_oc.h b/intl/msg_hash_oc.h index 60000f2178..170f078995 100644 --- a/intl/msg_hash_oc.h +++ b/intl/msg_hash_oc.h @@ -250,8 +250,6 @@ MSG_HASH( /* Settings > Input > Haptic Feedback/Vibration */ -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 0bd2be27f3..b5bc47aaeb 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -2214,16 +2214,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "Włącz wibracje urządzenia (dla obsługiwanych rdzeni)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_LABEL_VALUE_INPUT_RUMBLE_GAIN, "Siła wibracji (wymagany restart)" ) MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_SUBLABEL_INPUT_RUMBLE_GAIN, "Określ skalę efektów wibracji." ) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 9fb6530a7f..748b9c6fab 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -2254,16 +2254,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "Ativar vibração do dispositivo (para núcleos suportados)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_LABEL_VALUE_INPUT_RUMBLE_GAIN, "Força da vibração (requer reinício)" ) MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_SUBLABEL_INPUT_RUMBLE_GAIN, "Determine a magnitude dos efeitos do retorno táctil." ) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index 1b727f7a12..da7b246138 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -1730,8 +1730,6 @@ MSG_HASH( /* Settings > Input > Haptic Feedback/Vibration */ -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index a78bbe9ffc..e9f585b04c 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -2310,16 +2310,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "Вибрация устройством (если поддерживается ядром)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_LABEL_VALUE_INPUT_RUMBLE_GAIN, "Сила виброотдачи (требуется перезапуск)" ) MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_SUBLABEL_INPUT_RUMBLE_GAIN, "Настройка интенсивности эффекта тактильной отдачи." ) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_sk.h b/intl/msg_hash_sk.h index 70c9a6b405..f02ca1e3f1 100644 --- a/intl/msg_hash_sk.h +++ b/intl/msg_hash_sk.h @@ -1774,8 +1774,6 @@ MSG_HASH( /* Settings > Input > Haptic Feedback/Vibration */ -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_sv.h b/intl/msg_hash_sv.h index 4a532bd74f..f093b72493 100644 --- a/intl/msg_hash_sv.h +++ b/intl/msg_hash_sv.h @@ -1782,8 +1782,6 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "Aktivera enheters vibration (för kärnor som stödjer det)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_tr.h b/intl/msg_hash_tr.h index 0c01b1e789..4c37fcbacf 100644 --- a/intl/msg_hash_tr.h +++ b/intl/msg_hash_tr.h @@ -2286,16 +2286,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "Cihaz Titreşimini Etkinleştir (Desteklenen Çekirdekler İçin)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_LABEL_VALUE_INPUT_RUMBLE_GAIN, "Titreşim Gücü (Yeniden Başlatılmalı)" ) MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_SUBLABEL_INPUT_RUMBLE_GAIN, "Dokunsal geri bildirim efektlerinin büyüklüğünü belirtir." ) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_uk.h b/intl/msg_hash_uk.h index c0a30dc55b..41c2fd0930 100644 --- a/intl/msg_hash_uk.h +++ b/intl/msg_hash_uk.h @@ -2222,8 +2222,6 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_VIBRATE_ON_KEYPRESS, "Вібрувати при натисканні клавіші" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 211e2f9ba3..ef34cf36e7 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -2362,16 +2362,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_ENABLE_DEVICE_VIBRATION, "Enable Device Vibration (For Supported Cores)" ) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) MSG_HASH( - MENU_ENUM_LABEL_VALUE_INPUT_DINGUX_RUMBLE_GAIN, - "Vibration Strength (Restart Required)" + MENU_ENUM_LABEL_VALUE_INPUT_RUMBLE_GAIN, + "Vibration Strength" ) MSG_HASH( - MENU_ENUM_SUBLABEL_INPUT_DINGUX_RUMBLE_GAIN, + MENU_ENUM_SUBLABEL_INPUT_RUMBLE_GAIN, "Specify the magnitude of haptic feedback effects." ) -#endif /* Settings > Input > Menu Controls */ diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 772e897d60..2b7c561f45 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -634,8 +634,6 @@ MSG_HASH( /* Settings > Input > Haptic Feedback/Vibration */ -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -#endif /* Settings > Input > Menu Controls */ diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 2697db71c8..8aad58186a 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -359,9 +359,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_turbo_period, MENU_ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_duty_cycle, MENU_ENUM_SUBLABEL_INPUT_DUTY_CYCLE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_turbo_mode, MENU_ENUM_SUBLABEL_INPUT_TURBO_MODE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_turbo_default_button, MENU_ENUM_SUBLABEL_INPUT_TURBO_DEFAULT_BUTTON) -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) -DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_dingux_rumble_gain, MENU_ENUM_SUBLABEL_INPUT_DINGUX_RUMBLE_GAIN) -#endif +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_rumble_gain, MENU_ENUM_SUBLABEL_INPUT_RUMBLE_GAIN) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_vertical_sync, MENU_ENUM_SUBLABEL_VIDEO_VSYNC) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_adaptive_vsync, MENU_ENUM_SUBLABEL_VIDEO_ADAPTIVE_VSYNC) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_core_allow_rotate, MENU_ENUM_SUBLABEL_VIDEO_ALLOW_ROTATE) @@ -3599,11 +3597,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_INPUT_TURBO_DEFAULT_BUTTON: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_turbo_default_button); break; -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) - case MENU_ENUM_LABEL_INPUT_DINGUX_RUMBLE_GAIN: - BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_dingux_rumble_gain); + case MENU_ENUM_LABEL_INPUT_RUMBLE_GAIN: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_rumble_gain); break; -#endif case MENU_ENUM_LABEL_INPUT_BIND_TIMEOUT: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_bind_timeout); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 7621b3fa77..7c5883c43c 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5593,14 +5593,10 @@ unsigned menu_displaylist_build_list( PARSE_ONLY_BOOL, false) == 0) count++; } - -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) - if (string_is_equal(joypad_driver_id, "sdl_dingux")) - if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, - MENU_ENUM_LABEL_INPUT_DINGUX_RUMBLE_GAIN, - PARSE_ONLY_UINT, false) == 0) + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_RUMBLE_GAIN, + PARSE_ONLY_UINT, false) == 0) count++; -#endif } break; case DISPLAYLIST_INPUT_HOTKEY_BINDS_LIST: diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 893625038e..dfd68e12f1 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -8139,6 +8139,12 @@ static void general_write_handler(rarch_setting_t *setting) *setting->value.target.unsigned_integer); } break; + case MENU_ENUM_LABEL_INPUT_RUMBLE_GAIN: + { + input_set_rumble_gain( + *setting->value.target.unsigned_integer); + } + break; case MENU_ENUM_LABEL_WIFI_ENABLED: #ifdef HAVE_NETWORKING if (*setting->value.target.boolean) @@ -12918,13 +12924,12 @@ static bool setting_append_list( SD_FLAG_NONE ); -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) CONFIG_UINT( list, list_info, - &settings->uints.input_dingux_rumble_gain, - MENU_ENUM_LABEL_INPUT_DINGUX_RUMBLE_GAIN, - MENU_ENUM_LABEL_VALUE_INPUT_DINGUX_RUMBLE_GAIN, - DEFAULT_DINGUX_RUMBLE_GAIN, + &settings->uints.input_rumble_gain, + MENU_ENUM_LABEL_INPUT_RUMBLE_GAIN, + MENU_ENUM_LABEL_VALUE_INPUT_RUMBLE_GAIN, + DEFAULT_RUMBLE_GAIN, &group_info, &subgroup_info, parent_group, @@ -12932,8 +12937,9 @@ static bool setting_append_list( 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_special; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_percentage; menu_settings_list_current_add_range(list, list_info, 0, 100, 5, true, true); -#endif CONFIG_UINT( list, list_info, &settings->uints.input_poll_type_behavior, @@ -13337,17 +13343,13 @@ static bool setting_append_list( menu_settings_list_current_add_range(list, list_info, 1, 10, 1, true, true); SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ADVANCED); - if (string_is_equal(settings->arrays.input_driver, "android") || - string_is_equal(settings->arrays.input_joypad_driver, "sdl_dingux")) - { - CONFIG_ACTION( - list, list_info, - MENU_ENUM_LABEL_INPUT_HAPTIC_FEEDBACK_SETTINGS, - MENU_ENUM_LABEL_VALUE_INPUT_HAPTIC_FEEDBACK_SETTINGS, - &group_info, - &subgroup_info, - parent_group); - } + CONFIG_ACTION( + list, list_info, + MENU_ENUM_LABEL_INPUT_HAPTIC_FEEDBACK_SETTINGS, + MENU_ENUM_LABEL_VALUE_INPUT_HAPTIC_FEEDBACK_SETTINGS, + &group_info, + &subgroup_info, + parent_group); CONFIG_ACTION( list, list_info, diff --git a/msg_hash.h b/msg_hash.h index 8e3233c4a4..3f59f58015 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1009,6 +1009,7 @@ enum msg_hash_enums MENU_LABEL(INPUT_ALL_USERS_CONTROL_MENU), MENU_LABEL(INPUT_POLL_TYPE_BEHAVIOR), MENU_LABEL(INPUT_UNIFIED_MENU_CONTROLS), + MENU_LABEL(INPUT_RUMBLE_GAIN), MENU_LABEL(QUIT_PRESS_TWICE), MENU_LABEL(QUIT_ON_CLOSE_CONTENT), @@ -1017,10 +1018,6 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_QUIT_ON_CLOSE_CONTENT_ENABLED, MENU_ENUM_LABEL_VALUE_QUIT_ON_CLOSE_CONTENT_CLI, -#if defined(DINGUX) && defined(HAVE_LIBSHAKE) - MENU_LABEL(INPUT_DINGUX_RUMBLE_GAIN), -#endif - /* Video */ MENU_LABEL(BRIGHTNESS_CONTROL), MENU_LABEL(CRT_SWITCH_RESOLUTION), diff --git a/retroarch.c b/retroarch.c index c91fe7d793..ce9442c4c2 100644 --- a/retroarch.c +++ b/retroarch.c @@ -19196,10 +19196,35 @@ bool input_set_rumble_state(unsigned port, input_driver_state_t *input_driver_st = &(p_rarch->input_driver_state); settings_t *settings = p_rarch->configuration_settings; unsigned joy_idx = settings->uints.input_joypad_index[port]; + unsigned rumble_gain = settings->uints.input_rumble_gain; + uint16_t scaled_strength = strength; + + /* If gain setting is not suported, do software gain control */ + if (!input_driver_st->primary_joypad->set_rumble_gain) + scaled_strength = (rumble_gain * strength) / 100.0; return input_driver_set_rumble( input_driver_st, - port, joy_idx, effect, strength); + port, joy_idx, effect, scaled_strength); +} + +/** + * Sets the rumble gain. Used by MENU_ENUM_LABEL_INPUT_RUMBLE_GAIN. + * + * @param gain Rumble gain, 0-100 [%] + * + * @return true if the rumble gain has been successfully set + **/ +bool input_set_rumble_gain(unsigned gain) +{ + struct rarch_state *p_rarch = &rarch_st; + input_driver_state_t *input_driver_st = &(p_rarch->input_driver_state); + settings_t *settings = p_rarch->configuration_settings; + if (input_driver_set_rumble_gain( + input_driver_st, gain, settings->uints.input_max_users)) + return true; + else + return false; } /** diff --git a/retroarch.h b/retroarch.h index 44988e6c4d..19f0924781 100644 --- a/retroarch.h +++ b/retroarch.h @@ -2046,6 +2046,8 @@ void retroarch_init_task_queue(void); bool input_set_rumble_state(unsigned port, enum retro_rumble_effect effect, uint16_t strength); +bool input_set_rumble_gain(unsigned gain); + float input_get_sensor_state(unsigned port, unsigned id); bool input_set_sensor_state(unsigned port,