2013-12-01 20:55:52 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
2013-12-10 01:45:45 +00:00
|
|
|
|
using System.Text;
|
2014-06-11 21:14:13 +00:00
|
|
|
|
|
|
|
|
|
using BizHawk.Common;
|
2013-12-07 16:31:04 +00:00
|
|
|
|
using BizHawk.Emulation.Common;
|
|
|
|
|
|
2013-12-01 20:55:52 +00:00
|
|
|
|
namespace BizHawk.Client.Common
|
|
|
|
|
{
|
2014-07-07 18:00:25 +00:00
|
|
|
|
public sealed partial class TasMovie : Bk2Movie
|
2013-12-01 20:55:52 +00:00
|
|
|
|
{
|
2014-07-07 19:32:37 +00:00
|
|
|
|
private List<bool> LagLog = new List<bool>();
|
2014-07-07 18:40:42 +00:00
|
|
|
|
private readonly TasStateManager StateManager = new TasStateManager();
|
2014-07-09 16:35:39 +00:00
|
|
|
|
private readonly TasMovieMarkerList Markers = new TasMovieMarkerList();
|
2013-12-08 18:44:41 +00:00
|
|
|
|
|
2014-07-07 18:00:25 +00:00
|
|
|
|
public TasMovie(string path) : base(path) { }
|
2013-12-01 22:29:38 +00:00
|
|
|
|
|
2014-06-14 20:17:07 +00:00
|
|
|
|
public TasMovie()
|
2014-06-14 21:09:14 +00:00
|
|
|
|
: base()
|
2013-12-01 22:29:38 +00:00
|
|
|
|
{
|
2014-06-14 21:09:14 +00:00
|
|
|
|
Header[HeaderKeys.MOVIEVERSION] = "BizHawk v2.0 Tasproj v1.0";
|
2014-06-11 21:20:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-14 21:09:14 +00:00
|
|
|
|
public override string PreferredExtension
|
2014-06-11 21:20:23 +00:00
|
|
|
|
{
|
2014-07-07 18:00:25 +00:00
|
|
|
|
get { return Extension; }
|
2014-06-11 21:20:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-17 01:24:44 +00:00
|
|
|
|
public new const string Extension = "tasproj";
|
2013-12-01 20:55:52 +00:00
|
|
|
|
|
2014-07-07 18:03:02 +00:00
|
|
|
|
public TasMovieRecord this[int index]
|
2013-12-02 21:57:48 +00:00
|
|
|
|
{
|
2013-12-03 01:43:02 +00:00
|
|
|
|
get
|
|
|
|
|
{
|
2014-07-07 18:40:42 +00:00
|
|
|
|
return new TasMovieRecord
|
2014-07-07 18:00:25 +00:00
|
|
|
|
{
|
2014-07-07 18:40:42 +00:00
|
|
|
|
State = StateManager[index],
|
|
|
|
|
LogEntry = GetInput(index),
|
2014-07-10 19:24:21 +00:00
|
|
|
|
Lagged = (index < LagLog.Count) ? LagLog[index] : (bool?)null
|
2014-07-07 18:00:25 +00:00
|
|
|
|
};
|
2013-12-03 01:43:02 +00:00
|
|
|
|
}
|
2013-12-02 21:57:48 +00:00
|
|
|
|
}
|
2014-07-08 13:33:01 +00:00
|
|
|
|
|
|
|
|
|
public override void StartNewRecording()
|
|
|
|
|
{
|
|
|
|
|
LagLog.Clear();
|
|
|
|
|
StateManager.Clear();
|
2014-07-09 16:35:39 +00:00
|
|
|
|
Markers.Clear();
|
2014-07-08 13:33:01 +00:00
|
|
|
|
base.StartNewRecording();
|
|
|
|
|
}
|
2014-07-09 16:35:39 +00:00
|
|
|
|
|
|
|
|
|
public void Marker(int frame, string message)
|
|
|
|
|
{
|
|
|
|
|
Markers.Add(frame, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void DeleteMarker(int frame)
|
|
|
|
|
{
|
|
|
|
|
Markers.Remove(frame);
|
|
|
|
|
}
|
2014-07-10 02:45:56 +00:00
|
|
|
|
|
|
|
|
|
private readonly Bk2MnemonicConstants Mnemonics = new Bk2MnemonicConstants();
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns the mnemonic value for boolean buttons, and actual value for floats,
|
|
|
|
|
/// for a given frame and button
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string DisplayValue(int frame, string buttonName)
|
|
|
|
|
{
|
|
|
|
|
var adapter = GetInputState(frame);
|
|
|
|
|
|
|
|
|
|
if (adapter.Type.BoolButtons.Contains(buttonName))
|
|
|
|
|
{
|
|
|
|
|
return adapter.IsPressed(buttonName) ?
|
|
|
|
|
Mnemonics[buttonName].ToString() :
|
|
|
|
|
string.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (adapter.Type.FloatControls.Contains(buttonName))
|
|
|
|
|
{
|
|
|
|
|
adapter.GetFloat(buttonName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "!";
|
|
|
|
|
}
|
2013-12-01 20:55:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|