Some work on Movie object and convertSMV started
This commit is contained in:
parent
87fa456490
commit
a9c8756bd1
|
@ -570,6 +570,14 @@ namespace BizHawk.MultiClient
|
|||
UserMovie = MovieConvert.ConvertFCM(filePaths[0]);
|
||||
UserMovie.StartPlayback();
|
||||
|
||||
}
|
||||
else if (Path.GetExtension(filePaths[0]).ToUpper() == ".SMV")
|
||||
{
|
||||
//TODO: error checking of some kind and don't play on error
|
||||
LoadRom(CurrentlyOpenRom);
|
||||
UserMovie = MovieConvert.ConvertSMV(filePaths[0]);
|
||||
UserMovie.StartPlayback();
|
||||
|
||||
}
|
||||
else if (Path.GetExtension(filePaths[0]).ToUpper() == ".MMV")
|
||||
{
|
||||
|
@ -578,6 +586,13 @@ namespace BizHawk.MultiClient
|
|||
UserMovie = MovieConvert.ConvertMMV(filePaths[0]);
|
||||
UserMovie.StartPlayback();
|
||||
}
|
||||
else if (Path.GetExtension(filePaths[0]).ToUpper() == ".VBM")
|
||||
{
|
||||
//TODO: error checking of some kind and don't play on error
|
||||
LoadRom(CurrentlyOpenRom);
|
||||
UserMovie = MovieConvert.ConvertVBM(filePaths[0]);
|
||||
UserMovie.StartPlayback();
|
||||
}
|
||||
else
|
||||
LoadRom(filePaths[0]);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,6 @@ namespace BizHawk.MultiClient
|
|||
public void StartPlayback()
|
||||
{
|
||||
MovieMode = MOVIEMODE.PLAY;
|
||||
//TODO:...something else should be done here
|
||||
}
|
||||
|
||||
public MOVIEMODE GetMovieMode()
|
||||
|
|
|
@ -33,8 +33,8 @@ namespace BizHawk.MultiClient
|
|||
|
||||
UInt32 frameCount = r.ReadUInt32();
|
||||
|
||||
UInt32 rerecords = r.ReadUInt32();
|
||||
m.SetHeaderLine(MovieHeader.RERECORDS, rerecords.ToString());
|
||||
m.rerecordCount = (int)r.ReadUInt32();
|
||||
m.SetHeaderLine(MovieHeader.RERECORDS, m.rerecordCount.ToString());
|
||||
|
||||
UInt32 movieDataSize = r.ReadUInt32();
|
||||
UInt32 savestateOffset = r.ReadUInt32();
|
||||
|
@ -141,8 +141,8 @@ namespace BizHawk.MultiClient
|
|||
|
||||
UInt32 framecount = r.ReadUInt32();
|
||||
|
||||
UInt32 rerecords = r.ReadUInt32();
|
||||
m.SetHeaderLine(MovieHeader.RERECORDS, rerecords.ToString());
|
||||
m.rerecordCount = (int)r.ReadUInt32();
|
||||
m.SetHeaderLine(MovieHeader.RERECORDS, m.rerecordCount.ToString());
|
||||
|
||||
UInt32 IsFromReset = r.ReadUInt32();
|
||||
if (IsFromReset == 0)
|
||||
|
@ -249,25 +249,120 @@ namespace BizHawk.MultiClient
|
|||
return converted;
|
||||
}
|
||||
|
||||
public static string ConvertSMV(string path)
|
||||
public static Movie ConvertSMV(string path)
|
||||
{
|
||||
string converted = Path.ChangeExtension(path, ".tas");
|
||||
|
||||
return converted;
|
||||
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader r = new BinaryReader(fs);
|
||||
|
||||
byte[] signatureBytes = new byte[4];
|
||||
for (int x = 0; x < 4; x++)
|
||||
signatureBytes[x] = r.ReadByte();
|
||||
string signature = System.Text.Encoding.UTF8.GetString(signatureBytes);
|
||||
if (signature.Substring(0, 3) != "SMV")
|
||||
return null; //TODO: invalid movie type error
|
||||
|
||||
UInt32 version = r.ReadUInt32();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
return ConvertSMV143(r, path);
|
||||
case 4:
|
||||
return ConvertSMV151(r, path);
|
||||
case 5:
|
||||
return ConvertSMV152(r, path);
|
||||
default:
|
||||
return null; //TODO: version not recognized error
|
||||
}
|
||||
}
|
||||
|
||||
public static string ConvertGMV(string path)
|
||||
private static Movie ConvertSMV152(BinaryReader r, string path)
|
||||
{
|
||||
string converted = Path.ChangeExtension(path, ".tas");
|
||||
|
||||
return converted;
|
||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||
|
||||
UInt32 GUID = r.ReadUInt32();
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
public static string ConvertVBM(string path)
|
||||
private static Movie ConvertSMV151(BinaryReader r, string path)
|
||||
{
|
||||
string converted = Path.ChangeExtension(path, ".tas");
|
||||
|
||||
return converted;
|
||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
private static Movie ConvertSMV143(BinaryReader r, string path)
|
||||
{
|
||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||
|
||||
UInt32 GUID = r.ReadUInt32();
|
||||
m.SetHeaderLine(MovieHeader.GUID, GUID.ToString()); //TODO: format to hex string
|
||||
m.rerecordCount = (int)r.ReadUInt32();
|
||||
m.SetHeaderLine(MovieHeader.RERECORDS, m.rerecordCount.ToString());
|
||||
|
||||
UInt32 framecount = r.ReadUInt32();
|
||||
byte ControllerFlags = r.ReadByte();
|
||||
|
||||
int numControllers;
|
||||
if ((int)(ControllerFlags & 16) > 0)
|
||||
numControllers = 5;
|
||||
else if ((int)(ControllerFlags & 8) > 0)
|
||||
numControllers = 4;
|
||||
else if ((int)(ControllerFlags & 4) > 0)
|
||||
numControllers = 3;
|
||||
else if ((int)(ControllerFlags & 2) > 0)
|
||||
numControllers = 2;
|
||||
else
|
||||
numControllers = 1;
|
||||
|
||||
byte MovieFlags = r.ReadByte();
|
||||
|
||||
if ((int)(MovieFlags & 1) == 0)
|
||||
return null; //TODO: Savestate movies not supported error
|
||||
|
||||
if ((int)(MovieFlags & 2) > 0)
|
||||
{
|
||||
m.SetHeaderLine("PAL", "True");
|
||||
}
|
||||
|
||||
byte SyncOptions = r.ReadByte();
|
||||
byte SyncOptions2 = r.ReadByte();
|
||||
//TODO: these
|
||||
|
||||
UInt32 SavestateOffset = r.ReadUInt32();
|
||||
UInt32 FrameDataOffset = r.ReadUInt32();
|
||||
|
||||
//TODO: get extra rom info
|
||||
|
||||
r.BaseStream.Position = FrameDataOffset;
|
||||
for (int x = 0; x < framecount; x++)
|
||||
{
|
||||
//TODO: FF FF for all controllers = Reset
|
||||
string frame = "|0|";
|
||||
for (int y = 0; y < numControllers; y++)
|
||||
{
|
||||
UInt16 fd = r.ReadUInt16();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
public static Movie ConvertGMV(string path)
|
||||
{
|
||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
public static Movie ConvertVBM(string path)
|
||||
{
|
||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||
|
||||
return m;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace BizHawk.MultiClient
|
|||
public const string GAMENAME = "GameName";
|
||||
public const string AUTHOR = "Author";
|
||||
public const string RERECORDS = "rerecordCount";
|
||||
public const string GUID = "GUID";
|
||||
|
||||
public static string MovieVersion = "BizHawk v0.0.1";
|
||||
|
||||
|
@ -34,6 +35,7 @@ namespace BizHawk.MultiClient
|
|||
HeaderParams.Add(GAMENAME, "");
|
||||
HeaderParams.Add(AUTHOR, "");
|
||||
HeaderParams.Add(RERECORDS, "0");
|
||||
HeaderParams.Add(GUID, ""); //TODO: Generate one
|
||||
}
|
||||
|
||||
public MovieHeader(string EmulatorVersion, string MovieVersion, string Platform, string GameName, string Author, int rerecords)
|
||||
|
@ -44,6 +46,7 @@ namespace BizHawk.MultiClient
|
|||
HeaderParams.Add(GAMENAME, GameName);
|
||||
HeaderParams.Add(AUTHOR, Author);
|
||||
HeaderParams.Add(RERECORDS, rerecords.ToString());
|
||||
HeaderParams.Add(GUID, ""); //TODO: Generate one
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue