[retro-gtk/c-port: 35/39] Port Core to C



commit e59a924c92aa6f728542c3a654cfe67f39bd411b
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Sep 25 13:52:36 2017 +0200

    Port Core to C

 retro-gtk/Makefile.am                 |    2 +-
 retro-gtk/core.vala                   |  200 ---------
 retro-gtk/retro-controller-iterator.h |    1 +
 retro-gtk/retro-core-private.h        |   27 +-
 retro-gtk/retro-core.c                |  772 +++++++++++++++++++++++++++------
 retro-gtk/retro-core.h                |   87 ++++
 retro-gtk/retro-environment.c         |    4 +-
 retro-gtk/retro-gtk.h                 |    1 +
 retro-gtk/retro-log.c                 |    2 +-
 retro-gtk/retro-main-loop.h           |    2 +-
 retro-gtk/retro-module.h              |    3 +-
 retro-gtk/retro-rumble-effect.h       |    2 +-
 12 files changed, 763 insertions(+), 340 deletions(-)
---
diff --git a/retro-gtk/Makefile.am b/retro-gtk/Makefile.am
index 685d81f..d5799fb 100644
--- a/retro-gtk/Makefile.am
+++ b/retro-gtk/Makefile.am
@@ -30,7 +30,6 @@ BUILT_SOURCES = retro-gtk-internal.h
 libretro_gtk_la_SOURCES = \
        input/retro-keyboard-key.c \
        \
-       core.vala \
        retro.vala \
        retro-cairo-display.c \
        retro-core-descriptor.c \
@@ -110,6 +109,7 @@ retro_gtkinclude_HEADERS = \
        retro-analog-index.h \
        retro-cairo-display.h \
        retro-controller-iterator.h \
+       retro-core.h \
        retro-core-view.h \
        retro-device-type.h \
        retro-gtk.h \
diff --git a/retro-gtk/retro-controller-iterator.h b/retro-gtk/retro-controller-iterator.h
index 54b8fe9..ae95f8f 100644
--- a/retro-gtk/retro-controller-iterator.h
+++ b/retro-gtk/retro-controller-iterator.h
@@ -4,6 +4,7 @@
 #define RETRO_CONTROLLER_ITERATOR_H
 
 #include <glib-object.h>
+#include "retro-input-device.h"
 
 G_BEGIN_DECLS
 
diff --git a/retro-gtk/retro-core-private.h b/retro-gtk/retro-core-private.h
index 7b0d2cf..160c53d 100644
--- a/retro-gtk/retro-core-private.h
+++ b/retro-gtk/retro-core-private.h
@@ -3,6 +3,7 @@
 #ifndef RETRO_CORE_PRIVATE_H
 #define RETRO_CORE_PRIVATE_H
 
+#include "retro-core.h"
 #include "retro-disk-control-callback.h"
 #include "retro-gtk-internal.h"
 #include "retro-module.h"
@@ -16,11 +17,23 @@ typedef struct {
   void (*callback) (guchar down, guint keycode, guint32 character, guint16 key_modifiers);
 } RetroKeyboardCallback;
 
-#define RETRO_CORE_ENVIRONMENT_INTERNAL(core) ((RetroCoreEnvironmentInternal *) 
((core)->environment_internal))
+#define RETRO_CORE_ENVIRONMENT_INTERNAL(core) ((RetroCoreEnvironmentInternal *) (core))
 
-typedef struct _RetroCoreEnvironmentInternal RetroCoreEnvironmentInternal;
+typedef struct _RetroCore RetroCoreEnvironmentInternal;
+
+struct _RetroCore
+{
+  GObject parent_instance;
+  gchar *file_name;
+  gchar *system_directory;
+  gchar *libretro_path;
+  gchar *content_directory;
+  gchar *save_directory;
+  gboolean is_initiated;
+  gboolean game_loaded;
+  gboolean support_no_game;
+  gdouble frames_per_second;
 
-struct _RetroCoreEnvironmentInternal {
   RetroModule *module;
   RetroDiskControlCallback *disk_control_callback;
   gchar **media_uris;
@@ -33,9 +46,17 @@ struct _RetroCoreEnvironmentInternal {
 
   RetroKeyboardCallback keyboard_callback;
   GHashTable *controllers;
+  GtkWidget *keyboard_widget;
+  gulong key_press_event_id;
+  gulong key_release_event_id;
   RetroOptions *options;
 };
 
+void retro_core_push_cb_data (RetroCore *self);
+void retro_core_pop_cb_data (void);
+RetroCore *retro_core_get_cb_data (void);
+void retro_core_set_support_no_game (RetroCore *self,
+                                     gboolean   value);
 gchar *retro_core_get_name (RetroCore *self);
 void retro_core_set_system_av_info (RetroCore         *self,
                                     RetroSystemAvInfo *system_av_info);
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index 5da3a4d..87ca223 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -2,7 +2,7 @@
 
 #include "retro-core-private.h"
 
-#include "retro-gtk-internal.h"
+#include <string.h>
 #include "input/retro-keyboard-key.h"
 
 struct _RetroControllerIterator
@@ -22,38 +22,36 @@ enum {
   RETRO_CORE_ERROR_NO_CALLBACK,
 };
 
-/* Private */
-
-static void
-retro_controller_iterator_finalize (GObject *object)
-{
-  G_OBJECT_CLASS (retro_controller_iterator_parent_class)->finalize (object);
-}
-
-static void
-retro_controller_iterator_class_init (RetroControllerIteratorClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+G_DEFINE_TYPE (RetroCore, retro_core, G_TYPE_OBJECT)
 
-  object_class->finalize = retro_controller_iterator_finalize;
-}
+enum {
+  SIG_VIDEO_OUTPUT_SIGNAL,
+  SIG_AUDIO_OUTPUT_SIGNAL,
+  SIG_LOG_SIGNAL,
+  SIG_SHUTDOWN_SIGNAL,
+  SIG_MESSAGE_SIGNAL,
+  N_SIGNALS,
+};
 
-static void
-retro_controller_iterator_init (RetroControllerIterator *self)
-{
-}
+static guint signals[N_SIGNALS];
 
-static RetroControllerIterator *
-retro_controller_iterator_new (GHashTable *controllers)
-{
-  RetroControllerIterator *self;
-  g_return_val_if_fail (controllers != NULL, NULL);
-
-  self = g_object_new (RETRO_TYPE_CORE, NULL);
-  g_hash_table_iter_init (&self->iterator, controllers);
+enum {
+  PROP_0,
+  PROP_API_VERSION,
+  PROP_FILE_NAME,
+  PROP_SYSTEM_DIRECTORY,
+  PROP_LIBRETRO_PATH,
+  PROP_CONTENT_DIRECTORY,
+  PROP_SAVE_DIRECTORY,
+  PROP_IS_INITIATED,
+  PROP_GAME_LOADED,
+  PROP_SUPPORT_NO_GAME,
+  PROP_FRAMES_PER_SECOND,
+  PROP_RUMBLE_INTERFACE,
+  N_PROPS
+};
 
-  return self;
-}
+static GParamSpec *properties [N_PROPS];
 
 #define RETRO_CORE_OBJECTS_LENGTH 32
 
@@ -62,17 +60,25 @@ static GRecMutex retro_core_w_mutex = { 0 };
 static RetroCore *retro_core_objects[32];
 static gint retro_core_i = 0;
 
+static void retro_core_set_file_name (RetroCore   *self,
+                                      const gchar *value);
+static void retro_core_set_is_initiated (RetroCore *self,
+                                         gboolean   value);
+static void retro_core_set_game_loaded (RetroCore *self,
+                                        gboolean   value);
+
+/* Private */
+
 static GQuark
 retro_core_error_quark (void)
 {
   return g_quark_from_static_string ("retro-core-error-quark");
 }
 
-// FIXME Make static as soon as possible.
 void
 retro_core_push_cb_data (RetroCore *self)
 {
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
 
   g_rec_mutex_lock (&retro_core_w_mutex);
   g_rec_mutex_lock (&retro_core_r_mutex);
@@ -90,7 +96,6 @@ retro_core_push_cb_data (RetroCore *self)
   g_rec_mutex_unlock (&retro_core_r_mutex);
 }
 
-// FIXME Make static as soon as possible.
 void
 retro_core_pop_cb_data (void)
 {
@@ -111,7 +116,6 @@ retro_core_pop_cb_data (void)
   g_rec_mutex_unlock (&retro_core_w_mutex);
 }
 
-// FIXME Make static as soon as possible.
 RetroCore *
 retro_core_get_cb_data (void)
 {
@@ -132,6 +136,399 @@ retro_core_get_cb_data (void)
   return result;
 }
 
+static void
+retro_core_finalize (GObject *object)
+{
+  RetroCore *self = RETRO_CORE (object);
+  RetroCoreEnvironmentInternal *internal;
+  RetroUnloadGame unload_game;
+  RetroDeinit deinit;
+
+  g_return_if_fail (RETRO_IS_CORE (self));
+
+  internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
+
+  retro_core_push_cb_data (self);
+  if (retro_core_get_game_loaded (self)) {
+    unload_game = retro_module_get_unload_game (internal->module);
+    unload_game ();
+  }
+  deinit = retro_module_get_deinit (internal->module);
+  deinit ();
+  retro_core_pop_cb_data ();
+
+  if (internal->media_uris != NULL)
+    g_strfreev (internal->media_uris);
+
+  g_object_unref (internal->module);
+  g_hash_table_unref (internal->controllers);
+  g_object_unref (internal->options);
+
+  g_free (self->file_name);
+  g_free (self->system_directory);
+  g_free (self->libretro_path);
+  g_free (self->content_directory);
+  g_free (self->save_directory);
+  g_object_unref (self->keyboard_widget);
+
+  G_OBJECT_CLASS (retro_core_parent_class)->finalize (object);
+}
+
+static void
+retro_core_get_property (GObject    *object,
+                         guint       prop_id,
+                         GValue     *value,
+                         GParamSpec *pspec)
+{
+  RetroCore *self = RETRO_CORE (object);
+
+  switch (prop_id) {
+  case PROP_API_VERSION:
+    g_value_set_uint (value, retro_core_get_api_version (self));
+
+    break;
+  case PROP_FILE_NAME:
+    g_value_set_string (value, retro_core_get_file_name (self));
+
+    break;
+  case PROP_SYSTEM_DIRECTORY:
+    g_value_set_string (value, retro_core_get_system_directory (self));
+
+    break;
+  case PROP_LIBRETRO_PATH:
+    g_value_set_string (value, retro_core_get_libretro_path (self));
+
+    break;
+  case PROP_CONTENT_DIRECTORY:
+    g_value_set_string (value, retro_core_get_content_directory (self));
+
+    break;
+  case PROP_SAVE_DIRECTORY:
+    g_value_set_string (value, retro_core_get_save_directory (self));
+
+    break;
+  case PROP_IS_INITIATED:
+    g_value_set_boolean (value, retro_core_get_is_initiated (self));
+
+    break;
+  case PROP_GAME_LOADED:
+    g_value_set_boolean (value, retro_core_get_game_loaded (self));
+
+    break;
+  case PROP_SUPPORT_NO_GAME:
+    g_value_set_boolean (value, retro_core_get_support_no_game (self));
+
+    break;
+  case PROP_FRAMES_PER_SECOND:
+    g_value_set_double (value, retro_core_get_frames_per_second (self));
+
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+
+    break;
+  }
+}
+
+static void
+retro_core_set_property (GObject      *object,
+                         guint         prop_id,
+                         const GValue *value,
+                         GParamSpec   *pspec)
+{
+  RetroCore *self = RETRO_CORE (object);
+
+  // TODO
+  switch (prop_id) {
+  case PROP_FILE_NAME:
+    retro_core_set_file_name (self, g_value_get_string (value));
+
+    break;
+  case PROP_SYSTEM_DIRECTORY:
+    retro_core_set_system_directory (self, g_value_get_string (value));
+
+    break;
+  case PROP_LIBRETRO_PATH:
+    retro_core_set_libretro_path (self, g_value_get_string (value));
+
+    break;
+  case PROP_CONTENT_DIRECTORY:
+    retro_core_set_content_directory (self, g_value_get_string (value));
+
+    break;
+  case PROP_SAVE_DIRECTORY:
+    retro_core_set_save_directory (self, g_value_get_string (value));
+
+    break;
+  case PROP_IS_INITIATED:
+    retro_core_set_is_initiated (self, g_value_get_boolean (value));
+
+    break;
+  case PROP_GAME_LOADED:
+    retro_core_set_game_loaded (self, g_value_get_boolean (value));
+
+    break;
+  case PROP_SUPPORT_NO_GAME:
+    retro_core_set_support_no_game (self, g_value_get_boolean (value));
+
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+
+    break;
+  }
+}
+
+static void
+retro_core_class_init (RetroCoreClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = retro_core_finalize;
+  object_class->get_property = retro_core_get_property;
+  object_class->set_property = retro_core_set_property;
+
+  properties[PROP_API_VERSION] =
+    g_param_spec_uint ("api-version",
+                       "API version",
+                       "The API version",
+                       0,
+                       G_MAXUINT,
+                       0U,
+                       G_PARAM_READABLE |
+                       G_PARAM_STATIC_NAME |
+                       G_PARAM_STATIC_NICK |
+                       G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_API_VERSION, properties[PROP_API_VERSION]);
+
+  properties[PROP_FILE_NAME] =
+    g_param_spec_string ("file-name",
+                         "File name",
+                         "The module file name",
+                         NULL,
+                         G_PARAM_READWRITE |
+                         G_PARAM_STATIC_NAME |
+                         G_PARAM_STATIC_NICK |
+                         G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_FILE_NAME, properties[PROP_FILE_NAME]);
+
+  properties[PROP_SYSTEM_DIRECTORY] =
+    g_param_spec_string ("system-directory",
+                         "System directory",
+                         "The system directory",
+                         NULL,
+                         G_PARAM_READWRITE |
+                         G_PARAM_STATIC_NAME |
+                         G_PARAM_STATIC_NICK |
+                         G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SYSTEM_DIRECTORY, 
properties[PROP_SYSTEM_DIRECTORY]);
+
+  properties[PROP_LIBRETRO_PATH] =
+    g_param_spec_string ("libretro-path",
+                         "Libretro path",
+                         "The Libretro path",
+                         NULL,
+                         G_PARAM_READWRITE |
+                         G_PARAM_STATIC_NAME |
+                         G_PARAM_STATIC_NICK |
+                         G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_LIBRETRO_PATH, 
properties[PROP_LIBRETRO_PATH]);
+
+  properties[PROP_CONTENT_DIRECTORY] =
+    g_param_spec_string ("content-directory",
+                         "Content directory",
+                         "The content directory",
+                         NULL,
+                         G_PARAM_READWRITE |
+                         G_PARAM_STATIC_NAME |
+                         G_PARAM_STATIC_NICK |
+                         G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_CONTENT_DIRECTORY, 
properties[PROP_CONTENT_DIRECTORY]);
+
+  properties[PROP_SAVE_DIRECTORY] =
+    g_param_spec_string ("save-directory",
+                         "Save directory",
+                         "The save directory",
+                         NULL,
+                         G_PARAM_READWRITE |
+                         G_PARAM_STATIC_NAME |
+                         G_PARAM_STATIC_NICK |
+                         G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SAVE_DIRECTORY, 
properties[PROP_SAVE_DIRECTORY]);
+
+  properties[PROP_IS_INITIATED] =
+    g_param_spec_boolean ("is-initiated",
+                          "Is initiated",
+                          "Whether the core has been booted",
+                          FALSE,
+                          G_PARAM_READWRITE |
+                          G_PARAM_STATIC_NAME |
+                          G_PARAM_STATIC_NICK |
+                          G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_IS_INITIATED, properties[PROP_IS_INITIATED]);
+
+  properties[PROP_GAME_LOADED] =
+    g_param_spec_boolean ("game-loaded",
+                          "Game loaded",
+                          "Whether the game has been loaded",
+                          FALSE,
+                          G_PARAM_READWRITE |
+                          G_PARAM_STATIC_NAME |
+                          G_PARAM_STATIC_NICK |
+                          G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_GAME_LOADED, properties[PROP_GAME_LOADED]);
+
+  properties[PROP_SUPPORT_NO_GAME] =
+    g_param_spec_boolean ("support-no-game",
+                          "Support no game",
+                          "Whether the core supports no game",
+                          FALSE,
+                          G_PARAM_READWRITE |
+                          G_PARAM_STATIC_NAME |
+                          G_PARAM_STATIC_NICK |
+                          G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SUPPORT_NO_GAME, 
properties[PROP_SUPPORT_NO_GAME]);
+
+  properties[PROP_FRAMES_PER_SECOND] =
+    g_param_spec_double ("frames-per-second",
+                         "Frames per second",
+                         "The FPS rate for the core's video output",
+                         -G_MAXDOUBLE,
+                         G_MAXDOUBLE,
+                         0.0,
+                         G_PARAM_READABLE |
+                         G_PARAM_STATIC_NAME |
+                         G_PARAM_STATIC_NICK |
+                         G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_FRAMES_PER_SECOND, 
properties[PROP_FRAMES_PER_SECOND]);
+
+  signals[SIG_VIDEO_OUTPUT_SIGNAL] =
+    g_signal_new ("video-output", RETRO_TYPE_CORE, G_SIGNAL_RUN_LAST,
+                  0, NULL, NULL,
+                  NULL,
+                  G_TYPE_NONE,
+                  7,
+                  G_TYPE_POINTER,
+                  G_TYPE_INT,
+                  G_TYPE_UINT,
+                  G_TYPE_UINT,
+                  G_TYPE_ULONG,
+                  RETRO_TYPE_PIXEL_FORMAT,
+                  G_TYPE_FLOAT);
+
+  signals[SIG_AUDIO_OUTPUT_SIGNAL] =
+    g_signal_new ("audio-output", RETRO_TYPE_CORE, G_SIGNAL_RUN_LAST,
+                  0, NULL, NULL,
+                  NULL,
+                  G_TYPE_NONE,
+                  3,
+                  G_TYPE_POINTER,
+                  G_TYPE_INT,
+                  G_TYPE_DOUBLE);
+
+  signals[SIG_LOG_SIGNAL] =
+    g_signal_new ("log", RETRO_TYPE_CORE, G_SIGNAL_RUN_LAST,
+                  0, NULL, NULL,
+                  NULL,
+                  G_TYPE_NONE,
+                  3,
+                  G_TYPE_STRING,
+                  G_TYPE_UINT,
+                  G_TYPE_STRING);
+
+  signals[SIG_SHUTDOWN_SIGNAL] =
+    g_signal_new ("shutdown", RETRO_TYPE_CORE, G_SIGNAL_RUN_LAST,
+                  0, NULL, NULL,
+                  NULL,
+                  G_TYPE_BOOLEAN,
+                  0);
+
+  signals[SIG_MESSAGE_SIGNAL] =
+    g_signal_new ("message", RETRO_TYPE_CORE, G_SIGNAL_RUN_LAST,
+                  0, NULL, NULL,
+                  NULL,
+                  G_TYPE_BOOLEAN,
+                  2,
+                  G_TYPE_STRING,
+                  G_TYPE_UINT);
+}
+
+static void
+retro_core_init (RetroCore *self)
+{
+}
+
+static void
+retro_controller_iterator_finalize (GObject *object)
+{
+  G_OBJECT_CLASS (retro_controller_iterator_parent_class)->finalize (object);
+}
+
+static void
+retro_controller_iterator_class_init (RetroControllerIteratorClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = retro_controller_iterator_finalize;
+}
+
+static void
+retro_controller_iterator_init (RetroControllerIterator *self)
+{
+}
+
+static RetroControllerIterator *
+retro_controller_iterator_new (GHashTable *controllers)
+{
+  RetroControllerIterator *self;
+  g_return_val_if_fail (controllers != NULL, NULL);
+
+  self = g_object_new (RETRO_TYPE_CORE, NULL);
+  g_hash_table_iter_init (&self->iterator, controllers);
+
+  return self;
+}
+
+static void
+retro_core_set_file_name (RetroCore   *self,
+                          const gchar *value)
+{
+  g_return_if_fail (RETRO_IS_CORE (self));
+
+  if (g_strcmp0 (value, retro_core_get_file_name (self)) == 0)
+    return;
+
+  g_free (self->file_name);
+  self->file_name = g_strdup (value);;
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FILE_NAME]);
+}
+
+static void
+retro_core_set_is_initiated (RetroCore *self,
+                             gboolean   value)
+{
+  g_return_if_fail (RETRO_IS_CORE (self));
+
+  if (retro_core_get_is_initiated (self) == value)
+    return;
+
+  self->is_initiated = value;
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_IS_INITIATED]);
+}
+
+static void
+retro_core_set_game_loaded (RetroCore *self,
+                            gboolean   value)
+{
+  g_return_if_fail (RETRO_IS_CORE (self));
+
+  if (retro_core_get_game_loaded (self) == value)
+    return;
+
+  self->game_loaded = value;
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_GAME_LOADED]);
+}
+
 /**
  * retro_core_get_system_info:
  * @self: A #RetroCore
@@ -146,7 +543,7 @@ retro_core_get_system_info (RetroCore       *self,
   RetroCoreEnvironmentInternal *internal;
   RetroGetSystemInfo get_system_info;
 
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
   g_return_if_fail (system_info != NULL);
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
@@ -192,7 +589,7 @@ retro_core_controller_connected (RetroCore        *self,
 {
   RetroDeviceType device_type;
 
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
   g_return_if_fail (device != NULL);
 
   if (!retro_core_get_is_initiated (self))
@@ -207,7 +604,7 @@ void
 retro_core_controller_disconnected (RetroCore *self,
                                     guint      port)
 {
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
 
   if (!retro_core_get_is_initiated (self))
     return;
@@ -224,7 +621,7 @@ retro_core_send_input_key_event (RetroCore                *self,
 {
   RetroCoreEnvironmentInternal *environment_internal;
 
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
 
   environment_internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
@@ -244,7 +641,7 @@ retro_core_key_event (RetroCore   *self,
   RetroKeyboardModifierKey retro_modifier_key;
   guint32 character;
 
-  g_return_val_if_fail (self != NULL, FALSE);
+  g_return_val_if_fail (RETRO_IS_CORE (self), FALSE);
   g_return_val_if_fail (event != NULL, FALSE);
 
   if (!retro_core_get_is_initiated (self))
@@ -275,7 +672,7 @@ retro_core_set_disk_ejected (RetroCore  *self,
   RetroDiskControlCallbackSetEjectState set_eject_state;
   gboolean result;
 
-  g_return_val_if_fail (self != NULL, FALSE);
+  g_return_val_if_fail (RETRO_IS_CORE (self), FALSE);
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
@@ -306,7 +703,7 @@ retro_core_set_disk_image_index (RetroCore  *self,
   RetroDiskControlCallbackSetImageIndex set_image_index;
   gboolean result;
 
-  g_return_val_if_fail (self != NULL, FALSE);
+  g_return_val_if_fail (RETRO_IS_CORE (self), FALSE);
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
@@ -336,7 +733,7 @@ retro_core_get_disk_images_number (RetroCore  *self,
   RetroDiskControlCallbackGetNumImages get_num_images;
   guint result;
 
-  g_return_val_if_fail (self != NULL, FALSE);
+  g_return_val_if_fail (RETRO_IS_CORE (self), FALSE);
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
@@ -368,7 +765,7 @@ retro_core_replace_disk_image_index (RetroCore     *self,
   RetroDiskControlCallbackReplaceImageIndex replace_image_index;
   gboolean result;
 
-  g_return_val_if_fail (self != NULL, FALSE);
+  g_return_val_if_fail (RETRO_IS_CORE (self), FALSE);
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
@@ -398,7 +795,7 @@ retro_core_add_disk_image_index (RetroCore  *self,
   RetroDiskControlCallbackAddImageIndex add_image_index;
   gboolean result;
 
-  g_return_val_if_fail (self != NULL, FALSE);
+  g_return_val_if_fail (RETRO_IS_CORE (self), FALSE);
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
@@ -433,7 +830,7 @@ retro_core_load_discs (RetroCore  *self,
   RetroGameInfo *game_info = NULL;
   GError *tmp_error = NULL;
 
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
@@ -518,7 +915,7 @@ retro_core_load_game (RetroCore     *self,
   gboolean game_loaded;
   RetroSystemAvInfo info = {{ 0 }};
 
-  g_return_val_if_fail (self != NULL, FALSE);
+  g_return_val_if_fail (RETRO_IS_CORE (self), FALSE);
   g_return_val_if_fail (game != NULL, FALSE);
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
@@ -543,14 +940,14 @@ retro_core_load_game (RetroCore     *self,
 }
 
 static gboolean
-retro_core_prepare (RetroCore* self) {
+retro_core_prepare (RetroCore *self) {
   RetroCoreEnvironmentInternal *internal;
   RetroLoadGame load_game;
   RetroGetSystemAvInfo get_system_av_info;
   gboolean game_loaded;
   RetroSystemAvInfo info = {{ 0 }};
 
-  g_return_val_if_fail (self != NULL, FALSE);
+  g_return_val_if_fail (RETRO_IS_CORE (self), FALSE);
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
@@ -567,7 +964,7 @@ retro_core_prepare (RetroCore* self) {
 }
 
 static void
-retro_core_load_medias (RetroCore* self,
+retro_core_load_medias (RetroCore *self,
                         GError** error)
 {
   RetroCoreEnvironmentInternal *internal;
@@ -579,7 +976,7 @@ retro_core_load_medias (RetroCore* self,
   RetroGameInfo *game_info = NULL;
   GError *tmp_error = NULL;
 
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
   length = g_strv_length (internal->media_uris);
@@ -635,15 +1032,37 @@ retro_core_load_medias (RetroCore* self,
   g_free (uri);
 }
 
+void retro_core_set_environment_interface (RetroCore *self);
+void retro_core_set_callbacks (RetroCore *self);
+
 // FIXME Make static as soon as possible.
-guint
-retro_core_get_api_version_real (RetroCore *self)
+void
+retro_core_constructor (RetroCore   *self,
+                        const gchar *file_name)
+{
+
+}
+
+static gboolean
+on_key_event (GtkWidget   *widget,
+              GdkEventKey *event,
+              gpointer     self)
 {
+  g_return_val_if_fail (RETRO_IS_CORE (self), FALSE);
+  g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+  g_return_val_if_fail (event != NULL, FALSE);
+
+  return retro_core_key_event (RETRO_CORE (self), event);
+}
+
+/* Public */
+
+guint retro_core_get_api_version (RetroCore *self) {
   RetroCoreEnvironmentInternal *internal;
   guint result;
   RetroApiVersion api_version;
 
-  g_return_val_if_fail (self != NULL, 0U);
+  g_return_val_if_fail (RETRO_IS_CORE (self), 0U);
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
@@ -655,90 +1074,143 @@ retro_core_get_api_version_real (RetroCore *self)
   return result;
 }
 
-void retro_core_set_environment_interface (RetroCore *self);
-void retro_core_set_callbacks (RetroCore *self);
+const gchar *
+retro_core_get_file_name (RetroCore *self)
+{
+  g_return_val_if_fail (RETRO_IS_CORE (self), NULL);
 
-// FIXME Make static as soon as possible.
-void
-retro_core_constructor (RetroCore   *self,
-                        const gchar *file_name)
+  return self->file_name;
+}
+
+const gchar *
+retro_core_get_system_directory (RetroCore *self)
 {
-  RetroCoreEnvironmentInternal *internal;
-  GFile *file;
-  GFile *relative_path_file;
-  gchar *libretro_path;
+  g_return_val_if_fail (RETRO_IS_CORE (self), NULL);
 
-  g_return_if_fail (file_name != NULL);
+  return self->system_directory;
+}
 
-  retro_core_set_file_name (self, file_name);
+void retro_core_set_system_directory (RetroCore *self, const gchar* value) {
+  g_return_if_fail (RETRO_IS_CORE (self));
 
-  internal = g_new0 (RetroCoreEnvironmentInternal, 1);
-  self->environment_internal = internal;
+  if (g_strcmp0 (value, retro_core_get_system_directory (self)) == 0)
+    return;
 
-  file = g_file_new_for_path (file_name);
-  relative_path_file = g_file_resolve_relative_path (file, "");
+  g_free (self->system_directory);
+  self->system_directory = g_strdup (value);
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SYSTEM_DIRECTORY]);
+}
 
-  g_object_unref (file);
+const gchar *
+retro_core_get_libretro_path (RetroCore *self)
+{
+  g_return_val_if_fail (RETRO_IS_CORE (self), NULL);
 
-  libretro_path = g_file_get_path (relative_path_file);
+  return self->libretro_path;
+}
 
-  g_object_unref (relative_path_file);
+void
+retro_core_set_libretro_path (RetroCore   *self,
+                              const gchar *value)
+{
+  g_return_if_fail (RETRO_IS_CORE (self));
 
-  retro_core_set_libretro_path (self, libretro_path);
-  internal->module = retro_module_new (libretro_path);
+  if (g_strcmp0 (value, retro_core_get_libretro_path (self)) == 0)
+    return;
 
-  g_free (libretro_path);
+  g_free (self->libretro_path);
+  self->libretro_path = g_strdup (value);
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LIBRETRO_PATH]);
+}
 
-  retro_core_set_callbacks (self);
-  internal->controllers = g_hash_table_new_full (g_int_hash, g_int_equal,
-                                                        g_free, g_object_unref);
-  internal->options = retro_options_new ();
+const gchar *
+retro_core_get_content_directory (RetroCore *self)
+{
+  g_return_val_if_fail (RETRO_IS_CORE (self), NULL);
+
+  return self->content_directory;
 }
 
-// FIXME Make static as soon as possible.
 void
-retro_core_destructor (RetroCore *self)
+retro_core_set_content_directory (RetroCore   *self,
+                                  const gchar *value)
 {
-  RetroCoreEnvironmentInternal *internal;
-  RetroUnloadGame unload_game;
-  RetroDeinit deinit;
+  g_return_if_fail (RETRO_IS_CORE (self));
 
-  g_return_if_fail (self != NULL);
+  if (g_strcmp0 (value, retro_core_get_content_directory (self)) == 0)
+    return;
 
-  internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
+  g_free (self->content_directory);
+  self->content_directory = g_strdup (value);
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CONTENT_DIRECTORY]);
+}
 
-  retro_core_push_cb_data (self);
-  if (retro_core_get_game_loaded (self)) {
-    unload_game = retro_module_get_unload_game (internal->module);
-    unload_game ();
-  }
-  deinit = retro_module_get_deinit (internal->module);
-  deinit ();
-  retro_core_pop_cb_data ();
+const gchar *
+retro_core_get_save_directory (RetroCore *self)
+{
+  g_return_val_if_fail (RETRO_IS_CORE (self), NULL);
 
-  if (internal->media_uris != NULL)
-    g_strfreev (internal->media_uris);
+  return self->save_directory;
+}
 
