shithub: zelda3

Download patch

ref: a7a859b9652859b33a452bb436a3bc9b60a3e5bd
parent: 75b843b1e1c066e17d9528506cccf234f0b29cf0
author: Snesrev <snesrev@protonmail.com>
date: Tue Oct 4 19:18:57 EDT 2022

Reset Apu queue when loading snapshots (#125)

--- a/zelda_rtl.c
+++ b/zelda_rtl.c
@@ -92,7 +92,11 @@
   }
 }
 
+void ZeldaResetApuQueue() {
+  g_apu_write_ent_pos = g_apu_total_write = g_apu_write_count = 0;
+}
 
+
 uint8_t zelda_read_apui00() {
   // This needs to be here because the ancilla code reads
   // from the apu and we don't want to make the core code
@@ -463,6 +467,8 @@
 
   SpcPlayer_Initialize(g_zenv.player);
   EmuSynchronizeWholeState();
+  ZeldaResetApuQueue();
+  ZeldaOpenMsuFile();
 }
 
 static void LoadSnesState(SaveLoadFunc *func, void *ctx) {
@@ -477,8 +483,7 @@
   
   // Ensure emulator has the up-to-date state too
   EmuSynchronizeWholeState();
-
-  // Ensure we load any msu files
+  ZeldaResetApuQueue();
   ZeldaOpenMsuFile();
 }