Clean up `PauseWhenMenuActivated`
Disabled `Emulation` > `Pause` menu item when this feature is enabled. It would be possible, though annoying, to have it affect `_wasPaused` instead of the main `EmulatorPaused` while this feature is enabled.
This commit is contained in:
parent
29da927e73
commit
86ce476ad1
|
@ -602,6 +602,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private void EmulationMenuItem_DropDownOpened(object sender, EventArgs e)
|
private void EmulationMenuItem_DropDownOpened(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
PauseMenuItem.Checked = _didMenuPause ? _wasPaused : EmulatorPaused;
|
PauseMenuItem.Checked = _didMenuPause ? _wasPaused : EmulatorPaused;
|
||||||
|
PauseMenuItem.Enabled = !Config.PauseWhenMenuActivated;
|
||||||
|
|
||||||
SoftResetMenuItem.Enabled = Emulator.ControllerDefinition.BoolButtons.Contains("Reset")
|
SoftResetMenuItem.Enabled = Emulator.ControllerDefinition.BoolButtons.Contains("Reset")
|
||||||
&& !MovieSession.Movie.IsPlaying();
|
&& !MovieSession.Movie.IsPlaying();
|
||||||
|
@ -2143,9 +2144,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void MainFormContextMenu_Opening(object sender, System.ComponentModel.CancelEventArgs e)
|
private void MainFormContextMenu_Opening(object sender, System.ComponentModel.CancelEventArgs e)
|
||||||
{
|
{
|
||||||
_wasPaused = EmulatorPaused;
|
MaybePauseFromMenuOpened();
|
||||||
_didMenuPause = true;
|
|
||||||
PauseEmulator();
|
|
||||||
|
|
||||||
OpenRomContextMenuItem.Visible = Emulator.IsNull() || _inFullscreen;
|
OpenRomContextMenuItem.Visible = Emulator.IsNull() || _inFullscreen;
|
||||||
|
|
||||||
|
@ -2242,12 +2241,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainFormContextMenu_Closing(object sender, ToolStripDropDownClosingEventArgs e)
|
private void MainFormContextMenu_Closing(object sender, ToolStripDropDownClosingEventArgs e)
|
||||||
{
|
=> MaybeUnpauseFromMenuClosed();
|
||||||
if (!_wasPaused)
|
|
||||||
{
|
|
||||||
UnpauseEmulator();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DisplayConfigMenuItem_Click(object sender, EventArgs e)
|
private void DisplayConfigMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -2460,28 +2454,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void MainForm_Activated(object sender, EventArgs e)
|
private void MainForm_Activated(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!Config.RunInBackground)
|
if (!Config.RunInBackground) MaybeUnpauseFromMenuClosed();
|
||||||
{
|
|
||||||
if (!_wasPaused)
|
|
||||||
{
|
|
||||||
UnpauseEmulator();
|
|
||||||
}
|
|
||||||
|
|
||||||
_wasPaused = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainForm_Deactivate(object sender, EventArgs e)
|
private void MainForm_Deactivate(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!Config.RunInBackground)
|
if (!Config.RunInBackground) MaybePauseFromMenuOpened();
|
||||||
{
|
|
||||||
if (EmulatorPaused)
|
|
||||||
{
|
|
||||||
_wasPaused = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
PauseEmulator();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TimerMouseIdle_Tick(object sender, EventArgs e)
|
private void TimerMouseIdle_Tick(object sender, EventArgs e)
|
||||||
|
@ -2537,22 +2515,18 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public void MaybePauseFromMenuOpened()
|
public void MaybePauseFromMenuOpened()
|
||||||
{
|
{
|
||||||
if (Config.PauseWhenMenuActivated)
|
if (!Config.PauseWhenMenuActivated) return;
|
||||||
{
|
_wasPaused = EmulatorPaused;
|
||||||
_wasPaused = EmulatorPaused;
|
PauseEmulator();
|
||||||
_didMenuPause = true;
|
_didMenuPause = true; // overwrites value set during PauseEmulator call
|
||||||
PauseEmulator();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainformMenu_MenuDeactivate(object sender, EventArgs e) => MaybeUnpauseFromMenuClosed();
|
private void MainformMenu_MenuDeactivate(object sender, EventArgs e) => MaybeUnpauseFromMenuClosed();
|
||||||
|
|
||||||
public void MaybeUnpauseFromMenuClosed()
|
public void MaybeUnpauseFromMenuClosed()
|
||||||
{
|
{
|
||||||
if (!_wasPaused)
|
if (_wasPaused || !Config.PauseWhenMenuActivated) return;
|
||||||
{
|
UnpauseEmulator();
|
||||||
UnpauseEmulator();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void FormDragEnter(object sender, DragEventArgs e)
|
private static void FormDragEnter(object sender, DragEventArgs e)
|
||||||
|
|
|
@ -789,6 +789,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private set
|
private set
|
||||||
{
|
{
|
||||||
|
_didMenuPause = false; // overwritten where relevant
|
||||||
if (_emulatorPaused && !value) // Unpausing
|
if (_emulatorPaused && !value) // Unpausing
|
||||||
{
|
{
|
||||||
InitializeFpsData();
|
InitializeFpsData();
|
||||||
|
|
Loading…
Reference in New Issue