[retro-gtk/wip/aplazas/c-port: 36/36] Fixes



commit df9eb90fa775aae5987751f8a42565d7e057ee1c
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Oct 2 20:45:03 2017 +0200

    Fixes

 retro-gtk/Makefile.am             |    8 ++--
 retro-gtk/retro-core-descriptor.c |   69 +++++++++++++++++++++++++++++++++++++
 retro-gtk/retro-core-private.h    |    4 ++
 retro-gtk/retro-core.c            |   68 +++++++++++++++++-------------------
 retro-gtk/retro-core.h            |    4 --
 retro-gtk/retro-module-iterator.c |    6 ++--
 retro-gtk/retro-module-iterator.h |    4 +-
 7 files changed, 114 insertions(+), 49 deletions(-)
---
diff --git a/retro-gtk/Makefile.am b/retro-gtk/Makefile.am
index d2c83f2..7e60533 100644
--- a/retro-gtk/Makefile.am
+++ b/retro-gtk/Makefile.am
@@ -30,14 +30,12 @@ dist_vapi_DATA = retro-gtk-0.12.deps
 retro_gtk_public_h_sources = \
        retro-analog-id.h \
        retro-analog-index.h \
-       retro-cairo-display.h \
        retro-controller-iterator.h \
        retro-core-descriptor.h \
        retro-core.h \
        retro-core-view.h \
        retro-device-type.h \
        retro-gtk.h \
-       retro-input-descriptor.h \
        retro-input-device.h \
        retro-joypad-id.h \
        retro-lightgun-id.h \
@@ -47,7 +45,6 @@ retro_gtk_public_h_sources = \
        retro-module-iterator.h \
        retro-module-query.h \
        retro-mouse-id.h \
-       retro-pa-player.h \
        retro-pixel-format.h \
        retro-pointer-id.h \
        retro-rumble-effect.h \
@@ -56,15 +53,18 @@ retro_gtk_public_h_sources = \
 
 retro_gtk_private_h_sources = \
        libretro-environment.h \
+       retro-cairo-display.h \
        retro-controller-iterator-private.h \
        retro-core-private.h \
        retro-core-view-input-device.h \
        retro-disk-control-callback.h \
        retro-game-info.h \
+       retro-input-descriptor.h \
        retro-keyboard-key.h \
        retro-module.h \
        retro-option.h \
        retro-options.h \
+       retro-pa-player.h \
        retro-rotation.h \
        retro-system-av-info.h \
        retro-system-info.h \
@@ -127,7 +127,7 @@ BUILT_SOURCES = libretro-gtk.la Retro-0.12.gir
 Retro-0.12.gir: $(INTROSPECTION_SCANNER) libretro-gtk.la
 Retro_0_12_gir_INCLUDES = GLib-2.0 GObject-2.0 Gio-2.0 Gtk-3.0 cairo-1.0
 Retro_0_12_gir_SCANNERFLAGS = --c-include=retro-gtk.h --pkg-export=retro-gtk-0.12
-Retro_0_12_gir_CFLAGS = -I$(srcdir) -DRETRO_GTK_USE_UNSTABLE_API $(retro_gtk_CFLAGS)
+Retro_0_12_gir_CFLAGS = -I$(srcdir) -DRETRO_GTK_USE_UNSTABLE_API -DRETRO_GTK_COMPILATION $(retro_gtk_CFLAGS)
 Retro_0_12_gir_LIBS = libretro-gtk.la
 Retro_0_12_gir_FILES = $(introspection_sources)
 Retro_0_12_gir_EXPORT_PACKAGES = retro-gtk-0.12
diff --git a/retro-gtk/retro-core-descriptor.c b/retro-gtk/retro-core-descriptor.c
index 0d2b26b..8507d39 100644
--- a/retro-gtk/retro-core-descriptor.c
+++ b/retro-gtk/retro-core-descriptor.c
@@ -473,6 +473,13 @@ retro_core_descriptor_get_is_emulator (RetroCoreDescriptor  *self,
   return is_game;
 }
 
+/**
+ * retro_core_descriptor_get_icon
+ * @self: A #RetroCoreDescriptor
+ * @error: Return location for a #GError, or NULL
+ *
+ * Returns: (nullable) (transfer full): A #GIcon or NULL.
+ */
 GIcon *
 retro_core_descriptor_get_icon (RetroCoreDescriptor  *self,
                                 GError              **error)
@@ -499,6 +506,13 @@ retro_core_descriptor_get_icon (RetroCoreDescriptor  *self,
   return icon;
 }
 
+/**
+ * retro_core_descriptor_get_module
+ * @self: A #RetroCoreDescriptor
+ * @error: Return location for a #GError, or NULL
+ *
+ * Returns: (nullable) (transfer full): A string or NULL, free it with g_free.
+ */
 char *
 retro_core_descriptor_get_module (RetroCoreDescriptor  *self,
                                   GError              **error)
@@ -511,6 +525,13 @@ retro_core_descriptor_get_module (RetroCoreDescriptor  *self,
                                 error);
 }
 
+/**
+ * retro_core_descriptor_get_module_file
+ * @self: A #RetroCoreDescriptor
+ * @error: Return location for a #GError, or NULL
+ *
+ * Returns: (nullable) (transfer full): A #GFile or NULL.
+ */
 GFile *
 retro_core_descriptor_get_module_file (RetroCoreDescriptor  *self,
                                        GError              **error)
@@ -597,6 +618,18 @@ retro_core_descriptor_has_firmware_sha512 (RetroCoreDescriptor  *self,
                            error);
 }
 
+/**
+ * retro_core_descriptor_get_mime_type
+ * @self: A #RetroCoreDescriptor
+ * @platform: A platform name
+ * @length (out) (optional): Return location for the number of returned strings,
+ * or NULL
+ * @error: Return location for a #GError, or NULL
+ *
+ * Returns: (array zero-terminated=1 length=length) (element-type utf8)
+ * (transfer full): A NULL-terminated string array or NULL. The array should be
+ * freed with g_strfreev().
+ */
 gchar **
 retro_core_descriptor_get_mime_type (RetroCoreDescriptor  *self,
                                      const gchar          *platform,
@@ -611,6 +644,18 @@ retro_core_descriptor_get_mime_type (RetroCoreDescriptor  *self,
                                    error);
 }
 
+/**
+ * retro_core_descriptor_get_firmwares
+ * @self: A #RetroCoreDescriptor
+ * @platform: A platform name
+ * @length (out) (optional): Return location for the number of returned strings,
+ * or NULL
+ * @error: Return location for a #GError, or NULL
+ *
+ * Returns: (array zero-terminated=1 length=length) (element-type utf8)
+ * (transfer full): A NULL-terminated string array or NULL. The array should be
+ * freed with g_strfreev().
+ */
 gchar **
 retro_core_descriptor_get_firmwares (RetroCoreDescriptor  *self,
                                      const gchar          *platform,
@@ -625,6 +670,14 @@ retro_core_descriptor_get_firmwares (RetroCoreDescriptor  *self,
                                    error);
 }
 
+/**
+ * retro_core_descriptor_get_firmware_path
+ * @self: A #RetroCoreDescriptor
+ * @firmware: A firmware name.
+ * @error: Return location for a #GError, or NULL
+ *
+ * Returns: (nullable) (transfer full): A string or NULL, free it with g_free.
+ */
 gchar *
 retro_core_descriptor_get_firmware_path (RetroCoreDescriptor  *self,
                                          const gchar          *firmware,
@@ -637,6 +690,14 @@ retro_core_descriptor_get_firmware_path (RetroCoreDescriptor  *self,
                                        error);
 }
 
+/**
+ * retro_core_descriptor_get_firmware_md5
+ * @self: A #RetroCoreDescriptor
+ * @firmware: A firmware name.
+ * @error: Return location for a #GError, or NULL
+ *
+ * Returns: (nullable) (transfer full): A string or NULL, free it with g_free.
+ */
 gchar *
 retro_core_descriptor_get_firmware_md5 (RetroCoreDescriptor  *self,
                                         const gchar          *firmware,
@@ -649,6 +710,14 @@ retro_core_descriptor_get_firmware_md5 (RetroCoreDescriptor  *self,
                                        error);
 }
 
+/**
+ * retro_core_descriptor_get_firmware_sha512
+ * @self: A #RetroCoreDescriptor
+ * @firmware: A firmware name.
+ * @error: Return location for a #GError, or NULL
+ *
+ * Returns: (nullable) (transfer full): A string or NULL, free it with g_free.
+ */
 gchar *
 retro_core_descriptor_get_firmware_sha512 (RetroCoreDescriptor  *self,
                                            const gchar          *firmware,
diff --git a/retro-gtk/retro-core-private.h b/retro-gtk/retro-core-private.h
index 5a082fb..263b3ae 100644
--- a/retro-gtk/retro-core-private.h
+++ b/retro-gtk/retro-core-private.h
@@ -9,6 +9,7 @@
 
 #include "retro-core.h"
 #include "retro-disk-control-callback.h"
+#include "retro-input-descriptor.h"
 #include "retro-module.h"
 #include "retro-options.h"
 #include "retro-pixel-format.h"
@@ -66,6 +67,9 @@ void retro_core_set_system_av_info (RetroCore         *self,
 void retro_core_set_controller_port_device (RetroCore       *self,
                                             guint            port,
                                             RetroDeviceType  device);
+void retro_core_set_controller_descriptors (RetroCore            *self,
+                                            RetroInputDescriptor *input_descriptors,
+                                            gsize                 length);
 
 G_END_DECLS
 
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index 77c1504..4d15641 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -452,37 +452,6 @@ retro_core_init (RetroCore *self)
 }
 
 static void
-retro_controller_iterator_finalize (GObject *object)
-{
-  G_OBJECT_CLASS (retro_controller_iterator_parent_class)->finalize (object);
-}
-
-static void
-retro_controller_iterator_class_init (RetroControllerIteratorClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-  object_class->finalize = retro_controller_iterator_finalize;
-}
-
-static void
-retro_controller_iterator_init (RetroControllerIterator *self)
-{
-}
-
-static RetroControllerIterator *
-retro_controller_iterator_new (GHashTable *controllers)
-{
-  RetroControllerIterator *self;
-  g_return_val_if_fail (controllers != NULL, NULL);
-
-  self = g_object_new (RETRO_TYPE_CORE, NULL);
-  g_hash_table_iter_init (&self->iterator, controllers);
-
-  return self;
-}
-
-static void
 retro_core_set_file_name (RetroCore   *self,
                           const gchar *value)
 {
@@ -1374,6 +1343,15 @@ retro_core_supports_serialization (RetroCore *self)
   return size > 0;
 }
 
+/**
+ * retro_core_serialize_state
+ * @self: A #RetroCore
+ * @length (out): Return location for the size of the returned memory
+ * @error: Return location for a #GError, or NULL
+ *
+ * Returns: (array length=length) (transfer full): A newly-allocated array
+ * containing the serializated state of the core, or NULL.
+ */
 guint8 *
 retro_core_serialize_state (RetroCore  *self,
                             gsize      *length,
@@ -1428,11 +1406,21 @@ retro_core_serialize_state (RetroCore  *self,
   return data;
 }
 
+/**
+ * retro_core_deserialize_state
+ * @self: A #RetroCore
+ * @data (array length=length): The serialized state
+ * @length: The length of @data
+ * @error: Return location for a #GError, or NULL
+ *
+ * Returns: (array length=length) (transfer full): A newly-allocated array
+ * containing the serializated state of the core, or NULL.
+ */
 void
-retro_core_deserialize_state (RetroCore  *self,
-                              guint8     *data,
-                              gsize       length,
-                              GError    **error)
+retro_core_deserialize_state (RetroCore     *self,
+                              const guint8  *data,
+                              gsize          length,
+                              GError       **error)
 {
   RetroCoreEnvironmentInternal *internal;
   RetroSerializeSize serialize_size = NULL;
@@ -1628,7 +1616,7 @@ retro_core_get_controller_input_state (RetroCore       *self,
 void
 retro_core_set_controller_descriptors (RetroCore            *self,
                                        RetroInputDescriptor *input_descriptors,
-                                       gsize                 input_descriptors_length)
+                                       gsize                 length)
 {
   g_return_if_fail (RETRO_IS_CORE (self));
 
@@ -1709,6 +1697,14 @@ retro_core_remove_controller (RetroCore *self,
   retro_core_controller_disconnected (self, port);
 }
 
+/**
+ * retro_core_iterate_controllers
+ * @self: A #RetroCore
+ *
+ * Gives an iterator to the controllers plugged into @self.
+ *
+ * Returns: (transfer full): A #RetroControllerIterator.
+ */
 RetroControllerIterator *
 retro_core_iterate_controllers (RetroCore *self)
 {
diff --git a/retro-gtk/retro-core.h b/retro-gtk/retro-core.h
index 98bb1b0..e3636f1 100644
--- a/retro-gtk/retro-core.h
+++ b/retro-gtk/retro-core.h
@@ -10,7 +10,6 @@
 #include <gtk/gtk.h>
 #include "retro-controller-iterator.h"
 #include "retro-device-type.h"
-#include "retro-input-descriptor.h"
 #include "retro-input-device.h"
 #include "retro-memory-type.h"
 
@@ -73,9 +72,6 @@ gint16 retro_core_get_controller_input_state (RetroCore       *self,
                                               RetroDeviceType  device,
                                               guint            index,
                                               guint            id);
-void retro_core_set_controller_descriptors (RetroCore            *self,
-                                            RetroInputDescriptor *input_descriptors,
-                                            gsize                 length);
 guint64 retro_core_get_controller_capabilities (RetroCore *self);
 void retro_core_set_controller (RetroCore        *self,
                                 guint             port,
diff --git a/retro-gtk/retro-module-iterator.c b/retro-gtk/retro-module-iterator.c
index 1ad7134..086c289 100644
--- a/retro-gtk/retro-module-iterator.c
+++ b/retro-gtk/retro-module-iterator.c
@@ -321,15 +321,15 @@ retro_module_iterator_next (RetroModuleIterator *self)
  * Returns: A new #RetroModuleIterator
  */
 RetroModuleIterator *
-retro_module_iterator_new (gchar    **lookup_paths,
-                           gboolean   recursive)
+retro_module_iterator_new (const gchar * const *lookup_paths,
+                           gboolean             recursive)
 {
   RetroModuleIterator *self;
 
   g_return_val_if_fail (lookup_paths != NULL, NULL);
 
   self = g_object_new (RETRO_TYPE_MODULE_ITERATOR, NULL);
-  self->directories = g_strdupv (lookup_paths);
+  self->directories = g_strdupv ((gchar **) lookup_paths);
   self->recursive = recursive;
   self->visited = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
 
diff --git a/retro-gtk/retro-module-iterator.h b/retro-gtk/retro-module-iterator.h
index 28ffde8..ad85356 100644
--- a/retro-gtk/retro-module-iterator.h
+++ b/retro-gtk/retro-module-iterator.h
@@ -16,8 +16,8 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (RetroModuleIterator, retro_module_iterator, RETRO, MODULE_ITERATOR, GObject)
 
-RetroModuleIterator *retro_module_iterator_new (gchar    **lookup_paths,
-                                                gboolean   recursive);
+RetroModuleIterator *retro_module_iterator_new (const gchar * const *lookup_paths,
+                                                gboolean             recursive);
 RetroCoreDescriptor *retro_module_iterator_get (RetroModuleIterator *self);
 gboolean retro_module_iterator_next (RetroModuleIterator *self);
 


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