refactor movie convert into movie import. Currently this breaks movie conversion, as the main convert function now needs implementation
This commit is contained in:
parent
a38afd4fb2
commit
ff5c9a2799
|
@ -198,8 +198,8 @@
|
||||||
<DependentUpon>EditSubtitlesForm.cs</DependentUpon>
|
<DependentUpon>EditSubtitlesForm.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="movie\Movie.cs" />
|
<Compile Include="movie\Movie.cs" />
|
||||||
<Compile Include="movie\MovieConvert.cs" />
|
|
||||||
<Compile Include="movie\MovieHeader.cs" />
|
<Compile Include="movie\MovieHeader.cs" />
|
||||||
|
<Compile Include="movie\MovieImport.cs" />
|
||||||
<Compile Include="movie\MovieLog.cs" />
|
<Compile Include="movie\MovieLog.cs" />
|
||||||
<Compile Include="movie\MovieSession.cs" />
|
<Compile Include="movie\MovieSession.cs" />
|
||||||
<Compile Include="movie\MultitrackRecording.cs" />
|
<Compile Include="movie\MultitrackRecording.cs" />
|
||||||
|
|
|
@ -755,48 +755,18 @@ namespace BizHawk.MultiClient
|
||||||
RamWatch1.LoadWatchFile(filePaths[0], false);
|
RamWatch1.LoadWatchFile(filePaths[0], false);
|
||||||
RamWatch1.DisplayWatchList();
|
RamWatch1.DisplayWatchList();
|
||||||
}
|
}
|
||||||
else if (Path.GetExtension(filePaths[0]).ToUpper() == ".FCM")
|
|
||||||
{
|
|
||||||
LoadRom(CurrentlyOpenRom);
|
|
||||||
string error = "";
|
|
||||||
Movie m = MovieConvert.ConvertFCM(filePaths[0], out error);
|
|
||||||
if (error.Length > 0)
|
|
||||||
MessageBox.Show(error, "Conversion error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
else
|
|
||||||
StartNewMovie(m, false);
|
|
||||||
|
|
||||||
}
|
else if (MovieImport.IsValidMovieExtension(Path.GetExtension(filePaths[0])))
|
||||||
else if (Path.GetExtension(filePaths[0]).ToUpper() == ".SMV")
|
|
||||||
{
|
{
|
||||||
LoadRom(CurrentlyOpenRom);
|
LoadRom(CurrentlyOpenRom);
|
||||||
string error = "";
|
string error = "";
|
||||||
Movie m = MovieConvert.ConvertSMV(filePaths[0], out error);
|
Movie m = MovieImport.ImportFile(filePaths[0], out error);
|
||||||
if (error.Length > 0)
|
if (error.Length > 0)
|
||||||
MessageBox.Show(error, "Conversion error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(error, "Conversion error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
else
|
else
|
||||||
StartNewMovie(m, false);
|
StartNewMovie(m, false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
else if (Path.GetExtension(filePaths[0]).ToUpper() == ".MMV")
|
|
||||||
{
|
|
||||||
LoadRom(CurrentlyOpenRom);
|
|
||||||
string error = "";
|
|
||||||
Movie m = MovieConvert.ConvertMMV(filePaths[0], out error);
|
|
||||||
if (error.Length > 0)
|
|
||||||
MessageBox.Show(error, "Conversion error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
else
|
|
||||||
StartNewMovie(m, false);
|
|
||||||
}
|
|
||||||
else if (Path.GetExtension(filePaths[0]).ToUpper() == ".VBM")
|
|
||||||
{
|
|
||||||
LoadRom(CurrentlyOpenRom);
|
|
||||||
string error = "";
|
|
||||||
Movie m = MovieConvert.ConvertVBM(filePaths[0], out error);
|
|
||||||
if (error.Length > 0)
|
|
||||||
MessageBox.Show(error, "Conversion error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
else
|
|
||||||
StartNewMovie(m, false);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
LoadRom(filePaths[0]);
|
LoadRom(filePaths[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,24 @@ using System.IO;
|
||||||
|
|
||||||
namespace BizHawk.MultiClient
|
namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
public static class MovieConvert
|
public static class MovieImport
|
||||||
{
|
{
|
||||||
public static Movie ConvertFCM(string path, out string errorMsg)
|
public static Movie ImportFile(string path, out string errorMsg)
|
||||||
|
{
|
||||||
|
//TODO: This function will receive a file, parse the file extension,
|
||||||
|
//then decide which import function to call, call it, and return a movie object
|
||||||
|
//the multiclient should only call this and not the import members (make them private)
|
||||||
|
errorMsg = "";
|
||||||
|
return new Movie();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsValidMovieExtension(string extension)
|
||||||
|
{
|
||||||
|
//TODO: This function will receive, parse the extension and decide if it is a movie type that it can parse
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Movie ImportFCM(string path, out string errorMsg)
|
||||||
{
|
{
|
||||||
errorMsg = "";
|
errorMsg = "";
|
||||||
|
|
||||||
|
@ -132,7 +147,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Movie ConvertMMV(string path, out string errorMsg)
|
private static Movie ImportMMV(string path, out string errorMsg)
|
||||||
{
|
{
|
||||||
errorMsg = "";
|
errorMsg = "";
|
||||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||||
|
@ -258,14 +273,14 @@ namespace BizHawk.MultiClient
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ConvertMCM(string path)
|
private static string ImportMCM(string path)
|
||||||
{
|
{
|
||||||
string converted = Path.ChangeExtension(path, ".tas");
|
string converted = Path.ChangeExtension(path, ".tas");
|
||||||
|
|
||||||
return converted;
|
return converted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Movie ConvertSMV(string path, out string errorMSG)
|
private static Movie ImportSMV(string path, out string errorMSG)
|
||||||
{
|
{
|
||||||
errorMSG = "";
|
errorMSG = "";
|
||||||
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||||
|
@ -286,11 +301,11 @@ namespace BizHawk.MultiClient
|
||||||
switch (version)
|
switch (version)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
return ConvertSMV143(r, path);
|
return ImportSMV143(r, path);
|
||||||
case 4:
|
case 4:
|
||||||
return ConvertSMV151(r, path);
|
return ImportSMV151(r, path);
|
||||||
case 5:
|
case 5:
|
||||||
return ConvertSMV152(r, path);
|
return ImportSMV152(r, path);
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
errorMSG = "SMV version not recognized, 143, 151, and 152 are currently supported";
|
errorMSG = "SMV version not recognized, 143, 151, and 152 are currently supported";
|
||||||
|
@ -299,7 +314,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Movie ConvertSMV152(BinaryReader r, string path)
|
private static Movie ImportSMV152(BinaryReader r, string path)
|
||||||
{
|
{
|
||||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||||
|
|
||||||
|
@ -308,14 +323,14 @@ namespace BizHawk.MultiClient
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Movie ConvertSMV151(BinaryReader r, string path)
|
private static Movie ImportSMV151(BinaryReader r, string path)
|
||||||
{
|
{
|
||||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Movie ConvertSMV143(BinaryReader r, string path)
|
private static Movie ImportSMV143(BinaryReader r, string path)
|
||||||
{
|
{
|
||||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||||
|
|
||||||
|
@ -374,7 +389,7 @@ namespace BizHawk.MultiClient
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Movie ConvertGMV(string path, out string errorMsg)
|
private static Movie ImportGMV(string path, out string errorMsg)
|
||||||
{
|
{
|
||||||
errorMsg = "";
|
errorMsg = "";
|
||||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||||
|
@ -382,7 +397,7 @@ namespace BizHawk.MultiClient
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Movie ConvertVBM(string path, out string errorMsg)
|
private static Movie ImportVBM(string path, out string errorMsg)
|
||||||
{
|
{
|
||||||
errorMsg = "";
|
errorMsg = "";
|
||||||
//Converts vbm to native text based format.
|
//Converts vbm to native text based format.
|
Loading…
Reference in New Issue