refactor IMovie to expose the movie mode, and make extension methods that do IsPlaying type logic. This way there can be direct checks, and more variety of methods without cluttering the interface
This commit is contained in:
parent
d26cb7d272
commit
b80b367831
|
@ -15,13 +15,13 @@ namespace BizHawk.Client.Common
|
|||
|
||||
private readonly Action<string> LogCallback;
|
||||
|
||||
public bool StartsFromSavestate() => Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.StartsFromSavestate;
|
||||
public bool StartsFromSavestate() => Global.MovieSession.Movie.IsActive() && Global.MovieSession.Movie.StartsFromSavestate;
|
||||
|
||||
public bool StartsFromSaveram() => Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.StartsFromSaveRam;
|
||||
public bool StartsFromSaveram() => Global.MovieSession.Movie.IsActive() && Global.MovieSession.Movie.StartsFromSaveRam;
|
||||
|
||||
public Dictionary<string, dynamic> GetInput(int frame)
|
||||
{
|
||||
if (!Global.MovieSession.Movie.IsActive)
|
||||
if (Global.MovieSession.Movie.NotActive())
|
||||
{
|
||||
LogCallback("No movie loaded");
|
||||
return null;
|
||||
|
@ -40,7 +40,10 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public string GetInputAsMnemonic(int frame)
|
||||
{
|
||||
if (!Global.MovieSession.Movie.IsActive || frame >= Global.MovieSession.Movie.InputLogLength) return string.Empty;
|
||||
if (Global.MovieSession.Movie.NotActive() || frame >= Global.MovieSession.Movie.InputLogLength)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
var lg = Global.MovieSession.LogGeneratorInstance();
|
||||
lg.SetSource(Global.MovieSession.Movie.GetInputState(frame));
|
||||
return lg.GenerateLogEntry();
|
||||
|
@ -48,7 +51,11 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void Save(string filename = null)
|
||||
{
|
||||
if (!Global.MovieSession.Movie.IsActive) return;
|
||||
if (Global.MovieSession.Movie.NotActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(filename))
|
||||
{
|
||||
filename += $".{Global.MovieSession.Movie.PreferredExtension}";
|
||||
|
@ -65,7 +72,10 @@ namespace BizHawk.Client.Common
|
|||
public Dictionary<string, string> GetHeader()
|
||||
{
|
||||
var table = new Dictionary<string, string>();
|
||||
if (!Global.MovieSession.Movie.IsActive) return table;
|
||||
if (Global.MovieSession.Movie.NotActive())
|
||||
{
|
||||
return table;
|
||||
}
|
||||
foreach (var kvp in Global.MovieSession.Movie.HeaderEntries) table[kvp.Key] = kvp.Value;
|
||||
return table;
|
||||
}
|
||||
|
@ -73,7 +83,11 @@ namespace BizHawk.Client.Common
|
|||
public List<string> GetComments()
|
||||
{
|
||||
var list = new List<string>(Global.MovieSession.Movie.Comments.Count);
|
||||
if (!Global.MovieSession.Movie.IsActive) return list;
|
||||
if (Global.MovieSession.Movie.NotActive())
|
||||
{
|
||||
return list;
|
||||
}
|
||||
|
||||
for (var i = 0; i < Global.MovieSession.Movie.Comments.Count; i++) list[i] = Global.MovieSession.Movie.Comments[i];
|
||||
return list;
|
||||
}
|
||||
|
@ -81,7 +95,11 @@ namespace BizHawk.Client.Common
|
|||
public List<string> GetSubtitles()
|
||||
{
|
||||
var list = new List<string>(Global.MovieSession.Movie.Subtitles.Count);
|
||||
if (!Global.MovieSession.Movie.IsActive) return list;
|
||||
if (Global.MovieSession.Movie.NotActive())
|
||||
{
|
||||
return list;
|
||||
}
|
||||
|
||||
for (var i = 0; i < Global.MovieSession.Movie.Subtitles.Count; i++) list[i] = Global.MovieSession.Movie.Subtitles[i].ToString();
|
||||
return list;
|
||||
}
|
||||
|
@ -94,17 +112,11 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public bool GetRerecordCounting() => Global.MovieSession.Movie.IsCountingRerecords;
|
||||
|
||||
public bool IsLoaded() => Global.MovieSession.Movie.IsActive;
|
||||
public bool IsLoaded() => Global.MovieSession.Movie.IsActive();
|
||||
|
||||
public double Length() => Global.MovieSession.Movie.FrameCount;
|
||||
|
||||
public string Mode() => Global.MovieSession.Movie.IsFinished
|
||||
? "FINISHED"
|
||||
: Global.MovieSession.Movie.IsPlaying
|
||||
? "PLAY"
|
||||
: Global.MovieSession.Movie.IsRecording
|
||||
? "RECORD"
|
||||
: "INACTIVE";
|
||||
public string Mode() => Global.MovieSession.Movie.Mode.ToString().ToUpper();
|
||||
|
||||
public void SetReadOnly(bool readOnly) => Global.MovieSession.ReadOnly = readOnly;
|
||||
|
||||
|
@ -117,7 +129,11 @@ namespace BizHawk.Client.Common
|
|||
public double GetFps()
|
||||
{
|
||||
var movie = Global.MovieSession.Movie;
|
||||
if (!movie.IsActive) return default;
|
||||
if (movie.NotActive())
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
return new PlatformFrameRates()[
|
||||
movie.HeaderEntries[HeaderKeys.PLATFORM],
|
||||
movie.HeaderEntries.TryGetValue(HeaderKeys.PAL, out var isPal) && isPal == "1"
|
||||
|
|
|
@ -261,7 +261,7 @@ namespace BizHawk.Client.Common
|
|||
public static string SaveRamPath(GameInfo game)
|
||||
{
|
||||
var name = FilesystemSafeName(game);
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
if (Global.MovieSession.Movie.IsActive())
|
||||
{
|
||||
name += $".{Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename)}";
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ namespace BizHawk.Client.Common
|
|||
name = FilesystemSafeName(game);
|
||||
}
|
||||
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
if (Global.MovieSession.Movie.IsActive())
|
||||
{
|
||||
name = Path.Combine(name, $"movie-{Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename)}");
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ namespace BizHawk.Client.Common
|
|||
name += $".{Global.Emulator.Attributes().CoreName}";
|
||||
}
|
||||
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
if (Global.MovieSession.Movie.IsActive())
|
||||
{
|
||||
name += $".{Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename)}";
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
if (Global.MovieSession.Movie.IsActive())
|
||||
{
|
||||
bs.PutLump(BinaryStateLump.Input,
|
||||
delegate(TextWriter tw)
|
||||
|
@ -86,7 +86,7 @@ namespace BizHawk.Client.Common
|
|||
});
|
||||
}
|
||||
|
||||
if (Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie is TasMovie)
|
||||
if (Global.MovieSession.Movie.IsActive() && Global.MovieSession.Movie is TasMovie)
|
||||
{
|
||||
bs.PutLump(BinaryStateLump.LagLog,
|
||||
delegate(TextWriter tw)
|
||||
|
@ -139,7 +139,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
var succeed = false;
|
||||
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
if (Global.MovieSession.Movie.IsActive())
|
||||
{
|
||||
bl.GetLump(BinaryStateLump.Input, true, tr => succeed = Global.MovieSession.HandleMovieLoadState_HackyStep1(tr));
|
||||
if (!succeed)
|
||||
|
@ -179,7 +179,7 @@ namespace BizHawk.Client.Common
|
|||
Global.UserBag = (Dictionary<string, object>)ConfigService.LoadWithType(userData);
|
||||
}
|
||||
|
||||
if (Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie is TasMovie)
|
||||
if (Global.MovieSession.Movie.IsActive() && Global.MovieSession.Movie is TasMovie)
|
||||
{
|
||||
bl.GetLump(BinaryStateLump.LagLog, false, delegate(TextReader tr)
|
||||
{
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
get
|
||||
{
|
||||
if (Movie.IsActive && !Movie.IsFinished && Global.Emulator.Frame > 0)
|
||||
if (Movie.IsPlayingOrRecording() && Global.Emulator.Frame > 0)
|
||||
{
|
||||
return Movie.GetInputState(Global.Emulator.Frame - 1);
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
get
|
||||
{
|
||||
if (Movie.IsActive && !Movie.IsFinished && Global.Emulator.Frame > 1)
|
||||
if (Movie.IsPlayingOrRecording() && Global.Emulator.Frame > 1)
|
||||
{
|
||||
return Movie.GetInputState(Global.Emulator.Frame - 2);
|
||||
}
|
||||
|
@ -170,18 +170,18 @@ namespace BizHawk.Client.Common
|
|||
public void StopMovie(bool saveChanges = true)
|
||||
{
|
||||
var message = "Movie ";
|
||||
if (Movie.IsRecording)
|
||||
if (Movie.IsRecording())
|
||||
{
|
||||
message += "recording ";
|
||||
}
|
||||
else if (Movie.IsPlaying)
|
||||
else if (Movie.IsPlaying())
|
||||
{
|
||||
message += "playback ";
|
||||
}
|
||||
|
||||
message += "stopped.";
|
||||
|
||||
if (Movie.IsActive)
|
||||
if (Movie.IsActive())
|
||||
{
|
||||
var result = Movie.Stop(saveChanges);
|
||||
if (result)
|
||||
|
@ -199,7 +199,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void HandleMovieSaveState(TextWriter writer)
|
||||
{
|
||||
if (Movie.IsActive)
|
||||
if (Movie.IsActive())
|
||||
{
|
||||
Movie.WriteInputLog(writer);
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void ClearFrame()
|
||||
{
|
||||
if (Movie.IsPlaying)
|
||||
if (Movie.IsPlaying())
|
||||
{
|
||||
Movie.ClearFrame(Global.Emulator.Frame);
|
||||
Output($"Scrubbed input at frame {Global.Emulator.Frame}");
|
||||
|
@ -216,11 +216,11 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void HandleMovieOnFrameLoop()
|
||||
{
|
||||
if (!Movie.IsActive)
|
||||
if (!Movie.IsActive())
|
||||
{
|
||||
LatchInputFromPlayer(Global.MovieInputSourceAdapter);
|
||||
}
|
||||
else if (Movie.IsFinished)
|
||||
else if (Movie.IsFinished())
|
||||
{
|
||||
if (Global.Emulator.Frame < Movie.FrameCount) // This scenario can happen from rewinding (suddenly we are back in the movie, so hook back up to the movie
|
||||
{
|
||||
|
@ -232,18 +232,18 @@ namespace BizHawk.Client.Common
|
|||
LatchInputFromPlayer(Global.MovieInputSourceAdapter);
|
||||
}
|
||||
}
|
||||
else if (Movie.IsPlaying)
|
||||
else if (Movie.IsPlaying())
|
||||
{
|
||||
LatchInputFromLog();
|
||||
|
||||
if (Movie.IsRecording) // The movie end situation can cause the switch to record mode, in that case we need to capture some input for this frame
|
||||
if (Movie.IsRecording()) // The movie end situation can cause the switch to record mode, in that case we need to capture some input for this frame
|
||||
{
|
||||
HandleFrameLoopForRecordMode();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Movie may go into finished mode as a result from latching
|
||||
if (!Movie.IsFinished)
|
||||
if (!Movie.IsFinished())
|
||||
{
|
||||
if (Global.ClientControls.IsPressed("Scrub Input"))
|
||||
{
|
||||
|
@ -269,7 +269,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (Movie.IsRecording)
|
||||
else if (Movie.IsRecording())
|
||||
{
|
||||
HandleFrameLoopForRecordMode();
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ namespace BizHawk.Client.Common
|
|||
private void HandleFrameLoopForRecordMode()
|
||||
{
|
||||
// we don't want TasMovie to latch user input outside its internal recording mode, so limit it to autohold
|
||||
if (Movie is TasMovie && Movie.IsPlaying)
|
||||
if (Movie is TasMovie && Movie.IsPlaying())
|
||||
{
|
||||
MovieControllerAdapter.LatchSticky();
|
||||
}
|
||||
|
@ -304,12 +304,12 @@ namespace BizHawk.Client.Common
|
|||
if (Movie is TasMovie tasMovie)
|
||||
{
|
||||
tasMovie.GreenzoneCurrentFrame();
|
||||
if (tasMovie.IsPlaying && Global.Emulator.Frame >= tasMovie.InputLogLength)
|
||||
if (tasMovie.IsPlaying() && Global.Emulator.Frame >= tasMovie.InputLogLength)
|
||||
{
|
||||
HandleFrameLoopForRecordMode();
|
||||
}
|
||||
}
|
||||
else if (Movie.IsPlaying && !Movie.IsFinished && Global.Emulator.Frame >= Movie.InputLogLength)
|
||||
else if (Movie.Mode == MovieMode.Play && Global.Emulator.Frame >= Movie.InputLogLength)
|
||||
{
|
||||
HandlePlaybackEnd();
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ namespace BizHawk.Client.Common
|
|||
// TODO: maybe someone who understands more about what's going on here could rename these step1 and step2 into something more descriptive
|
||||
public bool HandleMovieLoadState_HackyStep2(TextReader reader)
|
||||
{
|
||||
if (!Movie.IsActive)
|
||||
if (Movie.NotActive())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public bool HandleMovieLoadState_HackyStep1(TextReader reader)
|
||||
{
|
||||
if (!Movie.IsActive)
|
||||
if (!Movie.IsActive())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -375,22 +375,22 @@ namespace BizHawk.Client.Common
|
|||
return false;
|
||||
}
|
||||
|
||||
if (Movie.IsRecording)
|
||||
if (Movie.IsRecording())
|
||||
{
|
||||
Movie.SwitchToPlay();
|
||||
}
|
||||
else if (Movie.IsFinished)
|
||||
else if (Movie.IsFinished())
|
||||
{
|
||||
LatchInputFromPlayer(Global.MovieInputSourceAdapter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Movie.IsFinished)
|
||||
if (Movie.IsFinished())
|
||||
{
|
||||
Movie.StartNewRecording();
|
||||
}
|
||||
else if (Movie.IsPlaying)
|
||||
else if (Movie.IsPlaying())
|
||||
{
|
||||
Movie.SwitchToRecord();
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void ToggleMultitrack()
|
||||
{
|
||||
if (Movie.IsActive)
|
||||
if (Movie.IsActive())
|
||||
{
|
||||
if (Global.Config.VBAStyleMovieLoadState)
|
||||
{
|
||||
|
|
|
@ -245,7 +245,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
if (Log.Count < stateFrame)
|
||||
{
|
||||
if (IsFinished)
|
||||
if (this.IsFinished())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4,20 +4,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public partial class Bk2Movie
|
||||
{
|
||||
protected enum MovieMode
|
||||
{
|
||||
Inactive, Play, Record, Finished
|
||||
}
|
||||
|
||||
protected MovieMode Mode { get; set; } = MovieMode.Inactive;
|
||||
|
||||
public bool IsActive => Mode != MovieMode.Inactive;
|
||||
|
||||
public bool IsPlaying => Mode == MovieMode.Play || Mode == MovieMode.Finished;
|
||||
|
||||
public bool IsRecording => Mode == MovieMode.Record;
|
||||
|
||||
public bool IsFinished => Mode == MovieMode.Finished;
|
||||
public MovieMode Mode { get; protected set; } = MovieMode.Inactive;
|
||||
|
||||
public virtual void StartNewRecording()
|
||||
{
|
||||
|
@ -51,7 +38,7 @@ namespace BizHawk.Client.Common
|
|||
bool saved = false;
|
||||
if (saveChanges)
|
||||
{
|
||||
if (Mode == MovieMode.Record || (IsActive && Changes))
|
||||
if (Mode == MovieMode.Record || (this.IsActive() && Changes))
|
||||
{
|
||||
Save();
|
||||
saved = true;
|
||||
|
|
|
@ -6,17 +6,42 @@ using BizHawk.Emulation.Common;
|
|||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public enum MovieMode
|
||||
{
|
||||
/// <summary>
|
||||
/// There is no movie loaded
|
||||
/// </summary>
|
||||
Inactive,
|
||||
|
||||
/// <summary>
|
||||
/// The movie is in playback mode
|
||||
/// </summary>
|
||||
Play,
|
||||
|
||||
/// <summary>
|
||||
/// The movie is currently recording
|
||||
/// </summary>
|
||||
Record,
|
||||
|
||||
/// <summary>
|
||||
/// The movie has played past the end, but is still loaded in memory
|
||||
/// </summary>
|
||||
Finished
|
||||
}
|
||||
|
||||
// TODO: message callback / event handler
|
||||
// TODO: consider other event handlers, switching modes?
|
||||
public interface IMovie
|
||||
{
|
||||
#region Status
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current movie mode
|
||||
/// </summary>
|
||||
MovieMode Mode { get; }
|
||||
|
||||
bool IsCountingRerecords { get; set; }
|
||||
bool IsActive { get; }
|
||||
bool IsPlaying { get; }
|
||||
bool IsRecording { get; }
|
||||
bool IsFinished { get; }
|
||||
|
||||
bool Changes { get; }
|
||||
|
||||
#endregion
|
||||
|
@ -218,4 +243,14 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static class MovieExtensions
|
||||
{
|
||||
public static bool IsActive(this IMovie movie) => movie.Mode != MovieMode.Inactive;
|
||||
public static bool NotActive(this IMovie movie) => movie.Mode == MovieMode.Inactive;
|
||||
public static bool IsPlaying(this IMovie movie) => movie.Mode == MovieMode.Play || movie.Mode == MovieMode.Finished;
|
||||
public static bool IsRecording(this IMovie movie) => movie.Mode == MovieMode.Record;
|
||||
public static bool IsFinished(this IMovie movie) => movie.Mode == MovieMode.Finished;
|
||||
public static bool IsPlayingOrRecording(this IMovie movie) => movie.Mode == MovieMode.Play && movie.Mode == MovieMode.Record;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace BizHawk.Client.Common
|
|||
TasLagLog.RemoveFrom(frame);
|
||||
TasLagLog[frame] = Global.Emulator.AsInputPollable().IsLagFrame;
|
||||
|
||||
if (IsRecording)
|
||||
if (this.IsRecording())
|
||||
{
|
||||
TasStateManager.Invalidate(frame + 1);
|
||||
}
|
||||
|
|
|
@ -115,12 +115,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public override void SwitchToPlay()
|
||||
{
|
||||
Mode = Moviemode.Play;
|
||||
Mode = MovieMode.Play;
|
||||
}
|
||||
|
||||
public override void SwitchToRecord()
|
||||
{
|
||||
Mode = Moviemode.Record;
|
||||
Mode = MovieMode.Record;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -379,7 +379,7 @@ namespace BizHawk.Client.Common
|
|||
Truncate(Log.Count);
|
||||
}
|
||||
|
||||
Mode = Moviemode.Finished;
|
||||
Mode = MovieMode.Finished;
|
||||
}
|
||||
|
||||
if (IsCountingRerecords)
|
||||
|
|
|
@ -313,7 +313,7 @@ namespace BizHawk.Client.Common
|
|||
// each one records how to get back to the previous state, once we've gone back to
|
||||
// the second item, it's already resulted in the first state being loaded. The
|
||||
// first item is just a junk entry with the initial value of _lastState (0 bytes).
|
||||
if (_rewindBuffer.Count <= 1 || (Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.InputLogLength == 0))
|
||||
if (_rewindBuffer.Count <= 1 || (Global.MovieSession.Movie.IsActive() && Global.MovieSession.Movie.InputLogLength == 0))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private string MakeFrameCounter()
|
||||
{
|
||||
if (Global.MovieSession.Movie.IsFinished)
|
||||
if (Global.MovieSession.Movie.IsFinished())
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb
|
||||
|
@ -79,7 +79,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return sb.ToString();
|
||||
}
|
||||
|
||||
if (Global.MovieSession.Movie.IsPlaying)
|
||||
if (Global.MovieSession.Movie.IsPlaying())
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb
|
||||
|
@ -188,7 +188,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public string InputPrevious()
|
||||
{
|
||||
if (Global.MovieSession.Movie.IsActive && !Global.MovieSession.Movie.IsFinished)
|
||||
if (Global.MovieSession.Movie.IsPlayingOrRecording())
|
||||
{
|
||||
var lg = Global.MovieSession.LogGeneratorInstance();
|
||||
var state = Global.MovieSession.Movie.GetInputState(Global.Emulator.Frame - 1);
|
||||
|
@ -204,11 +204,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public string InputStrOrAll()
|
||||
{
|
||||
var m = (Global.MovieSession.Movie.IsActive &&
|
||||
!Global.MovieSession.Movie.IsFinished &&
|
||||
Global.Emulator.Frame > 0) ?
|
||||
Global.MovieSession.Movie.GetInputState(Global.Emulator.Frame - 1) :
|
||||
Global.MovieSession.MovieControllerInstance();
|
||||
var m = Global.MovieSession.Movie.IsPlayingOrRecording() && Global.Emulator.Frame > 0
|
||||
? Global.MovieSession.Movie.GetInputState(Global.Emulator.Frame - 1)
|
||||
: Global.MovieSession.MovieControllerInstance();
|
||||
|
||||
var lg = Global.MovieSession.LogGeneratorInstance();
|
||||
|
||||
|
@ -225,11 +223,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public string MakeIntersectImmediatePrevious()
|
||||
{
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
if (Global.MovieSession.Movie.IsActive())
|
||||
{
|
||||
var m = Global.MovieSession.Movie.IsActive && !Global.MovieSession.Movie.IsFinished ?
|
||||
Global.MovieSession.Movie.GetInputState(Global.Emulator.Frame - 1) :
|
||||
Global.MovieSession.MovieControllerInstance();
|
||||
var m = Global.MovieSession.Movie.IsPlayingOrRecording()
|
||||
? Global.MovieSession.Movie.GetInputState(Global.Emulator.Frame - 1)
|
||||
: Global.MovieSession.MovieControllerInstance();
|
||||
|
||||
var lg = Global.MovieSession.LogGeneratorInstance();
|
||||
lg.SetSource(Global.AutofireStickyXORAdapter.And(m));
|
||||
|
@ -241,7 +239,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public string MakeRerecordCount()
|
||||
{
|
||||
return Global.MovieSession.Movie.IsActive
|
||||
return Global.MovieSession.Movie.IsActive()
|
||||
? Global.MovieSession.Movie.Rerecords.ToString()
|
||||
: "";
|
||||
}
|
||||
|
@ -270,8 +268,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (Global.Config.DisplayInput && !Global.Game.IsNullInstance())
|
||||
{
|
||||
if ((Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsFinished)
|
||||
|| (Global.MovieSession.Movie.IsFinished && Global.Emulator.Frame == Global.MovieSession.Movie.InputLogLength)) // Account for the last frame of the movie, the movie state is immediately "Finished" here but we still want to show the input
|
||||
if (Global.MovieSession.Movie.Mode == MovieMode.Play
|
||||
|| (Global.MovieSession.Movie.IsFinished() && Global.Emulator.Frame == Global.MovieSession.Movie.InputLogLength)) // Account for the last frame of the movie, the movie state is immediately "Finished" here but we still want to show the input
|
||||
{
|
||||
var input = InputStrMovie();
|
||||
var point = GetCoordinates(g, Global.Config.InputDisplay, input);
|
||||
|
@ -366,7 +364,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
g.DrawString(message, MessageFont, Color.White, point.X, point.Y);
|
||||
}
|
||||
|
||||
if (Global.MovieSession.Movie.IsActive && Global.Config.DisplaySubtitles)
|
||||
if (Global.MovieSession.Movie.IsActive() && Global.Config.DisplaySubtitles)
|
||||
{
|
||||
var subList = Global.MovieSession.Movie.Subtitles.GetSubtitles(Global.Emulator.Frame);
|
||||
|
||||
|
|
|
@ -237,12 +237,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void MovieSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
FullMovieLoadstatesMenuItem.Enabled = !MovieSession.MultiTrack.IsActive;
|
||||
StopMovieWithoutSavingMenuItem.Enabled = MovieSession.Movie.IsActive && MovieSession.Movie.Changes;
|
||||
StopMovieWithoutSavingMenuItem.Enabled = MovieSession.Movie.IsActive() && MovieSession.Movie.Changes;
|
||||
StopMovieMenuItem.Enabled
|
||||
= PlayFromBeginningMenuItem.Enabled
|
||||
= SaveMovieMenuItem.Enabled
|
||||
= SaveMovieAsMenuItem.Enabled
|
||||
= MovieSession.Movie.IsActive;
|
||||
= MovieSession.Movie.IsActive();
|
||||
|
||||
ReadonlyMenuItem.Checked = MovieSession.ReadOnly;
|
||||
AutomaticallyBackupMoviesMenuItem.Checked = Config.EnableBackupMovies;
|
||||
|
@ -683,11 +683,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
PauseMenuItem.Checked = _didMenuPause ? _wasPaused : EmulatorPaused;
|
||||
|
||||
SoftResetMenuItem.Enabled = Emulator.ControllerDefinition.BoolButtons.Contains("Reset") &&
|
||||
(!MovieSession.Movie.IsPlaying || MovieSession.Movie.IsFinished);
|
||||
SoftResetMenuItem.Enabled = Emulator.ControllerDefinition.BoolButtons.Contains("Reset")
|
||||
&& MovieSession.Movie.Mode != MovieMode.Play;
|
||||
|
||||
HardResetMenuItem.Enabled = Emulator.ControllerDefinition.BoolButtons.Contains("Power") &&
|
||||
(!MovieSession.Movie.IsPlaying || MovieSession.Movie.IsFinished);
|
||||
HardResetMenuItem.Enabled = Emulator.ControllerDefinition.BoolButtons.Contains("Power")
|
||||
&& MovieSession.Movie.Mode != MovieMode.Play;;
|
||||
|
||||
PauseMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Pause"].Bindings;
|
||||
RebootCoreMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Reboot Core"].Bindings;
|
||||
|
@ -1543,10 +1543,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
NESSoundChannelsMenuItem.Enabled = Tools.IsAvailable<NESSoundConfig>();
|
||||
MovieSettingsMenuItem.Enabled = (Emulator is NES || Emulator is SubNESHawk)
|
||||
&& !MovieSession.Movie.IsActive;
|
||||
&& !MovieSession.Movie.IsActive();
|
||||
|
||||
NesControllerSettingsMenuItem.Enabled = Tools.IsAvailable<NesControllerSettings>()
|
||||
&& !MovieSession.Movie.IsActive;
|
||||
&& !MovieSession.Movie.IsActive();
|
||||
|
||||
barcodeReaderToolStripMenuItem.Enabled = ServiceInjector.IsAvailable(Emulator.ServiceProvider, typeof(BarcodeEntry));
|
||||
|
||||
|
@ -1633,7 +1633,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void FdsEjectDiskMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!MovieSession.Movie.IsPlaying || MovieSession.Movie.IsFinished)
|
||||
if (MovieSession.Movie.Mode != MovieMode.Play)
|
||||
{
|
||||
ClickyVirtualPadController.Click("FDS Eject");
|
||||
AddOnScreenMessage("FDS disk ejected.");
|
||||
|
@ -1645,7 +1645,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (Emulator is NES nes && nes.IsVS
|
||||
|| Emulator is SubNESHawk sub && sub.IsVs)
|
||||
{
|
||||
if (!MovieSession.Movie.IsPlaying || MovieSession.Movie.IsFinished)
|
||||
if (MovieSession.Movie.Mode != MovieMode.Play)
|
||||
{
|
||||
ClickyVirtualPadController.Click("Insert Coin P1");
|
||||
AddOnScreenMessage("P1 Coin Inserted");
|
||||
|
@ -1658,7 +1658,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (Emulator is NES nes && nes.IsVS
|
||||
|| Emulator is SubNESHawk sub && sub.IsVs)
|
||||
{
|
||||
if (!MovieSession.Movie.IsPlaying || MovieSession.Movie.IsFinished)
|
||||
if (MovieSession.Movie.Mode != MovieMode.Play)
|
||||
{
|
||||
ClickyVirtualPadController.Click("Insert Coin P2");
|
||||
AddOnScreenMessage("P2 Coin Inserted");
|
||||
|
@ -1671,7 +1671,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (Emulator is NES nes && nes.IsVS
|
||||
|| Emulator is SubNESHawk sub && sub.IsVs)
|
||||
{
|
||||
if (!MovieSession.Movie.IsPlaying || MovieSession.Movie.IsFinished)
|
||||
if (MovieSession.Movie.Mode != MovieMode.Play)
|
||||
{
|
||||
ClickyVirtualPadController.Click("Service Switch");
|
||||
AddOnScreenMessage("Service Switch Pressed");
|
||||
|
@ -1725,8 +1725,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
var s = ((PCEngine)Emulator).GetSettings();
|
||||
|
||||
PceControllerSettingsMenuItem.Enabled = !MovieSession.Movie.IsActive;
|
||||
|
||||
PceControllerSettingsMenuItem.Enabled = MovieSession.Movie.NotActive();
|
||||
PCEAlwaysPerformSpriteLimitMenuItem.Checked = s.SpriteLimit;
|
||||
PCEAlwaysEqualizeVolumesMenuItem.Checked = s.EqualizeVolume;
|
||||
PCEArcadeCardRewindEnableMenuItem.Checked = s.ArcadeCardRewindHack;
|
||||
|
@ -2079,8 +2078,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void A7800SubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
A7800ControllerSettingsMenuItem.Enabled = !MovieSession.Movie.IsActive;
|
||||
A7800FilterSettingsMenuItem.Enabled = !MovieSession.Movie.IsActive;
|
||||
A7800ControllerSettingsMenuItem.Enabled
|
||||
= A7800FilterSettingsMenuItem.Enabled
|
||||
= MovieSession.Movie.NotActive();
|
||||
}
|
||||
|
||||
private void A7800ControllerSettingsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -2180,7 +2180,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void PSXSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
PSXControllerSettingsMenuItem.Enabled = !MovieSession.Movie.IsActive;
|
||||
PSXControllerSettingsMenuItem.Enabled = MovieSession.Movie.NotActive();
|
||||
}
|
||||
|
||||
private void PSXControllerSettingsMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -2230,7 +2230,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
SnesGBInSGBMenuItem.Visible = false;
|
||||
}
|
||||
|
||||
SNESControllerConfigurationMenuItem.Enabled = !MovieSession.Movie.IsActive;
|
||||
SNESControllerConfigurationMenuItem.Enabled = MovieSession.Movie.NotActive();
|
||||
}
|
||||
|
||||
private void SNESControllerConfigurationMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -2280,7 +2280,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var ss = ((ColecoVision)Emulator).GetSyncSettings();
|
||||
ColecoSkipBiosMenuItem.Checked = ss.SkipBiosIntro;
|
||||
ColecoUseSGMMenuItem.Checked = ss.UseSGM;
|
||||
ColecoControllerSettingsMenuItem.Enabled = !MovieSession.Movie.IsActive;
|
||||
ColecoControllerSettingsMenuItem.Enabled = MovieSession.Movie.NotActive();
|
||||
}
|
||||
|
||||
private void ColecoSkipBiosMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -2314,8 +2314,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
N64PluginSettingsMenuItem.Enabled =
|
||||
N64ControllerSettingsMenuItem.Enabled =
|
||||
N64ExpansionSlotMenuItem.Enabled =
|
||||
!MovieSession.Movie.IsActive;
|
||||
N64ExpansionSlotMenuItem.Enabled =
|
||||
MovieSession.Movie.NotActive();
|
||||
|
||||
N64CircularAnalogRangeMenuItem.Checked = Config.N64UseCircularAnalogConstraint;
|
||||
|
||||
|
@ -2568,7 +2568,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void IntVSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
IntVControllerSettingsMenuItem.Enabled = !MovieSession.Movie.IsActive;
|
||||
IntVControllerSettingsMenuItem.Enabled = MovieSession.Movie.NotActive();
|
||||
}
|
||||
|
||||
private void IntVControllerSettingsMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -2959,7 +2959,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
RecordMovieContextMenuItem.Visible =
|
||||
PlayMovieContextMenuItem.Visible =
|
||||
LoadLastMovieContextMenuItem.Visible =
|
||||
!Emulator.IsNull() && !MovieSession.Movie.IsActive;
|
||||
!Emulator.IsNull() && MovieSession.Movie.NotActive();
|
||||
|
||||
RestartMovieContextMenuItem.Visible =
|
||||
StopMovieContextMenuItem.Visible =
|
||||
|
@ -2967,13 +2967,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
ViewCommentsContextMenuItem.Visible =
|
||||
SaveMovieContextMenuItem.Visible =
|
||||
SaveMovieAsContextMenuItem.Visible =
|
||||
MovieSession.Movie.IsActive;
|
||||
MovieSession.Movie.IsActive();
|
||||
|
||||
BackupMovieContextMenuItem.Visible = MovieSession.Movie.IsActive;
|
||||
BackupMovieContextMenuItem.Visible = MovieSession.Movie.IsActive();
|
||||
|
||||
StopNoSaveContextMenuItem.Visible = MovieSession.Movie.IsActive && MovieSession.Movie.Changes;
|
||||
StopNoSaveContextMenuItem.Visible = MovieSession.Movie.IsActive() && MovieSession.Movie.Changes;
|
||||
|
||||
AddSubtitleContextMenuItem.Visible = !Emulator.IsNull() && MovieSession.Movie.IsActive && !MovieSession.ReadOnly;
|
||||
AddSubtitleContextMenuItem.Visible = !Emulator.IsNull() && MovieSession.Movie.IsActive() && !MovieSession.ReadOnly;
|
||||
|
||||
ConfigContextMenuItem.Visible = _inFullscreen;
|
||||
|
||||
|
@ -2984,7 +2984,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
LoadLastRomContextMenuItem.Enabled = !Config.RecentRoms.Empty;
|
||||
LoadLastMovieContextMenuItem.Enabled = !Config.RecentMovies.Empty;
|
||||
|
||||
if (MovieSession.Movie.IsActive)
|
||||
if (MovieSession.Movie.IsActive())
|
||||
{
|
||||
if (MovieSession.ReadOnly)
|
||||
{
|
||||
|
@ -3084,7 +3084,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ViewSubtitlesContextMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MovieSession.Movie.IsActive)
|
||||
if (MovieSession.Movie.IsActive())
|
||||
{
|
||||
using var form = new EditSubtitlesForm { ReadOnly = MovieSession.ReadOnly };
|
||||
form.GetMovie(MovieSession.Movie);
|
||||
|
@ -3130,7 +3130,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ViewCommentsContextMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MovieSession.Movie.IsActive)
|
||||
if (MovieSession.Movie.IsActive())
|
||||
{
|
||||
using var form = new EditCommentsForm();
|
||||
form.GetMovie(MovieSession.Movie);
|
||||
|
@ -3237,7 +3237,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void LinkConnectStatusBarButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
// toggle Link status (only outside of a movie session)
|
||||
if (!MovieSession.Movie.IsPlaying || MovieSession.Movie.IsFinished)
|
||||
if (MovieSession.Movie.Mode != MovieMode.Play)
|
||||
{
|
||||
Emulator.AsLinkable().LinkConnected ^= true;
|
||||
Console.WriteLine("Cable connect status to {0}", Emulator.AsLinkable().LinkConnected);
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
// SuuperW: Check changes. adelikat: this could break bk2 movies
|
||||
// TODO: Clean up the saving process
|
||||
if (movie.IsActive && (movie.Changes || !(movie is TasMovie)))
|
||||
if (movie.IsActive() && (movie.Changes || !(movie is TasMovie)))
|
||||
{
|
||||
movie.Save();
|
||||
}
|
||||
|
@ -98,19 +98,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void SetMainformMovieInfo()
|
||||
{
|
||||
if (MovieSession.Movie.IsPlaying)
|
||||
if (MovieSession.Movie.IsPlaying())
|
||||
{
|
||||
PlayRecordStatusButton.Image = Properties.Resources.Play;
|
||||
PlayRecordStatusButton.ToolTipText = "Movie is in playback mode";
|
||||
PlayRecordStatusButton.Visible = true;
|
||||
}
|
||||
else if (MovieSession.Movie.IsRecording)
|
||||
else if (MovieSession.Movie.IsRecording())
|
||||
{
|
||||
PlayRecordStatusButton.Image = Properties.Resources.RecordHS;
|
||||
PlayRecordStatusButton.ToolTipText = "Movie is in record mode";
|
||||
PlayRecordStatusButton.Visible = true;
|
||||
}
|
||||
else if (!MovieSession.Movie.IsActive)
|
||||
else if (!MovieSession.Movie.IsActive())
|
||||
{
|
||||
PlayRecordStatusButton.Image = Properties.Resources.Blank;
|
||||
PlayRecordStatusButton.ToolTipText = "No movie is active";
|
||||
|
@ -129,7 +129,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
if (MovieSession.Movie.IsActive)
|
||||
if (MovieSession.Movie.IsActive())
|
||||
{
|
||||
StartNewMovie(MovieSession.Movie, false);
|
||||
AddOnScreenMessage("Replaying movie file in read-only mode");
|
||||
|
|
|
@ -1568,7 +1568,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
str += $" - {Game.Name}";
|
||||
|
||||
if (MovieSession.Movie.IsActive)
|
||||
if (MovieSession.Movie.IsActive())
|
||||
{
|
||||
str += $" - {Path.GetFileName(MovieSession.Movie.Filename)}";
|
||||
}
|
||||
|
@ -2388,7 +2388,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void PutCoreSyncSettings(object o)
|
||||
{
|
||||
var settable = new SettingsAdapter(Emulator);
|
||||
if (MovieSession.Movie.IsActive)
|
||||
if (MovieSession.Movie.IsActive())
|
||||
{
|
||||
AddOnScreenMessage("Attempt to change sync-relevant settings while recording BLOCKED.");
|
||||
}
|
||||
|
@ -2485,7 +2485,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// is it enough to run this for one frame? maybe..
|
||||
if (Emulator.ControllerDefinition.BoolButtons.Contains("Reset"))
|
||||
{
|
||||
if (!MovieSession.Movie.IsPlaying || MovieSession.Movie.IsFinished)
|
||||
if (MovieSession.Movie.Mode != MovieMode.Play)
|
||||
{
|
||||
ClickyVirtualPadController.Click("Reset");
|
||||
AddOnScreenMessage("Reset button pressed.");
|
||||
|
@ -2498,7 +2498,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// is it enough to run this for one frame? maybe..
|
||||
if (Emulator.ControllerDefinition.BoolButtons.Contains("Power"))
|
||||
{
|
||||
if (!MovieSession.Movie.IsPlaying || MovieSession.Movie.IsFinished)
|
||||
if (MovieSession.Movie.Mode != MovieMode.Play)
|
||||
{
|
||||
ClickyVirtualPadController.Click("Power");
|
||||
AddOnScreenMessage("Power button pressed.");
|
||||
|
@ -2671,7 +2671,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void SaveMovie()
|
||||
{
|
||||
if (MovieSession.Movie.IsActive)
|
||||
if (MovieSession.Movie.IsActive())
|
||||
{
|
||||
MovieSession.Movie.Save();
|
||||
AddOnScreenMessage($"{MovieSession.Movie.Filename} saved.");
|
||||
|
@ -2780,7 +2780,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (Emulator.ControllerDefinition.BoolButtons.Contains(button))
|
||||
{
|
||||
if (!MovieSession.Movie.IsPlaying || MovieSession.Movie.IsFinished)
|
||||
if (MovieSession.Movie.Mode != MovieMode.Play)
|
||||
{
|
||||
ClickyVirtualPadController.Click(button);
|
||||
AddOnScreenMessage(msg);
|
||||
|
@ -3059,7 +3059,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
MovieSession.Movie.SwitchToRecord();
|
||||
}
|
||||
|
||||
if (isRewinding && !IsRewindSlave && MovieSession.Movie.IsRecording)
|
||||
if (isRewinding && !IsRewindSlave && MovieSession.Movie.IsRecording())
|
||||
{
|
||||
MovieSession.Movie.Truncate(Global.Emulator.Frame);
|
||||
}
|
||||
|
@ -3930,7 +3930,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Config.PutCoreSettings(settable.GetSettings(), t);
|
||||
}
|
||||
|
||||
if (settable.HasSyncSettings && !MovieSession.Movie.IsActive)
|
||||
if (settable.HasSyncSettings && !MovieSession.Movie.IsActive())
|
||||
{
|
||||
// don't trample config with loaded-from-movie settings
|
||||
Config.PutCoreSyncSettings(settable.GetSyncSettings(), t);
|
||||
|
@ -3970,7 +3970,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
StopAv();
|
||||
|
||||
CommitCoreSettingsToConfig();
|
||||
if (MovieSession.Movie.IsActive) // Note: this must be called after CommitCoreSettingsToConfig()
|
||||
if (MovieSession.Movie.IsActive()) // Note: this must be called after CommitCoreSettingsToConfig()
|
||||
{
|
||||
StopMovie();
|
||||
}
|
||||
|
@ -4120,7 +4120,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
UpdateToolsLoadstate();
|
||||
AutoFireController.ClearStarts();
|
||||
|
||||
if (!IsRewindSlave && MovieSession.Movie.IsActive)
|
||||
if (!IsRewindSlave && MovieSession.Movie.IsActive())
|
||||
{
|
||||
ClearRewindData();
|
||||
}
|
||||
|
@ -4417,7 +4417,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
if (MovieSession.Movie.IsActive)
|
||||
if (MovieSession.Movie.IsActive())
|
||||
{
|
||||
MovieSession.ReadOnly ^= true;
|
||||
AddOnScreenMessage(MovieSession.ReadOnly ? "Movie read-only mode" : "Movie read+write mode");
|
||||
|
@ -4535,7 +4535,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
runFrame = Rewinder.Rewind(1) && Emulator.Frame > 1;
|
||||
|
||||
if (runFrame && MovieSession.Movie.IsRecording)
|
||||
if (runFrame && MovieSession.Movie.IsRecording())
|
||||
{
|
||||
MovieSession.Movie.SwitchToPlay();
|
||||
returnToRecording = true;
|
||||
|
|
|
@ -223,27 +223,25 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
using (var mf = new MainForm(args))
|
||||
using var mf = new MainForm(args);
|
||||
var title = mf.Text;
|
||||
mf.Show();
|
||||
mf.Text = title;
|
||||
try
|
||||
{
|
||||
var title = mf.Text;
|
||||
mf.Show();
|
||||
mf.Text = title;
|
||||
try
|
||||
GlobalWin.ExitCode = mf.ProgramRunLoop();
|
||||
}
|
||||
catch (Exception e) when (Global.MovieSession.Movie.IsActive() && !(Debugger.IsAttached || VersionInfo.DeveloperBuild))
|
||||
{
|
||||
var result = MessageBox.Show(
|
||||
"EmuHawk has thrown a fatal exception and is about to close.\nA movie has been detected. Would you like to try to save?\n(Note: Depending on what caused this error, this may or may not succeed)",
|
||||
$"Fatal error: {e.GetType().Name}",
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Exclamation
|
||||
);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
GlobalWin.ExitCode = mf.ProgramRunLoop();
|
||||
}
|
||||
catch (Exception e) when (Global.MovieSession.Movie.IsActive && !(Debugger.IsAttached || VersionInfo.DeveloperBuild))
|
||||
{
|
||||
var result = MessageBox.Show(
|
||||
"EmuHawk has thrown a fatal exception and is about to close.\nA movie has been detected. Would you like to try to save?\n(Note: Depending on what caused this error, this may or may not succeed)",
|
||||
$"Fatal error: {e.GetType().Name}",
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Exclamation
|
||||
);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
Global.MovieSession.Movie.Save();
|
||||
}
|
||||
Global.MovieSession.Movie.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_s = s ?? new Gameboy.GambatteSettings();
|
||||
_ss = ss ?? new Gameboy.GambatteSyncSettings();
|
||||
propertyGrid1.SelectedObject = _ss;
|
||||
propertyGrid1.Enabled = !Global.MovieSession.Movie.IsActive;
|
||||
propertyGrid1.Enabled = Global.MovieSession.Movie.NotActive();
|
||||
checkBoxMuted.Checked = _s.Muted;
|
||||
cbDisplayBG.Checked = _s.DisplayBG;
|
||||
cbDisplayOBJ.Checked = _s.DisplayOBJ;
|
||||
|
@ -43,8 +43,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ButtonDefaults_Click(object sender, EventArgs e)
|
||||
{
|
||||
PutSettings(null, Global.MovieSession.Movie.IsActive ? _ss : null);
|
||||
if (!Global.MovieSession.Movie.IsActive)
|
||||
PutSettings(null, Global.MovieSession.Movie.IsActive() ? _ss : null);
|
||||
if (Global.MovieSession.Movie.NotActive())
|
||||
{
|
||||
SyncSettingsChanged = true;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
tabControl1.TabPages.Remove(tabPage2);
|
||||
}
|
||||
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
if (Global.MovieSession.Movie.IsActive())
|
||||
{
|
||||
propertyGrid2.Enabled = false; // disable changes to sync setting when movie, so as not to confuse user
|
||||
}
|
||||
|
|
|
@ -1099,7 +1099,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
GoalGroupBox.Enabled = false;
|
||||
_currentBotAttempt = new BotAttempt { Attempt = Attempts };
|
||||
|
||||
if (Global.MovieSession.Movie.IsRecording)
|
||||
if (Global.MovieSession.Movie.IsRecording())
|
||||
{
|
||||
_oldCountingSetting = Global.MovieSession.Movie.IsCountingRerecords;
|
||||
Global.MovieSession.Movie.IsCountingRerecords = false;
|
||||
|
@ -1156,7 +1156,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_currentBotAttempt = null;
|
||||
GoalGroupBox.Enabled = true;
|
||||
|
||||
if (Global.MovieSession.Movie.IsRecording)
|
||||
if (Global.MovieSession.Movie.IsRecording())
|
||||
{
|
||||
Global.MovieSession.Movie.IsCountingRerecords = _oldCountingSetting;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
// Movie recording must be active (check TAStudio because opening a project re-loads the ROM,
|
||||
// which resets tools before the movie session becomes active)
|
||||
if (!Global.MovieSession.Movie.IsActive && !GlobalWin.Tools.IsLoaded<TAStudio>())
|
||||
if (!Global.MovieSession.Movie.IsActive() && !GlobalWin.Tools.IsLoaded<TAStudio>())
|
||||
{
|
||||
MessageBox.Show("In order to use this tool you must be recording a movie.");
|
||||
Close();
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool RecordingMode
|
||||
{
|
||||
get => Global.MovieSession.Movie.IsRecording;
|
||||
get => Global.MovieSession.Movie.IsRecording();
|
||||
set
|
||||
{
|
||||
RecordingModeCheckbox.Checked = value;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace BizHawk.Client.EmuHawk
|
||||
using BizHawk.Client.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class TAStudio : IControlMainform
|
||||
{
|
||||
|
@ -60,11 +62,11 @@
|
|||
|
||||
public void ToggleReadOnly()
|
||||
{
|
||||
if (CurrentTasMovie.IsPlaying)
|
||||
if (CurrentTasMovie.IsPlaying())
|
||||
{
|
||||
TastudioRecordMode();
|
||||
}
|
||||
else if (CurrentTasMovie.IsRecording)
|
||||
else if (CurrentTasMovie.IsRecording())
|
||||
{
|
||||
TastudioPlayMode();
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Mainform.PauseOnFrame = frame.Value;
|
||||
int? diff = Mainform.PauseOnFrame - _seekStartFrame;
|
||||
|
||||
WasRecording = CurrentTasMovie.IsRecording || WasRecording;
|
||||
WasRecording = CurrentTasMovie.IsRecording() || WasRecording;
|
||||
TastudioPlayMode(); // suspend rec mode until seek ends, to allow mouse editing
|
||||
Mainform.UnpauseEmulator();
|
||||
|
||||
|
@ -541,7 +541,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
int frame = TasView.CurrentCell.RowIndex.Value;
|
||||
string buttonName = TasView.CurrentCell.Column.Name;
|
||||
WasRecording = CurrentTasMovie.IsRecording || WasRecording;
|
||||
WasRecording = CurrentTasMovie.IsRecording() || WasRecording;
|
||||
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
|
@ -953,7 +953,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// skip rerecord counting on drawing entirely, mouse down is enough
|
||||
// avoid introducing another global
|
||||
bool wasCountingRerecords = CurrentTasMovie.IsCountingRerecords;
|
||||
WasRecording = CurrentTasMovie.IsRecording || WasRecording;
|
||||
WasRecording = CurrentTasMovie.IsRecording() || WasRecording;
|
||||
|
||||
int startVal, endVal;
|
||||
int frame = e.NewCell.RowIndex.Value;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace BizHawk.Client.EmuHawk
|
||||
using BizHawk.Client.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class TAStudio
|
||||
{
|
||||
|
@ -27,7 +29,7 @@
|
|||
{
|
||||
// If seeking to a frame before or at the end of the movie, use StartAtNearestFrameAndEmulate
|
||||
// Otherwise, load the latest state (if not already there) and seek while recording.
|
||||
WasRecording = CurrentTasMovie.IsRecording || WasRecording;
|
||||
WasRecording = CurrentTasMovie.IsRecording() || WasRecording;
|
||||
|
||||
if (frame <= CurrentTasMovie.InputLogLength)
|
||||
{
|
||||
|
|
|
@ -334,7 +334,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
// Start Scenario 1: A regular movie is active
|
||||
if (Global.MovieSession.Movie.IsActive && !(Global.MovieSession.Movie is TasMovie))
|
||||
if (Global.MovieSession.Movie.IsActive() && !(Global.MovieSession.Movie is TasMovie))
|
||||
{
|
||||
var result = MessageBox.Show("In order to use Tastudio, a new project must be created from the current movie\nThe current movie will be saved and closed, and a new project file will be created\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
||||
if (result == DialogResult.OK)
|
||||
|
@ -350,7 +350,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
// Start Scenario 2: A tasproj is already active
|
||||
else if (Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie is TasMovie)
|
||||
else if (Global.MovieSession.Movie.IsActive() && Global.MovieSession.Movie is TasMovie)
|
||||
{
|
||||
bool result = LoadFile(new FileInfo(CurrentTasMovie.Filename), gotoFrame: Emulator.Frame);
|
||||
if (!result)
|
||||
|
|
|
@ -29,11 +29,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public bool Readonly
|
||||
{
|
||||
get
|
||||
{
|
||||
return _readOnly;
|
||||
}
|
||||
|
||||
get => _readOnly;
|
||||
set
|
||||
{
|
||||
_readOnly = value;
|
||||
|
@ -149,8 +145,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
#region IToolForm Implementation
|
||||
|
||||
public bool AskSaveChanges() { return true; }
|
||||
public bool UpdateBefore { get { return false; } }
|
||||
public bool AskSaveChanges() => true;
|
||||
public bool UpdateBefore => false;
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
|
@ -173,7 +169,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Pads.ForEach(p => p.SetPrevious(null)); // Not the cleanest way to clear this every frame
|
||||
|
||||
if (Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsFinished)
|
||||
if (Global.MovieSession.Movie.Mode == MovieMode.Play)
|
||||
{
|
||||
Readonly = true;
|
||||
if (Global.MovieSession.CurrentInput != null)
|
||||
|
@ -183,7 +179,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Global.MovieSession.Movie.IsRecording)
|
||||
if (Global.MovieSession.Movie.IsRecording())
|
||||
{
|
||||
Pads.ForEach(p => p.SetPrevious(Global.MovieSession.PreviousFrame));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue