[gnome-games] retro-runner: Add is_ready



commit 8c083d92f01810f7ca4f63e65e91e1a14c564206
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri Mar 25 13:04:42 2016 +0100

    retro-runner: Add is_ready
    
    This avoids to reset a game which have already been started when
    resuming it which is needed to pause the game when prompting if the user
    whether we should quit the game.

 src/retro/retro-runner.vala |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index 39ff00b..fcbb414 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -48,9 +48,12 @@ public class Games.RetroRunner : Object, Runner {
        }
 
        private bool is_initialized;
+       private bool is_ready;
 
        public RetroRunner (string module_basename, string uri, Uid uid) {
                is_initialized = false;
+               is_ready = false;
+               should_save = false;
 
                this.module_basename = module_basename;
                this.uri = uri;
@@ -86,8 +89,11 @@ public class Games.RetroRunner : Object, Runner {
 
                loop.stop ();
 
-               load_ram ();
-               core.reset ();
+               if (!is_ready) {
+                       load_ram ();
+                       core.reset ();
+                       is_ready = true;
+               }
 
                loop.start ();
                running = true;
@@ -99,9 +105,12 @@ public class Games.RetroRunner : Object, Runner {
 
                loop.stop ();
 
-               load_ram ();
-               core.reset ();
-               load_snapshot ();
+               if (!is_ready) {
+                       load_ram ();
+                       core.reset ();
+                       load_snapshot ();
+                       is_ready = true;
+               }
 
                loop.start ();
                running = true;


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