2013-12-01 01:55:41 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
2013-11-23 17:26:33 +00:00
|
|
|
|
using BizHawk.Emulation.Common;
|
2013-12-02 21:57:48 +00:00
|
|
|
|
using System;
|
2013-11-23 17:26:33 +00:00
|
|
|
|
|
|
|
|
|
namespace BizHawk.Client.Common
|
|
|
|
|
{
|
2013-11-29 19:55:05 +00:00
|
|
|
|
// TODO: message callback / event handler
|
|
|
|
|
// TODO: consider other event handlers, switching modes?
|
2013-11-23 17:26:33 +00:00
|
|
|
|
public interface IMovie
|
|
|
|
|
{
|
2013-11-29 19:55:05 +00:00
|
|
|
|
#region Status
|
2013-11-23 17:26:33 +00:00
|
|
|
|
|
|
|
|
|
bool IsCountingRerecords { get; set; }
|
|
|
|
|
bool IsActive { get; }
|
|
|
|
|
bool IsPlaying { get; }
|
|
|
|
|
bool IsRecording { get; }
|
|
|
|
|
bool IsFinished { get; }
|
2013-11-23 18:18:58 +00:00
|
|
|
|
bool Changes { get; }
|
|
|
|
|
bool Loaded { get; }
|
2013-11-29 19:55:05 +00:00
|
|
|
|
|
2013-11-30 02:50:54 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Properties
|
|
|
|
|
|
2013-11-30 03:10:05 +00:00
|
|
|
|
double FrameCount { get; }
|
|
|
|
|
|
2013-12-02 21:57:48 +00:00
|
|
|
|
TimeSpan Time { get; }
|
|
|
|
|
|
2013-11-30 03:10:05 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Actual length of the input log, should only be used by code that iterates or needs a real length
|
|
|
|
|
/// </summary>
|
|
|
|
|
int InputLogLength { get; }
|
2013-12-02 17:50:29 +00:00
|
|
|
|
|
2013-11-30 02:33:26 +00:00
|
|
|
|
IMovieHeader Header { get; }
|
2013-11-29 19:55:05 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
2013-11-23 17:26:33 +00:00
|
|
|
|
|
2013-11-29 19:55:05 +00:00
|
|
|
|
#region File Handling API
|
|
|
|
|
|
|
|
|
|
string Filename { get; set; }
|
2013-11-23 18:18:58 +00:00
|
|
|
|
bool Load();
|
|
|
|
|
void Save();
|
|
|
|
|
void SaveAs();
|
2013-11-30 02:50:54 +00:00
|
|
|
|
string GetInputLog();
|
2013-11-29 19:55:05 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Mode Handling API
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Tells the movie to start recording from the beginning.
|
2013-11-30 02:20:34 +00:00
|
|
|
|
/// This will clear SRAM, and the movie log
|
2013-11-29 19:55:05 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
void StartNewRecording();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Tells the movie to start playback from the beginning
|
2013-11-30 02:20:34 +00:00
|
|
|
|
/// This will clear SRAM
|
2013-11-29 19:55:05 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
void StartNewPlayback();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sets the movie to inactive (note that it will still be in memory)
|
|
|
|
|
/// The saveChanges flag will tell the movie to save its contents to disk
|
|
|
|
|
/// </summary>
|
2013-11-30 02:20:34 +00:00
|
|
|
|
/// <param name="saveChanges">if true, will save to disk</param>
|
2013-11-23 18:18:58 +00:00
|
|
|
|
void Stop(bool saveChanges = true);
|
2013-11-23 17:26:33 +00:00
|
|
|
|
|
2013-11-29 19:55:05 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Switches to record mode
|
2013-11-30 02:20:34 +00:00
|
|
|
|
/// Does not change the movie log or clear SRAM
|
2013-11-29 19:55:05 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
void SwitchToRecord();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Switches to playback mode
|
2013-11-30 02:20:34 +00:00
|
|
|
|
/// Does not change the movie log or clear SRAM
|
2013-11-29 19:55:05 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
void SwitchToPlay();
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2013-11-23 17:26:33 +00:00
|
|
|
|
#region Editing API
|
2013-11-23 18:18:58 +00:00
|
|
|
|
|
2013-12-03 15:59:46 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Repalces the given frame's input with an empty frame
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="frame"></param>
|
2013-11-23 17:26:33 +00:00
|
|
|
|
void ClearFrame(int frame);
|
2013-12-03 15:59:46 +00:00
|
|
|
|
|
|
|
|
|
/// <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>
|
2013-12-03 02:10:17 +00:00
|
|
|
|
void AppendFrame(MnemonicsGenerator mg);
|
2013-12-03 15:59:46 +00:00
|
|
|
|
|
|
|
|
|
/// <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);
|
|
|
|
|
|
2013-12-03 01:43:02 +00:00
|
|
|
|
void Truncate(int frame);
|
2013-12-03 15:59:46 +00:00
|
|
|
|
string GetInput(int frame);
|
2013-11-23 18:18:58 +00:00
|
|
|
|
|
2013-11-23 17:26:33 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Dubious, should reconsider
|
2013-11-30 02:33:26 +00:00
|
|
|
|
|
2013-12-04 03:16:35 +00:00
|
|
|
|
bool CheckTimeLines(TextReader reader, out string errorMessage); //Can we avoid passing a text reader?
|
2013-12-03 18:08:45 +00:00
|
|
|
|
void ExtractInputLog(TextReader reader); //Is passing a textreader the only reasonable way to do this?
|
2013-11-29 19:55:05 +00:00
|
|
|
|
|
2013-11-23 17:26:33 +00:00
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|