TAStudio - Implement AskSave() and various client logic regarding file saving/loading
This commit is contained in:
parent
35c3fcca16
commit
5fee952c3a
|
@ -114,7 +114,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public bool IsCountingRerecords { get; set; }
|
public bool IsCountingRerecords { get; set; }
|
||||||
|
|
||||||
public bool Changes { get; private set; }
|
public bool Changes { get; set; }
|
||||||
|
|
||||||
public TimeSpan Time
|
public TimeSpan Time
|
||||||
{
|
{
|
||||||
|
@ -188,6 +188,9 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public void Stop(bool saveChanges = true)
|
public void Stop(bool saveChanges = true)
|
||||||
{
|
{
|
||||||
|
// adelikat: I think Tastudio should be in charge of saving, and so we should not attempt to manage any logic like that here
|
||||||
|
// EmuHawk client UI assumes someone has already picked a filename ahead of time and that it is in charge of movies
|
||||||
|
/*
|
||||||
if (saveChanges)
|
if (saveChanges)
|
||||||
{
|
{
|
||||||
if (_mode == Moviemode.Record || Changes)
|
if (_mode == Moviemode.Record || Changes)
|
||||||
|
@ -195,7 +198,7 @@ namespace BizHawk.Client.Common
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
_mode = Moviemode.Inactive;
|
_mode = Moviemode.Inactive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,8 +275,9 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
SwitchToRecord();
|
SwitchToRecord();
|
||||||
|
|
||||||
// TODO: MakeBackup logic - Tastudio logic shoudl be to always make backups before saving!
|
// TODO: MakeBackup logic - Tastudio logic should be to always make backups before saving!
|
||||||
if (Global.Config.EnableBackupMovies && _records.Any() && !String.IsNullOrWhiteSpace(Filename))
|
|
||||||
|
if (Changes && !String.IsNullOrWhiteSpace(Filename))
|
||||||
{
|
{
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,14 +48,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Global.Emulator.ResetCounters();
|
Global.Emulator.ResetCounters();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (record)
|
if (!fromTastudio)
|
||||||
{
|
{
|
||||||
Global.MovieSession.Movie.StartNewRecording();
|
if (record)
|
||||||
Global.MovieSession.ReadOnly = false;
|
{
|
||||||
}
|
Global.MovieSession.Movie.StartNewRecording();
|
||||||
else
|
Global.MovieSession.ReadOnly = false;
|
||||||
{
|
}
|
||||||
Global.MovieSession.Movie.StartNewPlayback();
|
else
|
||||||
|
{
|
||||||
|
Global.MovieSession.Movie.StartNewPlayback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetMainformMovieInfo();
|
SetMainformMovieInfo();
|
||||||
|
|
|
@ -11,6 +11,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public partial class TAStudio : Form, IToolForm
|
public partial class TAStudio : Form, IToolForm
|
||||||
{
|
{
|
||||||
|
// TODO: UI flow that conveniently allows to start from savestate
|
||||||
|
|
||||||
private const string MarkerColumnName = "MarkerColumn";
|
private const string MarkerColumnName = "MarkerColumn";
|
||||||
private const string FrameColumnName = "FrameColumn";
|
private const string FrameColumnName = "FrameColumn";
|
||||||
|
|
||||||
|
@ -39,6 +41,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (Global.MovieSession.Movie is TasMovie)
|
if (Global.MovieSession.Movie is TasMovie)
|
||||||
{
|
{
|
||||||
Global.MovieSession.Movie = new Movie();
|
Global.MovieSession.Movie = new Movie();
|
||||||
|
GlobalWin.MainForm.StopMovie(saveChanges: false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -54,7 +57,27 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public bool AskSave()
|
public bool AskSave()
|
||||||
{
|
{
|
||||||
// TODO: eventually we want to do this
|
if (_tas.Changes)
|
||||||
|
{
|
||||||
|
GlobalWin.Sound.StopSound();
|
||||||
|
var result = MessageBox.Show("Save Changes?", "Tastudio", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3);
|
||||||
|
GlobalWin.Sound.StartSound();
|
||||||
|
if (result == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
SaveTASMenuItem_Click(null, null);
|
||||||
|
}
|
||||||
|
else if (result == DialogResult.No)
|
||||||
|
{
|
||||||
|
_tas.Changes = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (result == DialogResult.Cancel)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,26 +172,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_tas = Global.MovieSession.Movie as TasMovie;
|
_tas = Global.MovieSession.Movie as TasMovie;
|
||||||
_tas.StartNewRecording();
|
_tas.StartNewRecording();
|
||||||
_tas.OnChanged += OnMovieChanged;
|
_tas.OnChanged += OnMovieChanged;
|
||||||
|
GlobalWin.MainForm.StartNewMovie(_tas, true, true);
|
||||||
try
|
|
||||||
{
|
|
||||||
GlobalWin.MainForm.StartNewMovie(_tas, true, true);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
MessageBox.Show(e.Message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartNewSession()
|
private void StartNewSession()
|
||||||
{
|
{
|
||||||
if (AskSave())
|
if (AskSave())
|
||||||
{
|
{
|
||||||
// TODO: power-cycle
|
|
||||||
// TODO: UI flow that conveniently allows to start from savestate
|
|
||||||
GlobalWin.OSD.AddMessage("new TAStudio session started");
|
GlobalWin.OSD.AddMessage("new TAStudio session started");
|
||||||
_tas.StartNewRecording();
|
_tas.StartNewRecording();
|
||||||
|
GlobalWin.MainForm.StartNewMovie(_tas, true, true);
|
||||||
|
TASView.ItemCount = _tas.InputLogLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,7 +298,14 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void SaveTASMenuItem_Click(object sender, EventArgs e)
|
private void SaveTASMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_tas.Save();
|
if (String.IsNullOrEmpty(_tas.Filename))
|
||||||
|
{
|
||||||
|
SaveAsTASMenuItem_Click(sender, e);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_tas.Save();
|
||||||
|
}
|
||||||
// TODO: inform the user it happened somehow
|
// TODO: inform the user it happened somehow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue