[gnome-games] retro: Make RetroInputManager implement Retro.Rumble



commit dfde3c05da94737c48ed5f1f8a35bb730f48e10a
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Sun Aug 21 06:53:06 2016 +0200

    retro: Make RetroInputManager implement Retro.Rumble
    
    This is needed to avoid some invalid Libretro cores to crash the
    application when triggering rumble with a callback.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769318

 src/retro/retro-input-manager.vala |   14 +++++++++++++-
 src/retro/retro-runner.vala        |    1 +
 2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/retro/retro-input-manager.vala b/src/retro/retro-input-manager.vala
index e00540c..0829519 100644
--- a/src/retro/retro-input-manager.vala
+++ b/src/retro/retro-input-manager.vala
@@ -1,6 +1,6 @@
 // This file is part of GNOME Games. License: GPLv3
 
-private class Games.RetroInputManager : RetroGtk.InputDeviceManager {
+private class Games.RetroInputManager : RetroGtk.InputDeviceManager, Retro.Rumble {
        private RetroGtk.VirtualGamepad keyboard;
        private GamepadMonitor gamepad_monitor;
        private bool[] is_port_plugged;
@@ -71,4 +71,16 @@ private class Games.RetroInputManager : RetroGtk.InputDeviceManager {
                        remove_controller_device (port);
                }
        }
+
+       private bool set_rumble_state (uint port, Retro.RumbleEffect effect, uint16 strength) {
+               if (port > gamepads.length)
+                       return false;
+
+               if (gamepads[port] == null)
+                       return false;
+
+               // TODO Transmit the rumble signal to the gamepad.
+
+               return false;
+       }
 }
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index bf4764e..1a66499 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -229,6 +229,7 @@ public class Games.RetroRunner : Object, Runner {
                core.video_interface = video;
                core.audio_interface = audio;
                core.input_interface = input_manager;
+               core.rumble_interface = input_manager;
 
                core.init ();
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]