[retro-gtk] core: Add the environment_internal field
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] core: Add the environment_internal field
- Date: Wed, 5 Jul 2017 14:20:19 +0000 (UTC)
commit 994c2bec5369ab410811d3264499a3340d65d8df
Author: Adrien Plazas <kekun plazas laposte net>
Date: Tue Jul 4 16:40:06 2017 +0200
core: Add the environment_internal field
This will be used in the next to store data in a Core accessible only
from C only and hence this will help porting Core to C.
retro-gtk/core.vala | 9 +++++++++
retro-gtk/retro-core.c | 14 ++++++++++++++
retro-gtk/retro-core.h | 20 ++++++++++++++++++++
retro-gtk/retro-environment.c | 1 +
4 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/retro-gtk/core.vala b/retro-gtk/core.vala
index d7d95c9..16d5d17 100644
--- a/retro-gtk/core.vala
+++ b/retro-gtk/core.vala
@@ -222,6 +222,8 @@ public class Core : Object {
internal Rotation rotation;
internal double sample_rate;
+ internal void *environment_internal;
+
/**
* Creates a Core from the file name of a Libretro implementation.
*
@@ -235,6 +237,8 @@ public class Core : Object {
}
construct {
+ environment_internal_setup ();
+
libretro_path = File.new_for_path (file_name).resolve_relative_path ("").get_path ();
module = new Module (libretro_path);
@@ -248,6 +252,8 @@ public class Core : Object {
module.unload_game ();
module.deinit ();
pop_cb_data ();
+
+ environment_internal_release ();
}
/**
@@ -420,6 +426,9 @@ public class Core : Object {
}
private extern void set_system_av_info (SystemAvInfo system_av_info);
+
+ private extern void environment_internal_setup ();
+ private extern void environment_internal_release ();
}
}
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index 7996036..0f6d4bf 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -1,5 +1,7 @@
// This file is part of Retro. License: GPLv3
+#include "retro-core.h"
+
#include "retro-gtk-internal.h"
gboolean
@@ -176,3 +178,15 @@ 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);
+}
+
+void
+retro_core_environment_internal_release (RetroCore *self)
+{
+ g_free (self->environment_internal);
+}
diff --git a/retro-gtk/retro-core.h b/retro-gtk/retro-core.h
new file mode 100644
index 0000000..bd2581b
--- /dev/null
+++ b/retro-gtk/retro-core.h
@@ -0,0 +1,20 @@
+// This file is part of Retro. License: GPLv3
+
+#ifndef RETRO_CORE_H
+#define RETRO_CORE_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define RETRO_CORE_ENVIRONMENT_INTERNAL(core) ((RetroCoreEnvironmentInternal *)
((core)->environment_internal))
+
+typedef struct _RetroCoreEnvironmentInternal RetroCoreEnvironmentInternal;
+
+struct _RetroCoreEnvironmentInternal {
+ gpointer dummy;
+};
+
+G_END_DECLS
+
+#endif /* RETRO_CORE_H */
diff --git a/retro-gtk/retro-environment.c b/retro-gtk/retro-environment.c
index a74549d..3958986 100644
--- a/retro-gtk/retro-environment.c
+++ b/retro-gtk/retro-environment.c
@@ -2,6 +2,7 @@
#include "retro-gtk-internal.h"
#include "libretro-environment.h"
+#include "retro-core.h"
void retro_core_set_system_av_info (RetroCore *self,
RetroSystemAvInfo *system_av_info);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]