From 6bd4987b22efcc4ee6b51bd1a5da104fa4df8949 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Mon, 12 Apr 2021 22:38:41 +0200 Subject: [PATCH] fixed palette and custom BLARGG settings saving (see #787) --- src/emucore/FrameBuffer.cxx | 8 -------- src/gui/VideoAudioDialog.cxx | 39 ++++++++++++++++++++---------------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 6007ffc2b..d9ff97f3a 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -1066,14 +1066,6 @@ void FrameBuffer::saveConfig(Settings& settings) const { // Save the last windowed position and display on system shutdown saveCurrentWindowPosition(); - - if(myTIASurface) - { - Logger::debug("Saving TV effects options ..."); - tiaSurface().ntsc().saveConfig(settings); - Logger::debug("Saving palette settings..."); - tiaSurface().paletteHandler().saveConfig(settings); - } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/VideoAudioDialog.cxx b/src/gui/VideoAudioDialog.cxx index 9343dd97b..f777dca15 100644 --- a/src/gui/VideoAudioDialog.cxx +++ b/src/gui/VideoAudioDialog.cxx @@ -682,46 +682,47 @@ void VideoAudioDialog::updateSettingsWithPreset(AudioSettings& audioSettings) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void VideoAudioDialog::saveConfig() { + Settings& settings = instance().settings(); + ///////////////////////////////////////////////////////////////////////////// // Display tab // Renderer setting - instance().settings().setValue("video", - myRenderer->getSelectedTag().toString()); + settings.setValue("video", myRenderer->getSelectedTag().toString()); // TIA interpolation - instance().settings().setValue("tia.inter", myTIAInterpolate->getState()); + settings.setValue("tia.inter", myTIAInterpolate->getState()); // Fullscreen - instance().settings().setValue("fullscreen", myFullscreen->getState()); + settings.setValue("fullscreen", myFullscreen->getState()); // Fullscreen stretch setting - instance().settings().setValue("tia.fs_stretch", myUseStretch->getState()); + settings.setValue("tia.fs_stretch", myUseStretch->getState()); #ifdef ADAPTABLE_REFRESH_SUPPORT // Adapt refresh rate - instance().settings().setValue("tia.fs_refresh", myRefreshAdapt->getState()); + settings.setValue("tia.fs_refresh", myRefreshAdapt->getState()); #endif // Fullscreen overscan - instance().settings().setValue("tia.fs_overscan", myTVOverscan->getValueLabel()); + settings.setValue("tia.fs_overscan", myTVOverscan->getValueLabel()); // TIA zoom levels - instance().settings().setValue("tia.zoom", myTIAZoom->getValue() / 100.0); + settings.setValue("tia.zoom", myTIAZoom->getValue() / 100.0); // Aspect ratio correction - instance().settings().setValue("tia.correct_aspect", myCorrectAspect->getState()); + settings.setValue("tia.correct_aspect", myCorrectAspect->getState()); // Aspect ratio setting (NTSC and PAL) - const int oldAdjust = instance().settings().getInt("tia.vsizeadjust"); + const int oldAdjust = settings.getInt("tia.vsizeadjust"); const int newAdjust = myVSizeAdjust->getValue(); const bool vsizeChanged = oldAdjust != newAdjust; - instance().settings().setValue("tia.vsizeadjust", newAdjust); + settings.setValue("tia.vsizeadjust", newAdjust); - - // Note: Palette values are saved directly when changed! + Logger::debug("Saving palette settings..."); + instance().frameBuffer().tiaSurface().paletteHandler().saveConfig(settings); ///////////////////////////////////////////////////////////////////////////// // TV Effects tab // TV Mode - instance().settings().setValue("tv.filter", + settings.setValue("tv.filter", myTVMode->getSelectedTag().toString()); // TV Custom adjustables NTSCFilter::Adjustable ntscAdj; @@ -732,15 +733,19 @@ void VideoAudioDialog::saveConfig() ntscAdj.bleed = myTVBleed->getValue(); instance().frameBuffer().tiaSurface().ntsc().setCustomAdjustables(ntscAdj); + Logger::debug("Saving TV effects options ..."); + instance().frameBuffer().tiaSurface().ntsc().saveConfig(settings); + + // TV phosphor mode - instance().settings().setValue("tv.phosphor", + settings.setValue("tv.phosphor", myTVPhosphor->getState() ? "always" : "byrom"); // TV phosphor blend - instance().settings().setValue("tv.phosblend", myTVPhosLevel->getValueLabel() == "Off" + settings.setValue("tv.phosblend", myTVPhosLevel->getValueLabel() == "Off" ? "0" : myTVPhosLevel->getValueLabel()); // TV scanline intensity - instance().settings().setValue("tv.scanlines", myTVScanIntense->getValueLabel()); + settings.setValue("tv.scanlines", myTVScanIntense->getValueLabel()); if(instance().hasConsole()) {