From 70fb8fe72ff0ff6356e78be861355075bf8fb4fe Mon Sep 17 00:00:00 2001 From: pjft Date: Fri, 7 Apr 2017 12:19:05 +0100 Subject: [PATCH] Adding "Enable Vibration" Core Option to LibRetro --- frontend/libretro.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/frontend/libretro.c b/frontend/libretro.c index 4d56356a..c0784942 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -398,8 +398,11 @@ void pl_timing_prepare(int is_pal) void plat_trigger_vibrate(int pad, int low, int high) { - rumble.set_rumble_state(pad, RETRO_RUMBLE_STRONG, high << 8); - rumble.set_rumble_state(pad, RETRO_RUMBLE_WEAK, low ? 0xffff : 0x0); + if(in_enable_vibration) + { + rumble.set_rumble_state(pad, RETRO_RUMBLE_STRONG, high << 8); + rumble.set_rumble_state(pad, RETRO_RUMBLE_WEAK, low ? 0xffff : 0x0); + } } void pl_update_gun(int *xn, int *yn, int *xres, int *yres, int *in) @@ -452,6 +455,7 @@ void retro_set_environment(retro_environment_t cb) { "pcsx_rearmed_pad8type", "Pad 8 Type; default|none|standard|analog|negcon" }, { "pcsx_rearmed_multitap1", "Multitap 1; auto|disabled|enabled" }, { "pcsx_rearmed_multitap2", "Multitap 2; auto|disabled|enabled" }, + { "pcsx_rearmed_vibration", "Enable Vibration; enabled|disabled" }, #ifndef DRC_DISABLE { "pcsx_rearmed_drc", "Dynamic recompiler; enabled|disabled" }, #endif @@ -1361,6 +1365,17 @@ static void update_variables(bool in_flight) update_multitap(); + var.value = NULL; + var.key = "pcsx_rearmed_vibration"; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) + { + if (strcmp(var.value, "disabled") == 0) + in_enable_vibration = 0; + else if (strcmp(var.value, "enabled") == 0) + in_enable_vibration = 1; + } + #ifdef __ARM_NEON__ var.value = "NULL"; var.key = "pcsx_rearmed_neon_interlace_enable"; -- 2.39.5