when loading a movie, gracefully handle a movie/rom system id mismatch

This commit is contained in:
adelikat 2014-09-27 15:49:39 +00:00
parent ac69e8fcb4
commit da7cb4ec59
4 changed files with 28 additions and 2 deletions

View File

@ -104,6 +104,7 @@
<Compile Include="config\ToolDialogSettings.cs" />
<Compile Include="ControllerBinding.cs" />
<Compile Include="CoreFileProvider.cs" />
<Compile Include="ExceptionClasses.cs" />
<Compile Include="FirmwareManager.cs" />
<Compile Include="GLManager.cs">
<SubType>Code</SubType>

View File

@ -0,0 +1,12 @@
using System;
namespace BizHawk.Client.Common
{
public class MoviePlatformMismatchException : InvalidOperationException
{
public MoviePlatformMismatchException(string message) : base(message)
{
}
}
}

View File

@ -443,7 +443,11 @@ namespace BizHawk.Client.Common
movie.Load();
if (movie.SystemID != Global.Emulator.SystemId)
{
throw new InvalidOperationException("Movie does not match the currently loaded system, unable to load");
throw new MoviePlatformMismatchException(
string.Format(
"Movie system Id ({0}) does not match the currently loaded platform ({1}), unable to load",
movie.SystemID,
Global.Emulator.SystemId));
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
@ -14,7 +15,15 @@ namespace BizHawk.Client.EmuHawk
{
public void StartNewMovie(IMovie movie, bool record)
{
Global.MovieSession.QueueNewMovie(movie, record);
try
{
Global.MovieSession.QueueNewMovie(movie, record);
}
catch (MoviePlatformMismatchException ex)
{
MessageBox.Show(this, ex.Message, "Movie/Platform Mismatch", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
LoadRom(GlobalWin.MainForm.CurrentlyOpenRom);