Update comments and remove obsolete things.

This commit is contained in:
SuuperW 2025-07-19 19:22:50 -05:00
parent bb80c1f013
commit 28489c58f3
4 changed files with 15 additions and 28 deletions

View File

@ -167,8 +167,7 @@ namespace BizHawk.Client.Common
if (_dispoed) return;
_dispoed = true;
_stream!.Flush(flushToDisk: true);
_stream.Dispose();
_stream!.Dispose();
_stream = null;
// The caller should call CloseAndDispose and handle potential failure.

View File

@ -20,9 +20,6 @@ namespace BizHawk.Client.EmuHawk
// TODO: remove? or does anything ever need access to the FirmwareManager
FirmwareManager FirmwareManager { get; }
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
bool GameIsClosing { get; }
/// <remarks>only referenced from <see cref="PlaybackBox"/></remarks>
bool HoldFrameAdvance { get; set; }

View File

@ -885,7 +885,7 @@ namespace BizHawk.Client.EmuHawk
return;
}
}
// zero 03-nov-2015 - close game after other steps. tools might need to unhook themselves from a core.
CloseGame();
SaveConfig();
}
@ -3795,10 +3795,6 @@ namespace BizHawk.Client.EmuHawk
loader.OnLoadSettings += CoreSettings;
loader.OnLoadSyncSettings += CoreSyncSettings;
// this also happens in CloseGame(). But it needs to happen here since if we're restarting with the same core,
// any settings changes that we made need to make it back to config before we try to instantiate that core with
// the new settings objects
CommitCoreSettingsToConfig(); // adelikat: I Think by reordering things, this isn't necessary anymore
CloseGame();
var nextComm = CreateCoreComm();
@ -4085,13 +4081,12 @@ namespace BizHawk.Client.EmuHawk
}
}
// whats the difference between these two methods??
// its very tricky. rename to be more clear or combine them.
// This gets called whenever a core related thing is changed.
// Like reboot core.
/// <summary>
/// This closes the game but does not set things up for using the client with the new null emulator.
/// This method should only be called (outside of <see cref="CloseRom(bool)"/>) if the caller is about to load a new game with no user interaction between close and load.
/// </summary>
private void CloseGame(bool clearSram = false)
{
GameIsClosing = true;
if (clearSram)
{
var path = Config.PathEntries.SaveRamAbsolutePath(Game, MovieSession.Movie);
@ -4138,7 +4133,7 @@ namespace BizHawk.Client.EmuHawk
CommitCoreSettingsToConfig();
DisableRewind();
if (MovieSession.Movie.IsActive()) // Note: this must be called after CommitCoreSettingsToConfig()
if (MovieSession.Movie.IsActive()) // Note: this must be called after CommitCoreSettingsToConfig() because it checks if we have an active movie.
{
StopMovie();
}
@ -4152,7 +4147,6 @@ namespace BizHawk.Client.EmuHawk
InputManager.SyncControls(Emulator, MovieSession, Config);
RewireSound();
RebootStatusBarIcon.Visible = false;
GameIsClosing = false;
}
private FileWriteResult AutoSaveStateIfConfigured()
@ -4165,12 +4159,12 @@ namespace BizHawk.Client.EmuHawk
return new();
}
public bool GameIsClosing { get; private set; } // Lets tools make better decisions when being called by CloseGame
/// <summary>
/// This closes the current ROM, closes tools that require emulator services, and sets things up for the user to interact with the client having no loaded ROM.
/// </summary>
/// <param name="clearSram">True if SRAM should be deleted instead of saved.</param>
public void CloseRom(bool clearSram = false)
{
// This gets called after Close Game gets called.
// Tested with NESHawk and SMB3 (U)
if (Tools.AskSave())
{
CloseGame(clearSram);

View File

@ -59,13 +59,10 @@
public void StopMovie(bool suppressSave)
{
if (!MainForm.GameIsClosing)
{
Activate();
_suppressAskSave = suppressSave;
StartNewTasMovie();
_suppressAskSave = false;
}
Activate();
_suppressAskSave = suppressSave;
StartNewTasMovie();
_suppressAskSave = false;
}
public bool WantsToControlRewind { get; private set; } = true;