From 79aec475a937e2f9f173692517f6854b4ee8c5e5 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 15 Mar 2020 09:42:48 -0500 Subject: [PATCH] refactor CoreComm usage in sega cores --- BizHawk.Emulation.Cores/Consoles/SNK/NeoGeoPort.cs | 2 +- .../Consoles/Sega/GGHawkLink/GGHawkLink.IEmulator.cs | 7 ------- .../Consoles/Sega/GGHawkLink/GGHawkLink.cs | 2 -- .../Consoles/Sega/SMS/SMS.IEmulator.cs | 2 -- BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs | 11 ++++++----- .../Consoles/Sega/gpgx64/GPGX.IEmulator.cs | 2 -- BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.cs | 2 ++ 7 files changed, 9 insertions(+), 19 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/SNK/NeoGeoPort.cs b/BizHawk.Emulation.Cores/Consoles/SNK/NeoGeoPort.cs index 442ac82358..731045a3d5 100644 --- a/BizHawk.Emulation.Cores/Consoles/SNK/NeoGeoPort.cs +++ b/BizHawk.Emulation.Cores/Consoles/SNK/NeoGeoPort.cs @@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Consoles.SNK { [Core("NeoPop", "Thomas Klausner, Mednafen Team", true, true, "0.9.44.1", "https://mednafen.github.io/releases/", false)] - public class NeoGeoPort : WaterboxCore, + public class NeoGeoPort : WaterboxCore, ISaveRam, // NGP provides its own saveram interface ISettable { diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IEmulator.cs b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IEmulator.cs index f745815fe7..d400e7ddda 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IEmulator.cs @@ -284,8 +284,6 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink _isLag = false; } - public CoreComm CoreComm { get; } - public void Dispose() { L.Dispose(); @@ -383,11 +381,6 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink R.DiscardSamples(); } - private void GetSamples(short[] samples) - { - - } - public void DisposeSound() { diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs index 1ba4be9669..71e1d491a3 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs @@ -32,8 +32,6 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink linkSyncSettings = (GGLinkSyncSettings)syncSettings ?? new GGLinkSyncSettings(); _controllerDeck = new GGHawkLinkControllerDeck(GGHawkLinkControllerDeck.DefaultControllerName, GGHawkLinkControllerDeck.DefaultControllerName); - CoreComm = comm; - var temp_set_L = new SMS.SmsSettings(); var temp_set_R = new SMS.SmsSettings(); diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IEmulator.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IEmulator.cs index aa5c80d230..dd4ef8e3c7 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IEmulator.cs @@ -170,8 +170,6 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem _isLag = false; } - public CoreComm CoreComm { get; } - public void Dispose() { if (blip_L != null) diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs index 29e1833c01..383169efd8 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs @@ -29,7 +29,6 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem ServiceProvider = new BasicServiceProvider(this); Settings = (SmsSettings)settings ?? new SmsSettings(); SyncSettings = (SmsSyncSettings)syncSettings ?? new SmsSyncSettings(); - CoreComm = comm; IsGameGear = game.System == "GG"; IsGameGear_C = game.System == "GG"; @@ -47,7 +46,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem if (game["PAL"] && Region != DisplayType.PAL) { Region = DisplayType.PAL; - CoreComm.Notify("Display was forced to PAL mode for game compatibility."); + comm.Notify("Display was forced to PAL mode for game compatibility."); } if (IsGameGear) @@ -64,13 +63,13 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem if (game["Japan"] && _region != SmsSyncSettings.Regions.Japan) { _region = SmsSyncSettings.Regions.Japan; - CoreComm.Notify("Region was forced to Japan for game compatibility."); + comm.Notify("Region was forced to Japan for game compatibility."); } if (game["Korea"] && _region != SmsSyncSettings.Regions.Korea) { _region = SmsSyncSettings.Regions.Korea; - CoreComm.Notify("Region was forced to Korea for game compatibility."); + comm.Notify("Region was forced to Korea for game compatibility."); } if ((game.NotInDatabase || game["FM"]) && SyncSettings.EnableFm && !IsGameGear) @@ -183,9 +182,11 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem { SaveRAM = new byte[int.Parse(game.OptionValue("SRAM"))]; Console.WriteLine(SaveRAM.Length); - } + } else if (game.NotInDatabase) + { SaveRAM = new byte[0x8000]; + } SetupMemoryDomains(); diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IEmulator.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IEmulator.cs index 8e2415cf73..0e010030b1 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IEmulator.cs @@ -86,8 +86,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx LagCount = 0; } - public CoreComm CoreComm { get; } - public void Dispose() { if (!_disposed) diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.cs index 15ea3da9eb..3c9f156d06 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.cs @@ -287,6 +287,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx } + private CoreComm CoreComm { get; } + void CDRead(int lba, IntPtr dest, bool audio) { if ((uint)_discIndex < _cds.Length)