-Allow creating savestate-anchored movie from savestate-anchored movie
-Fix marker placement in savestate-anchored movies
This commit is contained in:
parent
52544efec9
commit
01290d2e59
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using BizHawk.Common.ReflectionExtensions;
|
using BizHawk.Common.ReflectionExtensions;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
@ -136,16 +137,21 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var tas = new TasMovie(newFilename, true);
|
TasMovie tas = new TasMovie(newFilename, true);
|
||||||
tas.BinarySavestate = savestate;
|
tas.BinarySavestate = savestate;
|
||||||
tas.TasStateManager.Clear();
|
tas.TasStateManager.Clear();
|
||||||
tas.ClearLagLog();
|
tas.ClearLagLog();
|
||||||
|
|
||||||
var entries = old.GetLogEntries();
|
List<string> entries = old.GetLogEntries();
|
||||||
|
|
||||||
tas.CopyLog(entries.Skip(frame));
|
tas.CopyLog(entries.Skip(frame));
|
||||||
|
tas.CopyVerificationLog(old.VerificationLog);
|
||||||
tas.CopyVerificationLog(entries.Take(frame));
|
tas.CopyVerificationLog(entries.Take(frame));
|
||||||
|
|
||||||
|
// States: TODO
|
||||||
|
|
||||||
|
// Lag Log: TODO
|
||||||
|
|
||||||
tas.HeaderEntries.Clear();
|
tas.HeaderEntries.Clear();
|
||||||
foreach (var kvp in old.HeaderEntries)
|
foreach (var kvp in old.HeaderEntries)
|
||||||
{
|
{
|
||||||
|
@ -167,12 +173,10 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
|
||||||
tas.Subtitles.Add(sub);
|
tas.Subtitles.Add(sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(var marker in old.Markers)
|
foreach(TasMovieMarker marker in old.Markers)
|
||||||
{
|
{
|
||||||
if (marker.Frame > 0)
|
if (marker.Frame > frame)
|
||||||
{
|
tas.Markers.Add(new TasMovieMarker(marker.Frame - frame, marker.Message));
|
||||||
tas.Markers.Add(marker);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tas.TasStateManager.Settings = old.TasStateManager.Settings;
|
tas.TasStateManager.Settings = old.TasStateManager.Settings;
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace BizHawk.Client.Common
|
||||||
private readonly TasStateManager StateManager;
|
private readonly TasStateManager StateManager;
|
||||||
private readonly TasLagLog LagLog = new TasLagLog();
|
private readonly TasLagLog LagLog = new TasLagLog();
|
||||||
private readonly Dictionary<int, IController> InputStateCache = new Dictionary<int, IController>();
|
private readonly Dictionary<int, IController> InputStateCache = new Dictionary<int, IController>();
|
||||||
private readonly List<string> VerificationLog = new List<string>(); // For movies that do not begin with power-on, this is the input required to get into the initial state
|
public readonly List<string> VerificationLog = new List<string>(); // For movies that do not begin with power-on, this is the input required to get into the initial state
|
||||||
|
|
||||||
private readonly TasBranchCollection Branches = new TasBranchCollection();
|
private readonly TasBranchCollection Branches = new TasBranchCollection();
|
||||||
|
|
||||||
|
@ -284,8 +284,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public void CopyVerificationLog(IEnumerable<string> log)
|
public void CopyVerificationLog(IEnumerable<string> log)
|
||||||
{
|
{
|
||||||
VerificationLog.Clear();
|
foreach (string entry in log)
|
||||||
foreach (var entry in log)
|
|
||||||
{
|
{
|
||||||
VerificationLog.Add(entry);
|
VerificationLog.Add(entry);
|
||||||
}
|
}
|
||||||
|
@ -458,7 +457,6 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public void LoadBranch(TasBranch branch)
|
public void LoadBranch(TasBranch branch)
|
||||||
{
|
{
|
||||||
// TODO: undo?
|
|
||||||
_log = branch.InputLog;
|
_log = branch.InputLog;
|
||||||
_changes = true;
|
_changes = true;
|
||||||
StateManager.ClearStateHistory();
|
StateManager.ClearStateHistory();
|
||||||
|
|
|
@ -168,11 +168,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
this.InsertNumFramesContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.InsertNumFramesContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripSeparator18 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator18 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.TruncateContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.TruncateContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.BranchContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.StartFromNowSeparator = new System.Windows.Forms.ToolStripSeparator();
|
this.StartFromNowSeparator = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.StartNewProjectFromNowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.StartNewProjectFromNowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
this.BookMarkControl = new BizHawk.Client.EmuHawk.BookmarksBranchesBox();
|
this.BookMarkControl = new BizHawk.Client.EmuHawk.BookmarksBranchesBox();
|
||||||
this.BranchContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.TASMenu.SuspendLayout();
|
this.TASMenu.SuspendLayout();
|
||||||
this.TasStatusStrip.SuspendLayout();
|
this.TasStatusStrip.SuspendLayout();
|
||||||
this.MarkerContextMenu.SuspendLayout();
|
this.MarkerContextMenu.SuspendLayout();
|
||||||
|
@ -1325,6 +1325,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
this.TruncateContextMenuItem.Text = "Truncate Movie";
|
this.TruncateContextMenuItem.Text = "Truncate Movie";
|
||||||
this.TruncateContextMenuItem.Click += new System.EventHandler(this.TruncateMenuItem_Click);
|
this.TruncateContextMenuItem.Click += new System.EventHandler(this.TruncateMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
// BranchContextMenuItem
|
||||||
|
//
|
||||||
|
this.BranchContextMenuItem.Name = "BranchContextMenuItem";
|
||||||
|
this.BranchContextMenuItem.Size = new System.Drawing.Size(272, 22);
|
||||||
|
this.BranchContextMenuItem.Text = "&Branch";
|
||||||
|
this.BranchContextMenuItem.Click += new System.EventHandler(this.BranchContextMenuItem_Click);
|
||||||
|
//
|
||||||
// StartFromNowSeparator
|
// StartFromNowSeparator
|
||||||
//
|
//
|
||||||
this.StartFromNowSeparator.Name = "StartFromNowSeparator";
|
this.StartFromNowSeparator.Name = "StartFromNowSeparator";
|
||||||
|
@ -1358,13 +1365,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
this.BookMarkControl.TabIndex = 8;
|
this.BookMarkControl.TabIndex = 8;
|
||||||
this.BookMarkControl.Tastudio = null;
|
this.BookMarkControl.Tastudio = null;
|
||||||
//
|
//
|
||||||
// BranchContextMenuItem
|
|
||||||
//
|
|
||||||
this.BranchContextMenuItem.Name = "BranchContextMenuItem";
|
|
||||||
this.BranchContextMenuItem.Size = new System.Drawing.Size(272, 22);
|
|
||||||
this.BranchContextMenuItem.Text = "&Branch";
|
|
||||||
this.BranchContextMenuItem.Click += new System.EventHandler(this.BranchContextMenuItem_Click);
|
|
||||||
//
|
|
||||||
// TAStudio
|
// TAStudio
|
||||||
//
|
//
|
||||||
this.AllowDrop = true;
|
this.AllowDrop = true;
|
||||||
|
|
|
@ -973,8 +973,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
StartFromNowSeparator.Visible =
|
StartFromNowSeparator.Visible =
|
||||||
StartNewProjectFromNowMenuItem.Visible =
|
StartNewProjectFromNowMenuItem.Visible =
|
||||||
TasView.SelectedRows.Count() == 1 &&
|
TasView.SelectedRows.Count() == 1;
|
||||||
!CurrentTasMovie.StartsFromSavestate;
|
|
||||||
|
|
||||||
RemoveMarkersContextMenuItem.Enabled = CurrentTasMovie.Markers.Any(m => TasView.SelectedRows.Contains(m.Frame)); // Disable the option to remove markers if no markers are selected (FCEUX does this).
|
RemoveMarkersContextMenuItem.Enabled = CurrentTasMovie.Markers.Any(m => TasView.SelectedRows.Contains(m.Frame)); // Disable the option to remove markers if no markers are selected (FCEUX does this).
|
||||||
|
|
||||||
|
@ -1005,8 +1004,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
GoToFrame(index);
|
GoToFrame(index);
|
||||||
|
|
||||||
TasMovie newProject = CurrentTasMovie.ConvertToSavestateAnchoredMovie(
|
TasMovie newProject = CurrentTasMovie.ConvertToSavestateAnchoredMovie(
|
||||||
index,
|
index, (byte[])StatableEmulator.SaveStateBinary().Clone());
|
||||||
(byte[])StatableEmulator.SaveStateBinary().Clone());
|
|
||||||
|
|
||||||
GlobalWin.MainForm.PauseEmulator();
|
GlobalWin.MainForm.PauseEmulator();
|
||||||
LoadFile(new FileInfo(newProject.Filename));
|
LoadFile(new FileInfo(newProject.Filename));
|
||||||
|
|
Loading…
Reference in New Issue