From 5384fcfdd2d4c7c740ef8be2f19576293e89906c Mon Sep 17 00:00:00 2001 From: adelikat Date: Thu, 5 Dec 2013 19:18:20 +0000 Subject: [PATCH] TAStudio - start new recording on load, and generate columns dynamically based on the core currently loaded. Currently only does 1 player's worth of columns. --- BizHawk.Client.Common/movie/TasMovie.cs | 9 +++++++- .../tools/TAStudio/TAStudio.cs | 23 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/BizHawk.Client.Common/movie/TasMovie.cs b/BizHawk.Client.Common/movie/TasMovie.cs index a8fd07091d..79bc43e9a9 100644 --- a/BizHawk.Client.Common/movie/TasMovie.cs +++ b/BizHawk.Client.Common/movie/TasMovie.cs @@ -88,7 +88,14 @@ namespace BizHawk.Client.Common { if (frame < _records.Count) { - return _records[frame].Input; + if (frame >= 0) + { + return _records[frame].Input; + } + else + { + return String.Empty; + } } else { diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 174031d68a..38decbb241 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.IO; +using System.Linq; using System.Windows.Forms; using BizHawk.Client.Common; @@ -13,6 +14,7 @@ namespace BizHawk.Client.EmuHawk { private int _defaultWidth; private int _defaultHeight; + private TasMovie _tas; #region API @@ -56,6 +58,8 @@ namespace BizHawk.Client.EmuHawk public void UpdateValues() { if (!IsHandleCreated || IsDisposed) return; + + TASView.ItemCount = _tas.InputLogLength; } public void Restart() @@ -89,7 +93,26 @@ namespace BizHawk.Client.EmuHawk GlobalWin.OSD.AddMessage("TAStudio engaged"); Global.MovieSession.Movie = new TasMovie(); + _tas = Global.MovieSession.Movie as TasMovie; + _tas.StartNewRecording(); + LoadConfigSettings(); + + SetUpColumns(); + } + + private void SetUpColumns() + { + TASView.Columns.Clear(); + ToolHelpers.AddColumn(TASView, "", true, 18); + ToolHelpers.AddColumn(TASView, "Frame#", true, 68); + + var mnemonics = MnemonicConstants.BUTTONS[Global.Emulator.Controller.Type.Name].Select(x => x.Value); + + foreach (var mnemonic in mnemonics) + { + ToolHelpers.AddColumn(TASView, mnemonic, true, 20); + } } private void LoadConfigSettings()