BizHawk/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.ISettable.cs

147 lines
4.4 KiB
C#
Raw Normal View History

2019-01-03 18:10:53 +00:00
using System;
using System.ComponentModel;
using Newtonsoft.Json;
using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.GBHawk;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
{
public partial class GBHawkLink : IEmulator, IStatable, ISettable<GBHawkLink.GBLinkSettings, GBHawkLink.GBLinkSyncSettings>
{
public GBLinkSettings GetSettings()
{
2019-01-03 23:31:35 +00:00
return linkSettings.Clone();
2019-01-03 18:10:53 +00:00
}
public GBLinkSyncSettings GetSyncSettings()
{
2019-01-03 23:31:35 +00:00
return linkSyncSettings.Clone();
2019-01-03 18:10:53 +00:00
}
public bool PutSettings(GBLinkSettings o)
{
2019-01-03 23:31:35 +00:00
linkSettings = o;
return false;
2019-01-03 18:10:53 +00:00
}
public bool PutSyncSettings(GBLinkSyncSettings o)
{
2019-01-03 23:31:35 +00:00
bool ret = GBLinkSyncSettings.NeedsReboot(linkSyncSettings, o);
linkSyncSettings = o;
return ret;
2019-01-03 18:10:53 +00:00
}
2019-01-03 23:31:35 +00:00
private GBLinkSettings linkSettings = new GBLinkSettings();
public GBLinkSyncSettings linkSyncSettings = new GBLinkSyncSettings();
2019-01-03 18:10:53 +00:00
public class GBLinkSettings
{
2019-01-03 23:31:35 +00:00
[DisplayName("Color Mode")]
[Description("Pick Between Green scale and Grey scale colors")]
[DefaultValue(GBHawk.GBHawk.GBSettings.PaletteType.BW)]
public GBHawk.GBHawk.GBSettings.PaletteType Palette_L { get; set; }
2019-01-03 18:10:53 +00:00
2019-01-03 23:31:35 +00:00
[DisplayName("Color Mode")]
[Description("Pick Between Green scale and Grey scale colors")]
[DefaultValue(GBHawk.GBHawk.GBSettings.PaletteType.BW)]
public GBHawk.GBHawk.GBSettings.PaletteType Palette_R { get; set; }
2019-01-03 18:10:53 +00:00
2019-01-03 23:31:35 +00:00
public enum AudioSrc
2019-01-03 18:10:53 +00:00
{
2019-01-03 23:31:35 +00:00
Left,
Right,
Both
2019-01-03 18:10:53 +00:00
}
2019-01-03 23:31:35 +00:00
[DisplayName("Audio Selection")]
[Description("Choose Audio Source. Both will produce Stereo sound.")]
[DefaultValue(AudioSrc.Left)]
public AudioSrc AudioSet { get; set; }
2019-01-03 18:10:53 +00:00
public GBLinkSettings Clone()
{
2019-01-03 23:31:35 +00:00
return (GBLinkSettings)MemberwiseClone();
2019-01-03 18:10:53 +00:00
}
}
public class GBLinkSyncSettings
{
2019-01-03 23:31:35 +00:00
[DisplayName("Console Mode L")]
[Description("Pick which console to run, 'Auto' chooses from ROM extension, 'GB' and 'GBC' chooses the respective system")]
[DefaultValue(GBHawk.GBHawk.GBSyncSettings.ConsoleModeType.Auto)]
public GBHawk.GBHawk.GBSyncSettings.ConsoleModeType ConsoleMode_L { get; set; }
[DisplayName("Console Mode R")]
[Description("Pick which console to run, 'Auto' chooses from ROM extension, 'GB' and 'GBC' chooses the respective system")]
[DefaultValue(GBHawk.GBHawk.GBSyncSettings.ConsoleModeType.Auto)]
public GBHawk.GBHawk.GBSyncSettings.ConsoleModeType ConsoleMode_R { get; set; }
[DisplayName("CGB in GBA")]
[Description("Emulate GBA hardware running a CGB game, instead of CGB hardware. Relevant only for titles that detect the presense of a GBA, such as Shantae.")]
[DefaultValue(false)]
public bool GBACGB { get; set; }
[DisplayName("RTC Initial Time L")]
[Description("Set the initial RTC time in terms of elapsed seconds.")]
[DefaultValue(0)]
public int RTCInitialTime_L
{
get { return _RTCInitialTime_L; }
set { _RTCInitialTime_L = Math.Max(0, Math.Min(1024 * 24 * 60 * 60, value)); }
}
2019-01-03 18:10:53 +00:00
2019-01-03 23:31:35 +00:00
[DisplayName("RTC Initial Time R")]
[Description("Set the initial RTC time in terms of elapsed seconds.")]
[DefaultValue(0)]
public int RTCInitialTime_R
2019-01-03 18:10:53 +00:00
{
2019-01-03 23:31:35 +00:00
get { return _RTCInitialTime_R; }
set { _RTCInitialTime_R = Math.Max(0, Math.Min(1024 * 24 * 60 * 60, value)); }
2019-01-03 18:10:53 +00:00
}
2019-01-03 23:31:35 +00:00
[DisplayName("Timer Div Initial Time L")]
[Description("Don't change from 0 unless it's hardware accurate. GBA GBC mode is known to be 8.")]
[DefaultValue(8)]
public int DivInitialTime_L
2019-01-03 18:10:53 +00:00
{
2019-01-03 23:31:35 +00:00
get { return _DivInitialTime_L; }
set { _DivInitialTime_L = Math.Min((ushort)65535, (ushort)value); }
2019-01-03 18:10:53 +00:00
}
2019-01-03 23:31:35 +00:00
[DisplayName("Timer Div Initial Time R")]
[Description("Don't change from 0 unless it's hardware accurate. GBA GBC mode is known to be 8.")]
[DefaultValue(8)]
public int DivInitialTime_R
{
get { return _DivInitialTime_R; }
set { _DivInitialTime_R = Math.Min((ushort)65535, (ushort)value); }
}
[DisplayName("Use Existing SaveRAM")]
[Description("When true, existing SaveRAM will be loaded at boot up")]
[DefaultValue(false)]
public bool Use_SRAM { get; set; }
[JsonIgnore]
private int _RTCInitialTime_L;
private int _RTCInitialTime_R;
[JsonIgnore]
2019-02-10 15:25:56 +00:00
public ushort _DivInitialTime_L = 8;
public ushort _DivInitialTime_R = 8;
2019-01-03 23:31:35 +00:00
2019-01-03 18:10:53 +00:00
public GBLinkSyncSettings Clone()
{
2019-01-03 23:31:35 +00:00
return (GBLinkSyncSettings)MemberwiseClone();
}
public static bool NeedsReboot(GBLinkSyncSettings x, GBLinkSyncSettings y)
{
return !DeepEquality.DeepEquals(x, y);
2019-01-03 18:10:53 +00:00
}
}
}
}