Misc code cleanups in Emulation.Common
This commit is contained in:
parent
a87096fb85
commit
b3dd9d26dc
|
@ -1,8 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Common
|
namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
|
@ -48,7 +46,10 @@ namespace BizHawk.Emulation.Common
|
||||||
where T : IEmulatorService
|
where T : IEmulatorService
|
||||||
{
|
{
|
||||||
if (provider == null)
|
if (provider == null)
|
||||||
|
{
|
||||||
throw new ArgumentNullException("provider");
|
throw new ArgumentNullException("provider");
|
||||||
|
}
|
||||||
|
|
||||||
Services[typeof(T)] = provider;
|
Services[typeof(T)] = provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,8 +63,10 @@ namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
object service;
|
object service;
|
||||||
if (Services.TryGetValue(t, out service))
|
if (Services.TryGetValue(t, out service))
|
||||||
|
{
|
||||||
return service;
|
return service;
|
||||||
else
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace BizHawk.Emulation.Common
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var dummy = debuggableCore.GetCpuFlagsAndRegisters();
|
debuggableCore.GetCpuFlagsAndRegisters();
|
||||||
}
|
}
|
||||||
catch (NotImplementedException)
|
catch (NotImplementedException)
|
||||||
{
|
{
|
||||||
|
|
|
@ -118,10 +118,14 @@ namespace BizHawk.Emulation.Common
|
||||||
|
|
||||||
List<string>[] ret = new List<string>[9];
|
List<string>[] ret = new List<string>[9];
|
||||||
for (int i = 0; i < ret.Length; i++)
|
for (int i = 0; i < ret.Length; i++)
|
||||||
|
{
|
||||||
ret[i] = new List<string>();
|
ret[i] = new List<string>();
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < list.Count; i++)
|
for (int i = 0; i < list.Count; i++)
|
||||||
|
{
|
||||||
ret[PlayerNumber(list[i])].Add(list[i]);
|
ret[PlayerNumber(list[i])].Add(list[i]);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +135,10 @@ namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
int player = 0;
|
int player = 0;
|
||||||
if (buttonName.Length > 3 && buttonName.StartsWith("P") && char.IsNumber(buttonName[1]))
|
if (buttonName.Length > 3 && buttonName.StartsWith("P") && char.IsNumber(buttonName[1]))
|
||||||
|
{
|
||||||
player = buttonName[1] - '0';
|
player = buttonName[1] - '0';
|
||||||
|
}
|
||||||
|
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace BizHawk.Emulation.Common
|
||||||
|
|
||||||
foreach (var action in actions)
|
foreach (var action in actions)
|
||||||
{
|
{
|
||||||
this.Remove(action);
|
Remove(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasAny = this.Any();
|
var hasAny = this.Any();
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Common
|
namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
|
@ -17,11 +15,11 @@ namespace BizHawk.Emulation.Common
|
||||||
private readonly List<IMemoryCallback> Writes = new List<IMemoryCallback>();
|
private readonly List<IMemoryCallback> Writes = new List<IMemoryCallback>();
|
||||||
private readonly List<IMemoryCallback> Execs = new List<IMemoryCallback>();
|
private readonly List<IMemoryCallback> Execs = new List<IMemoryCallback>();
|
||||||
|
|
||||||
bool empty = true;
|
private bool _empty = true;
|
||||||
|
|
||||||
private bool _hasReads = false;
|
private bool _hasReads;
|
||||||
private bool _hasWrites = false;
|
private bool _hasWrites;
|
||||||
private bool _hasExecutes = false;
|
private bool _hasExecutes;
|
||||||
|
|
||||||
public bool ExecuteCallbacksAvailable { get; set; }
|
public bool ExecuteCallbacksAvailable { get; set; }
|
||||||
|
|
||||||
|
@ -42,9 +40,13 @@ namespace BizHawk.Emulation.Common
|
||||||
_hasWrites = true;
|
_hasWrites = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (empty)
|
|
||||||
|
if (_empty)
|
||||||
|
{
|
||||||
Changes();
|
Changes();
|
||||||
empty = false;
|
}
|
||||||
|
|
||||||
|
_empty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Call(List<IMemoryCallback> cbs, uint addr)
|
private static void Call(List<IMemoryCallback> cbs, uint addr)
|
||||||
|
@ -119,9 +121,9 @@ namespace BizHawk.Emulation.Common
|
||||||
if (RemoveInternal(action) > 0)
|
if (RemoveInternal(action) > 0)
|
||||||
{
|
{
|
||||||
bool newEmpty = !HasReads && !HasWrites && !HasExecutes;
|
bool newEmpty = !HasReads && !HasWrites && !HasExecutes;
|
||||||
if (newEmpty != empty)
|
if (newEmpty != _empty)
|
||||||
Changes();
|
Changes();
|
||||||
empty = newEmpty;
|
_empty = newEmpty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,9 +137,9 @@ namespace BizHawk.Emulation.Common
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
bool newEmpty = !HasReads && !HasWrites && !HasExecutes;
|
bool newEmpty = !HasReads && !HasWrites && !HasExecutes;
|
||||||
if (newEmpty != empty)
|
if (newEmpty != _empty)
|
||||||
Changes();
|
Changes();
|
||||||
empty = newEmpty;
|
_empty = newEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateHasVariables();
|
UpdateHasVariables();
|
||||||
|
@ -148,9 +150,9 @@ namespace BizHawk.Emulation.Common
|
||||||
Reads.Clear();
|
Reads.Clear();
|
||||||
Writes.Clear();
|
Writes.Clear();
|
||||||
Execs.Clear();
|
Execs.Clear();
|
||||||
if (!empty)
|
if (!_empty)
|
||||||
Changes();
|
Changes();
|
||||||
empty = true;
|
_empty = true;
|
||||||
|
|
||||||
UpdateHasVariables();
|
UpdateHasVariables();
|
||||||
}
|
}
|
||||||
|
@ -169,23 +171,39 @@ namespace BizHawk.Emulation.Common
|
||||||
public IEnumerator<IMemoryCallback> GetEnumerator()
|
public IEnumerator<IMemoryCallback> GetEnumerator()
|
||||||
{
|
{
|
||||||
foreach (var imc in Reads)
|
foreach (var imc in Reads)
|
||||||
|
{
|
||||||
yield return imc;
|
yield return imc;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var imc in Writes)
|
foreach (var imc in Writes)
|
||||||
|
{
|
||||||
yield return imc;
|
yield return imc;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var imc in Execs)
|
foreach (var imc in Execs)
|
||||||
|
{
|
||||||
yield return imc;
|
yield return imc;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator()
|
IEnumerator IEnumerable.GetEnumerator()
|
||||||
{
|
{
|
||||||
foreach (var imc in Reads)
|
foreach (var imc in Reads)
|
||||||
|
{
|
||||||
yield return imc;
|
yield return imc;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var imc in Writes)
|
foreach (var imc in Writes)
|
||||||
|
{
|
||||||
yield return imc;
|
yield return imc;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var imc in Execs)
|
foreach (var imc in Execs)
|
||||||
|
{
|
||||||
yield return imc;
|
yield return imc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class MemoryCallback : IMemoryCallback
|
public class MemoryCallback : IMemoryCallback
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -30,7 +30,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
|
||||||
|
|
||||||
public static IMemoryDomains AsMemoryDomains(this IEmulator core)
|
public static IMemoryDomains AsMemoryDomains(this IEmulator core)
|
||||||
{
|
{
|
||||||
return (IMemoryDomains)core.ServiceProvider.GetService<IMemoryDomains>();
|
return core.ServiceProvider.GetService<IMemoryDomains>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool HasSaveRam(this IEmulator core)
|
public static bool HasSaveRam(this IEmulator core)
|
||||||
|
@ -45,7 +45,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
|
||||||
|
|
||||||
public static ISaveRam AsSaveRam(this IEmulator core)
|
public static ISaveRam AsSaveRam(this IEmulator core)
|
||||||
{
|
{
|
||||||
return (ISaveRam)core.ServiceProvider.GetService<ISaveRam>();
|
return core.ServiceProvider.GetService<ISaveRam>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool HasSavestates(this IEmulator core)
|
public static bool HasSavestates(this IEmulator core)
|
||||||
|
@ -60,7 +60,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
|
||||||
|
|
||||||
public static IStatable AsStatable(this IEmulator core)
|
public static IStatable AsStatable(this IEmulator core)
|
||||||
{
|
{
|
||||||
return (IStatable)core.ServiceProvider.GetService<IStatable>();
|
return core.ServiceProvider.GetService<IStatable>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CanPollInput(this IEmulator core)
|
public static bool CanPollInput(this IEmulator core)
|
||||||
|
@ -75,7 +75,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
|
||||||
|
|
||||||
public static IInputPollable AsInputPollable(this IEmulator core)
|
public static IInputPollable AsInputPollable(this IEmulator core)
|
||||||
{
|
{
|
||||||
return (IInputPollable)core.ServiceProvider.GetService<IInputPollable>();
|
return core.ServiceProvider.GetService<IInputPollable>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool InputCallbacksAvailable(this IEmulator core)
|
public static bool InputCallbacksAvailable(this IEmulator core)
|
||||||
|
@ -86,7 +86,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this is a pretty ugly way to handle this
|
// TODO: this is a pretty ugly way to handle this
|
||||||
var pollable = (IInputPollable)core.ServiceProvider.GetService<IInputPollable>();
|
var pollable = core.ServiceProvider.GetService<IInputPollable>();
|
||||||
if (pollable != null)
|
if (pollable != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -115,7 +115,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
|
||||||
|
|
||||||
public static IDriveLight AsDriveLight(this IEmulator core)
|
public static IDriveLight AsDriveLight(this IEmulator core)
|
||||||
{
|
{
|
||||||
return (IDriveLight)core.ServiceProvider.GetService<IDriveLight>();
|
return core.ServiceProvider.GetService<IDriveLight>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CanDebug(this IEmulator core)
|
public static bool CanDebug(this IEmulator core)
|
||||||
|
@ -130,7 +130,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
|
||||||
|
|
||||||
public static IDebuggable AsDebuggable(this IEmulator core)
|
public static IDebuggable AsDebuggable(this IEmulator core)
|
||||||
{
|
{
|
||||||
return (IDebuggable)core.ServiceProvider.GetService<IDebuggable>();
|
return core.ServiceProvider.GetService<IDebuggable>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CpuTraceAvailable(this IEmulator core)
|
public static bool CpuTraceAvailable(this IEmulator core)
|
||||||
|
@ -145,7 +145,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
|
||||||
|
|
||||||
public static ITraceable AsTracer(this IEmulator core)
|
public static ITraceable AsTracer(this IEmulator core)
|
||||||
{
|
{
|
||||||
return (ITraceable)core.ServiceProvider.GetService<ITraceable>();
|
return core.ServiceProvider.GetService<ITraceable>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool MemoryCallbacksAvailable(this IEmulator core)
|
public static bool MemoryCallbacksAvailable(this IEmulator core)
|
||||||
|
@ -203,7 +203,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
|
||||||
|
|
||||||
public static IDisassemblable AsDissassembler(this IEmulator core)
|
public static IDisassemblable AsDissassembler(this IEmulator core)
|
||||||
{
|
{
|
||||||
return (IDisassemblable)core.ServiceProvider.GetService<IDisassemblable>();
|
return core.ServiceProvider.GetService<IDisassemblable>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CanPoke(this MemoryDomain d)
|
public static bool CanPoke(this MemoryDomain d)
|
||||||
|
@ -237,7 +237,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
|
||||||
|
|
||||||
public static IRegionable AsRegionable(this IEmulator core)
|
public static IRegionable AsRegionable(this IEmulator core)
|
||||||
{
|
{
|
||||||
return (IRegionable)core.ServiceProvider.GetService<IRegionable>();
|
return core.ServiceProvider.GetService<IRegionable>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CanCDLog(this IEmulator core)
|
public static bool CanCDLog(this IEmulator core)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Common
|
namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,11 +39,18 @@ namespace BizHawk.Emulation.Common
|
||||||
public RegisterValue(ulong val, byte bitSize)
|
public RegisterValue(ulong val, byte bitSize)
|
||||||
{
|
{
|
||||||
if (bitSize == 64)
|
if (bitSize == 64)
|
||||||
|
{
|
||||||
Value = val;
|
Value = val;
|
||||||
|
}
|
||||||
else if (bitSize > 64 || bitSize == 0)
|
else if (bitSize > 64 || bitSize == 0)
|
||||||
|
{
|
||||||
throw new System.ArgumentOutOfRangeException("bitSize", "BitSize must be in 1..64");
|
throw new System.ArgumentOutOfRangeException("bitSize", "BitSize must be in 1..64");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Value = val & (1UL << bitSize) - 1;
|
Value = val & (1UL << bitSize) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
BitSize = bitSize;
|
BitSize = bitSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,10 @@ namespace BizHawk.Emulation.Common
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!AvailableCpus.Contains(value))
|
if (!AvailableCpus.Contains(value))
|
||||||
|
{
|
||||||
throw new ArgumentException();
|
throw new ArgumentException();
|
||||||
|
}
|
||||||
|
|
||||||
_cpu = value;
|
_cpu = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ namespace BizHawk.Emulation.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
// note that (some?) cores expect you to call SoundProvider.GetSamples() after each FrameAdvance()
|
// note that (some?) cores expect you to call SoundProvider.GetSamples() after each FrameAdvance()
|
||||||
// please do this, even when rendersound = false
|
// please do this, even when rendersound = false
|
||||||
/// <summary>
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void FrameAdvance(bool render, bool rendersound = true);
|
void FrameAdvance(bool render, bool rendersound = true);
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,7 @@ namespace BizHawk.Emulation.Common
|
||||||
/// Should be added to any field of an ICoreService that is not implemented. By Convention it should also throw a NotImplementedException
|
/// Should be added to any field of an ICoreService that is not implemented. By Convention it should also throw a NotImplementedException
|
||||||
/// Any feature that does not have this attribute is assumed to be implemented
|
/// Any feature that does not have this attribute is assumed to be implemented
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class FeatureNotImplemented : Attribute
|
public class FeatureNotImplemented : Attribute { }
|
||||||
{
|
|
||||||
public FeatureNotImplemented() { }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This represents a service that would not apply to every core, instead it is a specialized service specific to a core or group of cores
|
/// This represents a service that would not apply to every core, instead it is a specialized service specific to a core or group of cores
|
||||||
|
|
|
@ -1,11 +1,48 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Common
|
namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
|
public interface ISettable<TSettings, TSync> : IEmulatorService
|
||||||
|
{
|
||||||
|
// in addition to these methods, it's expected that the constructor or Load() method
|
||||||
|
// will take a Settings and SyncSettings object to set the initial state of the core
|
||||||
|
// (if those are null, default settings are to be used)
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// get the current core settings, excepting movie settings. should be a clone of the active in-core object.
|
||||||
|
/// VERY IMPORTANT: changes to the object returned by this function SHOULD NOT have any effect on emulation
|
||||||
|
/// (unless the object is later passed to PutSettings)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>a json-serializable object</returns>
|
||||||
|
TSettings GetSettings();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// get the current core settings that affect movie sync. these go in movie 2.0 files, so don't make the JSON too extravagant, please
|
||||||
|
/// should be a clone of the active in-core object.
|
||||||
|
/// VERY IMPORTANT: changes to the object returned by this function MUST NOT have any effect on emulation
|
||||||
|
/// (unless the object is later passed to PutSyncSettings)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>a json-serializable object</returns>
|
||||||
|
TSync GetSyncSettings();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// change the core settings, excepting movie settings
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="o">an object of the same type as the return for GetSettings</param>
|
||||||
|
/// <returns>true if a core reboot will be required to make the changes effective</returns>
|
||||||
|
bool PutSettings(TSettings o);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// changes the movie-sync relevant settings. THIS SHOULD NEVER BE CALLED WHILE RECORDING
|
||||||
|
/// if it is called while recording, the core need not guarantee continued determinism
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="o">an object of the same type as the return for GetSyncSettings</param>
|
||||||
|
/// <returns>true if a core reboot will be required to make the changes effective</returns>
|
||||||
|
bool PutSyncSettings(TSync o);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// serves as a shim between strongly typed ISettable and consumers
|
/// serves as a shim between strongly typed ISettable and consumers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -62,21 +99,30 @@ namespace BizHawk.Emulation.Common
|
||||||
public object GetSettings()
|
public object GetSettings()
|
||||||
{
|
{
|
||||||
if (!HasSettings)
|
if (!HasSettings)
|
||||||
|
{
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
return gets.Invoke(emu, tmp0);
|
return gets.Invoke(emu, tmp0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public object GetSyncSettings()
|
public object GetSyncSettings()
|
||||||
{
|
{
|
||||||
if (!HasSyncSettings)
|
if (!HasSyncSettings)
|
||||||
|
{
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
return (getss.Invoke(emu, tmp0));
|
return (getss.Invoke(emu, tmp0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool PutSettings(object o)
|
public bool PutSettings(object o)
|
||||||
{
|
{
|
||||||
if (!HasSettings)
|
if (!HasSettings)
|
||||||
|
{
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
tmp1[0] = o;
|
tmp1[0] = o;
|
||||||
return (bool)puts.Invoke(emu, tmp1);
|
return (bool)puts.Invoke(emu, tmp1);
|
||||||
}
|
}
|
||||||
|
@ -84,48 +130,14 @@ namespace BizHawk.Emulation.Common
|
||||||
public bool PutSyncSettings(object o)
|
public bool PutSyncSettings(object o)
|
||||||
{
|
{
|
||||||
if (!HasSyncSettings)
|
if (!HasSyncSettings)
|
||||||
|
{
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
tmp1[0] = o;
|
tmp1[0] = o;
|
||||||
return (bool)putss.Invoke(emu, tmp1);
|
return (bool)putss.Invoke(emu, tmp1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ISettable<TSettings, TSync> : IEmulatorService
|
|
||||||
{
|
|
||||||
// in addition to these methods, it's expected that the constructor or Load() method
|
|
||||||
// will take a Settings and SyncSettings object to set the initial state of the core
|
|
||||||
// (if those are null, default settings are to be used)
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// get the current core settings, excepting movie settings. should be a clone of the active in-core object.
|
|
||||||
/// VERY IMPORTANT: changes to the object returned by this function SHOULD NOT have any effect on emulation
|
|
||||||
/// (unless the object is later passed to PutSettings)
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>a json-serializable object</returns>
|
|
||||||
TSettings GetSettings();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// get the current core settings that affect movie sync. these go in movie 2.0 files, so don't make the JSON too extravagant, please
|
|
||||||
/// should be a clone of the active in-core object.
|
|
||||||
/// VERY IMPORTANT: changes to the object returned by this function MUST NOT have any effect on emulation
|
|
||||||
/// (unless the object is later passed to PutSyncSettings)
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>a json-serializable object</returns>
|
|
||||||
TSync GetSyncSettings();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// change the core settings, excepting movie settings
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="o">an object of the same type as the return for GetSettings</param>
|
|
||||||
/// <returns>true if a core reboot will be required to make the changes effective</returns>
|
|
||||||
bool PutSettings(TSettings o);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// changes the movie-sync relevant settings. THIS SHOULD NEVER BE CALLED WHILE RECORDING
|
|
||||||
/// if it is called while recording, the core need not guarantee continued determinism
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="o">an object of the same type as the return for GetSyncSettings</param>
|
|
||||||
/// <returns>true if a core reboot will be required to make the changes effective</returns>
|
|
||||||
bool PutSyncSettings(TSync o);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue