Corrected System Menu from staying after a failure involving BIOS/Firmware.

This commit is contained in:
hegyak 2014-08-27 18:15:02 +00:00
parent 13510e8213
commit e65e9d8a22
1 changed files with 105 additions and 101 deletions

View File

@ -1441,10 +1441,14 @@ namespace BizHawk.Client.EmuHawk
private void HandlePlatformMenus() private void HandlePlatformMenus()
{ {
var system = string.Empty; var system = string.Empty;
if (!Global.Game.IsNullInstance) if (!Global.Game.IsNullInstance)
{ {
system = Global.Game.System; //New Code
//We use SystemID as that has the system we are playing on.
system = Global.Emulator.SystemId;
//Old Code below.
//system = Global.Game.System;
} }
TI83SubMenu.Visible = false; TI83SubMenu.Visible = false;
@ -3118,7 +3122,6 @@ namespace BizHawk.Client.EmuHawk
var nextComm = CreateCoreComm(); var nextComm = CreateCoreComm();
CoreFileProvider.SyncCoreCommInputSignals(nextComm); CoreFileProvider.SyncCoreCommInputSignals(nextComm);
var result = loader.LoadRom(path, nextComm); var result = loader.LoadRom(path, nextComm);
if (result) if (result)
@ -3223,6 +3226,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
//This shows up if there's a problem
// TODO: put all these in a single method or something // TODO: put all these in a single method or something
HandlePlatformMenus(); HandlePlatformMenus();
_stateSlots.Clear(); _stateSlots.Clear();
@ -3288,6 +3292,8 @@ namespace BizHawk.Client.EmuHawk
// whats the difference between these two methods?? // whats the difference between these two methods??
// its very tricky. rename to be more clear or combine them. // its very tricky. rename to be more clear or combine them.
// This gets called whenever a core related thing is changed.
// Like reboot core.
private void CloseGame(bool clearSram = false) private void CloseGame(bool clearSram = false)
{ {
if (clearSram) if (clearSram)
@ -3311,21 +3317,20 @@ namespace BizHawk.Client.EmuHawk
{ {
StopMovie(true); StopMovie(true);
} }
Global.Emulator.Dispose(); Global.Emulator.Dispose();
Global.CoreComm = CreateCoreComm(); Global.CoreComm = CreateCoreComm();
CoreFileProvider.SyncCoreCommInputSignals(); CoreFileProvider.SyncCoreCommInputSignals();
Global.Emulator = new NullEmulator(Global.CoreComm); Global.Emulator = new NullEmulator(Global.CoreComm);
Global.ActiveController = Global.NullControls; Global.ActiveController = Global.NullControls;
Global.AutoFireController = Global.AutofireNullControls; Global.AutoFireController = Global.AutofireNullControls;
RewireSound(); RewireSound();
RebootStatusBarIcon.Visible = false; RebootStatusBarIcon.Visible = false;
} }
public void CloseRom(bool clearSram = false) public void CloseRom(bool clearSram = false)
{ {
//This gets called after Close Game gets called.
//Tested with NESHawk and SMB3 (U)
if (GlobalWin.Tools.AskSave()) if (GlobalWin.Tools.AskSave())
{ {
CloseGame(clearSram); CloseGame(clearSram);
@ -3335,7 +3340,6 @@ namespace BizHawk.Client.EmuHawk
Global.Game = GameInfo.NullInstance; Global.Game = GameInfo.NullInstance;
GlobalWin.Tools.Restart(); GlobalWin.Tools.Restart();
RewireSound(); RewireSound();
Global.Rewinder.ResetRewindBuffer(); Global.Rewinder.ResetRewindBuffer();
Text = "BizHawk" + (VersionInfo.DeveloperBuild ? " (interim) " : string.Empty); Text = "BizHawk" + (VersionInfo.DeveloperBuild ? " (interim) " : string.Empty);