Some refactoring of movie code to make the Header less implementation specific, and start Movie2.cs which will be a Movie 2.0 implementation
This commit is contained in:
parent
7e9b13f5c3
commit
6b2889957a
|
@ -97,6 +97,8 @@
|
|||
<Compile Include="7z\SevenZipSfx.cs" />
|
||||
<Compile Include="7z\StreamWrappers.cs" />
|
||||
<Compile Include="BinarySaveStates.cs" />
|
||||
<Compile Include="bk2\Movie2.cs" />
|
||||
<Compile Include="bk2\MovieHeader2.cs" />
|
||||
<Compile Include="config\Binding.cs" />
|
||||
<Compile Include="config\Config.cs" />
|
||||
<Compile Include="config\ConfigService.cs" />
|
||||
|
|
|
@ -0,0 +1,209 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public class Movie2 : IMovie
|
||||
{
|
||||
private enum Moviemode { Inactive, Play, Record, Finished }
|
||||
|
||||
private readonly MovieLog _log = new MovieLog();
|
||||
private readonly PlatformFrameRates _frameRates = new PlatformFrameRates();
|
||||
private Moviemode _mode = Moviemode.Inactive;
|
||||
private bool MakeBackup { get; set; }
|
||||
|
||||
public Movie2(string filename, bool startsFromSavestate = false)
|
||||
: this(startsFromSavestate)
|
||||
{
|
||||
Header.Rerecords = 0;
|
||||
Filename = filename;
|
||||
}
|
||||
|
||||
public Movie2(bool startsFromSavestate = false)
|
||||
{
|
||||
Header = new MovieHeader2();
|
||||
Filename = string.Empty;
|
||||
Header.StartsFromSavestate = startsFromSavestate;
|
||||
|
||||
IsCountingRerecords = true;
|
||||
_mode = Moviemode.Inactive;
|
||||
MakeBackup = true;
|
||||
}
|
||||
|
||||
#region Implementation
|
||||
|
||||
public string PreferredExtension { get { return "bk2"; } }
|
||||
|
||||
public bool IsCountingRerecords { get; set; }
|
||||
public IMovieHeader Header { get; private set; }
|
||||
public SubtitleList Subtitles
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public IList<string> Comments
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public string SyncSettingsJson
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsActive
|
||||
{
|
||||
get { return _mode != Moviemode.Inactive; }
|
||||
}
|
||||
|
||||
public bool IsPlaying
|
||||
{
|
||||
get { return _mode == Moviemode.Play || _mode == Moviemode.Finished; }
|
||||
}
|
||||
|
||||
public bool IsRecording
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public bool IsFinished
|
||||
{
|
||||
get { return _mode == Moviemode.Finished; }
|
||||
}
|
||||
|
||||
public bool Changes
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
private set { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public double FrameCount
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public double Fps
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public TimeSpan Time
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public int InputLogLength
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public string Filename
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public bool Load()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public string GetInputLog()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool CheckTimeLines(TextReader reader, out string errorMessage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool ExtractInputLog(TextReader reader, out string errorMessage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void StartNewRecording()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void StartNewPlayback()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Stop(bool saveChanges = true)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SwitchToRecord()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SwitchToPlay()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void AppendFrame(IController source)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RecordFrame(int frame, IController source)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Truncate(int frame)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public string GetInput(int frame)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// Probably won't support
|
||||
public void PokeFrame(int frame, IController source)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ClearFrame(int frame)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,184 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public class MovieHeader2 : IMovieHeader
|
||||
{
|
||||
public SubtitleList Subtitles
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public List<string> Comments
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public ulong Rerecords
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public bool StartsFromSavestate
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public string SavestateBinaryBase64Blob
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public string GameName
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public string SystemID
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public string SyncSettingsJson
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public bool ParseLineFromFile(string line)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Add(string key, string value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool ContainsKey(string key)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public ICollection<string> Keys
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public bool Remove(string key)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool TryGetValue(string key, out string value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public ICollection<string> Values
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public string this[string key]
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public void Add(KeyValuePair<string, string> item)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Contains(KeyValuePair<string, string> item)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void CopyTo(KeyValuePair<string, string>[] array, int arrayIndex)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public bool Remove(KeyValuePair<string, string> item)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
@ -48,7 +49,15 @@ namespace BizHawk.Client.Common
|
|||
/// </summary>
|
||||
string PreferredExtension { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Sync Settings from the Core
|
||||
/// Movies 2.0 TODO: instead of enforcing a Json transfer, there should be methods that get and receive SyncSettings objects and let the implementation decide the format
|
||||
/// </summary>
|
||||
string SyncSettingsJson { get; set; }
|
||||
|
||||
IMovieHeader Header { get; }
|
||||
SubtitleList Subtitles { get; }
|
||||
IList<string> Comments { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
@ -6,12 +7,14 @@ using System.Text;
|
|||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public class Movie : IMovie
|
||||
{
|
||||
private readonly MovieLog _log = new MovieLog();
|
||||
private readonly PlatformFrameRates _frameRates = new PlatformFrameRates();
|
||||
private bool _makeBackup = true;
|
||||
|
||||
private Moviemode _mode = Moviemode.Inactive;
|
||||
private int _preloadFramecount; // Not a a reliable number, used for preloading (when no log has yet been loaded), this is only for quick stat compilation for dialogs such as play movie
|
||||
|
@ -35,20 +38,43 @@ namespace BizHawk.Client.Common
|
|||
|
||||
IsCountingRerecords = true;
|
||||
_mode = Moviemode.Inactive;
|
||||
MakeBackup = true;
|
||||
_makeBackup = true;
|
||||
}
|
||||
|
||||
private enum Moviemode { Inactive, Play, Record, Finished }
|
||||
|
||||
#region Properties
|
||||
|
||||
public SubtitleList Subtitles
|
||||
{
|
||||
get { return Header.Subtitles; }
|
||||
}
|
||||
|
||||
public IList<string> Comments
|
||||
{
|
||||
get { return Header.Comments; }
|
||||
}
|
||||
|
||||
public string SyncSettingsJson
|
||||
{
|
||||
get
|
||||
{
|
||||
return Header[HeaderKeys.SYNCSETTINGS];
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Header[HeaderKeys.SYNCSETTINGS] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string PreferredExtension { get { return "bkm"; } }
|
||||
|
||||
// TODO: delete me
|
||||
public static string Extension { get { return "bkm"; } }
|
||||
|
||||
public IMovieHeader Header { get; private set; }
|
||||
|
||||
public bool MakeBackup { get; set; }
|
||||
public string Filename { get; set; }
|
||||
public bool IsCountingRerecords { get; set; }
|
||||
|
||||
|
@ -118,10 +144,10 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
_mode = Moviemode.Record;
|
||||
if (Global.Config.EnableBackupMovies && MakeBackup && _log.Length > 0)
|
||||
if (Global.Config.EnableBackupMovies && _makeBackup && _log.Length > 0)
|
||||
{
|
||||
SaveBackup();
|
||||
MakeBackup = false;
|
||||
_makeBackup = false;
|
||||
}
|
||||
|
||||
_log.Clear();
|
||||
|
@ -509,10 +535,10 @@ namespace BizHawk.Client.Common
|
|||
// We are in record mode so replace the movie log with the one from the savestate
|
||||
if (!Global.MovieSession.MultiTrack.IsActive)
|
||||
{
|
||||
if (Global.Config.EnableBackupMovies && MakeBackup && _log.Length > 0)
|
||||
if (Global.Config.EnableBackupMovies && _makeBackup && _log.Length > 0)
|
||||
{
|
||||
SaveBackup();
|
||||
MakeBackup = false;
|
||||
_makeBackup = false;
|
||||
}
|
||||
|
||||
_log.Clear();
|
||||
|
|
|
@ -317,7 +317,7 @@ namespace BizHawk.Client.Common
|
|||
length = line.Substring(first + 1, second - first - 1);
|
||||
}
|
||||
string message = line.Substring(second + 1).Trim();
|
||||
m.Header.Subtitles.AddFromString("subtitle " + frame + " 0 0 " + length + " FFFFFFFF " + message);
|
||||
m.Subtitles.AddFromString("subtitle " + frame + " 0 0 " + length + " FFFFFFFF " + message);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
@ -371,14 +371,14 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
else if (line.ToLower().StartsWith("emuversion"))
|
||||
{
|
||||
m.Header.Comments.Add(
|
||||
m.Comments.Add(
|
||||
EMULATIONORIGIN + " " + emulator + " version " + ParseHeader(line, "emuVersion")
|
||||
);
|
||||
}
|
||||
else if (line.ToLower().StartsWith("version"))
|
||||
{
|
||||
string version = ParseHeader(line, "version");
|
||||
m.Header.Comments.Add(
|
||||
m.Comments.Add(
|
||||
MOVIEORIGIN + " " + Path.GetExtension(path) + " version " + version
|
||||
);
|
||||
if (Path.GetExtension(path).ToUpper() == ".FM2" && version != "3")
|
||||
|
@ -459,7 +459,7 @@ namespace BizHawk.Client.Common
|
|||
else
|
||||
{
|
||||
// Everything not explicitly defined is treated as a comment.
|
||||
m.Header.Comments.Add(line);
|
||||
m.Comments.Add(line);
|
||||
}
|
||||
}
|
||||
sr.Close();
|
||||
|
@ -543,7 +543,7 @@ namespace BizHawk.Client.Common
|
|||
fs.Close();
|
||||
return null;
|
||||
}
|
||||
m.Header.Comments.Add(MOVIEORIGIN + " .FCM version " + version);
|
||||
m.Comments.Add(MOVIEORIGIN + " .FCM version " + version);
|
||||
// 008 1-byte flags
|
||||
byte flags = r.ReadByte();
|
||||
// bit 0: reserved, set to 0
|
||||
|
@ -571,7 +571,7 @@ namespace BizHawk.Client.Common
|
|||
m.Header[HeaderKeys.PAL] = pal.ToString();
|
||||
// other: reserved, set to 0
|
||||
bool syncHack = (((flags >> 4) & 0x1) != 0);
|
||||
m.Header.Comments.Add(SYNCHACK + " " + syncHack.ToString());
|
||||
m.Comments.Add(SYNCHACK + " " + syncHack.ToString());
|
||||
// 009 1-byte flags: reserved, set to 0
|
||||
r.ReadByte();
|
||||
// 00A 1-byte flags: reserved, set to 0
|
||||
|
@ -597,7 +597,7 @@ namespace BizHawk.Client.Common
|
|||
m.Header[MD5] = Util.BytesToHexString(md5).ToLower();
|
||||
// 030 4-byte little-endian unsigned int: version of the emulator used
|
||||
uint emuVersion = r.ReadUInt32();
|
||||
m.Header.Comments.Add(EMULATIONORIGIN + " FCEU " + emuVersion.ToString());
|
||||
m.Comments.Add(EMULATIONORIGIN + " FCEU " + emuVersion.ToString());
|
||||
// 034 name of the ROM used - UTF8 encoded nul-terminated string.
|
||||
List<byte> gameBytes = new List<byte>();
|
||||
while (r.PeekChar() != 0)
|
||||
|
@ -833,11 +833,11 @@ namespace BizHawk.Client.Common
|
|||
r.ReadInt16();
|
||||
// 010 64-byte zero-terminated emulator identifier string
|
||||
string emuVersion = NullTerminated(r.ReadStringFixedAscii(64));
|
||||
m.Header.Comments.Add(EMULATIONORIGIN + " Famtasia version " + emuVersion);
|
||||
m.Header.Comments.Add(MOVIEORIGIN + " .FMV");
|
||||
m.Comments.Add(EMULATIONORIGIN + " Famtasia version " + emuVersion);
|
||||
m.Comments.Add(MOVIEORIGIN + " .FMV");
|
||||
// 050 64-byte zero-terminated movie title string
|
||||
string description = NullTerminated(r.ReadStringFixedAscii(64));
|
||||
m.Header.Comments.Add(COMMENT + " " + description);
|
||||
m.Comments.Add(COMMENT + " " + description);
|
||||
if (!controller1 && !controller2 && !FDS)
|
||||
{
|
||||
warningMsg = "No input recorded.";
|
||||
|
@ -929,8 +929,8 @@ namespace BizHawk.Client.Common
|
|||
m.Header[HeaderKeys.PLATFORM] = "Genesis";
|
||||
// 00F ASCII-encoded GMV file format version. The most recent is 'A'. (?)
|
||||
string version = r.ReadStringFixedAscii(1);
|
||||
m.Header.Comments.Add(MOVIEORIGIN + " .GMV version " + version);
|
||||
m.Header.Comments.Add(EMULATIONORIGIN + " Gens");
|
||||
m.Comments.Add(MOVIEORIGIN + " .GMV version " + version);
|
||||
m.Comments.Add(EMULATIONORIGIN + " Gens");
|
||||
// 010 4-byte little-endian unsigned int: rerecord count
|
||||
uint rerecordCount = r.ReadUInt32();
|
||||
m.Header.Rerecords = rerecordCount;
|
||||
|
@ -970,7 +970,7 @@ namespace BizHawk.Client.Common
|
|||
r.ReadByte();
|
||||
// 018 40-byte zero-terminated ASCII movie name string
|
||||
string description = NullTerminated(r.ReadStringFixedAscii(40));
|
||||
m.Header.Comments.Add(COMMENT + " " + description);
|
||||
m.Comments.Add(COMMENT + " " + description);
|
||||
/*
|
||||
040 frame data
|
||||
For controller bytes, each value is determined by OR-ing together values for whichever of the following are
|
||||
|
@ -1089,7 +1089,7 @@ namespace BizHawk.Client.Common
|
|||
hf.BindArchiveMember(item.Index);
|
||||
var stream = hf.GetStream();
|
||||
string coreversion = Encoding.UTF8.GetString(Util.ReadAllBytes(stream)).Trim();
|
||||
m.Header.Comments.Add(COREORIGIN + " " + coreversion);
|
||||
m.Comments.Add(COREORIGIN + " " + coreversion);
|
||||
hf.Unbind();
|
||||
}
|
||||
else if (item.Name == "gamename")
|
||||
|
@ -1255,7 +1255,7 @@ namespace BizHawk.Client.Common
|
|||
hf.BindArchiveMember(item.Index);
|
||||
var stream = hf.GetStream();
|
||||
string systemid = Encoding.UTF8.GetString(Util.ReadAllBytes(stream)).Trim();
|
||||
m.Header.Comments.Add(EMULATIONORIGIN + " " + systemid);
|
||||
m.Comments.Add(EMULATIONORIGIN + " " + systemid);
|
||||
hf.Unbind();
|
||||
}
|
||||
}
|
||||
|
@ -1284,10 +1284,10 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
// 008 uint32 Mednafen Version (Current is 0A 08)
|
||||
uint emuVersion = r.ReadUInt32();
|
||||
m.Header.Comments.Add(EMULATIONORIGIN + " Mednafen " + emuVersion.ToString());
|
||||
m.Comments.Add(EMULATIONORIGIN + " Mednafen " + emuVersion.ToString());
|
||||
// 00C uint32 Movie Format Version (Current is 01)
|
||||
uint version = r.ReadUInt32();
|
||||
m.Header.Comments.Add(MOVIEORIGIN + " .MCM version " + version);
|
||||
m.Comments.Add(MOVIEORIGIN + " .MCM version " + version);
|
||||
// 010 32-byte MD5 of the ROM used
|
||||
byte[] md5 = r.ReadBytes(16);
|
||||
// Discard the second 16 bytes.
|
||||
|
@ -1405,8 +1405,8 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
// 0004: 4-byte little endian unsigned int: dega version
|
||||
uint emuVersion = r.ReadUInt32();
|
||||
m.Header.Comments.Add(EMULATIONORIGIN + " Dega version " + emuVersion.ToString());
|
||||
m.Header.Comments.Add(MOVIEORIGIN + " .MMV");
|
||||
m.Comments.Add(EMULATIONORIGIN + " Dega version " + emuVersion.ToString());
|
||||
m.Comments.Add(MOVIEORIGIN + " .MMV");
|
||||
// 0008: 4-byte little endian unsigned int: frame count
|
||||
uint frameCount = r.ReadUInt32();
|
||||
// 000c: 4-byte little endian unsigned int: rerecord count
|
||||
|
@ -1519,8 +1519,8 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
// 004 4-byte version string (example "0960")
|
||||
string emuVersion = r.ReadStringFixedAscii(4);
|
||||
m.Header.Comments.Add(EMULATIONORIGIN + " Nintendulator version " + emuVersion);
|
||||
m.Header.Comments.Add(MOVIEORIGIN + " .NMV");
|
||||
m.Comments.Add(EMULATIONORIGIN + " Nintendulator version " + emuVersion);
|
||||
m.Comments.Add(MOVIEORIGIN + " .NMV");
|
||||
// 008 4-byte file size, not including the 16-byte header
|
||||
r.ReadUInt32();
|
||||
/*
|
||||
|
@ -1680,7 +1680,7 @@ namespace BizHawk.Client.Common
|
|||
00C (variable) null-terminated UTF-8 text, movie description (currently not implemented)
|
||||
*/
|
||||
string movieDescription = NullTerminated(r.ReadStringFixedAscii((int)r.ReadUInt32()));
|
||||
m.Header.Comments.Add(COMMENT + " " + movieDescription);
|
||||
m.Comments.Add(COMMENT + " " + movieDescription);
|
||||
// ... 4-byte little-endian unsigned int: length of controller data in bytes
|
||||
uint length = r.ReadUInt32();
|
||||
// ... (variable) controller data
|
||||
|
@ -1765,8 +1765,8 @@ namespace BizHawk.Client.Common
|
|||
fs.Close();
|
||||
return null;
|
||||
}
|
||||
m.Header.Comments.Add(EMULATIONORIGIN + " Snes9x version " + version);
|
||||
m.Header.Comments.Add(MOVIEORIGIN + " .SMV");
|
||||
m.Comments.Add(EMULATIONORIGIN + " Snes9x version " + version);
|
||||
m.Comments.Add(MOVIEORIGIN + " .SMV");
|
||||
/*
|
||||
008 4-byte little-endian integer: movie "uid" - identifies the movie-savestate relationship, also used as the
|
||||
recording time in Unix epoch format
|
||||
|
@ -2116,7 +2116,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
if (is_sgb)
|
||||
{
|
||||
m.Header.Comments.Add(SUPERGAMEBOYMODE + " True");
|
||||
m.Comments.Add(SUPERGAMEBOYMODE + " True");
|
||||
}
|
||||
m.Header[HeaderKeys.PLATFORM] = platform;
|
||||
// 017 1-byte flags: (values of some boolean emulator options)
|
||||
|
@ -2158,8 +2158,8 @@ namespace BizHawk.Client.Common
|
|||
m.Header[HeaderKeys.GAMENAME] = gameName;
|
||||
// 030 1-byte unsigned char: minor version/revision number of current VBM version, the latest is "1"
|
||||
byte minorVersion = r.ReadByte();
|
||||
m.Header.Comments.Add(MOVIEORIGIN + " .VBM version " + majorVersion + "." + minorVersion);
|
||||
m.Header.Comments.Add(EMULATIONORIGIN + " Visual Boy Advance");
|
||||
m.Comments.Add(MOVIEORIGIN + " .VBM version " + majorVersion + "." + minorVersion);
|
||||
m.Comments.Add(EMULATIONORIGIN + " Visual Boy Advance");
|
||||
// 031 1-byte unsigned char: the internal CRC of the ROM used while recording
|
||||
r.ReadByte();
|
||||
/*
|
||||
|
@ -2191,7 +2191,7 @@ namespace BizHawk.Client.Common
|
|||
m.Header[HeaderKeys.AUTHOR] = author;
|
||||
// The following 128 bytes are for a description of the movie. Both parts must be null-terminated.
|
||||
string movieDescription = NullTerminated(r.ReadStringFixedAscii(128));
|
||||
m.Header.Comments.Add(COMMENT + " " + movieDescription);
|
||||
m.Comments.Add(COMMENT + " " + movieDescription);
|
||||
r.BaseStream.Position = firstFrameOffset;
|
||||
SimpleController controllers = new SimpleController {Type = new ControllerDefinition()};
|
||||
if (platform != "GBA")
|
||||
|
@ -2288,11 +2288,11 @@ namespace BizHawk.Client.Common
|
|||
m.Header[HeaderKeys.PLATFORM] = "NES";
|
||||
// 00C 2-byte little-endian integer: movie version 0x0400
|
||||
ushort version = r.ReadUInt16();
|
||||
m.Header.Comments.Add(MOVIEORIGIN + " .VMV version " + version);
|
||||
m.Header.Comments.Add(EMULATIONORIGIN + " VirtuaNES");
|
||||
m.Comments.Add(MOVIEORIGIN + " .VMV version " + version);
|
||||
m.Comments.Add(EMULATIONORIGIN + " VirtuaNES");
|
||||
// 00E 2-byte little-endian integer: record version
|
||||
ushort recordVersion = r.ReadUInt16();
|
||||
m.Header.Comments.Add(COMMENT + " Record version " + recordVersion);
|
||||
m.Comments.Add(COMMENT + " Record version " + recordVersion);
|
||||
// 010 4-byte flags (control byte)
|
||||
uint flags = r.ReadUInt32();
|
||||
/*
|
||||
|
@ -2512,8 +2512,8 @@ namespace BizHawk.Client.Common
|
|||
m.Header[HeaderKeys.PLATFORM] = "SNES";
|
||||
// 003 2-byte little-endian unsigned int: zsnes version number
|
||||
short version = r.ReadInt16();
|
||||
m.Header.Comments.Add(EMULATIONORIGIN + " ZSNES version " + version);
|
||||
m.Header.Comments.Add(MOVIEORIGIN + " .ZMV");
|
||||
m.Comments.Add(EMULATIONORIGIN + " ZSNES version " + version);
|
||||
m.Comments.Add(MOVIEORIGIN + " .ZMV");
|
||||
// 005 4-byte little-endian integer: CRC32 of the ROM
|
||||
int crc32 = r.ReadInt32();
|
||||
m.Header[CRC32] = crc32.ToString();
|
||||
|
|
|
@ -86,6 +86,29 @@ namespace BizHawk.Client.Common
|
|||
IsCountingRerecords = true;
|
||||
}
|
||||
|
||||
public SubtitleList Subtitles
|
||||
{
|
||||
get { return Header.Subtitles; }
|
||||
}
|
||||
|
||||
public IList<string> Comments
|
||||
{
|
||||
get { return Header.Comments; }
|
||||
}
|
||||
|
||||
public string SyncSettingsJson
|
||||
{
|
||||
get
|
||||
{
|
||||
return Header[HeaderKeys.SYNCSETTINGS];
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Header[HeaderKeys.SYNCSETTINGS] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Filename { get; set; }
|
||||
|
||||
public IMovieHeader Header { get; private set; }
|
||||
|
|
|
@ -452,7 +452,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (Global.MovieSession.Movie.IsActive && Global.Config.DisplaySubtitles)
|
||||
{
|
||||
var subList = Global.MovieSession.Movie.Header.Subtitles.GetSubtitles(Global.Emulator.Frame);
|
||||
var subList = Global.MovieSession.Movie.Subtitles.GetSubtitles(Global.Emulator.Frame);
|
||||
|
||||
foreach (var sub in subList)
|
||||
{
|
||||
|
|
|
@ -1922,9 +1922,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
int index = -1;
|
||||
var sub = new Subtitle();
|
||||
for (int x = 0; x < Global.MovieSession.Movie.Header.Subtitles.Count; x++)
|
||||
for (int x = 0; x < Global.MovieSession.Movie.Subtitles.Count; x++)
|
||||
{
|
||||
sub = Global.MovieSession.Movie.Header.Subtitles[x];
|
||||
sub = Global.MovieSession.Movie.Subtitles[x];
|
||||
if (Global.Emulator.Frame == sub.Frame)
|
||||
{
|
||||
index = x;
|
||||
|
@ -1943,10 +1943,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (index >= 0)
|
||||
{
|
||||
Global.MovieSession.Movie.Header.Subtitles.RemoveAt(index);
|
||||
Global.MovieSession.Movie.Subtitles.RemoveAt(index);
|
||||
}
|
||||
|
||||
Global.MovieSession.Movie.Header.Subtitles.Add(subForm.Sub);
|
||||
Global.MovieSession.Movie.Subtitles.Add(subForm.Sub);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
string s = Global.MovieSession.Movie.Header.SyncSettingsJson;
|
||||
string s = Global.MovieSession.Movie.SyncSettingsJson;
|
||||
if (!string.IsNullOrWhiteSpace(s))
|
||||
{
|
||||
_syncSettingsHack = ConfigService.LoadWithType(s);
|
||||
|
|
|
@ -1430,6 +1430,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void LoadMoviesFromRecent(string path)
|
||||
{
|
||||
// Movies 2.0 TODO - Use MovieLoader that returns an IMovie, loader will have a success flag to pass to HandleLoadError()
|
||||
var movie = new Movie(path);
|
||||
|
||||
if (!movie.Loaded)
|
||||
|
|
|
@ -69,11 +69,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (!Global.MovieSession.ReadOnly)
|
||||
{
|
||||
_selectedMovie.Header.Comments.Clear();
|
||||
_selectedMovie.Comments.Clear();
|
||||
for (int i = 0; i < CommentGrid.Rows.Count - 1; i++)
|
||||
{
|
||||
var c = CommentGrid.Rows[i].Cells[0];
|
||||
_selectedMovie.Header.Comments.Add("comment " + c.Value);
|
||||
_selectedMovie.Comments.Add("comment " + c.Value);
|
||||
}
|
||||
_selectedMovie.Save();
|
||||
}
|
||||
|
@ -83,11 +83,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void GetMovie(IMovie m)
|
||||
{
|
||||
_selectedMovie = m;
|
||||
if (m.Header.Comments.Count == 0) return;
|
||||
if (m.Comments.Count == 0) return;
|
||||
|
||||
for (int i = 0; i < m.Header.Comments.Count; i++)
|
||||
for (int i = 0; i < m.Comments.Count; i++)
|
||||
{
|
||||
var str = m.Header.Comments[i];
|
||||
var str = m.Comments[i];
|
||||
if (str.Length >= 7 && str.Substring(0, 7) == "comment")
|
||||
{
|
||||
str = str.Remove(0, 7);
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (!ReadOnly)
|
||||
{
|
||||
_selectedMovie.Header.Subtitles.Clear();
|
||||
_selectedMovie.Subtitles.Clear();
|
||||
for (int i = 0; i < SubGrid.Rows.Count - 1; i++)
|
||||
{
|
||||
var s = new Subtitle();
|
||||
|
@ -74,7 +74,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
try { c = SubGrid.Rows[i].Cells[5]; }
|
||||
catch { ShowError(i, 5); return; }
|
||||
s.Message = c.Value.ToString();
|
||||
_selectedMovie.Header.Subtitles.Add(s);
|
||||
_selectedMovie.Subtitles.Add(s);
|
||||
}
|
||||
_selectedMovie.Save();
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_selectedMovie = m;
|
||||
var subs = new SubtitleList();
|
||||
subs.AddRange(m.Header.Subtitles);
|
||||
subs.AddRange(m.Subtitles);
|
||||
|
||||
for (int x = 0; x < subs.Count; x++)
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
c = SubGrid.Rows[index].Cells[5];
|
||||
try { s.Message = c.Value.ToString(); }
|
||||
catch { }
|
||||
_selectedMovie.Header.Subtitles.Add(s);
|
||||
_selectedMovie.Subtitles.Add(s);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -511,8 +511,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
var FramesItem = new ListViewItem("Frames");
|
||||
FramesItem.SubItems.Add(_movieList[firstIndex].FrameCount.ToString());
|
||||
DetailsView.Items.Add(FramesItem);
|
||||
CommentsBtn.Enabled = _movieList[firstIndex].Header.Comments.Any();
|
||||
SubtitlesBtn.Enabled = _movieList[firstIndex].Header.Subtitles.Any();
|
||||
CommentsBtn.Enabled = _movieList[firstIndex].Comments.Any();
|
||||
SubtitlesBtn.Enabled = _movieList[firstIndex].Subtitles.Any();
|
||||
}
|
||||
|
||||
private void EditMenuItem_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_movieToRecord.Header[HeaderKeys.PLATFORM] = Global.Game.System;
|
||||
|
||||
// Sync Settings, for movies 1.0, just dump a json blob into a header line
|
||||
_movieToRecord.Header[HeaderKeys.SYNCSETTINGS] = ConfigService.SaveWithType(Global.Emulator.GetSyncSettings());
|
||||
_movieToRecord.SyncSettingsJson = ConfigService.SaveWithType(Global.Emulator.GetSyncSettings());
|
||||
|
||||
if (Global.Game != null)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue