diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IEmulator.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IEmulator.cs index b13d7e4dc8..2b55424647 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IEmulator.cs @@ -2,6 +2,7 @@ using System.Diagnostics; using BizHawk.Emulation.Common; +using System.Runtime.InteropServices; namespace BizHawk.Emulation.Cores.Nintendo.Gameboy { @@ -99,6 +100,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy GambatteState = IntPtr.Zero; } + _vram = IntPtr.Zero; + _oam = IntPtr.Zero; + _sppal = IntPtr.Zero; + _bgpal = IntPtr.Zero; + DisposeSound(); } } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs index 6ef428b33c..74412c7ff4 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs @@ -408,12 +408,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy #region ppudebug + public IntPtr _vram = IntPtr.Zero; + public IntPtr _bgpal = IntPtr.Zero; + public IntPtr _sppal = IntPtr.Zero; + public IntPtr _oam = IntPtr.Zero; + public GPUMemoryAreas GetGPU() - { - IntPtr _vram = IntPtr.Zero; - IntPtr _bgpal = IntPtr.Zero; - IntPtr _sppal = IntPtr.Zero; - IntPtr _oam = IntPtr.Zero; + { int unused = 0; if (!LibGambatte.gambatte_getmemoryarea(GambatteState, LibGambatte.MemoryAreas.vram, ref _vram, ref unused) || !LibGambatte.gambatte_getmemoryarea(GambatteState, LibGambatte.MemoryAreas.bgpal, ref _bgpal, ref unused) @@ -423,7 +424,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy throw new InvalidOperationException("Unexpected error in gambatte_getmemoryarea"); } return new GPUMemoryAreas(_vram, _oam, _sppal, _bgpal); - } /// <summary>