From e06a9218b8ad7e48bc909838afa2e4540b032cdc Mon Sep 17 00:00:00 2001 From: goyuken Date: Tue, 6 Nov 2012 01:41:22 +0000 Subject: [PATCH] nes hard reset no longer crashes. instead, certain sound channels stop playing (?) --- BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs index 5371aaa757..3377861de1 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs @@ -131,7 +131,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo ports[1] = new JoypadPortDevice(this, 1); apu = new APU(this); - if (magicSoundProvider != null) magicSoundProvider.Dispose(); + // don't replace the magicSoundProvider on reset, as it's not needed + // if (magicSoundProvider != null) magicSoundProvider.Dispose(); // set up region switch (cart.system) @@ -143,20 +144,23 @@ namespace BizHawk.Emulation.Consoles.Nintendo CoreOutputComm.VsyncNum = 50; CoreOutputComm.VsyncDen = 1; cpu_sequence = cpu_sequence_PAL; - magicSoundProvider = new MagicSoundProvider(this, 1662607); + if (magicSoundProvider == null) + magicSoundProvider = new MagicSoundProvider(this, 1662607); break; case "NES-NTSC": case "Famicom": ppu.region = PPU.Region.NTSC; cpu_sequence = cpu_sequence_NTSC; - magicSoundProvider = new MagicSoundProvider(this, 1789773); + if (magicSoundProvider == null) + magicSoundProvider = new MagicSoundProvider(this, 1789773); break; // there's no official name for these in bootgod, not sure what we should use //case "PC10"://TODO case "VS": ppu.region = PPU.Region.RGB; cpu_sequence = cpu_sequence_NTSC; - magicSoundProvider = new MagicSoundProvider(this, 1789773); + if (magicSoundProvider == null) + magicSoundProvider = new MagicSoundProvider(this, 1789773); vs_io = true; break; // this is in bootgod, but not used at all @@ -165,7 +169,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo CoreOutputComm.VsyncNum = 50; CoreOutputComm.VsyncDen = 1; cpu_sequence = cpu_sequence_NTSC; - magicSoundProvider = new MagicSoundProvider(this, 1773448); + if (magicSoundProvider == null) + magicSoundProvider = new MagicSoundProvider(this, 1773448); break; case null: Console.WriteLine("Unknown NES system! Defaulting to NTSC.");