Some more movie progress and fix exception thrown on startup

This commit is contained in:
adelikat 2013-12-01 01:55:41 +00:00
parent 2d51026883
commit 316aa56ce9
6 changed files with 42 additions and 10 deletions

View File

@ -124,6 +124,7 @@
<Compile Include="movie\HeaderKeys.cs" />
<Compile Include="movie\IMovie.cs" />
<Compile Include="movie\IMovieHeader.cs" />
<Compile Include="movie\IMovieRecord.cs" />
<Compile Include="movie\InputAdapters.cs" />
<Compile Include="movie\Movie.cs" />
<Compile Include="movie\MovieHeader.cs" />

View File

@ -1,4 +1,5 @@
using System.IO;
using System.Collections.Generic;
using System.IO;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.Common
@ -97,7 +98,7 @@ namespace BizHawk.Client.Common
void PokeFrame(int frameNum, string input); // 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
string GetTime(bool preLoad); // Rename to simply: Time, and make it a Timespan
void GetInputLog(TextReader reader, bool isMultitracking); // how about the movie know if it is multi-tracking rather than having to pass it in
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

View File

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Client.Common
{
/// <summary>
/// Represents everything needed for a frame of input
/// </summary>
public interface IMovieRecord
{
/// <summary>
/// String representation of the controller input as a series of mnemonics
/// </summary>
string Input { get; }
/// <summary>
/// Whether or not this was a lag frame,
/// where lag is the act of the core failing to poll for input (input on lag frames have no affect)
/// </summary>
bool Lagged { get; }
/// <summary>
/// A savestate for this frame of input
/// </summary>
IEnumerable<byte> State { get; }
}
}

View File

@ -439,7 +439,7 @@ namespace BizHawk.Client.Common
return sb.ToString();
}
public void GetInputLog(TextReader reader, bool isMultitracking)
public void ExtractInputLog(TextReader reader, bool isMultitracking)
{
int? stateFrame = null;

View File

@ -20,7 +20,7 @@ namespace BizHawk.Client.Common
this[HeaderKeys.EMULATIONVERSION] = VersionInfo.GetEmuVersion();
this[HeaderKeys.MOVIEVERSION] = HeaderKeys.MovieVersion;
this[HeaderKeys.PLATFORM] = Global.Emulator.SystemId;
this[HeaderKeys.PLATFORM] = Global.Emulator != null ? Global.Emulator.SystemId : String.Empty;
this[HeaderKeys.GAMENAME] = String.Empty;
this[HeaderKeys.AUTHOR] = String.Empty;
this[HeaderKeys.RERECORDS] = "0";

View File

@ -254,7 +254,7 @@ namespace BizHawk.Client.Common
{
reader.BaseStream.Position = 0;
reader.DiscardBufferedData();
Movie.GetInputLog(reader, MultiTrack.IsActive);
Movie.ExtractInputLog(reader, MultiTrack.IsActive);
}
else
{
@ -267,7 +267,7 @@ namespace BizHawk.Client.Common
{
reader.BaseStream.Position = 0;
reader.DiscardBufferedData();
Movie.GetInputLog(reader, MultiTrack.IsActive);
Movie.ExtractInputLog(reader, MultiTrack.IsActive);
return true;
}
else
@ -337,7 +337,7 @@ namespace BizHawk.Client.Common
Movie.SwitchToRecord();
reader.BaseStream.Position = 0;
reader.DiscardBufferedData();
Movie.GetInputLog(reader, MultiTrack.IsActive);
Movie.ExtractInputLog(reader, MultiTrack.IsActive);
return true;
}
else
@ -352,7 +352,7 @@ namespace BizHawk.Client.Common
Movie.SwitchToRecord();
reader.BaseStream.Position = 0;
reader.DiscardBufferedData();
Movie.GetInputLog(reader, MultiTrack.IsActive);
Movie.ExtractInputLog(reader, MultiTrack.IsActive);
return true;
}
else
@ -426,7 +426,7 @@ namespace BizHawk.Client.Common
Movie.StartNewRecording();
reader.BaseStream.Position = 0;
reader.DiscardBufferedData();
Movie.GetInputLog(reader, MultiTrack.IsActive);
Movie.ExtractInputLog(reader, MultiTrack.IsActive);
return true;
}
else
@ -442,7 +442,7 @@ namespace BizHawk.Client.Common
Movie.StartNewRecording();
reader.BaseStream.Position = 0;
reader.DiscardBufferedData();
Movie.GetInputLog(reader, MultiTrack.IsActive);
Movie.ExtractInputLog(reader, MultiTrack.IsActive);
return true;
}
else