TAStudio - stuff

This commit is contained in:
adelikat 2014-07-13 15:26:50 +00:00
parent 43a687060c
commit eae94f9184
5 changed files with 27 additions and 4 deletions

View File

@ -177,5 +177,13 @@ namespace BizHawk.Client.Common
{
get { return StateManager.Settings; }
}
public int LastEmulatedFrame
{
get
{
return StateManager.Last.Key;
}
}
}
}

View File

@ -13,7 +13,7 @@ namespace BizHawk.Client.Common
/// </summary>
public class TasStateManager
{
private readonly Dictionary<int, byte[]> States = new Dictionary<int, byte[]>();
private readonly SortedDictionary<int, byte[]> States = new SortedDictionary<int, byte[]>();
public TasStateManager()
{
@ -146,6 +146,11 @@ namespace BizHawk.Client.Common
}
}
public KeyValuePair<int, byte[]> Last
{
get { return States.Last(); }
}
public class ManagerSettings
{
public ManagerSettings()

View File

@ -9,8 +9,6 @@ namespace BizHawk.Client.EmuHawk
public void UpdateValues()
{
SetUpColumns();
if (!IsHandleCreated || IsDisposed)
{
return;

View File

@ -100,6 +100,7 @@ namespace BizHawk.Client.EmuHawk
if (Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.Contains(buttonName))
{
_tas.ToggleBoolState(TasView.PointedCell.Row.Value, TasView.PointedCell.Column);
GoToLastEmulatedFrameIfNecessary(TasView.PointedCell.Row.Value);
TasView.Refresh();
_startBoolDrawColumn = TasView.PointedCell.Column;

View File

@ -113,7 +113,7 @@ namespace BizHawk.Client.EmuHawk
}
// Start Scenario 3: No movie, but user wants to autload their last project
else if (Global.Config.AutoloadTAStudioProject)
else if (Global.Config.AutoloadTAStudioProject && !string.IsNullOrEmpty(Global.Config.RecentTas.MostRecent))
{
LoadProject(Global.Config.RecentTas.MostRecent);
}
@ -210,6 +210,15 @@ namespace BizHawk.Client.EmuHawk
TasView.ItemCount = _tas.InputLogLength;
}
// TODO: a better name
private void GoToLastEmulatedFrameIfNecessary(int frame)
{
if (frame <= _tas.LastEmulatedFrame)
{
GoToFrame(_tas.LastEmulatedFrame);
}
}
private void SetUpColumns()
{
TasView.Columns.Clear();
@ -365,6 +374,7 @@ namespace BizHawk.Client.EmuHawk
{
_tas.Save();
MessageStatusLabel.Text = Path.GetFileName(_tas.Filename) + " saved.";
Global.Config.RecentTas.Add(_tas.Filename);
}
}
@ -478,6 +488,7 @@ namespace BizHawk.Client.EmuHawk
_tas.RemoveFrames(list);
SetSplicer();
TasView.DeselectAll();
RefreshDialog();