diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 1fe8bb6af4c..553dccb7cac 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -103,10 +103,11 @@ static const char HELP_STRING[] = " -x, --save-slot[=NUM] Save game slot to load (default: autosave)\n" " -f, --fullscreen Force full-screen mode\n" " -F, --no-fullscreen Force windowed mode\n" - " -g, --gfx-mode=MODE Select graphics scaler (1x,2x,3x,2xsai,super2xsai,\n" - " supereagle,advmame2x,advmame3x,hq2x,hq3x,tv2x,\n" - " dotmatrix)\n" + " -g, --gfx-mode=MODE Select graphics mode\n" " --stretch-mode=MODE Select stretch mode (center, integral, fit, stretch)\n" + " --scaler=MODE Select graphics scaler (normal,hq,edge,advmame,sai,\n" + " supersai,supereagle,pm,dotmatrix,tv2x)\n" + " --scale-factor=FACTOR Factor to scale the graphics by\n" " --filtering Force filtered graphics mode\n" " --no-filtering Force unfiltered graphics mode\n" #ifdef USE_OPENGL @@ -248,6 +249,8 @@ void registerDefaults() { ConfMan.registerDefault("render_mode", "default"); ConfMan.registerDefault("desired_screen_aspect_ratio", "auto"); ConfMan.registerDefault("stretch_mode", "default"); + ConfMan.registerDefault("scaler", "default"); + ConfMan.registerDefault("scale_factor", -1); ConfMan.registerDefault("shader", "default"); ConfMan.registerDefault("show_fps", false); ConfMan.registerDefault("dirtyrects", true); @@ -663,6 +666,12 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha DO_LONG_OPTION("stretch-mode") END_OPTION + DO_LONG_OPTION("scaler") + END_OPTION + + DO_LONG_OPTION_INT("scale-factor") + END_OPTION + DO_LONG_OPTION("shader") END_OPTION diff --git a/base/main.cpp b/base/main.cpp index 6229c5ae85f..cb466f969f2 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -343,6 +343,7 @@ static void setupGraphics(OSystem &system) { system.setGraphicsMode(ConfMan.get("gfx_mode").c_str()); system.setStretchMode(ConfMan.get("stretch_mode").c_str()); system.setShader(ConfMan.get("shader").c_str()); + system.setScaler(ConfMan.get("scaler").c_str(), ConfMan.getInt("scale_factor")); system.initSize(320, 200); diff --git a/engines/engine.cpp b/engines/engine.cpp index a279734dcec..45d69a40127 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -215,6 +215,9 @@ void initCommonGFX() { if (gameDomain->contains("stretch_mode")) g_system->setStretchMode(ConfMan.get("stretch_mode").c_str()); + if (gameDomain->contains("scaler") || gameDomain->contains("scale_factor")) + g_system->setScaler(ConfMan.get("scaler").c_str(), ConfMan.getInt("scale_factor")); + if (gameDomain->contains("shader")) g_system->setShader(ConfMan.get("shader").c_str()); } diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 2db54cb9b5e..38cd57b98c8 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -37,7 +37,7 @@ #include "graphics/pixelformat.h" -#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.46" +#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.47" class OSystem; diff --git a/gui/editgamedialog.cpp b/gui/editgamedialog.cpp index 304a701c105..9df5c3579e7 100644 --- a/gui/editgamedialog.cpp +++ b/gui/editgamedialog.cpp @@ -411,6 +411,8 @@ void EditGameDialog::open() { e = ConfMan.hasKey("gfx_mode", _domain) || ConfMan.hasKey("render_mode", _domain) || ConfMan.hasKey("stretch_mode", _domain) || + ConfMan.hasKey("scaler", _domain) || + ConfMan.hasKey("scale_factor", _domain) || ConfMan.hasKey("aspect_ratio", _domain) || ConfMan.hasKey("fullscreen", _domain) || ConfMan.hasKey("vsync", _domain) || diff --git a/gui/options.cpp b/gui/options.cpp index 482b45c0600..3c84708ba7d 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -64,6 +64,7 @@ #endif #include "graphics/renderer.h" +#include "graphics/scalerplugin.h" namespace GUI { @@ -90,6 +91,7 @@ enum { kKbdMouseSpeedChanged = 'kmsc', kJoystickDeadzoneChanged= 'jodc', kGraphicsTabContainerReflowCmd = 'gtcr', + kScalerPopUpCmd = 'scPU', kFullscreenToggled = 'oful' }; @@ -185,6 +187,9 @@ void OptionsDialog::init() { _renderModePopUpDesc = nullptr; _stretchPopUp = nullptr; _stretchPopUpDesc = nullptr; + _scalerPopUp = nullptr; + _scalerPopUpDesc = nullptr; + _scaleFactorPopUp = nullptr; _fullscreenCheckbox = nullptr; _filteringCheckbox = nullptr; _aspectCheckbox = nullptr; @@ -350,6 +355,37 @@ void OptionsDialog::build() { _stretchPopUp->setVisible(false); } + _scalerPopUp->setSelected(0); + _scaleFactorPopUp->setSelected(0); + + if (g_system->hasFeature(OSystem::kFeatureScalers)) { + if (ConfMan.hasKey("scaler", _domain)) { + const PluginList &scalerPlugins = ScalerMan.getPlugins(); + Common::String scaler(ConfMan.get("scaler", _domain)); + + for (uint scalerIndex = 0; scalerIndex < scalerPlugins.size(); scalerIndex++) { + if (scumm_stricmp(scalerPlugins[scalerIndex]->get().getName(), scaler.c_str()) != 0) + continue; + + _scalerPopUp->setSelectedTag(scalerIndex); + updateScaleFactors(scalerIndex); + + if (ConfMan.hasKey("scale_factor", _domain)) { + int scaleFactor = ConfMan.getInt("scale_factor", _domain); + if (scalerPlugins[scalerIndex]->get().hasFactor(scaleFactor)) + _scaleFactorPopUp->setSelectedTag(scaleFactor); + } + + break; + } + + } + } else { + _scalerPopUpDesc->setVisible(false); + _scalerPopUp->setVisible(false); + _scaleFactorPopUp->setVisible(false); + } + // Fullscreen setting if (g_system->hasFeature(OSystem::kFeatureFullscreenMode)) { _fullscreenCheckbox->setState(ConfMan.getBool("fullscreen", _domain)); @@ -587,6 +623,31 @@ void OptionsDialog::apply() { graphicsModeChanged = true; } + isSet = false; + const PluginList &scalerPlugins = ScalerMan.getPlugins(); + if ((int32)_scalerPopUp->getSelectedTag() >= 0) { + const char *name = scalerPlugins[_scalerPopUp->getSelectedTag()]->get().getName(); + if (ConfMan.get("scaler", _domain) != name) + graphicsModeChanged = true; + ConfMan.set("scaler", name, _domain); + + int factor = _scaleFactorPopUp->getSelectedTag(); + if (ConfMan.getInt("scale_factor", _domain) != factor) + graphicsModeChanged = true; + ConfMan.setInt("scale_factor", factor, _domain); + isSet = true; + } + if (!isSet) { + ConfMan.removeKey("scaler", _domain); + ConfMan.removeKey("scale_factor", _domain); + + uint defaultScaler = g_system->getDefaultScaler(); + if (g_system->getScaler() != defaultScaler) + graphicsModeChanged = true; + else if (scalerPlugins[defaultScaler]->get().getFactor() != g_system->getDefaultScaleFactor()) + graphicsModeChanged = true; + } + if (_rendererTypePopUp->getSelectedTag() > 0) { Graphics::RendererType selected = (Graphics::RendererType) _rendererTypePopUp->getSelectedTag(); ConfMan.set("renderer", Graphics::getRendererTypeCode(selected), _domain); @@ -607,6 +668,8 @@ void OptionsDialog::apply() { ConfMan.removeKey("aspect_ratio", _domain); ConfMan.removeKey("gfx_mode", _domain); ConfMan.removeKey("stretch_mode", _domain); + ConfMan.removeKey("scaler", _domain); + ConfMan.removeKey("scale_factor", _domain); ConfMan.removeKey("render_mode", _domain); ConfMan.removeKey("renderer", _domain); ConfMan.removeKey("antialiasing", _domain); @@ -647,6 +710,7 @@ void OptionsDialog::apply() { g_system->beginGFXTransaction(); g_system->setGraphicsMode(ConfMan.get("gfx_mode", _domain).c_str()); g_system->setStretchMode(ConfMan.get("stretch_mode", _domain).c_str()); + g_system->setScaler(ConfMan.get("scaler", _domain).c_str(), ConfMan.getInt("scale_factor", _domain)); if (ConfMan.hasKey("aspect_ratio")) g_system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio", _domain)); @@ -967,6 +1031,10 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data case kGraphicsTabContainerReflowCmd: setupGraphicsTab(); break; + case kScalerPopUpCmd: + updateScaleFactors(data); + g_gui.scheduleTopDialogRedraw(); + break; case kApplyCmd: apply(); break; @@ -1007,6 +1075,9 @@ void OptionsDialog::setGraphicSettingsState(bool enabled) { _renderModePopUp->setEnabled(enabled); _stretchPopUpDesc->setEnabled(enabled); _stretchPopUp->setEnabled(enabled); + _scalerPopUpDesc->setEnabled(enabled); + _scalerPopUp->setEnabled(enabled); + _scaleFactorPopUp->setEnabled(enabled); _vsyncCheckbox->setEnabled(enabled); _filteringCheckbox->setEnabled(enabled); _rendererTypePopUpDesc->setEnabled(enabled); @@ -1353,6 +1424,20 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr sm++; } + // The Scaler popup + const PluginList &scalerPlugins = ScalerMan.getPlugins(); + _scalerPopUpDesc = new StaticTextWidget(boss, prefix + "grScalerPopupDesc", _("Scaler:")); + _scalerPopUp = new PopUpWidget(boss, prefix + "grScalerPopup", Common::U32String(), kScalerPopUpCmd); + + _scalerPopUp->appendEntry(_("")); + _scalerPopUp->appendEntry(Common::U32String()); + for (uint scalerIndex = 0; scalerIndex < scalerPlugins.size(); scalerIndex++) { + _scalerPopUp->appendEntry(_c(scalerPlugins[scalerIndex]->get().getPrettyName(), context), scalerIndex); + } + + _scaleFactorPopUp = new PopUpWidget(boss, prefix + "grScaleFactorPopup"); + updateScaleFactors(_scalerPopUp->getSelectedTag()); + // Fullscreen checkbox _fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", _("Fullscreen mode"), Common::U32String(), kFullscreenToggled); @@ -1722,6 +1807,33 @@ void OptionsDialog::setupGraphicsTab() { _aspectCheckbox->setVisible(true); _renderModePopUpDesc->setVisible(true); _renderModePopUp->setVisible(true); + + if (g_system->hasFeature(OSystem::kFeatureScalers)) { + _scalerPopUpDesc->setVisible(true); + _scalerPopUp->setVisible(true); + _scaleFactorPopUp->setVisible(true); + } else { + _scalerPopUpDesc->setVisible(false); + _scalerPopUp->setVisible(false); + _scaleFactorPopUp->setVisible(false); + } +} + +void OptionsDialog::updateScaleFactors(uint32 tag) { + if ((int32)tag >= 0) { + const PluginList &scalerPlugins = ScalerMan.getPlugins(); + const Common::Array &factors = scalerPlugins[tag]->get().getFactors(); + + _scaleFactorPopUp->clearEntries(); + for (Common::Array::const_iterator it = factors.begin(); it != factors.end(); it++) { + _scaleFactorPopUp->appendEntry(Common::U32String::format("%dx", (*it)), (*it)); + } + _scaleFactorPopUp->setSelectedTag(scalerPlugins[tag]->get().getFactor()); + } else { + _scaleFactorPopUp->clearEntries(); + _scaleFactorPopUp->appendEntry(_("")); + _scaleFactorPopUp->setSelected(0); + } } #pragma mark - diff --git a/gui/options.h b/gui/options.h index a2af96d97cb..156a8c762f6 100644 --- a/gui/options.h +++ b/gui/options.h @@ -112,6 +112,7 @@ protected: void setSubtitleSettingsState(bool enabled); virtual void setupGraphicsTab(); + void updateScaleFactors(uint32 tag); bool loadMusicDeviceSetting(PopUpWidget *popup, Common::String setting, MusicType preferredType = MT_AUTO); void saveMusicDeviceSetting(PopUpWidget *popup, Common::String setting); @@ -152,6 +153,8 @@ private: PopUpWidget *_gfxPopUp; StaticTextWidget *_stretchPopUpDesc; PopUpWidget *_stretchPopUp; + StaticTextWidget *_scalerPopUpDesc; + PopUpWidget *_scalerPopUp, *_scaleFactorPopUp; CheckboxWidget *_fullscreenCheckbox; CheckboxWidget *_filteringCheckbox; CheckboxWidget *_aspectCheckbox; diff --git a/gui/themes/default.inc b/gui/themes/default.inc index ce339e96577..99ca9239d1f 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -1703,6 +1703,17 @@ const char *defaultXML1 = "" "type='PopUp' " "/>" "" +"" +"" +"" +"" +"" "" @@ -3532,6 +3543,17 @@ const char *defaultXML1 = "" "type='PopUp' " "/>" "" +"" +"" +"" +"" +"" "" diff --git a/gui/themes/residualvm.zip b/gui/themes/residualvm.zip index 3a147828a6b..1373f446365 100644 Binary files a/gui/themes/residualvm.zip and b/gui/themes/residualvm.zip differ diff --git a/gui/themes/residualvm/THEMERC b/gui/themes/residualvm/THEMERC index 4a7b14f50c5..cf724c376af 100644 --- a/gui/themes/residualvm/THEMERC +++ b/gui/themes/residualvm/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.46:ResidualVM Modern Theme:No Author] +[SCUMMVM_STX0.8.47:ResidualVM Modern Theme:No Author] diff --git a/gui/themes/residualvm/residualvm_layout.stx b/gui/themes/residualvm/residualvm_layout.stx index 5ae7adc21cc..c93237e8c12 100644 --- a/gui/themes/residualvm/residualvm_layout.stx +++ b/gui/themes/residualvm/residualvm_layout.stx @@ -347,6 +347,17 @@ type = 'PopUp' /> + + + + + diff --git a/gui/themes/residualvm/residualvm_layout_lowres.stx b/gui/themes/residualvm/residualvm_layout_lowres.stx index 672ca184a16..c41d1f86702 100644 --- a/gui/themes/residualvm/residualvm_layout_lowres.stx +++ b/gui/themes/residualvm/residualvm_layout_lowres.stx @@ -329,6 +329,17 @@ type = 'PopUp' /> + + + + + diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip index eeba51f236a..1c042b57577 100644 Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ diff --git a/gui/themes/scummclassic/THEMERC b/gui/themes/scummclassic/THEMERC index effd352ba93..1168571bad6 100644 --- a/gui/themes/scummclassic/THEMERC +++ b/gui/themes/scummclassic/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.46:ScummVM Classic Theme:No Author] +[SCUMMVM_STX0.8.47:ScummVM Classic Theme:No Author] diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index 341ece40368..44951a4338c 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -333,6 +333,17 @@ type = 'PopUp' /> + + + + + diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx index beb7e3ef41d..c889eb1f72f 100644 --- a/gui/themes/scummclassic/classic_layout_lowres.stx +++ b/gui/themes/scummclassic/classic_layout_lowres.stx @@ -329,6 +329,17 @@ type = 'PopUp' /> + + + + + diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip index 63641955b3c..1f54ab59fa2 100644 Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ diff --git a/gui/themes/scummmodern/THEMERC b/gui/themes/scummmodern/THEMERC index cca3a45e7bc..e9b67c543b3 100644 --- a/gui/themes/scummmodern/THEMERC +++ b/gui/themes/scummmodern/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.46:ScummVM Modern Theme:No Author] +[SCUMMVM_STX0.8.47:ScummVM Modern Theme:No Author] diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index 5ae7adc21cc..c93237e8c12 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -347,6 +347,17 @@ type = 'PopUp' /> + + + + + diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index 672ca184a16..c41d1f86702 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -329,6 +329,17 @@ type = 'PopUp' /> + + + + + diff --git a/gui/themes/scummremastered.zip b/gui/themes/scummremastered.zip index 35b7048e722..90cc62a86e2 100644 Binary files a/gui/themes/scummremastered.zip and b/gui/themes/scummremastered.zip differ diff --git a/gui/themes/scummremastered/THEMERC b/gui/themes/scummremastered/THEMERC index c3e5b418a44..1272ed64dee 100644 --- a/gui/themes/scummremastered/THEMERC +++ b/gui/themes/scummremastered/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.46:ScummVM Modern Theme Remastered:No Author] +[SCUMMVM_STX0.8.47:ScummVM Modern Theme Remastered:No Author] diff --git a/gui/themes/scummremastered/remastered_layout.stx b/gui/themes/scummremastered/remastered_layout.stx index 0694882ff88..277dd6f3c31 100644 --- a/gui/themes/scummremastered/remastered_layout.stx +++ b/gui/themes/scummremastered/remastered_layout.stx @@ -349,6 +349,17 @@ type = 'PopUp' /> + + + + + diff --git a/gui/themes/scummremastered/remastered_layout_lowres.stx b/gui/themes/scummremastered/remastered_layout_lowres.stx index c05368635d1..4292b8b7ecb 100644 --- a/gui/themes/scummremastered/remastered_layout_lowres.stx +++ b/gui/themes/scummremastered/remastered_layout_lowres.stx @@ -331,6 +331,17 @@ type = 'PopUp' /> + + + + +