Fix drag and drop importing so it doesn't crash during null emulator. Also fixed the movie sram clearing function to not crash on null emulator.

This commit is contained in:
adelikat 2012-03-03 18:11:07 +00:00
parent e8c33e0a4d
commit 3bfe716952
3 changed files with 14 additions and 2 deletions

View File

@ -752,7 +752,14 @@ namespace BizHawk.MultiClient
else if (MovieImport.IsValidMovieExtension(Path.GetExtension(filePaths[0])))
{
LoadRom(CurrentlyOpenRom);
if (CurrentlyOpenRom == null)
{
OpenROM();
if (CurrentlyOpenRom == null)
return;
}
else
LoadRom(CurrentlyOpenRom);
string errorMsg = "";
string warningMsg = "";
Movie m = MovieImport.ImportFile(filePaths[0], out errorMsg, out warningMsg);

View File

@ -282,7 +282,10 @@ namespace BizHawk.MultiClient
{
string name = FilesystemSafeName(game);
if (Global.MainForm.MovieActive())
{
name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename);
}
switch (game.System)
{
@ -296,8 +299,8 @@ namespace BizHawk.MultiClient
case "GEN": return Path.Combine(MakeAbsolutePath(Global.Config.PathGenesisSaveRAM, "GEN"), name + ".SaveRAM");
case "NES": return Path.Combine(MakeAbsolutePath(Global.Config.PathNESSaveRAM, "NES"), name + ".SaveRAM");
case "TI83": return Path.Combine(MakeAbsolutePath(Global.Config.PathTI83SaveRAM, "TI83"), name + ".SaveRAM");
default: return Path.Combine(GetBasePathAbsolute(), name + ".SaveRAM");
}
return "";
}
public static string SaveStatePrefix(GameInfo game)

View File

@ -83,6 +83,8 @@ namespace BizHawk.MultiClient
public void ClearSaveRAM()
{
string x = PathManager.SaveRamPath(Global.Game);
var file = new FileInfo(PathManager.SaveRamPath(Global.Game));
if (file.Exists) file.Delete();
}