From 008db16fb5ca9bfbabc45fd1e12e3d53f8860e36 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Mon, 4 May 2020 02:04:28 +0200 Subject: [PATCH] [GTK3] Disable rumble for the WUP-028 for now --- gtk3/main.c | 12 +++++++++++- gtk3/resources/ui/window.ui | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gtk3/main.c b/gtk3/main.c index 782bc61..5ca2cde 100644 --- a/gtk3/main.c +++ b/gtk3/main.c @@ -124,6 +124,7 @@ typedef struct GuiData { struct Controller_t { SDL_GameController *controller; SDL_Haptic *haptic; + bool ignore_rumble; } *controllers; unsigned controller_count; struct Controller_t *last_used_controller; // Used for rumble @@ -508,6 +509,13 @@ static gboolean init_controllers(void) { } } + // Blacklist the WUP-028 for now + if (SDL_JoystickGetVendor(joystick) == 0x057e + && SDL_JoystickGetProduct(joystick) == 0x0337 + && SDL_JoystickGetProductVersion(joystick) == 0x0100) { + s->ignore_rumble = true; + } + char guid_str[33]; SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str)); @@ -592,10 +600,12 @@ static void gb_audio_callback(GB_gameboy_t *gb, GB_sample_t *sample) { } static void rumble_callback(GB_gameboy_t *gb, double amp) { - if (!gui_data.controllers || gui_data.controller_count == 0 || !gui_data.last_used_controller) return; + if (!gui_data.controllers || gui_data.controller_count == 0 || !gui_data.last_used_controller) return; struct Controller_t *s = gui_data.last_used_controller; + if (s->ignore_rumble) return; + if (s->haptic) { if (amp > 0.0) { SDL_HapticRumblePlay(s->haptic, amp, 100.0); diff --git a/gtk3/resources/ui/window.ui b/gtk3/resources/ui/window.ui index c38ef00..a8039ff 100644 --- a/gtk3/resources/ui/window.ui +++ b/gtk3/resources/ui/window.ui @@ -972,6 +972,7 @@ Maximilian Mader https://github.com/max-m True + False False 5 5 @@ -1013,6 +1014,7 @@ Maximilian Mader https://github.com/max-m True + False False 90 90 @@ -1127,6 +1129,7 @@ Maximilian Mader https://github.com/max-m Configure Joypad True + False True True