[retro-gtk] core: Move Core.get_memory_size() to C
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] core: Move Core.get_memory_size() to C
- Date: Fri, 7 Jul 2017 09:06:27 +0000 (UTC)
commit 1b7f57d2aa88912e6f5246e9464433ad4a83c9df
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Jul 6 11:01:19 2017 +0200
core: Move Core.get_memory_size() to C
This help porting the library to C.
https://bugzilla.gnome.org/show_bug.cgi?id=777489
retro-gtk/core.vala | 8 +-------
retro-gtk/retro-core.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/retro-gtk/core.vala b/retro-gtk/core.vala
index c0b875b..96ec318 100644
--- a/retro-gtk/core.vala
+++ b/retro-gtk/core.vala
@@ -351,13 +351,7 @@ public class Core : Object {
* @param id the region of memory
* @return the size of the region of memory
*/
- public size_t get_memory_size (MemoryType id) {
- push_cb_data ();
- var result = module.get_memory_size (id);
- pop_cb_data ();
-
- return result;
- }
+ public extern size_t get_memory_size (MemoryType id);
/**
* Gets a region of memory.
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index ff691d2..8ebc77d 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -242,6 +242,23 @@ retro_core_deserialize_state (RetroCore *self,
}
}
+gsize
+retro_core_get_memory_size (RetroCore *self,
+ RetroMemoryType id)
+{
+ gsize size;
+ RetroGetMemorySize get_memory_size;
+
+ g_return_val_if_fail (self != NULL, 0UL);
+
+ retro_core_push_cb_data (self);
+ get_memory_size = retro_module_get_get_memory_size (self->module);
+ size = get_memory_size (id);
+ retro_core_pop_cb_data ();
+
+ return size;
+}
+
guint8 *
retro_core_get_memory (RetroCore *self,
RetroMemoryType id,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]