[retro-gtk] core: Add Core.prepare()



commit e8ab1d7398fbe2ae0c71f51f4a8c08ff6d7832e4
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Sun Feb 19 20:40:19 2017 +0100

    core: Add Core.prepare()
    
    Allows to prepare standalone Libretro cores by replacing the calls to
    load_game() by calls to prepare() as standalone games don't have a game
    to load but nonetheless require retro_load_game() to be called.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777371

 retro-gtk/core.vala   |   18 ++++++++++++++++++
 retro-gtk/module.vala |    2 +-
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/retro-gtk/core.vala b/retro-gtk/core.vala
index 8c9ff59..ad25906 100644
--- a/retro-gtk/core.vala
+++ b/retro-gtk/core.vala
@@ -337,6 +337,24 @@ public class Core : Object {
        }
 
        /**
+        * Prepare the standalone core.
+        *
+        * This should be used instead of load_game() for standalone cores.
+        *
+        * @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;
+       }
+
+       /**
         * Gets the size of a region of memory.
         *
         * @param id the region of memory
diff --git a/retro-gtk/module.vala b/retro-gtk/module.vala
index 86fbfad..44e6134 100644
--- a/retro-gtk/module.vala
+++ b/retro-gtk/module.vala
@@ -35,7 +35,7 @@ private delegate bool Unserialize ([CCode (array_length_type = "gsize")] uint8[]
 
 
 [CCode (has_target = false)]
-private delegate bool LoadGame (GameInfo game);
+private delegate bool LoadGame (GameInfo? game);
 [CCode (has_target = false)]
 private delegate void UnloadGame ();
 


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