From 9041281b7291358f56490ad2895f1afb96ddd17f Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 17 Jan 2015 19:10:58 +0000 Subject: [PATCH] GambatteLink - break up into separate files --- .../BizHawk.Emulation.Cores.csproj | 21 +- .../Gameboy/GambatteLink.IDebuggable.cs | 49 +++ .../Gameboy/GambatteLink.IInputPollable.cs | 19 + .../Gameboy/GambatteLink.IMemoryDomains.cs | 31 ++ .../Nintendo/Gameboy/GambatteLink.ISaveRam.cs | 36 ++ .../Gameboy/GambatteLink.ISettable.cs | 81 +++++ .../Gameboy/GambatteLink.IStatable.cs | 111 ++++++ .../Gameboy/GambatteLink.IVideoProvider.cs | 25 ++ .../Consoles/Nintendo/Gameboy/GambatteLink.cs | 331 ++---------------- 9 files changed, 390 insertions(+), 314 deletions(-) create mode 100644 BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IDebuggable.cs create mode 100644 BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IInputPollable.cs create mode 100644 BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IMemoryDomains.cs create mode 100644 BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.ISaveRam.cs create mode 100644 BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.ISettable.cs create mode 100644 BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IStatable.cs create mode 100644 BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IVideoProvider.cs diff --git a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj index 48df255029..f546d81915 100644 --- a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj +++ b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj @@ -301,27 +301,34 @@ - Gambatte.cs + Gambatte.cs - Gambatte.cs + Gambatte.cs - Gambatte.cs + Gambatte.cs - Gambatte.cs + Gambatte.cs - Gambatte.cs + Gambatte.cs - Gambatte.cs + Gambatte.cs - Gambatte.cs + Gambatte.cs + + + + + + + diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IDebuggable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IDebuggable.cs new file mode 100644 index 0000000000..87934683da --- /dev/null +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IDebuggable.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using BizHawk.Emulation.Common; + +namespace BizHawk.Emulation.Cores.Nintendo.Gameboy +{ + public partial class GambatteLink : IDebuggable + { + public IDictionary GetCpuFlagsAndRegisters() + { + var left = L.GetCpuFlagsAndRegisters() + .Select(reg => new KeyValuePair("Left " + reg.Key, reg.Value)); + + var right = R.GetCpuFlagsAndRegisters() + .Select(reg => new KeyValuePair("Right " + reg.Key, reg.Value)); + + return left.Union(right).ToList().ToDictionary(pair => pair.Key, pair => pair.Value); + } + + public void SetCpuRegister(string register, int value) + { + if (register.StartsWith("Left ")) + { + L.SetCpuRegister(register.Replace("Left ", ""), value); + } + else if (register.StartsWith("Right ")) + { + R.SetCpuRegister(register.Replace("Right ", ""), value); + } + } + + public IMemoryCallbackSystem MemoryCallbacks + { + get { return _memorycallbacks; } + } + + public bool CanStep(StepType type) + { + return false; + } + + [FeatureNotImplemented] + public void Step(StepType type) { throw new NotImplementedException(); } + + private readonly MemoryCallbackSystem _memorycallbacks = new MemoryCallbackSystem(); + } +} diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IInputPollable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IInputPollable.cs new file mode 100644 index 0000000000..efddc620da --- /dev/null +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IInputPollable.cs @@ -0,0 +1,19 @@ +using System; +using BizHawk.Emulation.Common; + +namespace BizHawk.Emulation.Cores.Nintendo.Gameboy +{ + public partial class GambatteLink : IInputPollable + { + public int LagCount { get; set; } + + public bool IsLagFrame { get; private set; } + + public IInputCallbackSystem InputCallbacks + { + get { return _inputCallbacks; } + } + + private InputCallbackSystem _inputCallbacks = new InputCallbackSystem(); + } +} diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IMemoryDomains.cs new file mode 100644 index 0000000000..4d7bae9629 --- /dev/null +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IMemoryDomains.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using BizHawk.Emulation.Common; + +namespace BizHawk.Emulation.Cores.Nintendo.Gameboy +{ + public partial class GambatteLink + { + private IMemoryDomains _memoryDomains; + + private void SetMemoryDomains() + { + var mm = new List(); + + foreach (var md in L.MemoryDomains) + { + mm.Add(new MemoryDomain("L " + md.Name, md.Size, md.EndianType, md.PeekByte, md.PokeByte)); + } + + foreach (var md in R.MemoryDomains) + { + mm.Add(new MemoryDomain("R " + md.Name, md.Size, md.EndianType, md.PeekByte, md.PokeByte)); + } + + _memoryDomains = new MemoryDomainList(mm); + (ServiceProvider as BasicServiceProvider).Register(_memoryDomains); + } + } +} diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.ISaveRam.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.ISaveRam.cs new file mode 100644 index 0000000000..dd14a5221a --- /dev/null +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.ISaveRam.cs @@ -0,0 +1,36 @@ +using System; +using BizHawk.Emulation.Common; + +namespace BizHawk.Emulation.Cores.Nintendo.Gameboy +{ + public partial class GambatteLink : ISaveRam + { + public bool SaveRamModified + { + get + { + return L.SaveRamModified || R.SaveRamModified; + } + } + + public byte[] CloneSaveRam() + { + byte[] lb = L.CloneSaveRam(); + byte[] rb = R.CloneSaveRam(); + byte[] ret = new byte[lb.Length + rb.Length]; + Buffer.BlockCopy(lb, 0, ret, 0, lb.Length); + Buffer.BlockCopy(rb, 0, ret, lb.Length, rb.Length); + return ret; + } + + public void StoreSaveRam(byte[] data) + { + byte[] lb = new byte[L.CloneSaveRam().Length]; + byte[] rb = new byte[R.CloneSaveRam().Length]; + Buffer.BlockCopy(data, 0, lb, 0, lb.Length); + Buffer.BlockCopy(data, lb.Length, rb, 0, rb.Length); + L.StoreSaveRam(lb); + R.StoreSaveRam(rb); + } + } +} diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.ISettable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.ISettable.cs new file mode 100644 index 0000000000..a1ecea1798 --- /dev/null +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.ISettable.cs @@ -0,0 +1,81 @@ +using System; +using BizHawk.Emulation.Common; + +namespace BizHawk.Emulation.Cores.Nintendo.Gameboy +{ + public partial class GambatteLink : ISettable + { + public GambatteLinkSettings GetSettings() + { + return new GambatteLinkSettings + ( + L.GetSettings(), + R.GetSettings() + ); + } + public GambatteLinkSyncSettings GetSyncSettings() + { + return new GambatteLinkSyncSettings + ( + L.GetSyncSettings(), + R.GetSyncSettings() + ); + } + + public bool PutSettings(GambatteLinkSettings o) + { + return L.PutSettings(o.L) || R.PutSettings(o.R); + } + + public bool PutSyncSettings(GambatteLinkSyncSettings o) + { + return L.PutSyncSettings(o.L) || R.PutSyncSettings(o.R); + } + + public class GambatteLinkSettings + { + public Gameboy.GambatteSettings L; + public Gameboy.GambatteSettings R; + + public GambatteLinkSettings() + { + L = new Gameboy.GambatteSettings(); + R = new Gameboy.GambatteSettings(); + } + + public GambatteLinkSettings(Gameboy.GambatteSettings L, Gameboy.GambatteSettings R) + { + this.L = L; + this.R = R; + } + + public GambatteLinkSettings Clone() + { + return new GambatteLinkSettings(L.Clone(), R.Clone()); + } + } + + public class GambatteLinkSyncSettings + { + public Gameboy.GambatteSyncSettings L; + public Gameboy.GambatteSyncSettings R; + + public GambatteLinkSyncSettings() + { + L = new Gameboy.GambatteSyncSettings(); + R = new Gameboy.GambatteSyncSettings(); + } + + public GambatteLinkSyncSettings(Gameboy.GambatteSyncSettings L, Gameboy.GambatteSyncSettings R) + { + this.L = L; + this.R = R; + } + + public GambatteLinkSyncSettings Clone() + { + return new GambatteLinkSyncSettings(L.Clone(), R.Clone()); + } + } + } +} diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IStatable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IStatable.cs new file mode 100644 index 0000000000..b84396a207 --- /dev/null +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IStatable.cs @@ -0,0 +1,111 @@ +using System; +using System.IO; +using Newtonsoft.Json; + +using BizHawk.Emulation.Common; + +namespace BizHawk.Emulation.Cores.Nintendo.Gameboy +{ + public partial class GambatteLink : IStatable + { + public bool BinarySaveStatesPreferred { get { return true; } } + + public void SaveStateText(TextWriter writer) + { + var s = new DGBSerialized + { + L = L.SaveState(), + R = R.SaveState(), + IsLagFrame = IsLagFrame, + LagCount = LagCount, + Frame = Frame, + overflowL = overflowL, + overflowR = overflowR, + LatchL = LatchL, + LatchR = LatchR, + cableconnected = cableconnected, + cablediscosignal = cablediscosignal + }; + ser.Serialize(writer, s); + // write extra copy of stuff we don't use + // is this needed anymore?? + writer.WriteLine(); + writer.WriteLine("Frame {0}", Frame); + } + + public void LoadStateText(TextReader reader) + { + var s = (DGBSerialized)ser.Deserialize(reader, typeof(DGBSerialized)); + L.LoadState(s.L); + R.LoadState(s.R); + IsLagFrame = s.IsLagFrame; + LagCount = s.LagCount; + Frame = s.Frame; + overflowL = s.overflowL; + overflowR = s.overflowR; + LatchL = s.LatchL; + LatchR = s.LatchR; + cableconnected = s.cableconnected; + cablediscosignal = s.cablediscosignal; + } + + public void SaveStateBinary(BinaryWriter writer) + { + L.SaveStateBinary(writer); + R.SaveStateBinary(writer); + // other variables + writer.Write(IsLagFrame); + writer.Write(LagCount); + writer.Write(Frame); + writer.Write(overflowL); + writer.Write(overflowR); + writer.Write(LatchL); + writer.Write(LatchR); + writer.Write(cableconnected); + writer.Write(cablediscosignal); + } + + public void LoadStateBinary(BinaryReader reader) + { + L.LoadStateBinary(reader); + R.LoadStateBinary(reader); + // other variables + IsLagFrame = reader.ReadBoolean(); + LagCount = reader.ReadInt32(); + Frame = reader.ReadInt32(); + overflowL = reader.ReadInt32(); + overflowR = reader.ReadInt32(); + LatchL = reader.ReadInt32(); + LatchR = reader.ReadInt32(); + cableconnected = reader.ReadBoolean(); + cablediscosignal = reader.ReadBoolean(); + } + + public byte[] SaveStateBinary() + { + MemoryStream ms = new MemoryStream(); + BinaryWriter bw = new BinaryWriter(ms); + SaveStateBinary(bw); + bw.Flush(); + return ms.ToArray(); + } + + private JsonSerializer ser = new JsonSerializer { Formatting = Formatting.Indented }; + + private class DGBSerialized + { + public TextState L; + public TextState R; + // other data + public bool IsLagFrame; + public int LagCount; + public int Frame; + public int overflowL; + public int overflowR; + public int LatchL; + public int LatchR; + public bool cableconnected; + public bool cablediscosignal; + } + } +} diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IVideoProvider.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IVideoProvider.cs new file mode 100644 index 0000000000..1a2848b02e --- /dev/null +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IVideoProvider.cs @@ -0,0 +1,25 @@ +using System; +using BizHawk.Emulation.Common; + +namespace BizHawk.Emulation.Cores.Nintendo.Gameboy +{ + public partial class GambatteLink : IVideoProvider + { + public int VirtualWidth { get { return 320; } } + public int VirtualHeight { get { return 144; } } + public int BufferWidth { get { return 320; } } + public int BufferHeight { get { return 144; } } + + public int BackgroundColor + { + get { return unchecked((int)0xff000000); } + } + + public int[] GetVideoBuffer() + { + return VideoBuffer; + } + + private int[] VideoBuffer = new int[160 * 2 * 144]; + } +} diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs index 639486d247..ed4d92db21 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs @@ -18,31 +18,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy isReleased: true )] [ServiceNotApplicable(typeof(IDriveLight))] - public class GambatteLink : IEmulator, IVideoProvider, ISyncSoundProvider, IInputPollable, ISaveRam, IStatable, + public partial class GambatteLink : IEmulator, IVideoProvider, ISyncSoundProvider, IInputPollable, ISaveRam, IStatable, IDebuggable, ISettable { - bool disposed = false; - - Gameboy L; - Gameboy R; - // counter to ensure we do 35112 samples per frame - int overflowL = 0; - int overflowR = 0; - /// if true, the link cable is currently connected - bool cableconnected = true; - /// if true, the link cable toggle signal is currently asserted - bool cablediscosignal = false; - - const int SampPerFrame = 35112; - - LibsnesCore.SnesSaveController LCont = new LibsnesCore.SnesSaveController(Gameboy.GbController); - LibsnesCore.SnesSaveController RCont = new LibsnesCore.SnesSaveController(Gameboy.GbController); - - public bool IsCGBMode(bool right) - { - return right ? R.IsCGBMode() : L.IsCGBMode(); - } - public GambatteLink(CoreComm comm, GameInfo leftinfo, byte[] leftrom, GameInfo rightinfo, byte[] rightrom, object Settings, object SyncSettings, bool deterministic) { ServiceProvider = new BasicServiceProvider(this); @@ -85,12 +63,29 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy SetMemoryDomains(); } - public IEmulatorServiceProvider ServiceProvider { get; private set; } + bool disposed = false; - private InputCallbackSystem _inputCallbacks = new InputCallbackSystem(); - public IInputCallbackSystem InputCallbacks { get { return _inputCallbacks; } } - private readonly MemoryCallbackSystem _memorycallbacks = new MemoryCallbackSystem(); - public IMemoryCallbackSystem MemoryCallbacks { get { return _memorycallbacks; } } + Gameboy L; + Gameboy R; + // counter to ensure we do 35112 samples per frame + int overflowL = 0; + int overflowR = 0; + /// if true, the link cable is currently connected + bool cableconnected = true; + /// if true, the link cable toggle signal is currently asserted + bool cablediscosignal = false; + + const int SampPerFrame = 35112; + + LibsnesCore.SnesSaveController LCont = new LibsnesCore.SnesSaveController(Gameboy.GbController); + LibsnesCore.SnesSaveController RCont = new LibsnesCore.SnesSaveController(Gameboy.GbController); + + public bool IsCGBMode(bool right) + { + return right ? R.IsCGBMode() : L.IsCGBMode(); + } + + public IEmulatorServiceProvider ServiceProvider { get; private set; } public ISoundProvider SoundProvider { get { return null; } } public ISyncSoundProvider SyncSoundProvider { get { return this; } } @@ -227,8 +222,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy } public int Frame { get; private set; } - public int LagCount { get; set; } - public bool IsLagFrame { get; private set; } + public string SystemId { get { return "DGB"; } } public bool DeterministicEmulation { get { return L.DeterministicEmulation && R.DeterministicEmulation; } } @@ -260,207 +254,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy } } - #region saveram - - public byte[] CloneSaveRam() - { - byte[] lb = L.CloneSaveRam(); - byte[] rb = R.CloneSaveRam(); - byte[] ret = new byte[lb.Length + rb.Length]; - Buffer.BlockCopy(lb, 0, ret, 0, lb.Length); - Buffer.BlockCopy(rb, 0, ret, lb.Length, rb.Length); - return ret; - } - - public void StoreSaveRam(byte[] data) - { - byte[] lb = new byte[L.CloneSaveRam().Length]; - byte[] rb = new byte[R.CloneSaveRam().Length]; - Buffer.BlockCopy(data, 0, lb, 0, lb.Length); - Buffer.BlockCopy(data, lb.Length, rb, 0, rb.Length); - L.StoreSaveRam(lb); - R.StoreSaveRam(rb); - } - - public bool SaveRamModified - { - get - { - return L.SaveRamModified || R.SaveRamModified; - } - - [FeatureNotImplemented] - set - { - throw new NotImplementedException(); - } - } - - #endregion - - #region savestates - - JsonSerializer ser = new JsonSerializer { Formatting = Formatting.Indented }; - - private class DGBSerialized - { - public TextState L; - public TextState R; - // other data - public bool IsLagFrame; - public int LagCount; - public int Frame; - public int overflowL; - public int overflowR; - public int LatchL; - public int LatchR; - public bool cableconnected; - public bool cablediscosignal; - } - - public void SaveStateText(TextWriter writer) - { - var s = new DGBSerialized - { - L = L.SaveState(), - R = R.SaveState(), - IsLagFrame = IsLagFrame, - LagCount = LagCount, - Frame = Frame, - overflowL = overflowL, - overflowR = overflowR, - LatchL = LatchL, - LatchR = LatchR, - cableconnected = cableconnected, - cablediscosignal = cablediscosignal - }; - ser.Serialize(writer, s); - // write extra copy of stuff we don't use - // is this needed anymore?? - writer.WriteLine(); - writer.WriteLine("Frame {0}", Frame); - } - - public void LoadStateText(TextReader reader) - { - var s = (DGBSerialized)ser.Deserialize(reader, typeof(DGBSerialized)); - L.LoadState(s.L); - R.LoadState(s.R); - IsLagFrame = s.IsLagFrame; - LagCount = s.LagCount; - Frame = s.Frame; - overflowL = s.overflowL; - overflowR = s.overflowR; - LatchL = s.LatchL; - LatchR = s.LatchR; - cableconnected = s.cableconnected; - cablediscosignal = s.cablediscosignal; - } - - public void SaveStateBinary(BinaryWriter writer) - { - L.SaveStateBinary(writer); - R.SaveStateBinary(writer); - // other variables - writer.Write(IsLagFrame); - writer.Write(LagCount); - writer.Write(Frame); - writer.Write(overflowL); - writer.Write(overflowR); - writer.Write(LatchL); - writer.Write(LatchR); - writer.Write(cableconnected); - writer.Write(cablediscosignal); - } - - public void LoadStateBinary(BinaryReader reader) - { - L.LoadStateBinary(reader); - R.LoadStateBinary(reader); - // other variables - IsLagFrame = reader.ReadBoolean(); - LagCount = reader.ReadInt32(); - Frame = reader.ReadInt32(); - overflowL = reader.ReadInt32(); - overflowR = reader.ReadInt32(); - LatchL = reader.ReadInt32(); - LatchR = reader.ReadInt32(); - cableconnected = reader.ReadBoolean(); - cablediscosignal = reader.ReadBoolean(); - } - - public byte[] SaveStateBinary() - { - MemoryStream ms = new MemoryStream(); - BinaryWriter bw = new BinaryWriter(ms); - SaveStateBinary(bw); - bw.Flush(); - return ms.ToArray(); - } - - public bool BinarySaveStatesPreferred { get { return true; } } - - #endregion - - #region debugging - - private IMemoryDomains _memoryDomains; - - public IDictionary GetCpuFlagsAndRegisters() - { - var left = L.GetCpuFlagsAndRegisters() - .Select(reg => new KeyValuePair("Left " + reg.Key, reg.Value)); - - var right = R.GetCpuFlagsAndRegisters() - .Select(reg => new KeyValuePair("Right " + reg.Key, reg.Value)); - - return left.Union(right).ToList().ToDictionary(pair => pair.Key, pair => pair.Value); - } - - public void SetCpuRegister(string register, int value) - { - if (register.StartsWith("Left ")) - { - L.SetCpuRegister(register.Replace("Left ", ""), value); - } - else if (register.StartsWith("Right ")) - { - R.SetCpuRegister(register.Replace("Right ", ""), value); - } - } - - void SetMemoryDomains() - { - var mm = new List(); - - foreach (var md in L.MemoryDomains) - mm.Add(new MemoryDomain("L " + md.Name, md.Size, md.EndianType, md.PeekByte, md.PokeByte)); - foreach (var md in R.MemoryDomains) - mm.Add(new MemoryDomain("R " + md.Name, md.Size, md.EndianType, md.PeekByte, md.PokeByte)); - - _memoryDomains = new MemoryDomainList(mm); - (ServiceProvider as BasicServiceProvider).Register(_memoryDomains); - } - - public bool CanStep(StepType type) { return false; } - - [FeatureNotImplemented] - public void Step(StepType type) { throw new NotImplementedException(); } - - #endregion - - #region VideoProvider - - int[] VideoBuffer = new int[160 * 2 * 144]; - public int[] GetVideoBuffer() { return VideoBuffer; } - public int VirtualWidth { get { return 320; } } - public int VirtualHeight { get { return 144; } } - public int BufferWidth { get { return 320; } } - public int BufferHeight { get { return 144; } } - public int BackgroundColor { get { return unchecked((int)0xff000000); } } - - #endregion - #region SoundProvider // i tried using the left and right buffers and then mixing them together... it was kind of a mess of code, and slow @@ -544,81 +337,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy } #endregion - - #region settings - - public GambatteLinkSettings GetSettings() - { - return new GambatteLinkSettings - ( - L.GetSettings(), - R.GetSettings() - ); - } - public GambatteLinkSyncSettings GetSyncSettings() - { - return new GambatteLinkSyncSettings - ( - L.GetSyncSettings(), - R.GetSyncSettings() - ); - } - public bool PutSettings(GambatteLinkSettings o) - { - return L.PutSettings(o.L) || R.PutSettings(o.R); - } - public bool PutSyncSettings(GambatteLinkSyncSettings o) - { - return L.PutSyncSettings(o.L) || R.PutSyncSettings(o.R); - } - - public class GambatteLinkSettings - { - public Gameboy.GambatteSettings L; - public Gameboy.GambatteSettings R; - - public GambatteLinkSettings() - { - L = new Gameboy.GambatteSettings(); - R = new Gameboy.GambatteSettings(); - } - - public GambatteLinkSettings(Gameboy.GambatteSettings L, Gameboy.GambatteSettings R) - { - this.L = L; - this.R = R; - } - - public GambatteLinkSettings Clone() - { - return new GambatteLinkSettings(L.Clone(), R.Clone()); - } - } - - public class GambatteLinkSyncSettings - { - public Gameboy.GambatteSyncSettings L; - public Gameboy.GambatteSyncSettings R; - - public GambatteLinkSyncSettings() - { - L = new Gameboy.GambatteSyncSettings(); - R = new Gameboy.GambatteSyncSettings(); - } - - public GambatteLinkSyncSettings(Gameboy.GambatteSyncSettings L, Gameboy.GambatteSyncSettings R) - { - this.L = L; - this.R = R; - } - - public GambatteLinkSyncSettings Clone() - { - return new GambatteLinkSyncSettings(L.Clone(), R.Clone()); - } - } - - #endregion - } }