create IMovieSession with the necessary API, instead of using an instance of MovieSession, the API though is completetly horrible, we need to address this

This commit is contained in:
adelikat 2015-02-22 23:23:36 +00:00
parent be51677fde
commit aabd3f4526
4 changed files with 45 additions and 4 deletions

View File

@ -187,6 +187,7 @@
<Compile Include="movie\interfaces\ILogEntryGenerator.cs" />
<Compile Include="movie\interfaces\IMovie.cs" />
<Compile Include="movie\interfaces\IMovieController.cs" />
<Compile Include="movie\interfaces\IMovieSession.cs" />
<Compile Include="movie\MovieService.cs" />
<Compile Include="movie\MovieSession.cs" />
<Compile Include="movie\MultitrackRecording.cs" />

View File

@ -14,7 +14,7 @@ namespace BizHawk.Client.Common
public static FirmwareManager FirmwareManager;
public static Rewinder Rewinder;
public static MovieSession MovieSession = new MovieSession();
public static IMovieSession MovieSession = new MovieSession();
/// <summary>
/// Used to disable secondary throttling (e.g. vsync, audio) for unthrottled modes or when the primary (clock) throttle is taking over (e.g. during fast forward/rewind).

View File

@ -13,7 +13,7 @@ namespace BizHawk.Client.Common
{
public enum MovieEndAction { Stop, Pause, Record, Finish }
public class MovieSession
public class MovieSession : IMovieSession
{
public MovieSession()
{
@ -437,8 +437,8 @@ namespace BizHawk.Client.Common
// The behavior here is to only temporarily override these settings when playing a movie and then restore the user's preferred settings
// A more elegant approach would be appreciated
public bool? PreviousNES_InQuickNES = null;
public bool? PreviousSNES_InSnes9x = null;
public bool? PreviousNES_InQuickNES { get; set; }
public bool? PreviousSNES_InSnes9x { get; set; }
public void QueueNewMovie(IMovie movie, bool record, IEmulator emulator)
{

View File

@ -0,0 +1,40 @@
using System.IO;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.Common
{
public interface IMovieSession
{
IMovie Movie { get; set; }
IMovie QueuedMovie { get; }
IMovieController MovieControllerAdapter { get; }
IMovieController MovieControllerInstance();
MultitrackRecorder MultiTrack { get; }
IController PreviousFrame { get; }
IController CurrentInput { get; }
bool ReadOnly { get; set; }
bool MovieIsQueued { get; }
bool? PreviousNES_InQuickNES { get; set; }
bool? PreviousSNES_InSnes9x { get; set; }
void HandleMovieOnFrameLoop();
void HandleMovieSaveState(TextWriter writer);
bool HandleMovieLoadState(string path);
// To function as a MovieSession, you must have hacky LoadState steps, non-hacky steps just won't do
bool HandleMovieLoadState_HackyStep1(TextReader reader);
bool HandleMovieLoadState_HackyStep2(TextReader reader);
ILogEntryGenerator LogGeneratorInstance();
void QueueNewMovie(IMovie movie, bool record, IEmulator emulator);
void RunQueuedMovie(bool recordMode);
void ToggleMultitrack();
void StopMovie(bool saveChanges = true);
}
}