GUI: Add checkbox and config option to enable/disable graphics filtering
This commit is contained in:
parent
30aae5178a
commit
3e08c33c35
12 changed files with 61 additions and 1 deletions
|
@ -80,6 +80,8 @@ static const char HELP_STRING[] =
|
||||||
" -g, --gfx-mode=MODE Select graphics scaler (1x,2x,3x,2xsai,super2xsai,\n"
|
" -g, --gfx-mode=MODE Select graphics scaler (1x,2x,3x,2xsai,super2xsai,\n"
|
||||||
" supereagle,advmame2x,advmame3x,hq2x,hq3x,tv2x,\n"
|
" supereagle,advmame2x,advmame3x,hq2x,hq3x,tv2x,\n"
|
||||||
" dotmatrix)\n"
|
" dotmatrix)\n"
|
||||||
|
" --filtering Force filtered graphics mode\n"
|
||||||
|
" --no-filtering Force unfiltered graphics mode\n"
|
||||||
" --gui-theme=THEME Select GUI theme\n"
|
" --gui-theme=THEME Select GUI theme\n"
|
||||||
" --themepath=PATH Path to where GUI themes are stored\n"
|
" --themepath=PATH Path to where GUI themes are stored\n"
|
||||||
" --list-themes Display list of all usable GUI themes\n"
|
" --list-themes Display list of all usable GUI themes\n"
|
||||||
|
@ -178,6 +180,7 @@ void registerDefaults() {
|
||||||
|
|
||||||
// Graphics
|
// Graphics
|
||||||
ConfMan.registerDefault("fullscreen", false);
|
ConfMan.registerDefault("fullscreen", false);
|
||||||
|
ConfMan.registerDefault("filtering", false);
|
||||||
ConfMan.registerDefault("aspect_ratio", false);
|
ConfMan.registerDefault("aspect_ratio", false);
|
||||||
ConfMan.registerDefault("gfx_mode", "normal");
|
ConfMan.registerDefault("gfx_mode", "normal");
|
||||||
ConfMan.registerDefault("render_mode", "default");
|
ConfMan.registerDefault("render_mode", "default");
|
||||||
|
@ -441,6 +444,9 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
|
||||||
|
|
||||||
DO_OPTION_BOOL('f', "fullscreen")
|
DO_OPTION_BOOL('f', "fullscreen")
|
||||||
END_OPTION
|
END_OPTION
|
||||||
|
|
||||||
|
DO_LONG_OPTION_BOOL("filtering")
|
||||||
|
END_OPTION
|
||||||
|
|
||||||
#ifdef ENABLE_EVENTRECORDER
|
#ifdef ENABLE_EVENTRECORDER
|
||||||
DO_LONG_OPTION_INT("disable-display")
|
DO_LONG_OPTION_INT("disable-display")
|
||||||
|
|
|
@ -290,6 +290,8 @@ static void setupGraphics(OSystem &system) {
|
||||||
system.setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio"));
|
system.setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio"));
|
||||||
if (ConfMan.hasKey("fullscreen"))
|
if (ConfMan.hasKey("fullscreen"))
|
||||||
system.setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen"));
|
system.setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen"));
|
||||||
|
if (ConfMan.hasKey("filtering"))
|
||||||
|
system.setFeatureState(OSystem::kFeatureFilteringMode, ConfMan.getBool("filtering"));
|
||||||
system.endGFXTransaction();
|
system.endGFXTransaction();
|
||||||
|
|
||||||
// When starting up launcher for the first time, the user might have specified
|
// When starting up launcher for the first time, the user might have specified
|
||||||
|
|
|
@ -223,7 +223,7 @@ void initCommonGFX(bool defaultTo1XScaler) {
|
||||||
g_system->setGraphicsMode(gfxMode.c_str());
|
g_system->setGraphicsMode(gfxMode.c_str());
|
||||||
|
|
||||||
// HACK: For OpenGL modes, we will still honor the graphics scale override
|
// HACK: For OpenGL modes, we will still honor the graphics scale override
|
||||||
if (defaultTo1XScaler && (gfxMode.equalsIgnoreCase("opengl_linear") || gfxMode.equalsIgnoreCase("opengl_nearest")))
|
if (defaultTo1XScaler && gfxMode.equalsIgnoreCase("opengl"))
|
||||||
g_system->resetGraphicsScale();
|
g_system->resetGraphicsScale();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,6 +242,10 @@ void initCommonGFX(bool defaultTo1XScaler) {
|
||||||
// (De)activate fullscreen mode as determined by the config settings
|
// (De)activate fullscreen mode as determined by the config settings
|
||||||
if (gameDomain && gameDomain->contains("fullscreen"))
|
if (gameDomain && gameDomain->contains("fullscreen"))
|
||||||
g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen"));
|
g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen"));
|
||||||
|
|
||||||
|
// (De)activate filtering mode as determined by the config settings
|
||||||
|
if (gameDomain && gameDomain->contains("filtering"))
|
||||||
|
g_system->setFeatureState(OSystem::kFeatureFilteringMode, ConfMan.getBool("filtering"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Please leave the splash screen in working order for your releases, even if they're commercial.
|
// Please leave the splash screen in working order for your releases, even if they're commercial.
|
||||||
|
@ -364,6 +368,11 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics:
|
||||||
GUI::MessageDialog dialog(_("Could not apply fullscreen setting."));
|
GUI::MessageDialog dialog(_("Could not apply fullscreen setting."));
|
||||||
dialog.runModal();
|
dialog.runModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gfxError & OSystem::kTransactionFilteringFailed) {
|
||||||
|
GUI::MessageDialog dialog(_("Could not apply filtering setting."));
|
||||||
|
dialog.runModal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,7 @@ void OptionsDialog::init() {
|
||||||
_renderModePopUp = 0;
|
_renderModePopUp = 0;
|
||||||
_renderModePopUpDesc = 0;
|
_renderModePopUpDesc = 0;
|
||||||
_fullscreenCheckbox = 0;
|
_fullscreenCheckbox = 0;
|
||||||
|
_filteringCheckbox = 0;
|
||||||
_aspectCheckbox = 0;
|
_aspectCheckbox = 0;
|
||||||
_enableAudioSettings = false;
|
_enableAudioSettings = false;
|
||||||
_midiTabId = 0;
|
_midiTabId = 0;
|
||||||
|
@ -243,6 +244,12 @@ void OptionsDialog::open() {
|
||||||
_fullscreenCheckbox->setState(ConfMan.getBool("fullscreen", _domain));
|
_fullscreenCheckbox->setState(ConfMan.getBool("fullscreen", _domain));
|
||||||
#endif // GUI_ONLY_FULLSCREEN
|
#endif // GUI_ONLY_FULLSCREEN
|
||||||
|
|
||||||
|
// Filtering setting
|
||||||
|
if (g_system->hasFeature(OSystem::kFeatureFilteringMode))
|
||||||
|
_filteringCheckbox->setState(ConfMan.getBool("filtering", _domain));
|
||||||
|
else
|
||||||
|
_filteringCheckbox->setVisible(false);
|
||||||
|
|
||||||
// Aspect ratio setting
|
// Aspect ratio setting
|
||||||
if (_guioptions.contains(GUIO_NOASPECT)) {
|
if (_guioptions.contains(GUIO_NOASPECT)) {
|
||||||
_aspectCheckbox->setState(false);
|
_aspectCheckbox->setState(false);
|
||||||
|
@ -353,11 +360,14 @@ void OptionsDialog::close() {
|
||||||
bool graphicsModeChanged = false;
|
bool graphicsModeChanged = false;
|
||||||
if (_fullscreenCheckbox) {
|
if (_fullscreenCheckbox) {
|
||||||
if (_enableGraphicSettings) {
|
if (_enableGraphicSettings) {
|
||||||
|
if (ConfMan.getBool("filtering", _domain) != _filteringCheckbox->getState())
|
||||||
|
graphicsModeChanged = true;
|
||||||
if (ConfMan.getBool("fullscreen", _domain) != _fullscreenCheckbox->getState())
|
if (ConfMan.getBool("fullscreen", _domain) != _fullscreenCheckbox->getState())
|
||||||
graphicsModeChanged = true;
|
graphicsModeChanged = true;
|
||||||
if (ConfMan.getBool("aspect_ratio", _domain) != _aspectCheckbox->getState())
|
if (ConfMan.getBool("aspect_ratio", _domain) != _aspectCheckbox->getState())
|
||||||
graphicsModeChanged = true;
|
graphicsModeChanged = true;
|
||||||
|
|
||||||
|
ConfMan.setBool("filtering", _filteringCheckbox->getState(), _domain);
|
||||||
ConfMan.setBool("fullscreen", _fullscreenCheckbox->getState(), _domain);
|
ConfMan.setBool("fullscreen", _fullscreenCheckbox->getState(), _domain);
|
||||||
ConfMan.setBool("aspect_ratio", _aspectCheckbox->getState(), _domain);
|
ConfMan.setBool("aspect_ratio", _aspectCheckbox->getState(), _domain);
|
||||||
|
|
||||||
|
@ -384,6 +394,7 @@ void OptionsDialog::close() {
|
||||||
ConfMan.set("render_mode", Common::getRenderModeCode((Common::RenderMode)_renderModePopUp->getSelectedTag()), _domain);
|
ConfMan.set("render_mode", Common::getRenderModeCode((Common::RenderMode)_renderModePopUp->getSelectedTag()), _domain);
|
||||||
} else {
|
} else {
|
||||||
ConfMan.removeKey("fullscreen", _domain);
|
ConfMan.removeKey("fullscreen", _domain);
|
||||||
|
ConfMan.removeKey("filtering", _domain);
|
||||||
ConfMan.removeKey("aspect_ratio", _domain);
|
ConfMan.removeKey("aspect_ratio", _domain);
|
||||||
ConfMan.removeKey("gfx_mode", _domain);
|
ConfMan.removeKey("gfx_mode", _domain);
|
||||||
ConfMan.removeKey("render_mode", _domain);
|
ConfMan.removeKey("render_mode", _domain);
|
||||||
|
@ -399,6 +410,9 @@ void OptionsDialog::close() {
|
||||||
g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio", _domain));
|
g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio", _domain));
|
||||||
if (ConfMan.hasKey("fullscreen"))
|
if (ConfMan.hasKey("fullscreen"))
|
||||||
g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen", _domain));
|
g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen", _domain));
|
||||||
|
if (ConfMan.hasKey("filtering"))
|
||||||
|
g_system->setFeatureState(OSystem::kFeatureFilteringMode, ConfMan.getBool("filtering", _domain));
|
||||||
|
|
||||||
OSystem::TransactionError gfxError = g_system->endGFXTransaction();
|
OSystem::TransactionError gfxError = g_system->endGFXTransaction();
|
||||||
|
|
||||||
// Since this might change the screen resolution we need to give
|
// Since this might change the screen resolution we need to give
|
||||||
|
@ -441,6 +455,12 @@ void OptionsDialog::close() {
|
||||||
message += "\n";
|
message += "\n";
|
||||||
message += _("the fullscreen setting could not be changed");
|
message += _("the fullscreen setting could not be changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gfxError & OSystem::kTransactionFilteringFailed) {
|
||||||
|
ConfMan.setBool("filtering", g_system->getFeatureState(OSystem::kFeatureFilteringMode), _domain);
|
||||||
|
message += "\n";
|
||||||
|
message += _("the filtering setting could not be changed");
|
||||||
|
}
|
||||||
|
|
||||||
// And display the error
|
// And display the error
|
||||||
GUI::MessageDialog dialog(message);
|
GUI::MessageDialog dialog(message);
|
||||||
|
@ -633,6 +653,7 @@ void OptionsDialog::setGraphicSettingsState(bool enabled) {
|
||||||
_gfxPopUp->setEnabled(enabled);
|
_gfxPopUp->setEnabled(enabled);
|
||||||
_renderModePopUpDesc->setEnabled(enabled);
|
_renderModePopUpDesc->setEnabled(enabled);
|
||||||
_renderModePopUp->setEnabled(enabled);
|
_renderModePopUp->setEnabled(enabled);
|
||||||
|
_filteringCheckbox->setEnabled(enabled);
|
||||||
#ifndef GUI_ENABLE_KEYSDIALOG
|
#ifndef GUI_ENABLE_KEYSDIALOG
|
||||||
_fullscreenCheckbox->setEnabled(enabled);
|
_fullscreenCheckbox->setEnabled(enabled);
|
||||||
if (_guioptions.contains(GUIO_NOASPECT))
|
if (_guioptions.contains(GUIO_NOASPECT))
|
||||||
|
@ -785,6 +806,9 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
|
||||||
|
|
||||||
// Fullscreen checkbox
|
// Fullscreen checkbox
|
||||||
_fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", _("Fullscreen mode"));
|
_fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", _("Fullscreen mode"));
|
||||||
|
|
||||||
|
// Filtering checkbox
|
||||||
|
_filteringCheckbox = new CheckboxWidget(boss, prefix + "grFilteringCheckbox", _("Filter graphics"), _("Use linear filtering when scaling graphics"));
|
||||||
|
|
||||||
// Aspect ratio checkbox
|
// Aspect ratio checkbox
|
||||||
_aspectCheckbox = new CheckboxWidget(boss, prefix + "grAspectCheckbox", _("Aspect ratio correction"), _("Correct aspect ratio for 320x200 games"));
|
_aspectCheckbox = new CheckboxWidget(boss, prefix + "grAspectCheckbox", _("Aspect ratio correction"), _("Correct aspect ratio for 320x200 games"));
|
||||||
|
|
|
@ -114,6 +114,7 @@ private:
|
||||||
StaticTextWidget *_gfxPopUpDesc;
|
StaticTextWidget *_gfxPopUpDesc;
|
||||||
PopUpWidget *_gfxPopUp;
|
PopUpWidget *_gfxPopUp;
|
||||||
CheckboxWidget *_fullscreenCheckbox;
|
CheckboxWidget *_fullscreenCheckbox;
|
||||||
|
CheckboxWidget *_filteringCheckbox;
|
||||||
CheckboxWidget *_aspectCheckbox;
|
CheckboxWidget *_aspectCheckbox;
|
||||||
StaticTextWidget *_renderModePopUpDesc;
|
StaticTextWidget *_renderModePopUpDesc;
|
||||||
PopUpWidget *_renderModePopUp;
|
PopUpWidget *_renderModePopUp;
|
||||||
|
|
|
@ -834,6 +834,9 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
|
||||||
"<widget name='grFullscreenCheckbox' "
|
"<widget name='grFullscreenCheckbox' "
|
||||||
"type='Checkbox' "
|
"type='Checkbox' "
|
||||||
"/>"
|
"/>"
|
||||||
|
"<widget name='grFilteringCheckbox' "
|
||||||
|
"type='Checkbox' "
|
||||||
|
"/>"
|
||||||
"</layout>"
|
"</layout>"
|
||||||
"</dialog>"
|
"</dialog>"
|
||||||
"<dialog name='GlobalOptions_Audio' overlays='Dialog.GlobalOptions.TabWidget'>"
|
"<dialog name='GlobalOptions_Audio' overlays='Dialog.GlobalOptions.TabWidget'>"
|
||||||
|
@ -2370,6 +2373,9 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
|
||||||
"<widget name='grFullscreenCheckbox' "
|
"<widget name='grFullscreenCheckbox' "
|
||||||
"type='Checkbox' "
|
"type='Checkbox' "
|
||||||
"/>"
|
"/>"
|
||||||
|
"<widget name='grFilteringCheckbox' "
|
||||||
|
"type='Checkbox' "
|
||||||
|
"/>"
|
||||||
"</layout>"
|
"</layout>"
|
||||||
"</dialog>"
|
"</dialog>"
|
||||||
"<dialog name='GlobalOptions_Audio' overlays='Dialog.GlobalOptions.TabWidget'>"
|
"<dialog name='GlobalOptions_Audio' overlays='Dialog.GlobalOptions.TabWidget'>"
|
||||||
|
|
Binary file not shown.
|
@ -259,6 +259,9 @@
|
||||||
<widget name = 'grFullscreenCheckbox'
|
<widget name = 'grFullscreenCheckbox'
|
||||||
type = 'Checkbox'
|
type = 'Checkbox'
|
||||||
/>
|
/>
|
||||||
|
<widget name = 'grFilteringCheckbox'
|
||||||
|
type = 'Checkbox'
|
||||||
|
/>
|
||||||
</layout>
|
</layout>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
|
|
|
@ -257,6 +257,9 @@
|
||||||
<widget name = 'grFullscreenCheckbox'
|
<widget name = 'grFullscreenCheckbox'
|
||||||
type = 'Checkbox'
|
type = 'Checkbox'
|
||||||
/>
|
/>
|
||||||
|
<widget name = 'grFilteringCheckbox'
|
||||||
|
type = 'Checkbox'
|
||||||
|
/>
|
||||||
</layout>
|
</layout>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -273,6 +273,9 @@
|
||||||
<widget name = 'grFullscreenCheckbox'
|
<widget name = 'grFullscreenCheckbox'
|
||||||
type = 'Checkbox'
|
type = 'Checkbox'
|
||||||
/>
|
/>
|
||||||
|
<widget name = 'grFilteringCheckbox'
|
||||||
|
type = 'Checkbox'
|
||||||
|
/>
|
||||||
</layout>
|
</layout>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
|
|
|
@ -255,6 +255,9 @@
|
||||||
<widget name = 'grFullscreenCheckbox'
|
<widget name = 'grFullscreenCheckbox'
|
||||||
type = 'Checkbox'
|
type = 'Checkbox'
|
||||||
/>
|
/>
|
||||||
|
<widget name = 'grFilteringCheckbox'
|
||||||
|
type = 'Checkbox'
|
||||||
|
/>
|
||||||
</layout>
|
</layout>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue