[retro-gtk] core: Port the content of the constructor to C
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] core: Port the content of the constructor to C
- Date: Thu, 20 Jul 2017 12:54:13 +0000 (UTC)
commit ed4385439e385730a1f042e750aeb5323c1c825c
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Jul 20 12:01:17 2017 +0200
core: Port the content of the constructor to C
https://bugzilla.gnome.org/show_bug.cgi?id=777489
retro-gtk/core.vala | 20 +++-----------------
retro-gtk/retro-core.c | 42 ++++++++++++++++++++++++++++++++++++------
2 files changed, 39 insertions(+), 23 deletions(-)
---
diff --git a/retro-gtk/core.vala b/retro-gtk/core.vala
index a98f42f..d58dec8 100644
--- a/retro-gtk/core.vala
+++ b/retro-gtk/core.vala
@@ -108,7 +108,7 @@ public class Core : Object {
/**
* The file name of the module.
*/
- public string file_name { construct; get; }
+ public string file_name { internal set; get; }
/**
* The directory the core will use to look for for additional data.
@@ -210,9 +210,6 @@ public class Core : Object {
*/
public signal bool message (string message, uint frames);
- private extern void set_environment_interface ();
- private extern void set_callbacks ();
-
internal Module module;
internal Variables variables_interface;
@@ -227,23 +224,14 @@ public class Core : Object {
* @param file_name the file name of the Libretro implementation to load
*/
public Core (string file_name) {
- Object (file_name: file_name);
- }
-
- construct {
- environment_internal_setup ();
-
- libretro_path = File.new_for_path (file_name).resolve_relative_path ("").get_path ();
-
- module = new Module (libretro_path);
- set_callbacks ();
- variables_interface = new Options ();
+ constructor (file_name);
}
~Core () {
destructor ();
}
+ private extern void constructor (string file_name);
private extern void destructor ();
/**
@@ -317,8 +305,6 @@ public class Core : Object {
private extern void on_input_key_event (bool down, KeyboardKey keycode, uint32 character,
KeyboardModifierKey key_modifiers);
private extern void set_system_av_info (SystemAvInfo system_av_info);
-
- private extern void environment_internal_setup ();
}
}
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index e661f7f..faf8526 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -323,6 +323,42 @@ 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.
+void
+retro_core_constructor (RetroCore *self,
+ const gchar *file_name)
+{
+ GFile *file;
+ GFile *relative_path_file;
+ gchar *libretro_path;
+
+ g_return_if_fail (file_name != NULL);
+
+ retro_core_set_file_name (self, file_name);
+
+ self->environment_internal = g_new0 (RetroCoreEnvironmentInternal, 1);
+
+ 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->variables_interface = RETRO_VARIABLES (retro_options_new ());
+}
+
// FIXME Make static as soon as possible.
void
retro_core_destructor (RetroCore *self)
@@ -673,9 +709,3 @@ retro_core_set_memory (RetroCore *self,
memcpy (memory_region, data, length);
}
-
-void
-retro_core_environment_internal_setup (RetroCore *self)
-{
- self->environment_internal = g_new0 (RetroCoreEnvironmentInternal, 1);
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]