mirror of https://github.com/stella-emu/stella.git
added option for automatic pause/continue of emulation depending on focus (resolves #870)
This commit is contained in:
parent
cd9d25c5c7
commit
6daa04c6f4
|
@ -25,6 +25,8 @@
|
||||||
- Added option to show/hide file extensions.
|
- Added option to show/hide file extensions.
|
||||||
- Extended context menu and shortcuts.
|
- Extended context menu and shortcuts.
|
||||||
|
|
||||||
|
* Added option to automatically pause emulation when focus is lost.
|
||||||
|
|
||||||
* Added option to toggle autofire mode.
|
* Added option to toggle autofire mode.
|
||||||
|
|
||||||
* Added another oddball TIA glitch option for score mode color.
|
* Added another oddball TIA glitch option for score mode color.
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.5 KiB |
|
@ -2854,6 +2854,11 @@
|
||||||
indicating serious errors override this setting, and are always
|
indicating serious errors override this setting, and are always
|
||||||
shown.</td>
|
shown.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><pre>-autopause <1|0></pre></td>
|
||||||
|
<td>Enable or disable automatic pause/continue of emulation, when
|
||||||
|
Stella loses/gains focus.</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><pre>-pausedim <1|0></pre></td>
|
<td><pre>-pausedim <1|0></pre></td>
|
||||||
<td>Enable or disable emulation dimming in pause mode.</td>
|
<td>Enable or disable emulation dimming in pause mode.</td>
|
||||||
|
@ -3966,6 +3971,10 @@
|
||||||
<tr><td>Multi-threading</td><td>Enable multi-threaded rendering</td><td>-threads</td></tr>
|
<tr><td>Multi-threading</td><td>Enable multi-threaded rendering</td><td>-threads</td></tr>
|
||||||
<tr><td>Fast SuperCharger load</td><td>Skip progress loading bars for SuperCharger ROMs</td><td>-fastscbios</td></tr>
|
<tr><td>Fast SuperCharger load</td><td>Skip progress loading bars for SuperCharger ROMs</td><td>-fastscbios</td></tr>
|
||||||
<tr><td>Show UI messages</td><td>Overlay UI messages onscreen</td><td>-uimessages</td></tr>
|
<tr><td>Show UI messages</td><td>Overlay UI messages onscreen</td><td>-uimessages</td></tr>
|
||||||
|
<tr><td>
|
||||||
|
Automatic pause</td><td>Enable or disable automatic pause/continue of emulation,
|
||||||
|
when Stella loses/gains focus.</td><td>-autopause
|
||||||
|
</td></tr>
|
||||||
<tr><td>Confirm exiting...</td><td>Display a popup when emulation is exited</td><td>-confirmexit</td></tr>
|
<tr><td>Confirm exiting...</td><td>Display a popup when emulation is exited</td><td>-confirmexit</td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>When entering/exiting emulation:</td>
|
<td>When entering/exiting emulation:</td>
|
||||||
|
|
|
@ -376,6 +376,15 @@ void EventHandler::handleSystemEvent(SystemEvent e, int, int)
|
||||||
enterMenuMode(EventHandlerState::OPTIONSMENU);
|
enterMenuMode(EventHandlerState::OPTIONSMENU);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case SystemEvent::WINDOW_FOCUS_GAINED:
|
||||||
|
if(myOSystem.settings().getBool("autopause") && myState == EventHandlerState::PAUSE)
|
||||||
|
setState(EventHandlerState::EMULATION);
|
||||||
|
break;
|
||||||
|
case SystemEvent::WINDOW_FOCUS_LOST:
|
||||||
|
if(myOSystem.settings().getBool("autopause") && myState == EventHandlerState::EMULATION)
|
||||||
|
setState(EventHandlerState::PAUSE);
|
||||||
|
break;
|
||||||
|
|
||||||
default: // handle other events as testing requires
|
default: // handle other events as testing requires
|
||||||
// cerr << "handleSystemEvent: " << e << endl;
|
// cerr << "handleSystemEvent: " << e << endl;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -184,6 +184,8 @@ Settings::Settings()
|
||||||
setPermanent("dialogfont", "medium");
|
setPermanent("dialogfont", "medium");
|
||||||
setPermanent("dialogpos", 0);
|
setPermanent("dialogpos", 0);
|
||||||
setPermanent("confirmexit", false);
|
setPermanent("confirmexit", false);
|
||||||
|
setPermanent("autopause", false);
|
||||||
|
|
||||||
|
|
||||||
// Misc options
|
// Misc options
|
||||||
setPermanent("loglevel", int(Logger::Level::INFO));
|
setPermanent("loglevel", int(Logger::Level::INFO));
|
||||||
|
@ -624,6 +626,7 @@ void Settings::usage() const
|
||||||
<< " large16>\n"
|
<< " large16>\n"
|
||||||
<< " -dialogpos <0..4> Display all dialogs at given positions\n"
|
<< " -dialogpos <0..4> Display all dialogs at given positions\n"
|
||||||
<< " -confirmexit <0|1> Display a confirm dialog when exiting emulation\n"
|
<< " -confirmexit <0|1> Display a confirm dialog when exiting emulation\n"
|
||||||
|
<< " -autopause <0|1> Pause/continue emulation when focus is lost/gained\n"
|
||||||
<< " -listdelay <delay> Time to wait between keypresses in list widgets\n"
|
<< " -listdelay <delay> Time to wait between keypresses in list widgets\n"
|
||||||
<< " (300-1000)\n"
|
<< " (300-1000)\n"
|
||||||
<< " -mwheel <lines> Number of lines the mouse wheel will scroll in\n"
|
<< " -mwheel <lines> Number of lines the mouse wheel will scroll in\n"
|
||||||
|
|
|
@ -81,7 +81,7 @@ EmulationDialog::EmulationDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
|
|
||||||
// Set real dimensions
|
// Set real dimensions
|
||||||
_w = 37 * fontWidth + HBORDER * 2 + CheckboxWidget::prefixSize(_font);
|
_w = 37 * fontWidth + HBORDER * 2 + CheckboxWidget::prefixSize(_font);
|
||||||
_h = 12 * (lineHeight + VGAP) + VGAP * 7 + VBORDER * 3 + _th + buttonHeight;
|
_h = 13 * (lineHeight + VGAP) + VGAP * 7 + VBORDER * 3 + _th + buttonHeight;
|
||||||
|
|
||||||
xpos = HBORDER; ypos = VBORDER + _th;
|
xpos = HBORDER; ypos = VBORDER + _th;
|
||||||
|
|
||||||
|
@ -122,8 +122,14 @@ EmulationDialog::EmulationDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
wid.push_back(myUIMessages);
|
wid.push_back(myUIMessages);
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
// Confirm dialog when exiting emulation
|
// Automatically pause emulation when focus is lost
|
||||||
xpos = HBORDER; ypos += VGAP * 3;
|
xpos = HBORDER; ypos += VGAP * 3;
|
||||||
|
myAutoPauseWidget = new CheckboxWidget(this, _font, xpos, ypos, "Automatic pause");
|
||||||
|
myAutoPauseWidget->setToolTip("Check for automatic pause/continue of\nemulation when Stella loses/gains focus.");
|
||||||
|
wid.push_back(myAutoPauseWidget);
|
||||||
|
|
||||||
|
// Confirm dialog when exiting emulation
|
||||||
|
ypos += lineHeight + VGAP;
|
||||||
myConfirmExitWidget = new CheckboxWidget(this, _font, xpos, ypos, "Confirm exiting emulation");
|
myConfirmExitWidget = new CheckboxWidget(this, _font, xpos, ypos, "Confirm exiting emulation");
|
||||||
wid.push_back(myConfirmExitWidget);
|
wid.push_back(myConfirmExitWidget);
|
||||||
|
|
||||||
|
@ -186,6 +192,9 @@ void EmulationDialog::loadConfig()
|
||||||
// Multi-threaded rendering
|
// Multi-threaded rendering
|
||||||
myUseThreads->setState(settings.getBool("threads"));
|
myUseThreads->setState(settings.getBool("threads"));
|
||||||
|
|
||||||
|
// Automatically pause emulation when focus is lost
|
||||||
|
myAutoPauseWidget->setState(settings.getBool("autopause"));
|
||||||
|
|
||||||
// Confirm dialog when exiting emulation
|
// Confirm dialog when exiting emulation
|
||||||
myConfirmExitWidget->setState(settings.getBool("confirmexit"));
|
myConfirmExitWidget->setState(settings.getBool("confirmexit"));
|
||||||
|
|
||||||
|
@ -222,6 +231,9 @@ void EmulationDialog::saveConfig()
|
||||||
// Multi-threaded rendering
|
// Multi-threaded rendering
|
||||||
settings.setValue("threads", myUseThreads->getState());
|
settings.setValue("threads", myUseThreads->getState());
|
||||||
|
|
||||||
|
// Automatically pause emulation when focus is lost
|
||||||
|
settings.setValue("autopause", myAutoPauseWidget->getState());
|
||||||
|
|
||||||
// Confirm dialog when exiting emulation
|
// Confirm dialog when exiting emulation
|
||||||
settings.setValue("confirmexit", myConfirmExitWidget->getState());
|
settings.setValue("confirmexit", myConfirmExitWidget->getState());
|
||||||
|
|
||||||
|
@ -254,6 +266,7 @@ void EmulationDialog::setDefaults()
|
||||||
myUIMessages->setState(true);
|
myUIMessages->setState(true);
|
||||||
myFastSCBios->setState(true);
|
myFastSCBios->setState(true);
|
||||||
myUseThreads->setState(false);
|
myUseThreads->setState(false);
|
||||||
|
myAutoPauseWidget->setState(false);
|
||||||
myConfirmExitWidget->setState(false);
|
myConfirmExitWidget->setState(false);
|
||||||
|
|
||||||
mySaveOnExitGroup->setSelected(0);
|
mySaveOnExitGroup->setSelected(0);
|
||||||
|
|
|
@ -43,6 +43,7 @@ class EmulationDialog : public Dialog
|
||||||
CheckboxWidget* myUIMessages{nullptr};
|
CheckboxWidget* myUIMessages{nullptr};
|
||||||
CheckboxWidget* myFastSCBios{nullptr};
|
CheckboxWidget* myFastSCBios{nullptr};
|
||||||
CheckboxWidget* myUseThreads{nullptr};
|
CheckboxWidget* myUseThreads{nullptr};
|
||||||
|
CheckboxWidget* myAutoPauseWidget{nullptr};
|
||||||
CheckboxWidget* myConfirmExitWidget{nullptr};
|
CheckboxWidget* myConfirmExitWidget{nullptr};
|
||||||
RadioButtonGroup* mySaveOnExitGroup{nullptr};
|
RadioButtonGroup* mySaveOnExitGroup{nullptr};
|
||||||
CheckboxWidget* myAutoSlotWidget{nullptr};
|
CheckboxWidget* myAutoSlotWidget{nullptr};
|
||||||
|
|
Loading…
Reference in New Issue