75 lines
3.4 KiB
C#
75 lines
3.4 KiB
C#
![]() |
using System.IO;
|
|||
|
using BizHawk.Emulation.Common;
|
|||
|
|
|||
|
namespace BizHawk.Client.Common
|
|||
|
{
|
|||
|
public interface IMovie
|
|||
|
{
|
|||
|
|
|||
|
int Rerecords { get; set; }
|
|||
|
|
|||
|
string Filename { get; set; }
|
|||
|
|
|||
|
bool IsCountingRerecords { get; set; }
|
|||
|
|
|||
|
bool IsActive { get; }
|
|||
|
bool IsPlaying { get; }
|
|||
|
bool IsRecording { get; }
|
|||
|
bool IsFinished { get; }
|
|||
|
|
|||
|
bool LoadMovie();
|
|||
|
void WriteBackup();
|
|||
|
|
|||
|
#region Editing API
|
|||
|
void ClearFrame(int frame);
|
|||
|
void ModifyFrame(string record, int frame);
|
|||
|
void AppendFrame(string record);
|
|||
|
void InsertFrame(string record, int frame);
|
|||
|
void InsertBlankFrame(int frame);
|
|||
|
void DeleteFrame(int frame);
|
|||
|
void TruncateMovie(int frame);
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Dubious, should reconsider
|
|||
|
bool Loaded { get; } //Who needs to know it is loaded or not? The movie should decide what to do based on being loaded or not
|
|||
|
bool IsText { get; } //remove until needed Make a get set, consider an Enum of FileTypeMode or something,
|
|||
|
bool HasChanges { get; } //Rename to changes
|
|||
|
void CommitFrame(int frameNum, IController source); //why pass in frameNum? Calling api
|
|||
|
void PokeFrame(int frameNum, string input); //Why does this exist as something different than Commit Frame?
|
|||
|
void CaptureState(); //Movie code should manage wheter it needs to capture a state
|
|||
|
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 DateTime
|
|||
|
void DumpLogIntoSavestateText(TextWriter writer); //Why pass a Textwriter, just make a string property that is the inputlog as text
|
|||
|
void LoadLogFromSavestateText(TextReader reader, bool isMultitracking); //Pass in the text? do we need to care if it is multitracking, and can't hte movie already know that?
|
|||
|
int? Frames { get; } //Nullable is a hack, also why does calling code need to know the number of frames, can that be minimized?
|
|||
|
int RawFrames { get; } //Hacky to need two different frame properties
|
|||
|
|
|||
|
void Finish(); //Why isn't the movie in charge of this?
|
|||
|
void StartRecording(bool truncate = true); //Why do we need to truncate or not truncate? Why isn't the object in charge of this decision?
|
|||
|
void Stop(bool abortchanges = false); //Refactor to have a bool saveChanges instead
|
|||
|
|
|||
|
void StartPlayback(); //Poorly named for what it does, SetToPlay() perhaps? Also, this seems like too much power to give the calling code
|
|||
|
void SwitchToRecord(); //Ditto
|
|||
|
void SwitchToPlay(); //Dubious that it is needed
|
|||
|
|
|||
|
void WriteMovie(); //Rename to Write()
|
|||
|
|
|||
|
bool FrameLagged(int frame); //SHould be a property of a Record object
|
|||
|
byte[] GetState(int frame); //Should be a property of a Record object
|
|||
|
string GetInput(int frame); //Should be a property of a Record object
|
|||
|
byte[] InitState { get; } //Should be a record object?
|
|||
|
|
|||
|
bool StartsFromSavestate { get; set; } //Why is this settable!!!
|
|||
|
|
|||
|
MovieHeader Header { get; } //Don't expose this!!!
|
|||
|
MovieLog LogDump { get; } //Don't expose this!!!
|
|||
|
SubtitleList Subtitles { get; } //Don't expose this!!!
|
|||
|
|
|||
|
int StateFirstIndex { get; }
|
|||
|
int StateLastIndex { get; }
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//TODO: delete this and refactor code that uses it!
|
|||
|
public enum LoadStateResult { Pass, GuidMismatch, TimeLineError, FutureEventError, NotInRecording, EmptyLog, MissingFrameNumber }
|