[retro-gtk/wip/aplazas/c-port: 17/34] Port MemoryType to C



commit e1b4f6a126fba28500e5844cd4bd3fc6ff079380
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu Sep 7 11:33:01 2017 +0200

    Port MemoryType to C

 retro-gtk/Makefile.am           |    3 ++-
 retro-gtk/memory.vala           |   16 ----------------
 retro-gtk/retro-gtk.h           |    1 +
 retro-gtk/retro-memory-type.c   |   26 ++++++++++++++++++++++++++
 retro-gtk/retro-memory-type.h   |   33 +++++++++++++++++++++++++++++++++
 retro-gtk/vapi/retro-gtk-c.vapi |    8 ++++++++
 6 files changed, 70 insertions(+), 17 deletions(-)
---
diff --git a/retro-gtk/Makefile.am b/retro-gtk/Makefile.am
index 6ea8387..3c97cbe 100644
--- a/retro-gtk/Makefile.am
+++ b/retro-gtk/Makefile.am
@@ -39,6 +39,7 @@ retro_gtk_public_h_sources = \
        retro-input-device.h \
        retro-joypad-id.h \
        retro-lightgun-id.h \
+       retro-memory-type.h \
        retro-mouse-id.h \
        retro-pixel-format.h \
        retro-pointer-id.h \
@@ -74,7 +75,6 @@ libretro_gtk_la_SOURCES = \
        \
        core.vala \
        core-error.vala \
-       memory.vala \
        retro.vala \
        retro-analog-id.c \
        retro-analog-index.c \
@@ -90,6 +90,7 @@ libretro_gtk_la_SOURCES = \
        retro-joypad-id.c \
        retro-lightgun-id.c \
        retro-log.c \
+       retro-memory-type.c \
        retro-module.c \
        retro-module-query.vala \
        retro-module-iterator.vala \
diff --git a/retro-gtk/retro-gtk.h b/retro-gtk/retro-gtk.h
index 18b464e..5766d0b 100644
--- a/retro-gtk/retro-gtk.h
+++ b/retro-gtk/retro-gtk.h
@@ -18,6 +18,7 @@
 #include "retro-input-device.h"
 #include "retro-joypad-id.h"
 #include "retro-lightgun-id.h"
+#include "retro-memory-type.h"
 #include "retro-mouse-id.h"
 #include "retro-pixel-format.h"
 #include "retro-pointer-id.h"
diff --git a/retro-gtk/retro-memory-type.c b/retro-gtk/retro-memory-type.c
new file mode 100644
index 0000000..29eb71a
--- /dev/null
+++ b/retro-gtk/retro-memory-type.c
@@ -0,0 +1,26 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#include "retro-memory-type.h"
+
+GType
+retro_memory_type_get_type (void)
+{
+  static volatile gsize retro_memory_type_type = 0;
+
+  if (g_once_init_enter (&retro_memory_type_type)) {
+    static const GEnumValue values[] = {
+      { RETRO_MEMORY_TYPE_SAVE_RAM, "RETRO_MEMORY_TYPE_SAVE_RAM", "save-ram" },
+      { RETRO_MEMORY_TYPE_RTC, "RETRO_MEMORY_TYPE_RTC", "rtc" },
+      { RETRO_MEMORY_TYPE_SYSTEM_RAM, "RETRO_MEMORY_TYPE_SYSTEM_RAM", "system-ram" },
+      { RETRO_MEMORY_TYPE_VIDEO_RAM, "RETRO_MEMORY_TYPE_VIDEO_RAM", "video-ram" },
+      { 0, NULL, NULL },
+    };
+    GType type;
+
+    type = g_enum_register_static ("RetroMemoryType", values);
+
+    g_once_init_leave (&retro_memory_type_type, type);
+  }
+
+  return retro_memory_type_type;
+}
diff --git a/retro-gtk/retro-memory-type.h b/retro-gtk/retro-memory-type.h
new file mode 100644
index 0000000..4cede5e
--- /dev/null
+++ b/retro-gtk/retro-memory-type.h
@@ -0,0 +1,33 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#ifndef RETRO_MEMORY_TYPE_H
+#define RETRO_MEMORY_TYPE_H
+
+#if !defined(__RETRO_GTK_INSIDE__) && !defined(RETRO_GTK_COMPILATION)
+# error "Only <retro-gtk.h> can be included directly."
+#endif
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/**
+ * RetroMemoryType:
+ * @RETRO_MEMORY_TYPE_SAVE_RAM: the save RAM
+ * @RETRO_MEMORY_TYPE_RTC: the real time clock
+ * @RETRO_MEMORY_TYPE_SYSTEM_RAM: the system RAM
+ * @RETRO_MEMORY_TYPE_VIDEO_RAM: the video RAM
+ *
+ * Represents the memory types for the Libretro core.
+ */
+typedef enum
+{
+  RETRO_MEMORY_TYPE_SAVE_RAM,
+  RETRO_MEMORY_TYPE_RTC,
+  RETRO_MEMORY_TYPE_SYSTEM_RAM,
+  RETRO_MEMORY_TYPE_VIDEO_RAM,
+} RetroMemoryType;
+
+G_END_DECLS
+
+#endif /* RETRO_MEMORY_TYPE_H */
diff --git a/retro-gtk/vapi/retro-gtk-c.vapi b/retro-gtk/vapi/retro-gtk-c.vapi
index 1d548e2..bf0ea78 100644
--- a/retro-gtk/vapi/retro-gtk-c.vapi
+++ b/retro-gtk/vapi/retro-gtk-c.vapi
@@ -12,6 +12,14 @@ public enum Retro.DeviceType {
        POINTER = 6,
 }
 
+[CCode (cheader_filename = "retro-memory-type.h")]
+public enum Retro.MemoryType {
+       SAVE_RAM,
+       RTC,
+       SYSTEM_RAM,
+       VIDEO_RAM,
+}
+
 [CCode (cheader_filename = "retro-pixel-format.h")]
 public enum Retro.PixelFormat {
        XRGB1555,


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