Tastudio - when emuhawk is playing back frames, we must be logging lag and savestates in tasmovie if we do not have the information! This fixes a number of "spooky" bugs I've been finding!

This commit is contained in:
adelikat 2014-10-16 23:05:59 +00:00
parent b8925d2635
commit e58e911d7e
2 changed files with 21 additions and 1 deletions

View File

@ -114,7 +114,7 @@ namespace BizHawk.Client.Common
}
}
public IController GetInputState(int frame)
public virtual IController GetInputState(int frame)
{
if (frame < FrameCount && frame >= 0)
{

View File

@ -256,6 +256,7 @@ namespace BizHawk.Client.Common
}
// TODO: try not to need this, or at least use GetInputState and then a log entry generator
// TODO: this is being called in Clone and probably other places, and that's bad, they are capturing the current frame for other frames!
public string GetInputLogEntry(int frame)
{
if (Global.Emulator.Frame == frame && !StateManager.HasState(frame))
@ -303,5 +304,24 @@ namespace BizHawk.Client.Common
Changes = true;
}
}
public override IController GetInputState(int frame)
{
// TODO: states and lag capture
if (Global.Emulator.Frame == frame) // Take this opportunity to capture lag and state info if we do not have it
{
if (frame == LagLog.Count) // I intentionally did not do >=, if it were >= we missed some entries somewhere, oops, maybe this shoudl be a dictionary<int, bool> with frame values?
{
LagLog.Add(Global.Emulator.IsLagFrame);
}
if (!StateManager.HasState(frame))
{
StateManager.Capture();
}
}
return base.GetInputState(frame);
}
}
}