diff --git a/BizHawk.Client.Common/BizHawk.Client.Common.csproj b/BizHawk.Client.Common/BizHawk.Client.Common.csproj
index 1328f3bccb..f8eb645303 100644
--- a/BizHawk.Client.Common/BizHawk.Client.Common.csproj
+++ b/BizHawk.Client.Common/BizHawk.Client.Common.csproj
@@ -148,8 +148,8 @@
-
+
diff --git a/BizHawk.Client.Common/movie/MovieImport.cs b/BizHawk.Client.Common/movie/MovieImport.cs
index eb19d3f2ac..91c36f8c59 100644
--- a/BizHawk.Client.Common/movie/MovieImport.cs
+++ b/BizHawk.Client.Common/movie/MovieImport.cs
@@ -119,7 +119,7 @@ namespace BizHawk.Client.Common
m = ImportZMV(path, out errorMsg, out warningMsg);
break;
}
- if (errorMsg == String.Empty)
+ if (errorMsg == string.Empty)
{
m.Header[HeaderKeys.MOVIEVERSION] = HeaderKeys.MovieVersion1;
}
@@ -198,7 +198,7 @@ namespace BizHawk.Client.Common
{
controllers["Reset"] = (sections[1][0] == '1');
// Get the first invalid command warning message that arises.
- if (String.IsNullOrEmpty((warningMsg)))
+ if (string.IsNullOrEmpty((warningMsg)))
{
switch (sections[1][0])
{
@@ -325,12 +325,12 @@ namespace BizHawk.Client.Common
// Import a text-based movie format. This works for .FM2, .MC2, and .YMV.
private static Movie ImportText(string path, out string errorMsg, out string warningMsg)
{
- errorMsg = warningMsg = String.Empty;
- Movie m = new Movie(path + "." + Movie.Extension);
+ errorMsg = warningMsg = string.Empty;
+ Movie m = new Movie(path + "." + MovieService.DefaultExtension);
FileInfo file = new FileInfo(path);
StreamReader sr = file.OpenText();
- string emulator = String.Empty;
- string platform = String.Empty;
+ string emulator = string.Empty;
+ string platform = string.Empty;
switch (Path.GetExtension(path).ToUpper())
{
case ".FM2":
@@ -522,8 +522,8 @@ namespace BizHawk.Client.Common
// FCM file format: http://code.google.com/p/fceu/wiki/FCM
private static Movie ImportFCM(string path, out string errorMsg, out string warningMsg)
{
- errorMsg = warningMsg = String.Empty;
- Movie m = new Movie(path + "." + Movie.Extension);
+ errorMsg = warningMsg = string.Empty;
+ Movie m = new Movie(path + "." + MovieService.DefaultExtension);
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
// 000 4-byte signature: 46 43 4D 1A "FCM\x1A"
@@ -774,8 +774,8 @@ namespace BizHawk.Client.Common
// FMV file format: http://tasvideos.org/FMV.html
private static Movie ImportFMV(string path, out string errorMsg, out string warningMsg)
{
- errorMsg = warningMsg = String.Empty;
- Movie m = new Movie(path + "." + Movie.Extension);
+ errorMsg = warningMsg = string.Empty;
+ Movie m = new Movie(path + "." + MovieService.DefaultExtension);
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
// 000 4-byte signature: 46 4D 56 1A "FMV\x1A"
@@ -914,8 +914,8 @@ namespace BizHawk.Client.Common
// GMV file format: http://code.google.com/p/gens-rerecording/wiki/GMV
private static Movie ImportGMV(string path, out string errorMsg, out string warningMsg)
{
- errorMsg = warningMsg = String.Empty;
- Movie m = new Movie(path + "." + Movie.Extension);
+ errorMsg = warningMsg = string.Empty;
+ Movie m = new Movie(path + "." + MovieService.DefaultExtension);
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
// 000 16-byte signature and format version: "Gens Movie TEST9"
@@ -1038,8 +1038,8 @@ namespace BizHawk.Client.Common
// LSMV file format: http://tasvideos.org/Lsnes/Movieformat.html
private static Movie ImportLSMV(string path, out string errorMsg, out string warningMsg)
{
- errorMsg = warningMsg = String.Empty;
- Movie m = new Movie(path + "." + Movie.Extension);
+ errorMsg = warningMsg = string.Empty;
+ Movie m = new Movie(path + "." + MovieService.DefaultExtension);
HawkFile hf = new HawkFile(path);
// .LSMV movies are .zip files containing data files.
if (!hf.IsArchive)
@@ -1270,8 +1270,8 @@ namespace BizHawk.Client.Common
*/
private static Movie ImportMCM(string path, out string errorMsg, out string warningMsg)
{
- errorMsg = warningMsg = String.Empty;
- Movie m = new Movie(path + "." + Movie.Extension);
+ errorMsg = warningMsg = string.Empty;
+ Movie m = new Movie(path + "." + MovieService.DefaultExtension);
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
// 000 8-byte "MDFNMOVI" signature
@@ -1391,8 +1391,8 @@ namespace BizHawk.Client.Common
// MMV file format: http://tasvideos.org/MMV.html
private static Movie ImportMMV(string path, out string errorMsg, out string warningMsg)
{
- errorMsg = warningMsg = String.Empty;
- Movie m = new Movie(path + "." + Movie.Extension);
+ errorMsg = warningMsg = string.Empty;
+ Movie m = new Movie(path + "." + MovieService.DefaultExtension);
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
// 0000: 4-byte signature: "MMV\0"
@@ -1459,7 +1459,7 @@ namespace BizHawk.Client.Common
m.Header[HeaderKeys.GAMENAME] = gameName;
// 00e4-00f3: binary: rom MD5 digest
byte[] md5 = r.ReadBytes(16);
- m.Header[MD5] = String.Format("{0:x8}", Util.BytesToHexString(md5).ToLower());
+ m.Header[MD5] = string.Format("{0:x8}", Util.BytesToHexString(md5).ToLower());
SimpleController controllers = new SimpleController {Type = new ControllerDefinition {Name = "SMS Controller"}};
/*
76543210
@@ -1505,8 +1505,8 @@ namespace BizHawk.Client.Common
// NMV file format: http://tasvideos.org/NMV.html
private static Movie ImportNMV(string path, out string errorMsg, out string warningMsg)
{
- errorMsg = warningMsg = String.Empty;
- Movie m = new Movie(path + "." + Movie.Extension);
+ errorMsg = warningMsg = string.Empty;
+ Movie m = new Movie(path + "." + MovieService.DefaultExtension);
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
// 000 4-byte signature: 4E 53 53 1A "NSS\x1A"
@@ -1732,8 +1732,8 @@ namespace BizHawk.Client.Common
private static Movie ImportSMV(string path, out string errorMsg, out string warningMsg)
{
- errorMsg = warningMsg = String.Empty;
- Movie m = new Movie(path + "." + Movie.Extension);
+ errorMsg = warningMsg = string.Empty;
+ Movie m = new Movie(path + "." + MovieService.DefaultExtension);
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
// 000 4-byte signature: 53 4D 56 1A "SMV\x1A"
@@ -2003,8 +2003,8 @@ namespace BizHawk.Client.Common
// VBM file format: http://code.google.com/p/vba-rerecording/wiki/VBM
private static Movie ImportVBM(string path, out string errorMsg, out string warningMsg)
{
- errorMsg = warningMsg = String.Empty;
- Movie m = new Movie(path + "." + Movie.Extension);
+ errorMsg = warningMsg = string.Empty;
+ Movie m = new Movie(path + "." + MovieService.DefaultExtension);
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
// 000 4-byte signature: 56 42 4D 1A "VBM\x1A"
@@ -2273,8 +2273,8 @@ namespace BizHawk.Client.Common
// VMV file format: http://tasvideos.org/VMV.html
private static Movie ImportVMV(string path, out string errorMsg, out string warningMsg)
{
- errorMsg = warningMsg = String.Empty;
- Movie m = new Movie(path + "." + Movie.Extension);
+ errorMsg = warningMsg = string.Empty;
+ Movie m = new Movie(path + "." + MovieService.DefaultExtension);
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
// 000 12-byte signature: "VirtuaNES MV"
@@ -2497,8 +2497,8 @@ namespace BizHawk.Client.Common
// ZMV file format: http://tasvideos.org/ZMV.html
private static Movie ImportZMV(string path, out string errorMsg, out string warningMsg)
{
- errorMsg = warningMsg = String.Empty;
- Movie m = new Movie(path + "." + Movie.Extension);
+ errorMsg = warningMsg = string.Empty;
+ Movie m = new Movie(path + "." + MovieService.DefaultExtension);
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
// 000 3-byte signature: 5A 4D 56 "ZMV"
diff --git a/BizHawk.Client.Common/movie/MovieService.cs b/BizHawk.Client.Common/movie/MovieService.cs
index b29b65dd08..a4279bd146 100644
--- a/BizHawk.Client.Common/movie/MovieService.cs
+++ b/BizHawk.Client.Common/movie/MovieService.cs
@@ -4,15 +4,40 @@ using System.IO;
using System.Linq;
using System.Text;
+using BizHawk.Common;
+
namespace BizHawk.Client.Common
{
public static class MovieService
{
- public static IMovie Load(string path)
+ public static IMovie Get(string path)
{
// TODO: open the file and determine the format, and instantiate the appropriate implementation
// Currently we just assume it is a bkm implementation
+ // TODO: change IMovies to take HawkFiles only and not path
return new Movie(path);
}
+
+ ///
+ /// Gets the file extension for the default movie implementation used in the client
+ ///
+ public static string DefaultExtension
+ {
+ get { return "bkm"; }
+ }
+
+ ///
+ /// Returns a list of extensions for all IMovie implementations
+ ///
+ public static IEnumerable MovieExtensions
+ {
+ // Movies 2.0 TODO: consider using reflection to find IMovie implementations
+ get
+ {
+ yield return "bkm";
+ yield return "bk2";
+ yield return "tasproj";
+ }
+ }
}
}
diff --git a/BizHawk.Client.Common/movie/bk2/Movie2.cs b/BizHawk.Client.Common/movie/bk2/Movie2.cs
index 1c084623c2..bdf5ddcb30 100644
--- a/BizHawk.Client.Common/movie/bk2/Movie2.cs
+++ b/BizHawk.Client.Common/movie/bk2/Movie2.cs
@@ -154,6 +154,11 @@ namespace BizHawk.Client.Common
}
}
+ public void SaveBackup()
+ {
+ throw new NotImplementedException();
+ }
+
public bool IsActive
{
get { return _mode != Moviemode.Inactive; }
diff --git a/BizHawk.Client.Common/movie/bkm/Movie.cs b/BizHawk.Client.Common/movie/bkm/Movie.cs
index 2f7bf94468..c328c66f64 100644
--- a/BizHawk.Client.Common/movie/bkm/Movie.cs
+++ b/BizHawk.Client.Common/movie/bkm/Movie.cs
@@ -156,9 +156,6 @@ namespace BizHawk.Client.Common
public string PreferredExtension { get { return "bkm"; } }
- // Movies 2.0 TODO: delete me
- public static string Extension { get { return "bkm"; } }
-
public MovieHeader Header { get; private set; }
public string Filename { get; set; }
diff --git a/BizHawk.Client.Common/movie/interfaces/IMovie.cs b/BizHawk.Client.Common/movie/interfaces/IMovie.cs
index e66df868d9..828fce90cc 100644
--- a/BizHawk.Client.Common/movie/interfaces/IMovie.cs
+++ b/BizHawk.Client.Common/movie/interfaces/IMovie.cs
@@ -72,6 +72,11 @@ namespace BizHawk.Client.Common
///
IDictionary HeaderEntries { get; }
+ ///
+ /// Forces the creation of a backup file of the current movie state
+ ///
+ void SaveBackup();
+
#endregion
#region File Handling API
diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs
index 4b23fd8688..0d2cb5ad1e 100644
--- a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs
+++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs
@@ -202,6 +202,11 @@ namespace BizHawk.Client.Common
}
}
+ public void SaveBackup()
+ {
+ throw new NotImplementedException();
+ }
+
public string Filename { get; set; }
public MovieHeader Header { get; private set; }
diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs
index 357bcda462..42c8c78e21 100644
--- a/BizHawk.Client.EmuHawk/MainForm.Events.cs
+++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs
@@ -1794,8 +1794,7 @@ namespace BizHawk.Client.EmuHawk
SaveMovieContextMenuItem.Visible =
Global.MovieSession.Movie.IsActive;
- // Movies 2.0 TODO
- BackupMovieContextMenuItem.Visible = Global.MovieSession.Movie is Movie && Global.MovieSession.Movie.IsActive;
+ BackupMovieContextMenuItem.Visible = Global.MovieSession.Movie.IsActive;
StopNoSaveContextMenuItem.Visible = Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.Changes;
@@ -1904,12 +1903,8 @@ namespace BizHawk.Client.EmuHawk
private void BackupMovieContextMenuItem_Click(object sender, EventArgs e)
{
- //Movies 2.0 TODO
- if (Global.MovieSession.Movie is Movie)
- {
- GlobalWin.OSD.AddMessage("Backup movie saved.");
- (Global.MovieSession.Movie as Movie).SaveBackup();
- }
+ (Global.MovieSession.Movie as Movie).SaveBackup();
+ GlobalWin.OSD.AddMessage("Backup movie saved.");
}
private void ViewSubtitlesContextMenuItem_Click(object sender, EventArgs e)
@@ -2217,8 +2212,6 @@ namespace BizHawk.Client.EmuHawk
else if (MovieImport.IsValidMovieExtension(Path.GetExtension(filePaths[0])))
{
- // Movies 2.0 TODO: rethink this method
-
//tries to open a legacy movie format as if it were a BKM, by importing it
if (CurrentlyOpenRom == null)
{
@@ -2241,10 +2234,11 @@ namespace BizHawk.Client.EmuHawk
// fix movie extension to something palatable for these purposes.
// for instance, something which doesnt clobber movies you already may have had.
// i'm evenly torn between this, and a file in %TEMP%, but since we dont really have a way to clean up this tempfile, i choose this:
- movie.Filename += ".autoimported." + Movie.Extension;
+ movie.Filename += ".autoimported." + MovieService.DefaultExtension;
movie.Save();
StartNewMovie(movie, false);
}
+
GlobalWin.OSD.AddMessage(warningMsg);
}
else
diff --git a/BizHawk.Client.EmuHawk/movie/PlayMovie.cs b/BizHawk.Client.EmuHawk/movie/PlayMovie.cs
index 16a96ecf88..c13eb97c1c 100644
--- a/BizHawk.Client.EmuHawk/movie/PlayMovie.cs
+++ b/BizHawk.Client.EmuHawk/movie/PlayMovie.cs
@@ -257,8 +257,9 @@ namespace BizHawk.Client.EmuHawk
foreach(var subdir in Directory.GetDirectories(dp))
dpTodo.Enqueue(subdir);
+ // Movies 2.0 TODO: add tasproj, hardcoded is okay here
//add movies
- fpTodo.AddRange(Directory.GetFiles(dp, "*." + Movie.Extension));
+ fpTodo.AddRange(Directory.GetFiles(dp, "*." + MovieService.DefaultExtension));
}
//in parallel, scan each movie
@@ -606,7 +607,7 @@ namespace BizHawk.Client.EmuHawk
var ofd = new OpenFileDialog
{
// Movies 2.0 TODO - add tasproj in addition to default, hardcoded is fine in this case
- Filter = "Movie Files (*." + Movie.Extension + ")|*." + MovieService.DefaultExtension + "|All Files|*.*",
+ Filter = "Movie Files (*." + MovieService.DefaultExtension + ")|*." + MovieService.DefaultExtension + "|All Files|*.*",
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null)
};