[gnome-games/wip/exalm/runner-refactor: 15/58] savestate: Pass Game to get_game_savestates()



commit ead2969a69deae645ab0042cc82a98707f6f5dbb
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Mar 6 15:48:39 2020 +0500

    savestate: Pass Game to get_game_savestates()

 src/core/savestate.vala     | 8 ++++++--
 src/retro/retro-runner.vala | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/core/savestate.vala b/src/core/savestate.vala
index a36861dd..ee28ce8e 100644
--- a/src/core/savestate.vala
+++ b/src/core/savestate.vala
@@ -174,11 +174,15 @@ public class Games.Savestate : Object {
                }
        }
 
-       public static Savestate[] get_game_savestates (Uid game_uid, Platform platform, string core_id) 
throws Error {
+       public static Savestate[] get_game_savestates (Game game, string core_id) throws Error {
                var data_dir_path = Application.get_data_dir ();
                var savestates_dir_path = Path.build_filename (data_dir_path, "savestates");
+
+               var uid = game.uid;
+               var platform = game.platform;
                var core_id_prefix = core_id.replace (".libretro", "");
-               var game_savestates_dir_path = Path.build_filename (savestates_dir_path, 
@"$game_uid-$core_id_prefix");
+
+               var game_savestates_dir_path = Path.build_filename (savestates_dir_path, 
@"$uid-$core_id_prefix");
                var game_savestates_dir_file = File.new_for_path (game_savestates_dir_path);
 
                if (!game_savestates_dir_file.query_exists ()) {
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index b4719c9c..5020694a 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -124,7 +124,7 @@ public class Games.RetroRunner : Object, Runner {
        public void prepare () throws RunnerError {
                try {
                        // Step 1) Load the game's savestates ----------------------------------
-                       game_savestates = Savestate.get_game_savestates (game.uid, game.platform, get_core_id 
());
+                       game_savestates = Savestate.get_game_savestates (game, get_core_id ());
                        if (game_savestates.length != 0)
                                latest_savestate = game_savestates[0];
 


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