this is mostly a hack, but fixes loading a rom when a movie is still running

This commit is contained in:
adelikat 2014-08-01 01:34:40 +00:00
parent fb8d322146
commit 43d9f77fd6
6 changed files with 21 additions and 10 deletions

View File

@ -2377,7 +2377,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
LoadRom(CurrentlyOpenRom);
StopMovieThenLoadRom(CurrentlyOpenRom);
}
string errorMsg;
@ -2399,7 +2399,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
LoadRom(filePaths[0]);
StopMovieThenLoadRom(filePaths[0]);
}
}

View File

@ -158,7 +158,7 @@ namespace BizHawk.Client.EmuHawk
{
if (Global.MovieSession.Movie.IsActive)
{
LoadRom(CurrentlyOpenRom);
StopMovieThenLoadRom(CurrentlyOpenRom);
if (Global.MovieSession.Movie.StartsFromSavestate)
{
// TODO: why does this code exist twice??

View File

@ -262,7 +262,7 @@ namespace BizHawk.Client.EmuHawk
if (cmdRom != null)
{
// Commandline should always override auto-load
LoadRom(cmdRom);
StopMovieThenLoadRom(cmdRom);
if (Global.Game == null)
{
MessageBox.Show("Failed to load " + cmdRom + " specified on commandline");
@ -818,7 +818,7 @@ namespace BizHawk.Client.EmuHawk
public void RebootCore()
{
LoadRom(CurrentlyOpenRom);
StopMovieThenLoadRom(CurrentlyOpenRom);
}
public void PauseEmulator()
@ -1569,7 +1569,7 @@ namespace BizHawk.Client.EmuHawk
private void LoadRomFromRecent(string rom)
{
if (!LoadRom(rom))
if (!StopMovieThenLoadRom(rom))
{
Global.Config.RecentRoms.HandleLoadError(rom);
}
@ -1830,7 +1830,7 @@ namespace BizHawk.Client.EmuHawk
var file = new FileInfo(ofd.FileName);
Global.Config.LastRomPath = file.DirectoryName;
_lastOpenRomFilter = ofd.FilterIndex;
LoadRom(file.FullName);
StopMovieThenLoadRom(file.FullName);
}
private void CoreSyncSettings(object sender, RomLoader.SettingsLoadArgs e)
@ -3061,6 +3061,17 @@ namespace BizHawk.Client.EmuHawk
return platformChooser.PlatformChoice;
}
// TODO: a better name for this method, but this is the one that should be called, in general
public bool StopMovieThenLoadRom(string path, bool? deterministicemulation = null)
{
if (Global.MovieSession.Movie.IsActive)
{
Global.MovieSession.Movie.Stop();
}
return LoadRom(path, deterministicemulation);
}
// Still needs a good bit of refactoring
public bool LoadRom(string path, bool? deterministicemulation = null)
{

View File

@ -233,7 +233,7 @@ namespace BizHawk.Client.EmuHawk
void this_StartupNextInstance(object sender, StartupNextInstanceEventArgs e)
{
(MainForm as MainForm).LoadRom(e.CommandLine[0]);
(MainForm as MainForm).StopMovieThenLoadRom(e.CommandLine[0]);
}
protected override void OnCreateMainForm()

View File

@ -169,7 +169,7 @@ namespace BizHawk.Client.EmuHawk
DialogResult = DialogResult.OK;
Close();
GlobalWin.MainForm.LoadRom(textBoxOutputDir.Text);
GlobalWin.MainForm.StopMovieThenLoadRom(textBoxOutputDir.Text);
}
}

View File

@ -140,7 +140,7 @@ namespace BizHawk.Client.EmuHawk
)]
public static void OpenRom(string path)
{
GlobalWin.MainForm.LoadRom(path);
GlobalWin.MainForm.StopMovieThenLoadRom(path);
}
[LuaMethodAttributes(