-ImportFile now has access to errorMsg, which will show a message box and not play the movie when assigned, and warningMsg, which will simply add a message to RenderPanel and move on as usual.
-Made it so that any of the exceptions thrown from the Import* functions get converted into a string and stored in errorMsg. Now I can investigate what's wrong with ImportFCM.
This commit is contained in:
parent
5aaa5ccda1
commit
e40ca4c18d
|
@ -332,8 +332,6 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
for (; ; )
|
||||
{
|
||||
|
||||
|
||||
Input.Instance.Update();
|
||||
//handle events and dispatch as a hotkey action, or a hotkey button, or an input button
|
||||
ProcessInput();
|
||||
|
@ -364,7 +362,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
CurrAviWriter.CloseFile();
|
||||
CurrAviWriter = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CheckMessages()
|
||||
|
@ -431,11 +429,11 @@ namespace BizHawk.MultiClient
|
|||
public static ControllerDefinition ClientControlsDef = new ControllerDefinition
|
||||
{
|
||||
Name = "Emulator Frontend Controls",
|
||||
BoolButtons = { "Fast Forward", "Rewind", "Hard Reset", "Mode Flip", "Quick Save State", "Quick Load State", "Save Named State", "Load Named State",
|
||||
BoolButtons = { "Fast Forward", "Rewind", "Hard Reset", "Mode Flip", "Quick Save State", "Quick Load State", "Save Named State", "Load Named State",
|
||||
"Emulator Pause", "Frame Advance", "Unthrottle", "Screenshot", "Toggle Fullscreen", "SelectSlot0", "SelectSlot1", "SelectSlot2", "SelectSlot3", "SelectSlot4",
|
||||
"SelectSlot5", "SelectSlot6", "SelectSlot7", "SelectSlot8", "SelectSlot9", "SaveSlot0", "SaveSlot1", "SaveSlot2", "SaveSlot3", "SaveSlot4",
|
||||
"SaveSlot5","SaveSlot6","SaveSlot7","SaveSlot8","SaveSlot9","LoadSlot0","LoadSlot1","LoadSlot2","LoadSlot3","LoadSlot4","LoadSlot5","LoadSlot6",
|
||||
"LoadSlot7","LoadSlot8","LoadSlot9", "ToolBox", "Previous Slot", "Next Slot", "Ram Watch", "Ram Search", "Ram Poke", "Hex Editor",
|
||||
"LoadSlot7","LoadSlot8","LoadSlot9", "ToolBox", "Previous Slot", "Next Slot", "Ram Watch", "Ram Search", "Ram Poke", "Hex Editor",
|
||||
"Lua Console", "Cheats", "Open ROM", "Close ROM", "Display FPS", "Display FrameCounter", "Display LagCounter", "Display Input", "Toggle Read Only",
|
||||
"Play Movie", "Record Movie", "Stop Movie", "Play Beginning", "Volume Up", "Volume Down", "Toggle MultiTrack", "Record All", "Record None", "Increment Player",
|
||||
"Soft Reset", "Decrement Player", "Record AVI", "Stop AVI", "Toggle Menu"}
|
||||
|
@ -520,7 +518,6 @@ namespace BizHawk.MultiClient
|
|||
|
||||
Global.ClientControls = controls;
|
||||
|
||||
|
||||
Global.NullControls = new Controller(NullEmulator.NullController);
|
||||
Global.AutofireNullControls = new AutofireController(NullEmulator.NullController);
|
||||
|
||||
|
@ -752,15 +749,15 @@ namespace BizHawk.MultiClient
|
|||
else if (MovieImport.IsValidMovieExtension(Path.GetExtension(filePaths[0])))
|
||||
{
|
||||
LoadRom(CurrentlyOpenRom);
|
||||
string error = "";
|
||||
Movie m = MovieImport.ImportFile(filePaths[0], out error);
|
||||
if (error.Length > 0)
|
||||
MessageBox.Show(error, "Conversion error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
string errorMsg = "";
|
||||
string warningMsg = "";
|
||||
Movie m = MovieImport.ImportFile(filePaths[0], out errorMsg, out warningMsg);
|
||||
if (errorMsg.Length > 0)
|
||||
MessageBox.Show(errorMsg, "Conversion error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
else
|
||||
StartNewMovie(m, false);
|
||||
}
|
||||
|
||||
else
|
||||
Global.RenderPanel.AddMessage(warningMsg);
|
||||
} else
|
||||
LoadRom(filePaths[0]);
|
||||
}
|
||||
|
||||
|
@ -951,7 +948,7 @@ namespace BizHawk.MultiClient
|
|||
game = Database.CheckDatabase(hash);
|
||||
if (game == null)
|
||||
{
|
||||
// Game was not found in DB. For now we're going to send it to the PCE-CD core.
|
||||
// Game was not found in DB. For now we're going to send it to the PCE-CD core.
|
||||
// In the future we need to do something smarter, possibly including simply asking the user
|
||||
// what system the game is for.
|
||||
|
||||
|
@ -1063,7 +1060,6 @@ namespace BizHawk.MultiClient
|
|||
|
||||
if (nextEmulator == null) throw new Exception();
|
||||
|
||||
|
||||
CloseGame();
|
||||
Global.Emulator.Dispose();
|
||||
Global.Emulator = nextEmulator;
|
||||
|
@ -1480,7 +1476,7 @@ namespace BizHawk.MultiClient
|
|||
Global.MovieSession.MultiTrack.RecordAll = false;
|
||||
if (Global.MovieSession.MultiTrack.CurrentPlayer < 1)
|
||||
{
|
||||
Global.MovieSession.MultiTrack.CurrentPlayer = 5;//TODO: Replace with console's maximum or current maximum players??!
|
||||
Global.MovieSession.MultiTrack.CurrentPlayer = 5;//TODO: Replace with console's maximum or current maximum players??!
|
||||
}
|
||||
Global.RenderPanel.MT = "Recording Player " + Global.MovieSession.MultiTrack.CurrentPlayer.ToString();
|
||||
break;
|
||||
|
@ -1521,7 +1517,6 @@ namespace BizHawk.MultiClient
|
|||
throttle.Step(true, -1);
|
||||
}
|
||||
|
||||
|
||||
void StepRunLoop_Core()
|
||||
{
|
||||
bool runFrame = false;
|
||||
|
@ -1564,7 +1559,6 @@ namespace BizHawk.MultiClient
|
|||
FrameAdvanceTimestamp = DateTime.MinValue;
|
||||
}
|
||||
|
||||
|
||||
if (!EmulatorPaused)
|
||||
{
|
||||
runFrame = true;
|
||||
|
@ -1667,7 +1661,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
//TODO: adelikat: don't know what this should do so leaving it commented out
|
||||
//if (Global.MovieSession.Movie.Mode == MOVIEMODE.RECORD && Global.MovieSession.MultiTrack.IsActive)
|
||||
//{
|
||||
//{
|
||||
// Global.MovieSession.MovieControllerAdapter.SetControllersAsMnemonic(Global.MovieSession.Movie.GetInputFrame(Global.Emulator.Frame-1));
|
||||
//}
|
||||
|
||||
|
@ -2331,7 +2325,6 @@ namespace BizHawk.MultiClient
|
|||
StatusSlot9.Enabled = StateSlots.HasSlot(9);
|
||||
StatusSlot10.Enabled = StateSlots.HasSlot(0);
|
||||
|
||||
|
||||
StatusSlot1.BackColor = SystemColors.Control;
|
||||
StatusSlot2.BackColor = SystemColors.Control;
|
||||
StatusSlot3.BackColor = SystemColors.Control;
|
||||
|
|
|
@ -11,46 +11,53 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
public static class MovieImport
|
||||
{
|
||||
public static Movie ImportFile(string path, out string errorMsg)
|
||||
public static Movie ImportFile(string path, out string errorMsg, out string warningMsg)
|
||||
{
|
||||
Movie mov;
|
||||
Movie m = new Movie(); ;
|
||||
errorMsg = "";
|
||||
switch (Path.GetExtension(path).ToUpper())
|
||||
warningMsg = "";
|
||||
try
|
||||
{
|
||||
case ".FCM":
|
||||
mov = ImportFCM(path, out errorMsg);
|
||||
break;
|
||||
case ".FM2":
|
||||
mov = ImportFM2(path, out errorMsg);
|
||||
break;
|
||||
case ".FMV":
|
||||
mov = ImportFMV(path, out errorMsg);
|
||||
break;
|
||||
case ".GMV":
|
||||
mov = ImportGMV(path, out errorMsg);
|
||||
break;
|
||||
case ".MCM":
|
||||
mov = ImportMCM(path, out errorMsg);
|
||||
break;
|
||||
case ".MC2":
|
||||
mov = ImportMC2(path, out errorMsg);
|
||||
break;
|
||||
case ".MMV":
|
||||
mov = ImportMMV(path, out errorMsg);
|
||||
break;
|
||||
case ".SMV":
|
||||
mov = ImportSMV(path, out errorMsg);
|
||||
break;
|
||||
case ".VBM":
|
||||
mov = ImportVBM(path, out errorMsg);
|
||||
break;
|
||||
default:
|
||||
mov = new Movie();
|
||||
break;
|
||||
switch (Path.GetExtension(path).ToUpper())
|
||||
{
|
||||
case ".FCM":
|
||||
m = ImportFCM(path, out errorMsg, out warningMsg);
|
||||
break;
|
||||
case ".FM2":
|
||||
m = ImportFM2(path, out errorMsg, out warningMsg);
|
||||
break;
|
||||
case ".FMV":
|
||||
m = ImportFMV(path, out errorMsg, out warningMsg);
|
||||
break;
|
||||
case ".GMV":
|
||||
m = ImportGMV(path, out errorMsg, out warningMsg);
|
||||
break;
|
||||
case ".MCM":
|
||||
m = ImportMCM(path, out errorMsg, out warningMsg);
|
||||
break;
|
||||
case ".MC2":
|
||||
m = ImportMC2(path, out errorMsg, out warningMsg);
|
||||
break;
|
||||
case ".MMV":
|
||||
m = ImportMMV(path, out errorMsg, out warningMsg);
|
||||
break;
|
||||
case ".SMV":
|
||||
m = ImportSMV(path, out errorMsg, out warningMsg);
|
||||
break;
|
||||
case ".VBM":
|
||||
m = ImportVBM(path, out errorMsg, out warningMsg);
|
||||
break;
|
||||
}
|
||||
if (errorMsg == "")
|
||||
{
|
||||
m.WriteMovie();
|
||||
}
|
||||
}
|
||||
Global.RenderPanel.AddMessage(errorMsg);
|
||||
mov.WriteMovie();
|
||||
return mov;
|
||||
catch (Exception except)
|
||||
{
|
||||
errorMsg = except.ToString();
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
public static bool IsValidMovieExtension(string extension)
|
||||
|
@ -94,9 +101,10 @@ namespace BizHawk.MultiClient
|
|||
return true;
|
||||
}
|
||||
|
||||
private static Movie ImportText(string path, out string errorMsg, string emulator)
|
||||
private static Movie ImportText(string path, out string errorMsg, out string warningMsg, string emulator)
|
||||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||
var file = new FileInfo(path);
|
||||
using (StreamReader sr = file.OpenText())
|
||||
|
@ -128,7 +136,7 @@ namespace BizHawk.MultiClient
|
|||
str = ParseHeader(str, "StartsFromSavestate");
|
||||
if (str == "1")
|
||||
{
|
||||
errorMsg = "Movies that begin with a savestate are not supported.";
|
||||
warningMsg = "Movies that begin with a savestate are not supported.";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +177,7 @@ namespace BizHawk.MultiClient
|
|||
case "FCEUX":
|
||||
buttons = new string[8] { "Right", "Left", "Down", "Up", "Start", "Select", "B", "A" };
|
||||
controllers.Type.Name = "NES Controller";
|
||||
if (errorMsg == "" && sections[1].Length != 0)
|
||||
if (warningMsg == "" && sections[1].Length != 0)
|
||||
{
|
||||
switch (sections[1][0])
|
||||
{
|
||||
|
@ -181,22 +189,22 @@ namespace BizHawk.MultiClient
|
|||
case '2':
|
||||
if (m.Length() != 0)
|
||||
{
|
||||
errorMsg = "hard reset";
|
||||
warningMsg = "hard reset";
|
||||
}
|
||||
break;
|
||||
case '4':
|
||||
errorMsg = "FDS Insert";
|
||||
warningMsg = "FDS Insert";
|
||||
break;
|
||||
case '8':
|
||||
errorMsg = "FDS Select";
|
||||
warningMsg = "FDS Select";
|
||||
break;
|
||||
default:
|
||||
errorMsg = "unknown";
|
||||
warningMsg = "unknown";
|
||||
break;
|
||||
}
|
||||
if (errorMsg != "")
|
||||
if (warningMsg != "")
|
||||
{
|
||||
errorMsg = "Unable to import " + errorMsg + " command on line " + line;
|
||||
warningMsg = "Unable to import " + warningMsg + " command on line " + line;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -235,9 +243,10 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
|
||||
// FCM file format: http://code.google.com/p/fceu/wiki/FCM
|
||||
private static Movie ImportFCM(string path, out string errorMsg)
|
||||
private static Movie ImportFCM(string path, out string errorMsg, out string warningMsg)
|
||||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader r = new BinaryReader(fs);
|
||||
|
@ -348,52 +357,58 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
|
||||
// FM2 file format: http://www.fceux.com/web/FM2.html
|
||||
private static Movie ImportFM2(string path, out string errorMsg)
|
||||
private static Movie ImportFM2(string path, out string errorMsg, out string warningMsg)
|
||||
{
|
||||
errorMsg = "";
|
||||
Movie m = ImportText(path, out errorMsg, "FCEUX");
|
||||
warningMsg = "";
|
||||
Movie m = ImportText(path, out errorMsg, out warningMsg, "FCEUX");
|
||||
m.Header.SetHeaderLine(MovieHeader.PLATFORM, "NES");
|
||||
return m;
|
||||
}
|
||||
|
||||
// FMV file format: http://tasvideos.org/FMV.html
|
||||
private static Movie ImportFMV(string path, out string errorMsg)
|
||||
private static Movie ImportFMV(string path, out string errorMsg, out string warningMsg)
|
||||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||
return m;
|
||||
}
|
||||
|
||||
// GMV file format: http://code.google.com/p/gens-rerecording/wiki/GMV
|
||||
private static Movie ImportGMV(string path, out string errorMsg)
|
||||
private static Movie ImportGMV(string path, out string errorMsg, out string warningMsg)
|
||||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||
return m;
|
||||
}
|
||||
|
||||
// MCM file format: http://code.google.com/p/mednafen-rr/wiki/MCM
|
||||
private static Movie ImportMCM(string path, out string errorMsg)
|
||||
private static Movie ImportMCM(string path, out string errorMsg, out string warningMsg)
|
||||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||
return m;
|
||||
}
|
||||
|
||||
// MC2 file format: http://code.google.com/p/pcejin/wiki/MC2
|
||||
private static Movie ImportMC2(string path, out string errorMsg)
|
||||
private static Movie ImportMC2(string path, out string errorMsg, out string warningMsg)
|
||||
{
|
||||
errorMsg = "";
|
||||
Movie m = ImportText(path, out errorMsg, "Mednafen/PCEjin");
|
||||
warningMsg = "";
|
||||
Movie m = ImportText(path, out errorMsg, out warningMsg, "Mednafen/PCEjin");
|
||||
m.Header.SetHeaderLine(MovieHeader.PLATFORM, "MC2");
|
||||
// TODO: PCECD equivalent.
|
||||
return m;
|
||||
}
|
||||
|
||||
// MMV file format: http://tasvideos.org/MMV.html
|
||||
private static Movie ImportMMV(string path, out string errorMsg)
|
||||
private static Movie ImportMMV(string path, out string errorMsg, out string warningMsg)
|
||||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||
|
||||
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
|
@ -511,9 +526,10 @@ namespace BizHawk.MultiClient
|
|||
return m;
|
||||
}
|
||||
|
||||
private static Movie ImportSMV(string path, out string errorMsg)
|
||||
private static Movie ImportSMV(string path, out string errorMsg, out string warningMsg)
|
||||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader r = new BinaryReader(fs);
|
||||
|
||||
|
@ -616,9 +632,10 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
|
||||
//VBM file format: http://code.google.com/p/vba-rerecording/wiki/VBM
|
||||
private static Movie ImportVBM(string path, out string errorMsg)
|
||||
private static Movie ImportVBM(string path, out string errorMsg, out string warningMsg)
|
||||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
//Converts vbm to native text based format.
|
||||
Movie m = new Movie(Path.ChangeExtension(path, ".tas"), MOVIEMODE.PLAY);
|
||||
|
||||
|
|
Loading…
Reference in New Issue