-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.IO;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using BizHawk.Common.ReflectionExtensions;
|
||||
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.TasStateManager.Clear();
|
||||
tas.ClearLagLog();
|
||||
|
||||
var entries = old.GetLogEntries();
|
||||
List<string> entries = old.GetLogEntries();
|
||||
|
||||
tas.CopyLog(entries.Skip(frame));
|
||||
tas.CopyVerificationLog(old.VerificationLog);
|
||||
tas.CopyVerificationLog(entries.Take(frame));
|
||||
|
||||
// States: TODO
|
||||
|
||||
// Lag Log: TODO
|
||||
|
||||
tas.HeaderEntries.Clear();
|
||||
foreach (var kvp in old.HeaderEntries)
|
||||
{
|
||||
|
@ -167,12 +173,10 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
|
|||
tas.Subtitles.Add(sub);
|
||||
}
|
||||
|
||||
foreach(var marker in old.Markers)
|
||||
foreach(TasMovieMarker marker in old.Markers)
|
||||
{
|
||||
if (marker.Frame > 0)
|
||||
{
|
||||
tas.Markers.Add(marker);
|
||||
}
|
||||
if (marker.Frame > frame)
|
||||
tas.Markers.Add(new TasMovieMarker(marker.Frame - frame, marker.Message));
|
||||
}
|
||||
|
||||
tas.TasStateManager.Settings = old.TasStateManager.Settings;
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace BizHawk.Client.Common
|
|||
private readonly TasStateManager StateManager;
|
||||
private readonly TasLagLog LagLog = new TasLagLog();
|
||||
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();
|
||||
|
||||
|
@ -284,8 +284,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void CopyVerificationLog(IEnumerable<string> log)
|
||||
{
|
||||
VerificationLog.Clear();
|
||||
foreach (var entry in log)
|
||||
foreach (string entry in log)
|
||||
{
|
||||
VerificationLog.Add(entry);
|
||||
}
|
||||
|
@ -458,7 +457,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void LoadBranch(TasBranch branch)
|
||||
{
|
||||
// TODO: undo?
|
||||
_log = branch.InputLog;
|
||||
_changes = true;
|
||||
StateManager.ClearStateHistory();
|
||||
|
|
|
@ -168,11 +168,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.InsertNumFramesContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator18 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.TruncateContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.BranchContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.StartFromNowSeparator = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.StartNewProjectFromNowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.BookMarkControl = new BizHawk.Client.EmuHawk.BookmarksBranchesBox();
|
||||
this.BranchContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.TASMenu.SuspendLayout();
|
||||
this.TasStatusStrip.SuspendLayout();
|
||||
this.MarkerContextMenu.SuspendLayout();
|
||||
|
@ -1325,6 +1325,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.TruncateContextMenuItem.Text = "Truncate Movie";
|
||||
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
|
||||
//
|
||||
this.StartFromNowSeparator.Name = "StartFromNowSeparator";
|
||||
|
@ -1358,13 +1365,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.BookMarkControl.TabIndex = 8;
|
||||
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
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
|
|
|
@ -973,8 +973,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
StartFromNowSeparator.Visible =
|
||||
StartNewProjectFromNowMenuItem.Visible =
|
||||
TasView.SelectedRows.Count() == 1 &&
|
||||
!CurrentTasMovie.StartsFromSavestate;
|
||||
TasView.SelectedRows.Count() == 1;
|
||||
|
||||
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);
|
||||
|
||||
TasMovie newProject = CurrentTasMovie.ConvertToSavestateAnchoredMovie(
|
||||
index,
|
||||
(byte[])StatableEmulator.SaveStateBinary().Clone());
|
||||
index, (byte[])StatableEmulator.SaveStateBinary().Clone());
|
||||
|
||||
GlobalWin.MainForm.PauseEmulator();
|
||||
LoadFile(new FileInfo(newProject.Filename));
|
||||
|
|
Loading…
Reference in New Issue