[retro-gtk] retro-gobject: Merge interface commands into core commands



commit d12a981ad4cdfbffc1ec6ebe979128aeb0077290
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu Jan 19 18:30:55 2017 +0100

    retro-gobject: Merge interface commands into core commands
    
    This will help giving the core more power over how these commands are
    handled.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777489

 retro-gobject/retro-environment.c |   33 ++++++++++-----------------------
 1 files changed, 10 insertions(+), 23 deletions(-)
---
diff --git a/retro-gobject/retro-environment.c b/retro-gobject/retro-environment.c
index e7d6f50..52fd8b7 100644
--- a/retro-gobject/retro-environment.c
+++ b/retro-gobject/retro-environment.c
@@ -253,9 +253,15 @@ static gboolean environment_core_command (RetroCore *self, unsigned cmd, gpointe
        case RETRO_ENVIRONMENT_GET_LIBRETRO_PATH:
                return get_libretro_path (self, (const gchar* *) data);
 
+       case RETRO_ENVIRONMENT_GET_LOG_INTERFACE:
+               return get_log_callback (self, (RetroLogCallback *) data);
+
        case RETRO_ENVIRONMENT_GET_OVERSCAN:
                return get_overscan (self, (gboolean *) data);
 
+       case RETRO_ENVIRONMENT_GET_RUMBLE_INTERFACE:
+               return get_rumble_callback (self, (RetroRumbleCallback *) data);
+
        case RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY:
                return get_save_directory (self, (const gchar* *) data);
 
@@ -295,7 +301,11 @@ static gboolean environment_core_command (RetroCore *self, unsigned cmd, gpointe
        case RETRO_ENVIRONMENT_SHUTDOWN:
                return shutdown (self);
 
+       case RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE:
        case RETRO_ENVIRONMENT_GET_LANGUAGE:
+       case RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE:
+       case RETRO_ENVIRONMENT_GET_PERF_INTERFACE:
+       case RETRO_ENVIRONMENT_GET_SENSOR_INTERFACE:
        case RETRO_ENVIRONMENT_GET_USERNAME:
        case RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK:
        case RETRO_ENVIRONMENT_SET_CONTROLLER_INFO:
@@ -312,35 +322,12 @@ static gboolean environment_core_command (RetroCore *self, unsigned cmd, gpointe
        }
 }
 
-static gboolean environment_interfaces_command (RetroCore *self, unsigned cmd, gpointer data) {
-       if (!self)
-               return FALSE;
-
-       switch (cmd) {
-       case RETRO_ENVIRONMENT_GET_LOG_INTERFACE:
-               return get_log_callback (self, (RetroLogCallback *) data);
-
-       case RETRO_ENVIRONMENT_GET_RUMBLE_INTERFACE:
-               return get_rumble_callback (self, (RetroRumbleCallback *) data);
-
-       case RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE:
-       case RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE:
-       case RETRO_ENVIRONMENT_GET_PERF_INTERFACE:
-       case RETRO_ENVIRONMENT_GET_SENSOR_INTERFACE:
-       default:
-               return FALSE;
-       }
-}
-
 gpointer retro_core_get_module_environment_interface (RetroCore *self) {
        gboolean real_cb (unsigned cmd, gpointer data) {
                RetroCore *cb_data = retro_core_get_cb_data ();
 
                if (!cb_data) g_assert_not_reached ();
 
-               if (environment_interfaces_command (cb_data, cmd, data))
-                       return TRUE;
-
                return environment_core_command (cb_data, cmd, data);
        }
 


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