From c1a746c7d6c80634e2b0eae18882ed702e1bb324 Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 30 May 2017 12:37:47 -0500 Subject: [PATCH] Don't expose Colecovision syncSettings, aquire sync settings the intended way instead --- .../ColecoVision/ColecoControllerSettings.cs | 2 +- .../config/INTV/IntvControllerSettings.cs | 3 +-- .../Consoles/Coleco/ColecoVision.ISettable.cs | 20 +++++++++++++------ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/BizHawk.Client.EmuHawk/config/ColecoVision/ColecoControllerSettings.cs b/BizHawk.Client.EmuHawk/config/ColecoVision/ColecoControllerSettings.cs index a995e564ce..82325dce5a 100644 --- a/BizHawk.Client.EmuHawk/config/ColecoVision/ColecoControllerSettings.cs +++ b/BizHawk.Client.EmuHawk/config/ColecoVision/ColecoControllerSettings.cs @@ -18,7 +18,7 @@ namespace BizHawk.Client.EmuHawk private void ColecoControllerSettings_Load(object sender, EventArgs e) { - _syncSettings = (Global.Emulator as ColecoVision)._syncSettings.Clone(); + _syncSettings = ((ColecoVision)Global.Emulator).GetSyncSettings().Clone(); var possibleControllers = ColecoVisionControllerDeck.ValidControllerTypes.Select(t => t.Key); diff --git a/BizHawk.Client.EmuHawk/config/INTV/IntvControllerSettings.cs b/BizHawk.Client.EmuHawk/config/INTV/IntvControllerSettings.cs index 42d4e28484..964c7cd37e 100644 --- a/BizHawk.Client.EmuHawk/config/INTV/IntvControllerSettings.cs +++ b/BizHawk.Client.EmuHawk/config/INTV/IntvControllerSettings.cs @@ -1,5 +1,4 @@ using System; -using System.Data; using System.Linq; using System.Windows.Forms; @@ -19,7 +18,7 @@ namespace BizHawk.Client.EmuHawk private void IntvControllerSettings_Load(object sender, EventArgs e) { - _syncSettings = (Global.Emulator as Intellivision).GetSyncSettings().Clone(); + _syncSettings = ((Intellivision)Global.Emulator).GetSyncSettings().Clone(); var possibleControllers = IntellivisionControllerDeck.ValidControllerTypes.Select(t => t.Key); diff --git a/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.ISettable.cs b/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.ISettable.cs index 3579934547..b043990793 100644 --- a/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.ISettable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.ISettable.cs @@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision { public ColecoSettings GetSettings() { - return Settings.Clone(); + return _settings.Clone(); } public ColecoSyncSettings GetSyncSettings() @@ -20,7 +20,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision public bool PutSettings(ColecoSettings o) { - Settings = o; + _settings = o; return false; } @@ -40,8 +40,8 @@ namespace BizHawk.Emulation.Cores.ColecoVision } } - public ColecoSettings Settings = new ColecoSettings(); - public ColecoSyncSettings _syncSettings = new ColecoSyncSettings(); + private ColecoSettings _settings = new ColecoSettings(); + private ColecoSyncSettings _syncSettings = new ColecoSyncSettings(); public class ColecoSyncSettings { @@ -53,7 +53,11 @@ namespace BizHawk.Emulation.Cores.ColecoVision [JsonIgnore] public string Port1 { - get { return _port1; } + get + { + return _port1; + } + set { if (!ColecoVisionControllerDeck.ValidControllerTypes.ContainsKey(value)) @@ -68,7 +72,11 @@ namespace BizHawk.Emulation.Cores.ColecoVision [JsonIgnore] public string Port2 { - get { return _port2; } + get + { + return _port2; + } + set { if (!ColecoVisionControllerDeck.ValidControllerTypes.ContainsKey(value))