GUI: Ommit aspect ratio checkbox if this feature is missing

Also fix compilation when building for --disable-aspect (buggy end bracket in backends/graphics/surfacesdl/surfacesdl-graphics.cpp)
This commit is contained in:
antoniou79 2023-06-17 20:40:27 +03:00 committed by Eugene Sandulenko
parent 38e88cde66
commit 68c293a004
3 changed files with 29 additions and 16 deletions

View File

@ -109,7 +109,9 @@ OpenGLGraphicsManager::~OpenGLGraphicsManager() {
bool OpenGLGraphicsManager::hasFeature(OSystem::Feature f) const {
switch (f) {
#ifdef USE_ASPECT
case OSystem::kFeatureAspectRatioCorrection:
#endif
case OSystem::kFeatureCursorPalette:
case OSystem::kFeatureFilteringMode:
case OSystem::kFeatureStretchMode:

View File

@ -1383,8 +1383,8 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
#ifdef USE_ASPECT
if (_videoMode.aspectRatioCorrection && orig_dst_y < height && !_overlayInGUI)
r->h = stretch200To240((uint8 *) _hwScreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1, _videoMode.filtering, convertSDLPixelFormat(_hwScreen->format));
}
#endif
}
}
SDL_UnlockSurface(srcSurf);
SDL_UnlockSurface(_hwScreen);

View File

@ -366,12 +366,14 @@ void OptionsDialog::build() {
}
// Aspect ratio setting
if (_guioptions.contains(GUIO_NOASPECT)) {
_aspectCheckbox->setState(false);
_aspectCheckbox->setEnabled(false);
} else {
_aspectCheckbox->setEnabled(true);
_aspectCheckbox->setState(ConfMan.getBool("aspect_ratio", _domain));
if (g_system->hasFeature(OSystem::kFeatureAspectRatioCorrection)) {
if (_guioptions.contains(GUIO_NOASPECT)) {
_aspectCheckbox->setState(false);
_aspectCheckbox->setEnabled(false);
} else {
_aspectCheckbox->setEnabled(true);
_aspectCheckbox->setState(ConfMan.getBool("aspect_ratio", _domain));
}
}
if (g_system->hasFeature(OSystem::kFeatureVSync)) {
@ -612,8 +614,10 @@ void OptionsDialog::apply() {
ConfMan.setBool("fullscreen", _fullscreenCheckbox->getState(), _domain);
_fullscreenCheckbox->setOverride(false);
}
if (ConfMan.getBool("aspect_ratio", _domain) != _aspectCheckbox->getState())
graphicsModeChanged = true;
if (g_system->hasFeature(OSystem::kFeatureAspectRatioCorrection)) {
if (ConfMan.getBool("aspect_ratio", _domain) != _aspectCheckbox->getState())
graphicsModeChanged = true;
}
if (g_system->hasFeature(OSystem::kFeatureVSync)) {
if (ConfMan.getBool("vsync", _domain) != _vsyncCheckbox->getState()) {
graphicsModeChanged = true;
@ -622,7 +626,9 @@ void OptionsDialog::apply() {
}
}
ConfMan.setBool("aspect_ratio", _aspectCheckbox->getState(), _domain);
if (g_system->hasFeature(OSystem::kFeatureAspectRatioCorrection)) {
ConfMan.setBool("aspect_ratio", _aspectCheckbox->getState(), _domain);
}
bool isSet = false;
@ -1285,10 +1291,12 @@ void OptionsDialog::setGraphicSettingsState(bool enabled) {
else
_fullscreenCheckbox->setEnabled(false);
if (_guioptions.contains(GUIO_NOASPECT))
_aspectCheckbox->setEnabled(false);
else
_aspectCheckbox->setEnabled(enabled);
if (g_system->hasFeature(OSystem::kFeatureAspectRatioCorrection)) {
if (_guioptions.contains(GUIO_NOASPECT))
_aspectCheckbox->setEnabled(false);
else
_aspectCheckbox->setEnabled(enabled);
}
if (g_system->hasFeature(OSystem::kFeatureVSync))
_vsyncCheckbox->setEnabled(enabled);
@ -1693,7 +1701,8 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
_filteringCheckbox = new CheckboxWidget(boss, prefix + "grFilteringCheckbox", _("Filter graphics"), _("Use linear filtering when scaling graphics"));
// Aspect ratio checkbox
_aspectCheckbox = new CheckboxWidget(boss, prefix + "grAspectCheckbox", _("Aspect ratio correction"), _("Correct aspect ratio for games"));
if (g_system->hasFeature(OSystem::kFeatureAspectRatioCorrection))
_aspectCheckbox = new CheckboxWidget(boss, prefix + "grAspectCheckbox", _("Aspect ratio correction"), _("Correct aspect ratio for games"));
_enableGraphicSettings = true;
}
@ -2041,7 +2050,9 @@ void OptionsDialog::setupGraphicsTab() {
if (g_system->hasFeature(OSystem::kFeatureFilteringMode))
_filteringCheckbox->setVisible(true);
_aspectCheckbox->setVisible(true);
if (g_system->hasFeature(OSystem::kFeatureAspectRatioCorrection))
_aspectCheckbox->setVisible(true);
_renderModePopUpDesc->setVisible(true);
_renderModePopUp->setVisible(true);