Progress on Bk2 implementation
This commit is contained in:
parent
1ab1538f8b
commit
398577245e
|
@ -5,8 +5,42 @@ using System.Text;
|
|||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public class MovieHeader2
|
||||
public class Bk2Header : Dictionary<string, string>
|
||||
{
|
||||
|
||||
public new string this[string key]
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ContainsKey(key) ? base[key] : string.Empty;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (ContainsKey(key))
|
||||
{
|
||||
base[key] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Add(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
foreach (var kvp in this)
|
||||
{
|
||||
sb
|
||||
.Append(kvp.Key)
|
||||
.Append(' ')
|
||||
.Append(kvp.Value)
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,47 +7,53 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public partial class Bk2Movie : IMovie
|
||||
{
|
||||
private readonly Bk2Header Header = new Bk2Header();
|
||||
|
||||
public IDictionary<string, string> HeaderEntries
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
get { return Header; }
|
||||
}
|
||||
|
||||
public SubtitleList Subtitles
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public IList<string> Comments
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public string SyncSettingsJson
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
get { return Header[HeaderKeys.SYNCSETTINGS]; }
|
||||
set { Header[HeaderKeys.SYNCSETTINGS] = value; }
|
||||
}
|
||||
|
||||
public string SavestateBinaryBase64Blob
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (Header.ContainsKey(HeaderKeys.SAVESTATEBINARYBASE64BLOB))
|
||||
{
|
||||
return Header[HeaderKeys.SAVESTATEBINARYBASE64BLOB];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (value == null)
|
||||
{
|
||||
Header.Remove(HeaderKeys.SAVESTATEBINARYBASE64BLOB);
|
||||
}
|
||||
else
|
||||
{
|
||||
Header.Add(HeaderKeys.SAVESTATEBINARYBASE64BLOB, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,12 +61,17 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (!Header.ContainsKey(HeaderKeys.RERECORDS))
|
||||
{
|
||||
Header[HeaderKeys.RERECORDS] = "0";
|
||||
}
|
||||
|
||||
return ulong.Parse(Header[HeaderKeys.RERECORDS]);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
Header[HeaderKeys.RERECORDS] = value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,12 +79,24 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (Header.ContainsKey(HeaderKeys.STARTSFROMSAVESTATE))
|
||||
{
|
||||
return bool.Parse(Header[HeaderKeys.STARTSFROMSAVESTATE]);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (value)
|
||||
{
|
||||
Header.Add(HeaderKeys.STARTSFROMSAVESTATE, "True");
|
||||
}
|
||||
else
|
||||
{
|
||||
Header.Remove(HeaderKeys.STARTSFROMSAVESTATE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,12 +104,17 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (Header.ContainsKey(HeaderKeys.GAMENAME))
|
||||
{
|
||||
return Header[HeaderKeys.GAMENAME];
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
Header[HeaderKeys.GAMENAME] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,104 +122,60 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (Header.ContainsKey(HeaderKeys.PLATFORM))
|
||||
{
|
||||
return Header[HeaderKeys.PLATFORM];
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
Header[HeaderKeys.PLATFORM] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Hash
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
get { return Header[HeaderKeys.SHA1]; }
|
||||
set { Header[HeaderKeys.SHA1] = value; }
|
||||
}
|
||||
|
||||
public string Author
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
get { return Header[HeaderKeys.AUTHOR]; }
|
||||
set { Header[HeaderKeys.AUTHOR] = value; }
|
||||
}
|
||||
|
||||
public string Core
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
get { return Header[HeaderKeys.CORE]; }
|
||||
set { Header[HeaderKeys.CORE] = value; }
|
||||
}
|
||||
|
||||
public string Platform
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
get { return Header[HeaderKeys.PLATFORM]; }
|
||||
set { Header[HeaderKeys.PLATFORM] = value; }
|
||||
}
|
||||
|
||||
public string BoardName
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
get { return Header[HeaderKeys.BOARDNAME]; }
|
||||
set { Header[HeaderKeys.BOARDNAME] = value; }
|
||||
}
|
||||
|
||||
public string EmulatorVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
get { return Header[HeaderKeys.EMULATIONVERSION]; }
|
||||
set { Header[HeaderKeys.EMULATIONVERSION] = value; }
|
||||
}
|
||||
|
||||
public string FirmwareHash
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
get { return Header[HeaderKeys.FIRMWARESHA1]; }
|
||||
set { Header[HeaderKeys.FIRMWARESHA1] = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public partial class Bk2Movie : IMovie
|
||||
{
|
||||
private readonly BkmLog _log = new BkmLog();
|
||||
|
||||
public string GetInputLog()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public bool IsRecording
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
get { return _mode == Moviemode.Record; }
|
||||
}
|
||||
|
||||
public bool IsFinished
|
||||
|
@ -32,27 +32,44 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void StartNewRecording()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_mode = Moviemode.Record;
|
||||
if (Global.Config.EnableBackupMovies && _makeBackup && _log.Any())
|
||||
{
|
||||
SaveBackup();
|
||||
_makeBackup = false;
|
||||
}
|
||||
|
||||
_log.Clear();
|
||||
}
|
||||
|
||||
public void StartNewPlayback()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_mode = Moviemode.Play;
|
||||
}
|
||||
|
||||
public void SwitchToRecord()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_mode = Moviemode.Record;
|
||||
}
|
||||
|
||||
public void SwitchToPlay()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_mode = Moviemode.Play;
|
||||
Save();
|
||||
}
|
||||
|
||||
public void Stop(bool saveChanges = true)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (saveChanges)
|
||||
{
|
||||
if (_mode == Moviemode.Record || Changes)
|
||||
{
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
Changes = false;
|
||||
_mode = Moviemode.Inactive;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,14 +11,15 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public partial class Bk2Movie : IMovie
|
||||
{
|
||||
private readonly MovieLog _log = new MovieLog();
|
||||
private readonly PlatformFrameRates _frameRates = new PlatformFrameRates();
|
||||
|
||||
private bool MakeBackup { get; set; }
|
||||
private bool _makeBackup = true;
|
||||
|
||||
public Bk2Movie(string filename, bool startsFromSavestate = false)
|
||||
: this(startsFromSavestate)
|
||||
{
|
||||
Subtitles = new SubtitleList();
|
||||
Comments = new List<string>();
|
||||
|
||||
Rerecords = 0;
|
||||
Filename = filename;
|
||||
}
|
||||
|
@ -30,7 +31,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
IsCountingRerecords = true;
|
||||
_mode = Moviemode.Inactive;
|
||||
MakeBackup = true;
|
||||
_makeBackup = true;
|
||||
}
|
||||
|
||||
#region Implementation
|
||||
|
@ -38,11 +39,7 @@ namespace BizHawk.Client.Common
|
|||
public string PreferredExtension { get { return "bk2"; } }
|
||||
public bool IsCountingRerecords { get; set; }
|
||||
|
||||
public bool Changes
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
private set { throw new NotImplementedException(); }
|
||||
}
|
||||
public bool Changes { get; private set; }
|
||||
|
||||
public double FrameCount
|
||||
{
|
||||
|
|
|
@ -3,9 +3,9 @@ using System.Text;
|
|||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public class MovieHeader : Dictionary<string, string>
|
||||
public class BkmHeader : Dictionary<string, string>
|
||||
{
|
||||
public MovieHeader()
|
||||
public BkmHeader()
|
||||
{
|
||||
Comments = new List<string>();
|
||||
Subtitles = new SubtitleList();
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace BizHawk.Client.Common
|
|||
/// <summary>
|
||||
/// Represents the controller key presses of a movie
|
||||
/// </summary>
|
||||
public class MovieLog : IEnumerable<string>
|
||||
public class BkmLog : IEnumerable<string>
|
||||
{
|
||||
public IEnumerator<string> GetEnumerator()
|
||||
{
|
||||
|
|
|
@ -91,7 +91,6 @@ namespace BizHawk.Client.Common
|
|||
public string EmulatorVersion
|
||||
{
|
||||
get { return Header[HeaderKeys.EMULATIONVERSION]; }
|
||||
|
||||
set { Header[HeaderKeys.EMULATIONVERSION] = value; }
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public partial class BkmMovie : IMovie
|
||||
{
|
||||
private readonly MovieLog _log = new MovieLog();
|
||||
private readonly BkmLog _log = new BkmLog();
|
||||
|
||||
public string GetInputLog()
|
||||
{
|
||||
|
@ -182,7 +182,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
// This function will compare the movie data to the savestate movie data to see if they match
|
||||
errorMessage = string.Empty;
|
||||
var log = new MovieLog();
|
||||
var log = new BkmLog();
|
||||
var stateFrame = 0;
|
||||
while (true)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public BkmMovie(bool startsFromSavestate = false)
|
||||
{
|
||||
Header = new MovieHeader();
|
||||
Header = new BkmHeader();
|
||||
Header[HeaderKeys.MOVIEVERSION] = "BizHawk v0.0.1";
|
||||
Filename = string.Empty;
|
||||
_preloadFramecount = 0;
|
||||
|
@ -34,7 +34,7 @@ namespace BizHawk.Client.Common
|
|||
#region Properties
|
||||
|
||||
public string PreferredExtension { get { return "bkm"; } }
|
||||
public MovieHeader Header { get; private set; }
|
||||
public BkmHeader Header { get; private set; }
|
||||
public string Filename { get; set; }
|
||||
public bool IsCountingRerecords { get; set; }
|
||||
public bool Loaded { get; private set; }
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
_mg = MnemonicGeneratorFactory.Generate();
|
||||
Filename = string.Empty;
|
||||
Header = new MovieHeader { StartsFromSavestate = startsFromSavestate };
|
||||
Header = new BkmHeader { StartsFromSavestate = startsFromSavestate };
|
||||
Header[HeaderKeys.MOVIEVERSION] = "BizHawk v2.0";
|
||||
_records = new MovieRecordList();
|
||||
_mode = Moviemode.Inactive;
|
||||
|
@ -287,7 +287,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public string Filename { get; set; }
|
||||
|
||||
public MovieHeader Header { get; private set; }
|
||||
public BkmHeader Header { get; private set; }
|
||||
|
||||
public bool IsActive
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue