2017-03-01 02:44:05 +00:00
|
|
|
|
using System;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
|
|
using BizHawk.Common;
|
|
|
|
|
using BizHawk.Emulation.Common;
|
2014-12-05 03:16:08 +00:00
|
|
|
|
|
|
|
|
|
namespace BizHawk.Emulation.Cores.ColecoVision
|
|
|
|
|
{
|
2017-03-01 02:44:05 +00:00
|
|
|
|
public partial class ColecoVision : IEmulator, IStatable, ISettable<ColecoVision.ColecoSettings, ColecoVision.ColecoSyncSettings>
|
2014-12-05 03:16:08 +00:00
|
|
|
|
{
|
2017-03-01 02:44:05 +00:00
|
|
|
|
public ColecoSettings GetSettings()
|
2014-12-05 03:16:08 +00:00
|
|
|
|
{
|
2017-05-30 17:37:47 +00:00
|
|
|
|
return _settings.Clone();
|
2014-12-05 03:16:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ColecoSyncSettings GetSyncSettings()
|
|
|
|
|
{
|
|
|
|
|
return _syncSettings.Clone();
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-01 02:44:05 +00:00
|
|
|
|
public bool PutSettings(ColecoSettings o)
|
2014-12-05 03:16:08 +00:00
|
|
|
|
{
|
2017-05-30 17:37:47 +00:00
|
|
|
|
_settings = o;
|
2014-12-05 03:16:08 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool PutSyncSettings(ColecoSyncSettings o)
|
|
|
|
|
{
|
|
|
|
|
bool ret = o.SkipBiosIntro != _syncSettings.SkipBiosIntro;
|
2017-03-01 02:44:05 +00:00
|
|
|
|
ret |= ColecoSyncSettings.NeedsReboot(_syncSettings, o);
|
2014-12-05 03:16:08 +00:00
|
|
|
|
_syncSettings = o;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-01 02:44:05 +00:00
|
|
|
|
public class ColecoSettings
|
|
|
|
|
{
|
|
|
|
|
public ColecoSettings Clone()
|
|
|
|
|
{
|
|
|
|
|
return (ColecoSettings)MemberwiseClone();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-30 17:37:47 +00:00
|
|
|
|
private ColecoSettings _settings = new ColecoSettings();
|
|
|
|
|
private ColecoSyncSettings _syncSettings = new ColecoSyncSettings();
|
2014-12-05 03:16:08 +00:00
|
|
|
|
|
|
|
|
|
public class ColecoSyncSettings
|
|
|
|
|
{
|
|
|
|
|
public bool SkipBiosIntro { get; set; }
|
|
|
|
|
|
2017-03-01 02:44:05 +00:00
|
|
|
|
private string _port1 = ColecoVisionControllerDeck.DefaultControllerName;
|
|
|
|
|
private string _port2 = ColecoVisionControllerDeck.DefaultControllerName;
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public string Port1
|
|
|
|
|
{
|
2017-05-30 17:37:47 +00:00
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _port1;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-01 02:44:05 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (!ColecoVisionControllerDeck.ValidControllerTypes.ContainsKey(value))
|
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException("Invalid controller type: " + value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_port1 = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public string Port2
|
|
|
|
|
{
|
2017-05-30 17:37:47 +00:00
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _port2;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-01 02:44:05 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (!ColecoVisionControllerDeck.ValidControllerTypes.ContainsKey(value))
|
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException("Invalid controller type: " + value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_port2 = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-05 03:16:08 +00:00
|
|
|
|
public ColecoSyncSettings Clone()
|
|
|
|
|
{
|
|
|
|
|
return (ColecoSyncSettings)MemberwiseClone();
|
|
|
|
|
}
|
2017-03-01 02:44:05 +00:00
|
|
|
|
|
|
|
|
|
public static bool NeedsReboot(ColecoSyncSettings x, ColecoSyncSettings y)
|
|
|
|
|
{
|
|
|
|
|
return !DeepEquality.DeepEquals(x, y);
|
|
|
|
|
}
|
2014-12-05 03:16:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|