Tastudio - Integrate branches with the statusbar slot icons

This commit is contained in:
adelikat 2019-12-08 13:53:36 -06:00
parent fff85d917a
commit 35fdb5dbdd
3 changed files with 28 additions and 9 deletions

View File

@ -1,5 +1,4 @@
using System.IO;
using BizHawk.Emulation.Common.IEmulatorExtensions;
namespace BizHawk.Client.Common
@ -28,13 +27,20 @@ namespace BizHawk.Client.Common
for (int i = 0; i < 10; i++)
{
var file = new FileInfo($"{PathManager.SaveStatePrefix(Global.Game)}.QuickSave{i}.State");
if (file.Directory != null && file.Directory.Exists == false)
if (Global.MovieSession.Movie is TasMovie tasMovie)
{
file.Directory.Create();
_slots[i] = i < tasMovie.Branches.Count;
}
else
{
var file = new FileInfo($"{PathManager.SaveStatePrefix(Global.Game)}.QuickSave{i}.State");
if (file.Directory != null && file.Directory.Exists == false)
{
file.Directory.Create();
}
_slots[i] = file.Exists;
_slots[i] = file.Exists;
}
}
}
@ -69,6 +75,11 @@ namespace BizHawk.Client.Common
return;
}
if (Global.MovieSession.Movie is TasMovie tasMovie)
{
return;
}
_redo[slot] ^= true;
}
@ -79,6 +90,11 @@ namespace BizHawk.Client.Common
return false;
}
if (Global.MovieSession.Movie is TasMovie tasMovie)
{
return false;
}
return _redo[slot];
}

View File

@ -2500,7 +2500,7 @@ namespace BizHawk.Client.EmuHawk
: SystemColors.Control;
}
private void UpdateStatusSlots()
public void UpdateStatusSlots()
{
_stateSlots.Update();

View File

@ -19,6 +19,7 @@ namespace BizHawk.Client.EmuHawk
private readonly ScreenshotForm _screenshot = new ScreenshotForm();
private TasMovie Movie => Tastudio.CurrentTasMovie;
private MainForm MainForm => GlobalWin.MainForm; // TODO: pass this in
private TasBranch _backupBranch;
private BranchUndo _branchUndo = BranchUndo.None;
@ -144,6 +145,7 @@ namespace BizHawk.Client.EmuHawk
Select(Movie.CurrentBranch, true);
BranchView.Refresh();
Tastudio.RefreshDialog();
MainForm.UpdateStatusSlots();
}
public TasBranch SelectedBranch => BranchView.AnyRowsSelected
@ -157,8 +159,8 @@ namespace BizHawk.Client.EmuHawk
Frame = Tastudio.Emulator.Frame,
CoreData = (byte[])(Tastudio.StatableEmulator.SaveStateBinary().Clone()),
InputLog = Movie.CloneInput(),
CoreFrameBuffer = GlobalWin.MainForm.MakeScreenshotImage(),
OSDFrameBuffer = GlobalWin.MainForm.CaptureOSD(),
CoreFrameBuffer = MainForm.MakeScreenshotImage(),
OSDFrameBuffer = MainForm.CaptureOSD(),
ChangeLog = new TasMovieChangeLog(Movie),
TimeStamp = DateTime.Now,
Markers = Movie.Markers.DeepClone(),
@ -183,7 +185,7 @@ namespace BizHawk.Client.EmuHawk
if (Tastudio.Settings.OldControlSchemeForBranches && Tastudio.TasPlaybackBox.RecordingMode)
Movie.Truncate(branch.Frame);
GlobalWin.MainForm.PauseOnFrame = null;
MainForm.PauseOnFrame = null;
Tastudio.RefreshDialog();
}
@ -343,6 +345,7 @@ namespace BizHawk.Client.EmuHawk
RemovedCallback?.Invoke(index);
Tastudio.RefreshDialog();
GlobalWin.OSD.AddMessage($"Removed branch {index}");
MainForm.UpdateStatusSlots();
}
private void UndoBranchToolStripMenuItem_Click(object sender, EventArgs e)