Movie stuff

This commit is contained in:
adelikat 2013-12-03 15:59:46 +00:00
parent d71ec20df7
commit e1d1095c3e
4 changed files with 55 additions and 16 deletions

View File

@ -83,22 +83,41 @@ namespace BizHawk.Client.Common
#region Editing API
/// <summary>
/// Repalces the given frame's input with an empty frame
/// </summary>
/// <param name="frame"></param>
void ClearFrame(int frame);
/// <summary>
/// Adds the given input to the movie
/// Note: this edits the input log without the normal movie recording logic applied
/// </summary>
/// <param name="mg"></param>
void AppendFrame(MnemonicsGenerator mg);
/// <summary>
/// Replaces the input at the given frame with the given input
/// Note: this edits the input log without the normal movie recording logic applied
/// </summary>
void PokeFrame(int frame, MnemonicsGenerator mg);
/// <summary>
/// Records the given input into the given frame,
/// This is subject to normal movie recording logic
/// </summary>
void RecordFrame(int frame, MnemonicsGenerator mg);
void Truncate(int frame);
string GetInput(int frame);
#endregion
#region Dubious, should reconsider
void CommitFrame(int frameNum, MnemonicsGenerator mg); // Why pass in frameNum? Calling api
void PokeFrame(int frameNum, MnemonicsGenerator mg); // Why does this exist as something different than Commit Frame?
LoadStateResult CheckTimeLines(TextReader reader, bool onlyGuid, bool ignoreGuidMismatch, out string errorMessage); // No need to return a status, no reason to have hacky flags, no need to pass a textreader
void ExtractInputLog(TextReader reader, bool isMultitracking); // how about the movie know if it is multi-tracking rather than having to pass it in
string GetInput(int frame); // Should be a property of a Record object
#endregion
}
}

View File

@ -366,13 +366,13 @@ namespace BizHawk.Client.Common
#region Public Misc Methods
public void PokeFrame(int frameNum, MnemonicsGenerator mg)
public void PokeFrame(int frame, MnemonicsGenerator mg)
{
_changes = true;
_log.SetFrameAt(frameNum, mg.GetControllersAsMnemonic());
_log.SetFrameAt(frame, mg.GetControllersAsMnemonic());
}
public void CommitFrame(int frameNum, MnemonicsGenerator mg)
public void RecordFrame(int frame, MnemonicsGenerator mg)
{
// Note: Truncation here instead of loadstate will make VBA style loadstates
// (Where an entire movie is loaded then truncated on the next frame
@ -386,7 +386,7 @@ namespace BizHawk.Client.Common
}
_changes = true;
_log.SetFrameAt(frameNum, mg.GetControllersAsMnemonic());
_log.SetFrameAt(frame, mg.GetControllersAsMnemonic());
}
public string GetInputLog()

View File

@ -141,7 +141,6 @@ namespace BizHawk.Client.Common
else if (Movie.IsPlaying)
{
LatchInputFromLog();
//Movie may go into finished mode as a result from latching
@ -184,7 +183,7 @@ namespace BizHawk.Client.Common
//this has been wired to Global.MovieOutputHardpoint in RewireInputChain
var mg = new MnemonicsGenerator();
mg.SetSource(Global.MovieOutputHardpoint);
Movie.CommitFrame(Global.Emulator.Frame, mg);
Movie.RecordFrame(Global.Emulator.Frame, mg);
}
}

View File

@ -169,25 +169,46 @@ namespace BizHawk.Client.Common
public void ClearFrame(int frame)
{
throw new NotImplementedException();
if (frame < _records.Count)
{
Changes = true;
_records[frame].Input = MnemonicsGenerator.GetEmptyMnemonic;
}
}
public void AppendFrame(MnemonicsGenerator mg)
{
Changes = true;
_records.Add(new MovieRecord()
{
Input = mg.GetControllersAsMnemonic(),
});
}
public void CommitFrame(int frameNum, MnemonicsGenerator mg)
public void RecordFrame(int frame, MnemonicsGenerator mg)
{
throw new NotImplementedException();
if (_mode == Moviemode.Record)
{
Changes = true;
if (Global.Config.VBAStyleMovieLoadState)
{
if (Global.Emulator.Frame < _records.Count)
{
_records.Truncate(Global.Emulator.Frame);
}
}
PokeFrame(frame, mg);
}
}
public void PokeFrame(int frameNum, MnemonicsGenerator mg)
public void PokeFrame(int frame, MnemonicsGenerator mg)
{
throw new NotImplementedException();
if (frame < _records.Count)
{
Changes = true;
_records[frame].Input = mg.GetControllersAsMnemonic();
}
}
public LoadStateResult CheckTimeLines(System.IO.TextReader reader, bool onlyGuid, bool ignoreGuidMismatch, out string errorMessage)