Make the lag counter settable, and expose this functionality in lua

This commit is contained in:
adelikat 2015-07-09 13:05:30 -04:00
parent 9455aec767
commit 3541c9e975
25 changed files with 40 additions and 18 deletions

View File

@ -191,6 +191,22 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes(
"setlagcount",
"Sets the current lag count"
)]
public void SetLagCount(int count)
{
if (InputPollableCore != null)
{
InputPollableCore.LagCount = count;
}
else
{
Log(string.Format("Can not set lag information, {0} does not implement IInputPollable", Emulator.Attributes().CoreName));
}
}
[LuaMethodAttributes( [LuaMethodAttributes(
"limitframerate", "limitframerate",
"sets the limit framerate property of the emulator" "sets the limit framerate property of the emulator"

View File

@ -5,7 +5,7 @@
/// <summary> /// <summary>
/// The lag count. /// The lag count.
/// </summary> /// </summary>
int LagCount { get; } int LagCount { get; set; }
/// <summary> /// <summary>
/// If the current frame is a lag frame. /// If the current frame is a lag frame.

View File

@ -11,6 +11,7 @@ namespace BizHawk.Emulation.Cores.Calculators
public int LagCount public int LagCount
{ {
get { return _lagCount; } get { return _lagCount; }
set { _lagCount = value; }
} }
public IInputCallbackSystem InputCallbacks { get; private set; } public IInputCallbackSystem InputCallbacks { get; private set; }

View File

@ -4,7 +4,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
{ {
public partial class AppleII : IInputPollable public partial class AppleII : IInputPollable
{ {
public int LagCount { get; private set; } public int LagCount { get; set; }
public bool IsLagFrame public bool IsLagFrame
{ {

View File

@ -12,6 +12,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
public int LagCount public int LagCount
{ {
get { return _lagcount; } get { return _lagcount; }
set { _lagcount = value; }
} }
public IInputCallbackSystem InputCallbacks { get; private set; } public IInputCallbackSystem InputCallbacks { get; private set; }

View File

@ -7,6 +7,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public int LagCount public int LagCount
{ {
get { return _lagcount; } get { return _lagcount; }
set { _lagcount = value; }
} }
public bool IsLagFrame public bool IsLagFrame

View File

@ -7,6 +7,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
public int LagCount public int LagCount
{ {
get { return _lagcount; } get { return _lagcount; }
set { _lagcount = value; }
} }
public bool IsLagFrame public bool IsLagFrame

View File

@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
{ {
public partial class Lynx : IInputPollable public partial class Lynx : IInputPollable
{ {
public int LagCount { get; private set; } public int LagCount { get; set; }
public bool IsLagFrame { get; private set; } public bool IsLagFrame { get; private set; }

View File

@ -8,6 +8,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
public int LagCount public int LagCount
{ {
get { return _lagCount; } get { return _lagCount; }
set { _lagCount = value; }
} }
public bool IsLagFrame public bool IsLagFrame

View File

@ -340,7 +340,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
return savebuff2; return savebuff2;
} }
public int LagCount { get; private set; } public int LagCount { get; set; }
public bool IsLagFrame { get; private set; } public bool IsLagFrame { get; private set; }
[FeatureNotImplemented] [FeatureNotImplemented]

View File

@ -101,7 +101,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
} }
public int Frame { get; private set; } public int Frame { get; private set; }
public int LagCount { get; private set; } public int LagCount { get; set; }
public bool IsLagFrame { get; private set; } public bool IsLagFrame { get; private set; }
private readonly InputCallbackSystem _inputCallbacks = new InputCallbackSystem(); private readonly InputCallbackSystem _inputCallbacks = new InputCallbackSystem();

View File

@ -115,7 +115,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
} }
public int Frame { get; private set; } public int Frame { get; private set; }
public int LagCount { get; private set; } public int LagCount { get; set; }
public bool IsLagFrame { get; private set; } public bool IsLagFrame { get; private set; }
private ITraceable Tracer { get; set; } private ITraceable Tracer { get; set; }

View File

@ -192,7 +192,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
internal IntPtr GambatteState = IntPtr.Zero; internal IntPtr GambatteState = IntPtr.Zero;
public int Frame { get; set; } public int Frame { get; set; }
public int LagCount { get; private set; } public int LagCount { get; set; }
public bool IsLagFrame { get; private set; } public bool IsLagFrame { get; private set; }
// all cycle counts are relative to a 2*1024*1024 mhz refclock // all cycle counts are relative to a 2*1024*1024 mhz refclock

View File

@ -5,7 +5,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
public partial class N64 : IInputPollable public partial class N64 : IInputPollable
{ {
public int Frame { get; private set; } public int Frame { get; private set; }
public int LagCount { get; private set; } public int LagCount { get; set; }
public bool IsLagFrame public bool IsLagFrame
{ {

View File

@ -7,6 +7,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public int LagCount public int LagCount
{ {
get { return _lagcount; } get { return _lagcount; }
set { _lagcount = value; }
} }
public bool IsLagFrame public bool IsLagFrame

View File

@ -5,7 +5,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
{ {
public partial class QuickNES : IInputPollable public partial class QuickNES : IInputPollable
{ {
public int LagCount { get; private set; } public int LagCount { get; set; }
public bool IsLagFrame { get; private set; } public bool IsLagFrame { get; private set; }
public IInputCallbackSystem InputCallbacks public IInputCallbackSystem InputCallbacks

View File

@ -713,7 +713,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
int timeFrameCounter; int timeFrameCounter;
public int Frame { get { return timeFrameCounter; } set { timeFrameCounter = value; } } public int Frame { get { return timeFrameCounter; } set { timeFrameCounter = value; } }
public int LagCount { get; private set; } public int LagCount { get; set; }
public bool IsLagFrame { get; private set; } public bool IsLagFrame { get; private set; }
public string SystemId { get; private set; } public string SystemId { get; private set; }

View File

@ -309,7 +309,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
bool lagged = true; bool lagged = true;
bool isLag = false; bool isLag = false;
public int Frame { get { return frame; } set { frame = value; } } public int Frame { get { return frame; } set { frame = value; } }
public int LagCount { get { return lagCount; } } public int LagCount { get { return lagCount; } set { lagCount = value; } }
public bool IsLagFrame { get { return isLag; } } public bool IsLagFrame { get { return isLag; } }
private readonly InputCallbackSystem _inputCallbacks = new InputCallbackSystem(); private readonly InputCallbackSystem _inputCallbacks = new InputCallbackSystem();

View File

@ -309,7 +309,7 @@ namespace BizHawk.Emulation.Cores.Sega.Genesis
public void EndAsyncSound() { } public void EndAsyncSound() { }
public int Frame { get; set; } public int Frame { get; set; }
public int LagCount { get { return _lagcount; } } public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
public bool IsLagFrame { get { return islag; } } public bool IsLagFrame { get { return islag; } }
public bool DeterministicEmulation { get { return true; } } public bool DeterministicEmulation { get { return true; } }
public string SystemId { get { return "GEN"; } } public string SystemId { get { return "GEN"; } }

View File

@ -77,7 +77,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
bool lagged = true; bool lagged = true;
bool isLag = false; bool isLag = false;
public int Frame { get { return frame; } set { frame = value; } } public int Frame { get { return frame; } set { frame = value; } }
public int LagCount { get { return lagCount; } } public int LagCount { get { return lagCount; } set { lagCount = value; } }
public bool IsLagFrame { get { return isLag; } } public bool IsLagFrame { get { return isLag; } }
private readonly InputCallbackSystem _inputCallbacks = new InputCallbackSystem(); private readonly InputCallbackSystem _inputCallbacks = new InputCallbackSystem();

View File

@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
{ {
public partial class Yabause : IInputPollable public partial class Yabause : IInputPollable
{ {
public int LagCount { get; private set; } public int LagCount { get; set; }
public bool IsLagFrame { get; private set; } public bool IsLagFrame { get; private set; }

View File

@ -427,7 +427,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
} }
public int Frame { get; private set; } public int Frame { get; private set; }
public int LagCount { get; private set; } public int LagCount { get; set; }
public bool IsLagFrame { get; private set; } public bool IsLagFrame { get; private set; }
public string SystemId { get { return "GEN"; } } public string SystemId { get { return "GEN"; } }

View File

@ -429,7 +429,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
} }
public int Frame { get; private set; } public int Frame { get; private set; }
public int LagCount { get; private set; } public int LagCount { get; set; }
public bool IsLagFrame { get; private set; } public bool IsLagFrame { get; private set; }
public string SystemId { get { return "GEN"; } } public string SystemId { get { return "GEN"; } }

View File

@ -659,7 +659,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
public IController Controller { get; set; } public IController Controller { get; set; }
public int Frame { get; private set; } public int Frame { get; private set; }
public int LagCount { get; private set; } public int LagCount { get; set; }
public bool IsLagFrame { get; private set; } public bool IsLagFrame { get; private set; }
[FeatureNotImplemented] [FeatureNotImplemented]

View File

@ -100,7 +100,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan
IntPtr Core; IntPtr Core;
public int Frame { get; private set; } public int Frame { get; private set; }
public int LagCount { get; private set; } public int LagCount { get; set; }
public bool IsLagFrame { get; private set; } public bool IsLagFrame { get; private set; }
public string SystemId { get { return "WSWAN"; } } public string SystemId { get { return "WSWAN"; } }