[retro-gtk] core: Move Core.prepare() to C
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] core: Move Core.prepare() to C
- Date: Fri, 7 Jul 2017 09:06:32 +0000 (UTC)
commit 81abe41c31b09aca0136a26738eeb3538c48b003
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Jul 6 11:39:44 2017 +0200
core: Move Core.prepare() to C
This help porting the library to C.
https://bugzilla.gnome.org/show_bug.cgi?id=777489
retro-gtk/core.vala | 13 ++-----------
retro-gtk/retro-core.c | 21 +++++++++++++++++++++
retro-gtk/retro-core.h | 2 ++
3 files changed, 25 insertions(+), 11 deletions(-)
---
diff --git a/retro-gtk/core.vala b/retro-gtk/core.vala
index 96ec318..65f8dce 100644
--- a/retro-gtk/core.vala
+++ b/retro-gtk/core.vala
@@ -138,7 +138,7 @@ public class Core : Object {
/**
* Whether or not the a game is loaded.
*/
- public bool game_loaded { private set; get; default = false; }
+ public bool game_loaded { internal set; get; default = false; }
/**
* Whether or not the core supports games.
@@ -334,16 +334,7 @@ public class Core : Object {
*
* @return false if the preparation failed, true otherwise
*/
- public bool prepare () {
- push_cb_data ();
- game_loaded = module.load_game (null);
- SystemAvInfo info;
- module.get_system_av_info (out info);
- set_system_av_info (info);
- pop_cb_data ();
-
- return game_loaded;
- }
+ public extern bool prepare ();
/**
* Gets the size of a region of memory.
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index 8ebc77d..aad0e82 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -242,6 +242,27 @@ retro_core_deserialize_state (RetroCore *self,
}
}
+gboolean
+retro_core_prepare (RetroCore* self) {
+ RetroLoadGame load_game;
+ RetroGetSystemAvInfo get_system_av_info;
+ gboolean game_loaded;
+ RetroSystemAvInfo info = {{ 0 }};
+
+ g_return_val_if_fail (self != NULL, FALSE);
+
+ retro_core_push_cb_data (self);
+ load_game = retro_module_get_load_game (self->module);
+ game_loaded = load_game (NULL);
+ retro_core_set_game_loaded (self, game_loaded);
+ get_system_av_info = retro_module_get_get_system_av_info (self->module);
+ get_system_av_info (&info);
+ retro_core_set_system_av_info (self, &info);
+ retro_core_pop_cb_data ();
+
+ return game_loaded;
+}
+
gsize
retro_core_get_memory_size (RetroCore *self,
RetroMemoryType id)
diff --git a/retro-gtk/retro-core.h b/retro-gtk/retro-core.h
index 2d38266..c645d4f 100644
--- a/retro-gtk/retro-core.h
+++ b/retro-gtk/retro-core.h
@@ -25,6 +25,8 @@ struct _RetroCoreEnvironmentInternal {
RetroKeyboardCallback keyboard_callback;
};
+void retro_core_set_system_av_info (RetroCore *self,
+ RetroSystemAvInfo *system_av_info);
void retro_core_set_controller_port_device (RetroCore *self,
guint port,
RetroDeviceType device);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]