-Added .YMV importer.
--Might actually have a chance of syncing if it weren't for all of the frames that are added from the BIOS. Should I make the importer add extra frames to compensate for this? -Fixed some typos.
This commit is contained in:
parent
79349aeb39
commit
961897a91b
|
@ -445,7 +445,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ThrowLoadError("A core accepted the rom, but throw an exception while loading it:\n\n" + ex, system);
|
ThrowLoadError("A core accepted the rom, but threw an exception while loading it:\n\n" + ex, system);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -79,6 +79,9 @@ namespace BizHawk.Client.Common
|
||||||
case ".VMV":
|
case ".VMV":
|
||||||
m = ImportVMV(path, out errorMsg, out warningMsg);
|
m = ImportVMV(path, out errorMsg, out warningMsg);
|
||||||
break;
|
break;
|
||||||
|
case ".YMV":
|
||||||
|
m = ImportYMV(path, out errorMsg, out warningMsg);
|
||||||
|
break;
|
||||||
case ".ZMV":
|
case ".ZMV":
|
||||||
m = ImportZMV(path, out errorMsg, out warningMsg);
|
m = ImportZMV(path, out errorMsg, out warningMsg);
|
||||||
break;
|
break;
|
||||||
|
@ -100,7 +103,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
string[] extensions = new[]
|
string[] extensions = new[]
|
||||||
{
|
{
|
||||||
"FCM", "FM2", "FMV", "GMV", "MCM", "MC2", "MMV", "NMV", "LSMV", "SMV", "VBM", "VMV", "ZMV"
|
"FCM", "FM2", "FMV", "GMV", "MCM", "MC2", "MMV", "NMV", "LSMV", "SMV", "VBM", "VMV", "YMV", "ZMV"
|
||||||
};
|
};
|
||||||
return extensions.Any(ext => extension.ToUpper() == "." + ext);
|
return extensions.Any(ext => extension.ToUpper() == "." + ext);
|
||||||
}
|
}
|
||||||
|
@ -150,6 +153,10 @@ namespace BizHawk.Client.Common
|
||||||
controller = "Gameboy Controller";
|
controller = "Gameboy Controller";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ".YMV":
|
||||||
|
buttons = new[] { "Left", "Right", "Up", "Down", "Start", "A", "B", "C", "X", "Y", "Z", "L", "R" };
|
||||||
|
controller = "Saturn Controller";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
SimpleController controllers = new SimpleController {Type = new ControllerDefinition {Name = controller}};
|
SimpleController controllers = new SimpleController {Type = new ControllerDefinition {Name = controller}};
|
||||||
// Split up the sections of the frame.
|
// Split up the sections of the frame.
|
||||||
|
@ -282,7 +289,7 @@ namespace BizHawk.Client.Common
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Import a text-based movie format. This works for .FM2 and .MC2.
|
// 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)
|
private static Movie ImportText(string path, out string errorMsg, out string warningMsg)
|
||||||
{
|
{
|
||||||
errorMsg = warningMsg = String.Empty;
|
errorMsg = warningMsg = String.Empty;
|
||||||
|
@ -301,6 +308,10 @@ namespace BizHawk.Client.Common
|
||||||
emulator = "Mednafen/PCEjin";
|
emulator = "Mednafen/PCEjin";
|
||||||
platform = "PCE";
|
platform = "PCE";
|
||||||
break;
|
break;
|
||||||
|
case ".YMV":
|
||||||
|
emulator = "Yabause";
|
||||||
|
platform = "Sega Saturn";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
m.Header[HeaderKeys.PLATFORM] = platform;
|
m.Header[HeaderKeys.PLATFORM] = platform;
|
||||||
int lineNum = 0;
|
int lineNum = 0;
|
||||||
|
@ -348,64 +359,73 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
m.Header[HeaderKeys.GAMENAME] = ParseHeader(line, "romFilename");
|
m.Header[HeaderKeys.GAMENAME] = ParseHeader(line, "romFilename");
|
||||||
}
|
}
|
||||||
else if (line.ToLower().StartsWith("romchecksum"))
|
else if (line.ToLower().StartsWith("cdgamename"))
|
||||||
{
|
{
|
||||||
string blob = ParseHeader(line, "romChecksum");
|
m.Header[HeaderKeys.GAMENAME] = ParseHeader(line, "cdGameName");
|
||||||
byte[] md5 = DecodeBlob(blob);
|
}
|
||||||
if (md5 != null && md5.Length == 16)
|
else if (line.ToLower().StartsWith("romchecksum"))
|
||||||
{
|
{
|
||||||
m.Header[MD5] = Util.BytesToHexString(md5).ToLower();
|
string blob = ParseHeader(line, "romChecksum");
|
||||||
}
|
byte[] md5 = DecodeBlob(blob);
|
||||||
else
|
if (md5 != null && md5.Length == 16)
|
||||||
{
|
{
|
||||||
warningMsg = "Bad ROM checksum.";
|
m.Header[MD5] = Util.BytesToHexString(md5).ToLower();
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else if (line.ToLower().StartsWith("comment author"))
|
{
|
||||||
{
|
warningMsg = "Bad ROM checksum.";
|
||||||
m.Header[HeaderKeys.AUTHOR] = ParseHeader(line, "comment author");
|
}
|
||||||
}
|
}
|
||||||
else if (line.ToLower().StartsWith("rerecordcount"))
|
else if (line.ToLower().StartsWith("comment author"))
|
||||||
{
|
{
|
||||||
int rerecordCount;
|
m.Header[HeaderKeys.AUTHOR] = ParseHeader(line, "comment author");
|
||||||
// Try to parse the re-record count as an integer, defaulting to 0 if it fails.
|
}
|
||||||
try
|
else if (line.ToLower().StartsWith("rerecordcount"))
|
||||||
{
|
{
|
||||||
rerecordCount = int.Parse(ParseHeader(line, "rerecordCount"));
|
int rerecordCount;
|
||||||
}
|
// Try to parse the re-record count as an integer, defaulting to 0 if it fails.
|
||||||
catch
|
try
|
||||||
{
|
{
|
||||||
rerecordCount = 0;
|
rerecordCount = int.Parse(ParseHeader(line, "rerecordCount"));
|
||||||
}
|
}
|
||||||
m.Header.Rerecords = (ulong)rerecordCount;
|
catch
|
||||||
}
|
{
|
||||||
else if (line.ToLower().StartsWith("guid"))
|
rerecordCount = 0;
|
||||||
{
|
}
|
||||||
continue; //We no longer care to keep this info
|
m.Header.Rerecords = (ulong)rerecordCount;
|
||||||
}
|
}
|
||||||
else if (line.ToLower().StartsWith("startsfromsavestate"))
|
else if (line.ToLower().StartsWith("guid"))
|
||||||
{
|
{
|
||||||
// If this movie starts from a savestate, we can't support it.
|
continue; //We no longer care to keep this info
|
||||||
if (ParseHeader(line, "StartsFromSavestate") == "1")
|
}
|
||||||
{
|
else if (line.ToLower().StartsWith("startsfromsavestate"))
|
||||||
errorMsg = "Movies that begin with a savestate are not supported.";
|
{
|
||||||
sr.Close();
|
// If this movie starts from a savestate, we can't support it.
|
||||||
return null;
|
if (ParseHeader(line, "StartsFromSavestate") == "1")
|
||||||
}
|
{
|
||||||
}
|
errorMsg = "Movies that begin with a savestate are not supported.";
|
||||||
else if (line.ToLower().StartsWith("palflag"))
|
sr.Close();
|
||||||
{
|
return null;
|
||||||
bool pal = (ParseHeader(line, "palFlag") == "1");
|
}
|
||||||
m.Header[HeaderKeys.PAL] = pal.ToString();
|
}
|
||||||
}
|
else if (line.ToLower().StartsWith("palflag"))
|
||||||
else if (line.ToLower().StartsWith("fourscore"))
|
{
|
||||||
{
|
bool pal = (ParseHeader(line, "palFlag") == "1");
|
||||||
bool fourscore = (ParseHeader(line, "fourscore") == "1");
|
m.Header[HeaderKeys.PAL] = pal.ToString();
|
||||||
m.Header[HeaderKeys.FOURSCORE] = fourscore.ToString();
|
}
|
||||||
}
|
else if (line.ToLower().StartsWith("ispal"))
|
||||||
else
|
{
|
||||||
// Everything not explicitly defined is treated as a comment.
|
bool pal = (ParseHeader(line, "isPal") == "1");
|
||||||
m.Header.Comments.Add(line);
|
m.Header[HeaderKeys.PAL] = pal.ToString();
|
||||||
|
}
|
||||||
|
else if (line.ToLower().StartsWith("fourscore"))
|
||||||
|
{
|
||||||
|
bool fourscore = (ParseHeader(line, "fourscore") == "1");
|
||||||
|
m.Header[HeaderKeys.FOURSCORE] = fourscore.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
// Everything not explicitly defined is treated as a comment.
|
||||||
|
m.Header.Comments.Add(line);
|
||||||
}
|
}
|
||||||
sr.Close();
|
sr.Close();
|
||||||
return m;
|
return m;
|
||||||
|
@ -2431,6 +2451,12 @@ namespace BizHawk.Client.Common
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// YMV file format: https://code.google.com/p/yabause-rr/wiki/YMVfileformat
|
||||||
|
private static Movie ImportYMV(string path, out string errorMsg, out string warningMsg)
|
||||||
|
{
|
||||||
|
return ImportText(path, out errorMsg, out warningMsg);
|
||||||
|
}
|
||||||
|
|
||||||
// ZMV file format: http://tasvideos.org/ZMV.html
|
// ZMV file format: http://tasvideos.org/ZMV.html
|
||||||
private static Movie ImportZMV(string path, out string errorMsg, out string warningMsg)
|
private static Movie ImportZMV(string path, out string errorMsg, out string warningMsg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -399,7 +399,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
InitialDirectory = PathManager.GetRomsPath(Global.Emulator.SystemId),
|
InitialDirectory = PathManager.GetRomsPath(Global.Emulator.SystemId),
|
||||||
Multiselect = true,
|
Multiselect = true,
|
||||||
Filter = FormatFilter(
|
Filter = FormatFilter(
|
||||||
"Movie Files", "*.fm2;*.mc2;*.mcm;*.mmv;*.gmv;*.vbm;*.lsmv;*.fcm;*.fmv;*.vmv;*.nmv;*.smv;*.zmv;",
|
"Movie Files", "*.fm2;*.mc2;*.mcm;*.mmv;*.gmv;*.vbm;*.lsmv;*.fcm;*.fmv;*.vmv;*.nmv;*.smv;*.ymv;*.zmv;",
|
||||||
"FCEUX", "*.fm2",
|
"FCEUX", "*.fm2",
|
||||||
"PCEjin/Mednafen", "*.mc2;*.mcm",
|
"PCEjin/Mednafen", "*.mc2;*.mcm",
|
||||||
"Dega", "*.mmv",
|
"Dega", "*.mmv",
|
||||||
|
@ -411,6 +411,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
"VirtuaNES", "*.vmv",
|
"VirtuaNES", "*.vmv",
|
||||||
"Nintendulator", "*.nmv",
|
"Nintendulator", "*.nmv",
|
||||||
"Snes9x", "*.smv",
|
"Snes9x", "*.smv",
|
||||||
|
"Yabause", "*.ymv",
|
||||||
"ZSNES", "*.zmv",
|
"ZSNES", "*.zmv",
|
||||||
"All Files", "*.*"),
|
"All Files", "*.*"),
|
||||||
RestoreDirectory = false
|
RestoreDirectory = false
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
this.textBox1.ReadOnly = true;
|
this.textBox1.ReadOnly = true;
|
||||||
this.textBox1.Size = new System.Drawing.Size(414, 35);
|
this.textBox1.Size = new System.Drawing.Size(414, 35);
|
||||||
this.textBox1.TabIndex = 2;
|
this.textBox1.TabIndex = 2;
|
||||||
this.textBox1.Text = "This Rom was not found in the database. Further more, the extension leaves no cl" +
|
this.textBox1.Text = "This Rom was not found in the database. Furthermore, the extension leaves no cl" +
|
||||||
"ue as to which platform should be chosen.";
|
"ue as to which platform should be chosen.";
|
||||||
//
|
//
|
||||||
// OkBtn
|
// OkBtn
|
||||||
|
|
Loading…
Reference in New Issue