diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs index 54436ecdd6..9034d0c730 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs @@ -397,9 +397,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx } } - private readonly MemoryCallbackSystem _memoryCallbacks = new MemoryCallbackSystem(); - public IMemoryCallbackSystem MemoryCallbacks { get { return _memoryCallbacks; } } - #endregion // TODO: use render and rendersound @@ -425,8 +422,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx Frame++; drivelight = false; - RefreshMemCallbacks(); - LibGPGX.gpgx_advance(); update_video(); update_audio(); @@ -657,6 +652,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx LibGPGX.gpgx_flush_vram(); // fully regenerate internal caches as needed } + private readonly MemoryCallbackSystem _memoryCallbacks = new MemoryCallbackSystem(); + public IMemoryCallbackSystem MemoryCallbacks { get { return _memoryCallbacks; } } + LibGPGX.mem_cb ExecCallback; LibGPGX.mem_cb ReadCallback; LibGPGX.mem_cb WriteCallback; @@ -666,6 +664,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx ExecCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallExecute(a)); ReadCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallRead(a)); WriteCallback = new LibGPGX.mem_cb(a => MemoryCallbacks.CallWrite(a)); + _memoryCallbacks.ActiveChanged += RefreshMemCallbacks; } void RefreshMemCallbacks()