[retro-gtk] retro-gobject: Move retro-environment-variable.h into retro-environment.c
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] retro-gobject: Move retro-environment-variable.h into retro-environment.c
- Date: Sat, 27 Aug 2016 20:31:36 +0000 (UTC)
commit 6e0ad76c41f40c3d184604d0412fc5537e5e2d96
Author: Adrien Plazas <kekun plazas laposte net>
Date: Mon Aug 1 14:47:11 2016 +0200
retro-gobject: Move retro-environment-variable.h into retro-environment.c
This helps making the code cleaner.
https://bugzilla.gnome.org/show_bug.cgi?id=769880
retro-gobject/Makefile.am | 1 -
retro-gobject/retro-environment-variables.h | 46 ---------------------------
retro-gobject/retro-environment.c | 40 ++++++++++++++++++++++-
3 files changed, 39 insertions(+), 48 deletions(-)
---
diff --git a/retro-gobject/Makefile.am b/retro-gobject/Makefile.am
index 5818c66..63f8cf5 100644
--- a/retro-gobject/Makefile.am
+++ b/retro-gobject/Makefile.am
@@ -68,7 +68,6 @@ libretro_gobject_la_SOURCES = \
retro-environment-interfaces.c \
libretro-environment.h \
retro-environment-interfaces.h \
- retro-environment-variables.h \
$(NULL)
retro-core.c: retro-gobject-internal.h
diff --git a/retro-gobject/retro-environment.c b/retro-gobject/retro-environment.c
index 62cc54a..5c3bf45 100644
--- a/retro-gobject/retro-environment.c
+++ b/retro-gobject/retro-environment.c
@@ -3,7 +3,6 @@
#include "retro-gobject-internal.h"
#include "libretro-environment.h"
-#include "retro-environment-variables.h"
#include "retro-environment-interfaces.h"
typedef struct {
@@ -53,6 +52,19 @@ static gboolean get_system_directory (RetroCore *self, const gchar* *system_dire
return TRUE;
}
+static gboolean get_variable (RetroVariables *self, RetroVariable *variable) {
+ gchar *result = retro_variables_get_variable (self, variable->key);
+ variable->value = result ? result : "";
+
+ return !!result;
+}
+
+static gboolean get_variable_update (RetroVariables *self, gboolean *update) {
+ *update = retro_variables_get_variable_update (self);
+
+ return TRUE;
+}
+
static gboolean set_audio_callback (RetroCore *self, RetroAudioCallback *callback) {
retro_core_set_audio_callback (self, callback);
@@ -122,6 +134,14 @@ static gboolean set_system_av_info (RetroCore *self, RetroSystemAvInfo *system_a
return TRUE;
}
+static gboolean set_variables (RetroVariables *self, RetroVariable *variables) {
+ int length;
+ for (length = 0 ; variables[length].key && variables[length].value ; length++);
+ retro_variables_set_variable (self, variables, length);
+
+ return TRUE;
+}
+
static gboolean shutdown (RetroCore *self) {
gboolean result = FALSE;
g_signal_emit_by_name (self, "shutdown", &result);
@@ -224,6 +244,24 @@ static gboolean environment_input_command (RetroInput *self, unsigned cmd, gpoin
}
}
+static gboolean environment_variables_command (RetroVariables *self, unsigned cmd, gpointer data) {
+ if (!self) return FALSE;
+
+ switch (cmd) {
+ case RETRO_ENVIRONMENT_GET_VARIABLE:
+ return get_variable (self, (RetroVariable *) data);
+
+ case RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE:
+ return get_variable_update (self, (gboolean *) data);
+
+ case RETRO_ENVIRONMENT_SET_VARIABLES:
+ return set_variables (self, (RetroVariable *) data);
+
+ 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 ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]