[retro-gtk] retro-core: Iterate earlier in load_state()



commit 9d8d7d3e827ad13b4808bc7b26454d14cdcb4bad
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Thu Feb 20 15:45:34 2020 +0500

    retro-core: Iterate earlier in load_state()
    
    Some cores change the memory size after the first iteration.
    For these cores, it's not enough to iterate just before setting it, it
    must be done before checking its size.

 retro-runner/retro-core.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/retro-runner/retro-core.c b/retro-runner/retro-core.c
index 18891e4..c65c452 100644
--- a/retro-runner/retro-core.c
+++ b/retro-runner/retro-core.c
@@ -1793,6 +1793,20 @@ retro_core_load_state (RetroCore    *self,
     return;
   }
 
+  /* Some cores, such as MAME and ParaLLEl N64, can only properly restore the
+   * state after at least one frame has been run. */
+  if (!self->has_run) {
+    RetroRun run = retro_module_get_run (self->module);
+
+    /* Ignore the video output here to avoid briefly showing the previous state
+     * in case user is showing a screenshot of the state to restore here. */
+    self->block_video_signal = TRUE;
+    run ();
+    self->block_video_signal = FALSE;
+
+    self->has_run = TRUE;
+  }
+
   serialize_size = retro_module_get_serialize_size (self->module);
   expected_size = serialize_size ();
 
@@ -1812,20 +1826,6 @@ retro_core_load_state (RetroCore    *self,
                 expected_size,
                 data_size);
 
-  /* Some cores, such as MAME and ParaLLEl N64, can only properly restore the
-   * state after at least one frame has been run. */
-  if (!self->has_run) {
-    RetroRun run = retro_module_get_run (self->module);
-
-    /* Ignore the video output here to avoid briefly showing the previous state
-     * in case user is showing a screenshot of the state to restore here. */
-    self->block_video_signal = TRUE;
-    run ();
-    self->block_video_signal = FALSE;
-
-    self->has_run = TRUE;
-  }
-
   unserialize = retro_module_get_unserialize (self->module);
   success = unserialize ((guint8 *) data, data_size);
 


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