[gnome-games] retro: Be more tolerant about serialization sizes



commit 194c9271e86f49216d7904aa8e1e0974cd67f141
Author: Mathieu Bridon <bochecha daitauha fr>
Date:   Tue Nov 1 17:06:42 2016 +0100

    retro: Be more tolerant about serialization sizes
    
    We are having problems with Nestopia, which returns 21400 the first
    time, and then 21380 every time after that.
    
    With the current code, which checks for equality, we always fail to
    deserialize the Nestopia saved states.
    
    The libretro.h header has this to say about the function:
    
        // Returns the amount of data the implementation requires to serialize internal state (save states).
        // Beetween calls to retro_load_game() and retro_unload_game(), the returned size is never allowed to 
be larger than a previous returned value, to
        // ensure that the frontend can allocate a save state buffer once.
    
    They seem to implicitly acknowledge that this value can change, but that
    it can only ever be smaller than a previous value.
    
    This commit changes the check for equality into a check for inferiority,
    which makes loading a saved state for Nestopia work.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770783

 src/retro/retro-runner.vala |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index 803eaba..a628469 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -464,7 +464,7 @@ public class Games.RetroRunner : Object, Runner {
                FileUtils.get_data (snapshot_path, out data);
 
                var expected_size = core.serialize_size ();
-               if (data.length != expected_size)
+               if (data.length > expected_size)
                        /* Not translated as this is not presented to the user */
                        throw new RetroError.COULDNT_LOAD_SNAPSHOT ("[%s] Unexpected serialization data size: 
got %lu, expected %lu\n", core.file_name, data.length, expected_size);
 


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