Skip to content

Commit 28489c5

Browse files
committed
Update comments and remove obsolete things.
1 parent bb80c1f commit 28489c5

File tree

4 files changed

+15
-28
lines changed

4 files changed

+15
-28
lines changed

src/BizHawk.Client.Common/FileWriter.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ public void Dispose()
167167
if (_dispoed) return;
168168
_dispoed = true;
169169

170-
_stream!.Flush(flushToDisk: true);
171-
_stream.Dispose();
170+
_stream!.Dispose();
172171
_stream = null;
173172

174173
// The caller should call CloseAndDispose and handle potential failure.

src/BizHawk.Client.EmuHawk/IMainFormForTools.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ public interface IMainFormForTools : IDialogController
2020
// TODO: remove? or does anything ever need access to the FirmwareManager
2121
FirmwareManager FirmwareManager { get; }
2222

23-
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
24-
bool GameIsClosing { get; }
25-
2623
/// <remarks>only referenced from <see cref="PlaybackBox"/></remarks>
2724
bool HoldFrameAdvance { get; set; }
2825

src/BizHawk.Client.EmuHawk/MainForm.cs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ private void CheckMayCloseAndCleanup(object/*?*/ closingSender, CancelEventArgs
885885
return;
886886
}
887887
}
888-
// zero 03-nov-2015 - close game after other steps. tools might need to unhook themselves from a core.
888+
889889
CloseGame();
890890
SaveConfig();
891891
}
@@ -3795,10 +3795,6 @@ private bool LoadRomInternal(string path, LoadRomArgs args, out bool failureIsFr
37953795
loader.OnLoadSettings += CoreSettings;
37963796
loader.OnLoadSyncSettings += CoreSyncSettings;
37973797

3798-
// this also happens in CloseGame(). But it needs to happen here since if we're restarting with the same core,
3799-
// any settings changes that we made need to make it back to config before we try to instantiate that core with
3800-
// the new settings objects
3801-
CommitCoreSettingsToConfig(); // adelikat: I Think by reordering things, this isn't necessary anymore
38023798
CloseGame();
38033799

38043800
var nextComm = CreateCoreComm();
@@ -4085,13 +4081,12 @@ private void CommitCoreSettingsToConfig()
40854081
}
40864082
}
40874083

4088-
// whats the difference between these two methods??
4089-
// its very tricky. rename to be more clear or combine them.
4090-
// This gets called whenever a core related thing is changed.
4091-
// Like reboot core.
4084+
/// <summary>
4085+
/// This closes the game but does not set things up for using the client with the new null emulator.
4086+
/// 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.
4087+
/// </summary>
40924088
private void CloseGame(bool clearSram = false)
40934089
{
4094-
GameIsClosing = true;
40954090
if (clearSram)
40964091
{
40974092
var path = Config.PathEntries.SaveRamAbsolutePath(Game, MovieSession.Movie);
@@ -4138,7 +4133,7 @@ private void CloseGame(bool clearSram = false)
41384133
CommitCoreSettingsToConfig();
41394134
DisableRewind();
41404135

4141-
if (MovieSession.Movie.IsActive()) // Note: this must be called after CommitCoreSettingsToConfig()
4136+
if (MovieSession.Movie.IsActive()) // Note: this must be called after CommitCoreSettingsToConfig() because it checks if we have an active movie.
41424137
{
41434138
StopMovie();
41444139
}
@@ -4152,7 +4147,6 @@ private void CloseGame(bool clearSram = false)
41524147
InputManager.SyncControls(Emulator, MovieSession, Config);
41534148
RewireSound();
41544149
RebootStatusBarIcon.Visible = false;
4155-
GameIsClosing = false;
41564150
}
41574151

41584152
private FileWriteResult AutoSaveStateIfConfigured()
@@ -4165,12 +4159,12 @@ private FileWriteResult AutoSaveStateIfConfigured()
41654159
return new();
41664160
}
41674161

4168-
public bool GameIsClosing { get; private set; } // Lets tools make better decisions when being called by CloseGame
4169-
4162+
/// <summary>
4163+
/// 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.
4164+
/// </summary>
4165+
/// <param name="clearSram">True if SRAM should be deleted instead of saved.</param>
41704166
public void CloseRom(bool clearSram = false)
41714167
{
4172-
// This gets called after Close Game gets called.
4173-
// Tested with NESHawk and SMB3 (U)
41744168
if (Tools.AskSave())
41754169
{
41764170
CloseGame(clearSram);

src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IControlMainForm.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,10 @@ public void ToggleReadOnly()
5959

6060
public void StopMovie(bool suppressSave)
6161
{
62-
if (!MainForm.GameIsClosing)
63-
{
64-
Activate();
65-
_suppressAskSave = suppressSave;
66-
StartNewTasMovie();
67-
_suppressAskSave = false;
68-
}
62+
Activate();
63+
_suppressAskSave = suppressSave;
64+
StartNewTasMovie();
65+
_suppressAskSave = false;
6966
}
7067

7168
public bool WantsToControlRewind { get; private set; } = true;

0 commit comments

Comments
 (0)