-  g_object_unref (internal->module);
-  g_hash_table_unref (internal->controllers);
-  g_object_unref (internal->options);
+void
+retro_core_set_save_directory (RetroCore   *self,
+                               const gchar *value)
+{
+  g_return_if_fail (RETRO_IS_CORE (self));
 
-  g_free (self->environment_internal);
+  if (g_strcmp0 (value, retro_core_get_save_directory (self)) == 0)
+    return;
+
+  g_free (self->save_directory);
+  self->save_directory = g_strdup (value);
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SAVE_DIRECTORY]);
 }
 
-static gboolean
-on_key_event (GtkWidget   *widget,
-              GdkEventKey *event,
-              gpointer     self)
+gboolean
+retro_core_get_is_initiated (RetroCore *self)
 {
   g_return_val_if_fail (RETRO_IS_CORE (self), FALSE);
-  g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
-  g_return_val_if_fail (event != NULL, FALSE);
 
-  return retro_core_key_event (RETRO_CORE (self), event);
+  return self->is_initiated;
 }
 
-/* Public */
+gboolean
+retro_core_get_game_loaded (RetroCore *self)
+{
+  g_return_val_if_fail (RETRO_IS_CORE (self), FALSE);
+
+  return self->game_loaded;
+}
+
+gboolean
+retro_core_get_support_no_game (RetroCore *self)
+{
+  g_return_val_if_fail (RETRO_IS_CORE (self), FALSE);
+
+  return self->support_no_game;
+}
+
+void
+retro_core_set_support_no_game (RetroCore *self,
+                                gboolean   value)
+{
+  g_return_if_fail (RETRO_IS_CORE (self));
+
+  if (retro_core_get_support_no_game (self) == value)
+    return;
+
+  self->support_no_game = value;
+  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SUPPORT_NO_GAME]);
+}
+
+gdouble
+retro_core_get_frames_per_second (RetroCore *self)
+{
+  g_return_val_if_fail (RETRO_IS_CORE (self), 0.0);
+
+  return self->frames_per_second;
+}
 
 void
 retro_core_boot (RetroCore  *self,
@@ -752,7 +1224,7 @@ retro_core_boot (RetroCore  *self,
   RetroDeviceType device_type;
   GError *tmp_error = NULL;
 
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
@@ -782,12 +1254,12 @@ retro_core_boot (RetroCore  *self,
 }
 
 void
-retro_core_set_medias (RetroCore  *self,
-                       gchar     **uris)
+retro_core_set_medias (RetroCore    *self,
+                       const gchar **uris)
 {
   RetroCoreEnvironmentInternal *internal;
 
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
   g_return_if_fail (!retro_core_get_is_initiated (self));
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
@@ -795,7 +1267,7 @@ retro_core_set_medias (RetroCore  *self,
   if (internal->media_uris != NULL)
     g_strfreev (internal->media_uris);
 
-  internal->media_uris = g_strdupv (uris);
+  internal->media_uris = g_strdupv ((gchar **) uris);
 }
 
 void
@@ -807,7 +1279,7 @@ retro_core_set_current_media (RetroCore  *self,
   guint length;
   GError *tmp_error = NULL;
 
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
   length = g_strv_length (internal->media_uris);
@@ -847,7 +1319,7 @@ retro_core_set_controller_port_device (RetroCore       *self,
   RetroCoreEnvironmentInternal *internal;
   RetroSetControllerPortDevice set_controller_port_device;
 
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
@@ -858,12 +1330,12 @@ retro_core_set_controller_port_device (RetroCore       *self,
 }
 
 void
-retro_core_reset (RetroCore* self)
+retro_core_reset (RetroCore *self)
 {
   RetroCoreEnvironmentInternal *internal;
   RetroReset reset;
 
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
@@ -874,12 +1346,12 @@ retro_core_reset (RetroCore* self)
 }
 
 void
-retro_core_run (RetroCore* self)
+retro_core_run (RetroCore *self)
 {
   RetroCoreEnvironmentInternal *internal;
   RetroRun run;
 
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
@@ -896,7 +1368,7 @@ retro_core_supports_serialization (RetroCore *self)
   RetroSerializeSize serialize_size = NULL;
   gsize size;
 
-  g_return_val_if_fail (self != NULL, FALSE);
+  g_return_val_if_fail (RETRO_IS_CORE (self), FALSE);
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
@@ -920,7 +1392,7 @@ retro_core_serialize_state (RetroCore  *self,
   gsize size;
   gboolean success;
 
-  g_return_val_if_fail (self != NULL, NULL);
+  g_return_val_if_fail (RETRO_IS_CORE (self), NULL);
   g_return_val_if_fail (length != NULL, NULL);
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
@@ -974,7 +1446,7 @@ retro_core_deserialize_state (RetroCore  *self,
   gsize size;
   gboolean success;
 
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
   g_return_if_fail (data != NULL);
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
@@ -998,7 +1470,10 @@ retro_core_deserialize_state (RetroCore  *self,
     g_set_error (error,
                  RETRO_CORE_ERROR,
                  RETRO_CORE_ERROR_COULDNT_DESERIALIZE,
-                 "Couldn't deserialize the internal state: expected at most %"G_GSIZE_FORMAT" bytes, got 
%"G_GSIZE_FORMAT".", size, length);
+                 "Couldn't deserialize the internal state: expected at most %"
+                 G_GSIZE_FORMAT" bytes, got %"G_GSIZE_FORMAT".",
+                 size,
+                 length);
 
     return;
   }
@@ -1025,7 +1500,7 @@ retro_core_get_memory_size (RetroCore       *self,
   gsize size;
   RetroGetMemorySize get_memory_size;
 
-  g_return_val_if_fail (self != NULL, 0UL);
+  g_return_val_if_fail (RETRO_IS_CORE (self), 0UL);
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
@@ -1040,7 +1515,7 @@ retro_core_get_memory_size (RetroCore       *self,
 guint8 *
 retro_core_get_memory (RetroCore       *self,
                        RetroMemoryType  id,
-                       gint            *length)
+                       gsize           *length)
 {
   RetroCoreEnvironmentInternal *internal;
   RetroGetMemoryData get_mem_data;
@@ -1048,7 +1523,7 @@ retro_core_get_memory (RetroCore       *self,
   guint8 *data;
   gsize size;
 
-  g_return_val_if_fail (self != NULL, NULL);
+  g_return_val_if_fail (RETRO_IS_CORE (self), NULL);
   g_return_val_if_fail (length != NULL, NULL);
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
@@ -1071,7 +1546,7 @@ void
 retro_core_set_memory (RetroCore       *self,
                        RetroMemoryType  id,
                        guint8          *data,
-                       gint             length)
+                       gsize            length)
 {
   RetroCoreEnvironmentInternal *internal;
   RetroGetMemoryData get_mem_region;
@@ -1079,7 +1554,7 @@ retro_core_set_memory (RetroCore       *self,
   guint8 *memory_region;
   gsize memory_region_size;
 
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
   g_return_if_fail (data != NULL);
   g_return_if_fail (length > 0);
 
@@ -1097,8 +1572,9 @@ retro_core_set_memory (RetroCore       *self,
   g_return_if_fail (memory_region_size >= length);
 
   if (memory_region_size != length)
-    g_debug ("%s expects %"G_GSIZE_FORMAT" bytes for memory region %d: %d bytes"
-             " were passed. The excess will be filled with zeros.",
+    g_debug ("%s expects %"G_GSIZE_FORMAT" bytes for memory region %d: %"
+             G_GSIZE_FORMAT" bytes were passed. The excess will be filled with"
+             "zeros.",
              retro_core_get_name (self),
              memory_region_size,
              id,
@@ -1199,7 +1675,7 @@ void
 retro_core_set_keyboard (RetroCore *self,
                          GtkWidget *widget)
 {
-  g_return_if_fail (self != NULL);
+  g_return_if_fail (RETRO_IS_CORE (self));
 
   if (self->keyboard_widget != NULL) {
     g_signal_handler_disconnect (G_OBJECT (self->keyboard_widget), self->key_press_event_id);
@@ -1250,6 +1726,42 @@ retro_core_iterate_controllers (RetroCore *self)
   return retro_controller_iterator_new (internal->controllers);
 }
 
+RetroCore *
+retro_core_new (const gchar *file_name)
+{
+  RetroCore *self;
+  GFile *file;
+  GFile *relative_path_file;
+  gchar *libretro_path;
+
+  g_return_val_if_fail (file_name != NULL, NULL);
+
+  self = g_object_new (RETRO_TYPE_CORE, NULL);
+
+  retro_core_set_file_name (self, file_name);
+
+  file = g_file_new_for_path (file_name);
+  relative_path_file = g_file_resolve_relative_path (file, "");
+
+  g_object_unref (file);
+
+  libretro_path = g_file_get_path (relative_path_file);
+
+  g_object_unref (relative_path_file);
+
+  retro_core_set_libretro_path (self, libretro_path);
+  self->module = retro_module_new (libretro_path);
+
+  g_free (libretro_path);
+
+  retro_core_set_callbacks (self);
+  self->controllers = g_hash_table_new_full (g_int_hash, g_int_equal,
+                                             g_free, g_object_unref);
+  self->options = retro_options_new ();
+
+  return self;
+}
+
 gboolean
 retro_controller_iterator_next (RetroControllerIterator  *self,
                                 guint                   **port,
diff --git a/retro-gtk/retro-core.h b/retro-gtk/retro-core.h
new file mode 100644
index 0000000..140092b
--- /dev/null
+++ b/retro-gtk/retro-core.h
@@ -0,0 +1,87 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#ifndef RETRO_CORE_H
+#define RETRO_CORE_H
+
+#include <gtk/gtk.h>
+#include "retro-controller-iterator.h"
+#include "retro-device-type.h"
+#include "retro-input-descriptor.h"
+#include "retro-input-device.h"
+#include "retro-memory-type.h"
+
+G_BEGIN_DECLS
+
+#define RETRO_TYPE_CORE (retro_core_get_type())
+
+G_DECLARE_FINAL_TYPE (RetroCore, retro_core, RETRO, CORE, GObject)
+
+RetroCore *retro_core_new (const gchar *file_name);
+guint retro_core_get_api_version (RetroCore *self);
+const gchar *retro_core_get_file_name (RetroCore *self);
+const gchar *retro_core_get_system_directory (RetroCore *self);
+void retro_core_set_system_directory (RetroCore *self, const gchar* value);
+const gchar *retro_core_get_libretro_path (RetroCore *self);
+void retro_core_set_libretro_path (RetroCore   *self,
+                                   const gchar *value);
+const gchar *retro_core_get_content_directory (RetroCore *self);
+void retro_core_set_content_directory (RetroCore   *self,
+                                       const gchar *value);
+const gchar *retro_core_get_save_directory (RetroCore *self);
+void retro_core_set_save_directory (RetroCore   *self,
+                                    const gchar *value);
+gboolean retro_core_get_is_initiated (RetroCore *self);
+gboolean retro_core_get_game_loaded (RetroCore *self);
+gboolean retro_core_get_support_no_game (RetroCore *self);
+gdouble retro_core_get_frames_per_second (RetroCore *self);
+void retro_core_boot (RetroCore  *self,
+                      GError    **error);
+void retro_core_set_medias (RetroCore    *self,
+                            const gchar **uris);
+void retro_core_set_current_media (RetroCore  *self,
+                                   guint       media_index,
+                                   GError    **error);
+void retro_core_set_controller_port_device (RetroCore       *self,
+                                            guint            port,
+                                            RetroDeviceType  device);
+void retro_core_reset (RetroCore *self);
+void retro_core_run (RetroCore *self);
+gboolean retro_core_supports_serialization (RetroCore *self);
+guint8 *retro_core_serialize_state (RetroCore  *self,
+                                    gsize      *length,
+                                    GError    **error);
+void retro_core_deserialize_state (RetroCore  *self,
+                                   guint8     *data,
+                                   gsize       length,
+                                   GError    **error);
+gsize retro_core_get_memory_size (RetroCore       *self,
+                                  RetroMemoryType  id);
+guint8 *retro_core_get_memory (RetroCore       *self,
+                              RetroMemoryType  id,
+                              gsize           *length);
+void retro_core_set_memory (RetroCore       *self,
+                            RetroMemoryType  id,
+                            guint8          *data,
+                            gsize            length);
+void retro_core_poll_controllers (RetroCore *self);
+gint16 retro_core_get_controller_input_state (RetroCore       *self,
+                                              uint             port,
+                                              RetroDeviceType  device,
+                                              guint            index,
+                                              guint            id);
+void retro_core_set_controller_descriptors (RetroCore            *self,
+                                            RetroInputDescriptor *input_descriptors,
+                                            gsize                 length);
+guint64 retro_core_get_controller_capabilities (RetroCore *self);
+void retro_core_set_controller (RetroCore        *self,
+                                guint             port,
+                                RetroInputDevice *device);
+void retro_core_set_keyboard (RetroCore *self,
+                              GtkWidget *widget);
+void retro_core_remove_controller (RetroCore *self,
+                                   guint      port);
+RetroControllerIterator *retro_core_iterate_controllers (RetroCore *self);
+
+G_END_DECLS
+
+#endif /* RETRO_CORE_H */
diff --git a/retro-gtk/retro-environment.c b/retro-gtk/retro-environment.c
index 0cf5a98..8572480 100644
--- a/retro-gtk/retro-environment.c
+++ b/retro-gtk/retro-environment.c
@@ -586,8 +586,8 @@ retro_core_set_system_av_info (RetroCore         *self,
 
   internal = RETRO_CORE_ENVIRONMENT_INTERNAL (self);
 
-  if (self->_frames_per_second != system_av_info->timing.fps) {
-    self->_frames_per_second = system_av_info->timing.fps;
+  if (self->frames_per_second != system_av_info->timing.fps) {
+    self->frames_per_second = system_av_info->timing.fps;
     g_object_notify (G_OBJECT (self), "frames-per-second");
   }
   if (system_av_info->geometry.aspect_ratio > 0.f)
diff --git a/retro-gtk/retro-gtk.h b/retro-gtk/retro-gtk.h
index 1494f08..b6e16ab 100644
--- a/retro-gtk/retro-gtk.h
+++ b/retro-gtk/retro-gtk.h
@@ -9,6 +9,7 @@
 
 #include "retro-analog-id.h"
 #include "retro-analog-index.h"
+#include "retro-core.h"
 #include "retro-core-view.h"
 #include "retro-device-type.h"
 #include "retro-gtk-vala.h"
diff --git a/retro-gtk/retro-log.c b/retro-gtk/retro-log.c
index 3b14fef..53043a3 100644
--- a/retro-gtk/retro-log.c
+++ b/retro-gtk/retro-log.c
@@ -1,6 +1,6 @@
 // This file is part of retro-gtk. License: GPL-3.0+.
 
-#include "retro-gtk-internal.h"
+#include "retro-core.h"
 
 void
 retro_g_log (RetroCore      *self,
diff --git a/retro-gtk/retro-main-loop.h b/retro-gtk/retro-main-loop.h
index 0589289..c6a2067 100644
--- a/retro-gtk/retro-main-loop.h
+++ b/retro-gtk/retro-main-loop.h
@@ -3,7 +3,7 @@
 #ifndef RETRO_MAIN_LOOP_H
 #define RETRO_MAIN_LOOP_H
 
-#include <glib-object.h>
+#include "retro-core.h"
 
 G_BEGIN_DECLS
 
diff --git a/retro-gtk/retro-module.h b/retro-gtk/retro-module.h
index 1041126..cb5858e 100644
--- a/retro-gtk/retro-module.h
+++ b/retro-gtk/retro-module.h
@@ -4,8 +4,9 @@
 #define RETRO_MODULE_H
 
 #include <glib-object.h>
-#include "retro-gtk-internal.h"
+#include "retro-device-type.h"
 #include "retro-game-info.h"
+#include "retro-memory-type.h"
 #include "retro-system-av-info.h"
 #include "retro-system-info.h"
 
diff --git a/retro-gtk/retro-rumble-effect.h b/retro-gtk/retro-rumble-effect.h
index f05b7f1..d21de7b 100644
--- a/retro-gtk/retro-rumble-effect.h
+++ b/retro-gtk/retro-rumble-effect.h
@@ -8,7 +8,7 @@
 G_BEGIN_DECLS
 
 /**
- * RetroAnalogIndex:
+ * RetroRumbleEffect:
  * @RETRO_RUMBLE_EFFECT_STRONG: The strong rumble effect.
  * @RETRO_RUMBLE_EFFECT_WEAK: The weak rumble effect.
  *



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