[gnome-games] retro-runner: Preview the latest savestate when initialising



commit b6f51f6b5c26154c0df62b14fdb5fbe3d8b685e7
Author: Yetizone <andreii lisita gmail com>
Date:   Thu Aug 8 14:38:45 2019 +0300

    retro-runner: Preview the latest savestate when initialising

 src/retro/retro-runner.vala | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)
---
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index 3b14d812..8b8bfd80 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -143,9 +143,15 @@ public class Games.RetroRunner : Object, Runner {
                settings.changed["video-filter"].connect (on_video_filter_changed);
                on_video_filter_changed ();
 
-               // Step 3) Display the screenshot of the latest_savestate --------------
-               // FIXME: This does not work currently
-               load_screenshot ();
+               // Step 3) Instantiate the core
+               // This is needed to check if the core supports savestates
+               tmp_live_savestate = Savestate.create_empty_in_tmp ();
+               instantiate_core (tmp_live_savestate.get_save_directory_path ());
+
+               // Step 4) Preview the latest savestate --------------------------------
+               if (latest_savestate != null)
+                       preview_savestate (latest_savestate);
+
        }
 
        public Gtk.Widget get_display () {
@@ -556,20 +562,6 @@ public class Games.RetroRunner : Object, Runner {
                             null);
        }
 
-       // Display the screenshot of the latest savestate
-       private void load_screenshot () throws Error {
-               if (game_savestates.length == 0)
-                       return;
-
-               var screenshot_path = latest_savestate.get_screenshot_path ();
-
-               if (!FileUtils.test (screenshot_path, FileTest.EXISTS))
-                       return;
-
-               var pixbuf = new Gdk.Pixbuf.from_file (screenshot_path);
-               view.set_pixbuf (pixbuf);
-       }
-
        private bool on_shutdown () {
                stop ();
 


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