Simplify movie stopping+saving logic, fixing bug where opening a new movie while in recording mode in TAStudio would save the current movie even if the user said not to. (#4341)
This commit is contained in:
parent
e82d5fcd08
commit
61b44d72ba
|
@ -260,11 +260,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
message += "stopped.";
|
||||
|
||||
var result = Movie.Stop(saveChanges);
|
||||
if (result)
|
||||
if (saveChanges && Movie.Changes)
|
||||
{
|
||||
Movie.Save();
|
||||
Output($"{Path.GetFileName(Movie.Filename)} written to disk.");
|
||||
}
|
||||
Movie.Stop();
|
||||
|
||||
Output(message);
|
||||
ReadOnly = true;
|
||||
|
@ -372,7 +373,7 @@ namespace BizHawk.Client.Common
|
|||
switch (Settings.MovieEndAction)
|
||||
{
|
||||
case MovieEndAction.Stop:
|
||||
Movie.Stop();
|
||||
StopMovie();
|
||||
break;
|
||||
case MovieEndAction.Record:
|
||||
Movie.SwitchToRecord();
|
||||
|
|
|
@ -20,23 +20,6 @@
|
|||
public void SwitchToRecord() => Mode = MovieMode.Record;
|
||||
public void SwitchToPlay() => Mode = MovieMode.Play;
|
||||
public void FinishedMode() => Mode = MovieMode.Finished;
|
||||
|
||||
public virtual bool Stop(bool saveChanges = true)
|
||||
{
|
||||
bool saved = false;
|
||||
if (saveChanges)
|
||||
{
|
||||
if (Mode == MovieMode.Record || (this.IsActive() && Changes))
|
||||
{
|
||||
Save();
|
||||
saved = true;
|
||||
}
|
||||
}
|
||||
|
||||
Changes = false;
|
||||
Mode = MovieMode.Inactive;
|
||||
|
||||
return saved;
|
||||
}
|
||||
public void Stop() => Mode = MovieMode.Inactive;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,11 +121,8 @@ namespace BizHawk.Client.Common
|
|||
|
||||
/// <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>
|
||||
/// <param name="saveChanges">if true, will save to disk</param>
|
||||
/// <returns>Whether or not the movie was saved</returns>
|
||||
bool Stop(bool saveChanges = true);
|
||||
void Stop();
|
||||
|
||||
/// <summary>
|
||||
/// Switches to record mode
|
||||
|
|
Loading…
Reference in New Issue