From 089379711acf5b27deb2396dce1503a554ddcf4c Mon Sep 17 00:00:00 2001 From: goyuken Date: Tue, 6 Nov 2012 02:13:16 +0000 Subject: [PATCH] nes: fix missing sound after hard reset --- BizHawk.Emulation/Consoles/Nintendo/NES/APU.cs | 10 +++++++++- BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/APU.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/APU.cs index ee76a580b0..8c35f9de55 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/APU.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/APU.cs @@ -34,10 +34,18 @@ namespace BizHawk.Emulation.Consoles.Nintendo public bool EnableDMC = true; NES nes; - public APU(NES nes) + public APU(NES nes, APU old = null) { this.nes = nes; dmc = new DMCUnit(this); + if (old != null) + { + EnableSquare1 = old.EnableSquare1; + EnableSquare2 = old.EnableSquare2; + EnableTriangle = old.EnableTriangle; + EnableNoise = old.EnableNoise; + EnableDMC = old.EnableDMC; + } } static int[] DMC_RATE_NTSC = { 428, 380, 340, 320, 286, 254, 226, 214, 190, 160, 142, 128, 106, 84, 72, 54 }; diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs index 3377861de1..78a8851abc 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs @@ -130,7 +130,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo ports[0] = new JoypadPortDevice(this, 0); ports[1] = new JoypadPortDevice(this, 1); - apu = new APU(this); + apu = new APU(this, apu); // don't replace the magicSoundProvider on reset, as it's not needed // if (magicSoundProvider != null) magicSoundProvider.Dispose();