Movies - rework some things so that MovieSession is in charge of sending a movie into finished mode, as opposed to GetInutState() having the side effect of MovieFInished

This commit is contained in:
adelikat 2014-07-13 22:36:37 +00:00
parent f79a674219
commit 02a5337cd6
7 changed files with 15 additions and 20 deletions

View File

@ -103,13 +103,15 @@ namespace BizHawk.Client.Common
/// </summary>
public void LatchInputFromLog()
{
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)
if (Global.Emulator.Frame < Movie.InputLogLength)
{
var input = Movie.GetInputState(Global.Emulator.Frame);
MovieControllerAdapter.LatchFromSource(input);
}
else
{
Movie.FinishedMode();
}
}
public bool MovieLoad()

View File

@ -69,12 +69,9 @@ namespace BizHawk.Client.Common
_mode = Moviemode.Inactive;
}
protected void Finish()
public void FinishedMode()
{
if (_mode == Moviemode.Play)
{
_mode = Moviemode.Finished;
}
_mode = Moviemode.Finished;
}
}
}

View File

@ -128,7 +128,6 @@ namespace BizHawk.Client.Common
return adapter;
}
Finish();
return null;
}

View File

@ -85,15 +85,9 @@ namespace BizHawk.Client.Common
_mode = Moviemode.Inactive;
}
/// <summary>
/// If a movie is in playback mode, this will set it to movie finished
/// </summary>
private void Finish()
public void FinishedMode()
{
if (_mode == Moviemode.Play)
{
_mode = Moviemode.Finished;
}
_mode = Moviemode.Finished;
}
}
}

View File

@ -106,7 +106,6 @@ namespace BizHawk.Client.Common
return adapter;
}
Finish();
return null;
}

View File

@ -157,6 +157,11 @@ namespace BizHawk.Client.Common
/// </summary>
void SwitchToPlay();
/// <summary>
/// Tells the movie to go into "Finished" mode, where the user resumes control of input but the movie is still loaded in memory
/// </summary>
void FinishedMode();
#endregion
#region Editing API

View File

@ -205,7 +205,6 @@ namespace BizHawk.Client.Common
return _log[getframe];
}
Finish();
return string.Empty;
}