[retro-gtk] retro-core: Make state size mismatch non-fatal



commit 37135e1948ca27267b712bc37a6d2a6e84438aad
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Feb 3 18:36:59 2020 +0500

    retro-core: Make state size mismatch non-fatal
    
    Since RetroArch doesn't check this, some cores actually save states of
    larger size than what they declare as their size. Some examples would be
    Beetle Saturn and Flycast, where the size of their state depends on the
    amount of plugged in controllers.
    
    Instead, just print a critical.

 retro-gtk/retro-core.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index 4a00d4d..8e334c1 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -1911,17 +1911,12 @@ retro_core_load_state (RetroCore    *self,
     return;
   }
 
-  if (data_size > expected_size) {
-    g_set_error (error,
-                 RETRO_CORE_ERROR,
-                 RETRO_CORE_ERROR_COULDNT_DESERIALIZE,
-                 "Couldn't deserialize the internal state: expected at most %"
-                 G_GSIZE_FORMAT" bytes, got %"G_GSIZE_FORMAT".",
-                 expected_size,
-                 data_size);
-
-    return;
-  }
+  if (data_size != expected_size)
+    g_critical ("%s expects %"G_GSIZE_FORMAT" bytes for its internal state, but %"
+                G_GSIZE_FORMAT" bytes were passed.",
+                retro_core_get_name (self),
+                expected_size,
+                data_size);
 
   unserialize = retro_module_get_unserialize (self->module);
 


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