Remove GetInput() from IMovie
This commit is contained in:
parent
57c86f7491
commit
f79a674219
|
@ -103,12 +103,12 @@ namespace BizHawk.Client.Common
|
|||
/// </summary>
|
||||
public void LatchInputFromLog()
|
||||
{
|
||||
var input = Movie.GetInput(Global.Emulator.Frame);
|
||||
var input = Movie.GetInputState(Global.Emulator.Frame);
|
||||
|
||||
// Attempting to get a frame past the end of a movie changes the mode to finished
|
||||
if (!Movie.IsFinished)
|
||||
{
|
||||
MovieControllerAdapter.SetControllersAsMnemonic(input);
|
||||
MovieControllerAdapter.LatchFromSource(input);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
private int? LoopOffset
|
||||
protected int? LoopOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace BizHawk.Client.Common
|
|||
_mode = Moviemode.Inactive;
|
||||
}
|
||||
|
||||
private void Finish()
|
||||
protected void Finish()
|
||||
{
|
||||
if (_mode == Moviemode.Play)
|
||||
{
|
||||
|
|
|
@ -96,36 +96,6 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
public virtual string GetInput(int frame)
|
||||
{
|
||||
if (frame < FrameCount && frame >= 0)
|
||||
{
|
||||
|
||||
int getframe;
|
||||
|
||||
if (LoopOffset.HasValue)
|
||||
{
|
||||
if (frame < _log.Count)
|
||||
{
|
||||
getframe = frame;
|
||||
}
|
||||
else
|
||||
{
|
||||
getframe = ((frame - LoopOffset.Value) % (_log.Count - LoopOffset.Value)) + LoopOffset.Value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getframe = frame;
|
||||
}
|
||||
|
||||
return _log[getframe];
|
||||
}
|
||||
|
||||
Finish();
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public IController GetInputState(int frame)
|
||||
{
|
||||
if (frame < FrameCount && frame >= 0)
|
||||
|
|
|
@ -75,36 +75,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region Public Log Editing
|
||||
|
||||
public string GetInput(int frame)
|
||||
{
|
||||
if (frame < FrameCount && frame >= 0)
|
||||
{
|
||||
|
||||
int getframe;
|
||||
|
||||
if (_loopOffset.HasValue)
|
||||
{
|
||||
if (frame < _log.Count)
|
||||
{
|
||||
getframe = frame;
|
||||
}
|
||||
else
|
||||
{
|
||||
getframe = ((frame - _loopOffset.Value) % (_log.Count - _loopOffset.Value)) + _loopOffset.Value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getframe = frame;
|
||||
}
|
||||
|
||||
return _log[getframe];
|
||||
}
|
||||
|
||||
Finish();
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public IController GetInputState(int frame)
|
||||
{
|
||||
if (frame < FrameCount && frame >= 0)
|
||||
|
|
|
@ -191,14 +191,6 @@ namespace BizHawk.Client.Common
|
|||
/// <param name="frame">The frame at which to truncate</param>
|
||||
void Truncate(int frame);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single frame of input from the movie at the given frame
|
||||
/// The input will be in the same format as represented in the input log when saved as a file
|
||||
/// </summary>
|
||||
/// <param name="frame">The frame of input to be retrieved</param>
|
||||
/// <returns>a string representation of a log entry from the input log file itself</returns>
|
||||
string GetInput(int frame);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single frame of input via a controller state
|
||||
/// </summary>
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace BizHawk.Client.Common
|
|||
return new TasMovieRecord
|
||||
{
|
||||
State = StateManager[index],
|
||||
LogEntry = GetInput(index),
|
||||
LogEntry = GetInputLogEntry(index),
|
||||
Lagged = (index < LagLog.Count) ? LagLog[index] : (bool?)null
|
||||
};
|
||||
}
|
||||
|
@ -168,7 +168,8 @@ namespace BizHawk.Client.Common
|
|||
return adapter.GetFloat(buttonName);
|
||||
}
|
||||
|
||||
public override string GetInput(int frame)
|
||||
// TODO: try not to need this, or at least use GetInputState and then a log entry generator
|
||||
public string GetInputLogEntry(int frame)
|
||||
{
|
||||
if (Global.Emulator.Frame == frame && !StateManager.HasState(frame))
|
||||
{
|
||||
|
@ -180,7 +181,32 @@ namespace BizHawk.Client.Common
|
|||
LagLog.Add(Global.Emulator.IsLagFrame);
|
||||
}
|
||||
|
||||
return base.GetInput(frame);
|
||||
if (frame < FrameCount && frame >= 0)
|
||||
{
|
||||
|
||||
int getframe;
|
||||
|
||||
if (LoopOffset.HasValue)
|
||||
{
|
||||
if (frame < _log.Count)
|
||||
{
|
||||
getframe = frame;
|
||||
}
|
||||
else
|
||||
{
|
||||
getframe = ((frame - LoopOffset.Value) % (_log.Count - LoopOffset.Value)) + LoopOffset.Value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getframe = frame;
|
||||
}
|
||||
|
||||
return _log[getframe];
|
||||
}
|
||||
|
||||
Finish();
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public TasStateManager.ManagerSettings GreenzoneSettings
|
||||
|
|
|
@ -527,7 +527,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
foreach (var frame in framesToInsert)
|
||||
{
|
||||
inputLog.Add(_tas.GetInput(frame));
|
||||
inputLog.Add(_tas.GetInputLogEntry(frame));
|
||||
}
|
||||
|
||||
_tas.InsertInput(insertionFrame, inputLog);
|
||||
|
|
Loading…
Reference in New Issue