diff --git a/higan/emulator/emulator.hpp b/higan/emulator/emulator.hpp index d18b11da..87c2c380 100644 --- a/higan/emulator/emulator.hpp +++ b/higan/emulator/emulator.hpp @@ -12,7 +12,7 @@ using namespace nall; namespace Emulator { static const string Name = "higan"; - static const string Version = "103.10"; + static const string Version = "103.11"; static const string Author = "byuu"; static const string License = "GPLv3"; static const string Website = "http://byuu.org/"; diff --git a/higan/target-tomoko/configuration/configuration.cpp b/higan/target-tomoko/configuration/configuration.cpp index 7576991b..c75feb71 100644 --- a/higan/target-tomoko/configuration/configuration.cpp +++ b/higan/target-tomoko/configuration/configuration.cpp @@ -25,9 +25,8 @@ Settings::Settings() { set("Video/Gamma", 100); set("Video/Luminance", 100); - set("Video/Overscan/Mask", false); - set("Video/Overscan/Horizontal", 8); - set("Video/Overscan/Vertical", 8); + set("Video/Overscan/Horizontal", 0); + set("Video/Overscan/Vertical", 0); set("Video/Windowed/AspectCorrection", true); set("Video/Windowed/IntegralScaling", true); diff --git a/higan/target-tomoko/presentation/presentation.cpp b/higan/target-tomoko/presentation/presentation.cpp index cd72e97d..58768891 100644 --- a/higan/target-tomoko/presentation/presentation.cpp +++ b/higan/target-tomoko/presentation/presentation.cpp @@ -72,10 +72,6 @@ Presentation::Presentation() { settings["Video/ScanlineEmulation"].setValue(scanlineEmulation.checked()); if(emulator) emulator->set("Scanline Emulation", scanlineEmulation.checked()); }); - maskOverscan.setText("Mask Overscan").setChecked(settings["Video/Overscan/Mask"].boolean()).onToggle([&] { - settings["Video/Overscan/Mask"].setValue(maskOverscan.checked()); - resizeViewport(); - }); videoShaderMenu.setText("Video Shader"); videoShaderNone.setText("None").onActivate([&] { settings["Video/Shader"].setValue("None"); @@ -153,7 +149,7 @@ Presentation::Presentation() { }); onSize([&] { - resizeViewport(true); + resizeViewport(false); }); onClose([&] { @@ -237,10 +233,7 @@ auto Presentation::clearViewport() -> void { } } -//onSize is true only for events generated from window resizing -//it will suppress automatic viewport scaling, and disable adaptive scaling -//it does this so that the main window can always be resizable -auto Presentation::resizeViewport(bool onSize) -> void { +auto Presentation::resizeViewport(bool resizeWindow) -> void { //clear video area before resizing to avoid seeing distorted video momentarily clearViewport(); @@ -255,7 +248,7 @@ auto Presentation::resizeViewport(bool onSize) -> void { emulatorWidth = resolution.width; emulatorHeight = resolution.height; aspectCorrection = resolution.aspectCorrection; - if(emulator->information.overscan && settings["Video/Overscan/Mask"].boolean()) { + if(emulator->information.overscan) { uint overscanHorizontal = settings["Video/Overscan/Horizontal"].natural(); uint overscanVertical = settings["Video/Overscan/Vertical"].natural(); emulatorWidth -= overscanHorizontal * 2; @@ -266,7 +259,7 @@ auto Presentation::resizeViewport(bool onSize) -> void { if(!fullScreen()) { if(settings["Video/Windowed/AspectCorrection"].boolean()) emulatorWidth *= aspectCorrection; - if(!onSize) { + if(resizeWindow) { string viewportScale = "640x480"; if(settings["Video/Windowed/Scale"].text() == "Small") viewportScale = settings["Video/Windowed/Scale/Small"].text(); if(settings["Video/Windowed/Scale"].text() == "Medium") viewportScale = settings["Video/Windowed/Scale/Medium"].text(); @@ -276,7 +269,7 @@ auto Presentation::resizeViewport(bool onSize) -> void { viewportHeight = resolution(1).natural(); } - if(settings["Video/Windowed/AdaptiveSizing"].boolean() && !onSize) { + if(settings["Video/Windowed/AdaptiveSizing"].boolean() && resizeWindow) { uint multiplier = min(viewportWidth / emulatorWidth, viewportHeight / emulatorHeight); emulatorWidth *= multiplier; emulatorHeight *= multiplier; @@ -285,12 +278,12 @@ auto Presentation::resizeViewport(bool onSize) -> void { uint multiplier = min(viewportWidth / emulatorWidth, viewportHeight / emulatorHeight); emulatorWidth *= multiplier; emulatorHeight *= multiplier; - if(!onSize) setSize({viewportWidth, viewportHeight}); + if(resizeWindow) setSize({viewportWidth, viewportHeight}); } else { double multiplier = min(viewportWidth / emulatorWidth, viewportHeight / emulatorHeight); emulatorWidth *= multiplier; emulatorHeight *= multiplier; - if(!onSize) setSize({viewportWidth, viewportHeight}); + if(resizeWindow) setSize({viewportWidth, viewportHeight}); } } else { if(settings["Video/Fullscreen/AspectCorrection"].boolean()) emulatorWidth *= aspectCorrection; diff --git a/higan/target-tomoko/presentation/presentation.hpp b/higan/target-tomoko/presentation/presentation.hpp index c56d3886..c7513be6 100644 --- a/higan/target-tomoko/presentation/presentation.hpp +++ b/higan/target-tomoko/presentation/presentation.hpp @@ -12,7 +12,7 @@ struct Presentation : Window { Presentation(); auto updateEmulator() -> void; auto clearViewport() -> void; - auto resizeViewport(bool onSize = false) -> void; + auto resizeViewport(bool resizeWindow = true) -> void; auto toggleFullScreen() -> void; auto loadShaders() -> void; @@ -30,12 +30,10 @@ struct Presentation : Window { MenuItem videoScaleSmall{&videoScaleMenu}; MenuItem videoScaleMedium{&videoScaleMenu}; MenuItem videoScaleLarge{&videoScaleMenu}; - //Group videoScales{&videoScaleSmall, &videoScaleMedium, &videoScaleLarge}; Menu videoEmulationMenu{&settingsMenu}; MenuCheckItem blurEmulation{&videoEmulationMenu}; MenuCheckItem colorEmulation{&videoEmulationMenu}; MenuCheckItem scanlineEmulation{&videoEmulationMenu}; - MenuCheckItem maskOverscan{&videoEmulationMenu}; Menu videoShaderMenu{&settingsMenu}; MenuRadioItem videoShaderNone{&videoShaderMenu}; MenuRadioItem videoShaderBlur{&videoShaderMenu}; diff --git a/higan/target-tomoko/program/interface.cpp b/higan/target-tomoko/program/interface.cpp index b1a4af62..d466f9a3 100644 --- a/higan/target-tomoko/program/interface.cpp +++ b/higan/target-tomoko/program/interface.cpp @@ -55,7 +55,7 @@ auto Program::videoRefresh(const uint32* data, uint pitch, uint width, uint heig pitch >>= 2; - if(emulator->information.overscan && settings["Video/Overscan/Mask"].boolean()) { + if(emulator->information.overscan) { uint overscanHorizontal = settings["Video/Overscan/Horizontal"].natural(); uint overscanVertical = settings["Video/Overscan/Vertical"].natural(); auto resolution = emulator->videoResolution(); diff --git a/higan/target-tomoko/program/program.cpp b/higan/target-tomoko/program/program.cpp index ab6241dc..b6df8342 100644 --- a/higan/target-tomoko/program/program.cpp +++ b/higan/target-tomoko/program/program.cpp @@ -59,8 +59,6 @@ Program::Program(string_vector args) { new ToolsManager; new AboutWindow; - presentation->setFocused(); - updateVideoShader(); updateAudioDriver(); updateAudioEffects(); diff --git a/higan/target-tomoko/settings/settings.hpp b/higan/target-tomoko/settings/settings.hpp index 68dd33c1..556a0a87 100644 --- a/higan/target-tomoko/settings/settings.hpp +++ b/higan/target-tomoko/settings/settings.hpp @@ -34,9 +34,8 @@ struct VideoSettings : TabFrameItem { CheckLabel fullscreenModeAspectCorrection{&fullscreenModeLayout, Size{0, 0}}; CheckLabel fullscreenModeIntegralScaling{&fullscreenModeLayout, Size{0, 0}}; - auto updateColor() -> void; - auto updateOverscan() -> void; - auto updateViewport() -> void; + auto updateColor(bool initializing = false) -> void; + auto updateViewport(bool initializing = false) -> void; }; struct AudioSettings : TabFrameItem { diff --git a/higan/target-tomoko/settings/video.cpp b/higan/target-tomoko/settings/video.cpp index ba7346ad..578cd649 100644 --- a/higan/target-tomoko/settings/video.cpp +++ b/higan/target-tomoko/settings/video.cpp @@ -18,10 +18,10 @@ VideoSettings::VideoSettings(TabFrame* parent) : TabFrameItem(parent) { overscanMaskLabel.setFont(Font().setBold()).setText("Overscan Mask"); horizontalMaskLabel.setText("Horizontal:"); horizontalMaskValue.setAlignment(0.5); - horizontalMaskSlider.setLength(25).setPosition(settings["Video/Overscan/Horizontal"].natural()).onChange([&] { updateOverscan(); }); + horizontalMaskSlider.setLength(25).setPosition(settings["Video/Overscan/Horizontal"].natural()).onChange([&] { updateViewport(); }); verticalMaskLabel.setText("Vertical:"); verticalMaskValue.setAlignment(0.5); - verticalMaskSlider.setLength(25).setPosition(settings["Video/Overscan/Vertical"].natural()).onChange([&] { updateOverscan(); }); + verticalMaskSlider.setLength(25).setPosition(settings["Video/Overscan/Vertical"].natural()).onChange([&] { updateViewport(); }); windowedModeLabel.setFont(Font().setBold()).setText("Windowed Mode"); windowedModeAspectCorrection.setText("Aspect correction").setChecked(settings["Video/Windowed/AspectCorrection"].boolean()).onToggle([&] { updateViewport(); }); @@ -32,34 +32,34 @@ VideoSettings::VideoSettings(TabFrame* parent) : TabFrameItem(parent) { fullscreenModeAspectCorrection.setText("Aspect correction").setChecked(settings["Video/Fullscreen/AspectCorrection"].boolean()).onToggle([&] { updateViewport(); }); fullscreenModeIntegralScaling.setText("Integral scaling").setChecked(settings["Video/Fullscreen/IntegralScaling"].boolean()).onToggle([&] { updateViewport(); }); - updateColor(); - updateOverscan(); - updateViewport(); + updateColor(true); + updateViewport(true); } -auto VideoSettings::updateColor() -> void { +auto VideoSettings::updateColor(bool initializing) -> void { settings["Video/Saturation"].setValue(saturationSlider.position()); settings["Video/Gamma"].setValue(100 + gammaSlider.position()); settings["Video/Luminance"].setValue(luminanceSlider.position()); saturationValue.setText({saturationSlider.position(), "%"}); gammaValue.setText({100 + gammaSlider.position(), "%"}); luminanceValue.setText({luminanceSlider.position(), "%"}); - program->updateVideoPalette(); + + if(!initializing) program->updateVideoPalette(); } -auto VideoSettings::updateOverscan() -> void { +auto VideoSettings::updateViewport(bool initializing) -> void { + bool wasAdaptive = settings["Video/Windowed/AdaptiveSizing"].boolean(); + bool isAdaptive = windowedModeAdaptiveSizing.checked(); + settings["Video/Overscan/Horizontal"].setValue(horizontalMaskSlider.position()); settings["Video/Overscan/Vertical"].setValue(verticalMaskSlider.position()); - horizontalMaskValue.setText({horizontalMaskSlider.position()}); - verticalMaskValue.setText({verticalMaskSlider.position()}); - presentation->resizeViewport(); -} - -auto VideoSettings::updateViewport() -> void { settings["Video/Windowed/AspectCorrection"].setValue(windowedModeAspectCorrection.checked()); settings["Video/Windowed/IntegralScaling"].setValue(windowedModeIntegralScaling.checked()); settings["Video/Windowed/AdaptiveSizing"].setValue(windowedModeAdaptiveSizing.checked()); settings["Video/Fullscreen/AspectCorrection"].setValue(fullscreenModeAspectCorrection.checked()); settings["Video/Fullscreen/IntegralScaling"].setValue(fullscreenModeIntegralScaling.checked()); - presentation->resizeViewport(); + horizontalMaskValue.setText({horizontalMaskSlider.position()}); + verticalMaskValue.setText({verticalMaskSlider.position()}); + + if(!initializing) presentation->resizeViewport(isAdaptive || wasAdaptive != isAdaptive); } diff --git a/hiro/windows/window.cpp b/hiro/windows/window.cpp index 2f5f8a9c..98f88174 100644 --- a/hiro/windows/window.cpp +++ b/hiro/windows/window.cpp @@ -120,11 +120,11 @@ auto pWindow::setGeometry(Geometry geometry) -> void { hwnd, nullptr, geometry.x() - margin.x(), geometry.y() - margin.y(), geometry.width() + margin.width(), geometry.height() + margin.height(), - SWP_NOZORDER | SWP_FRAMECHANGED + SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED ); if(auto statusBar = state().statusBar) { if(auto self = statusBar->self()) { - SetWindowPos(self->hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_FRAMECHANGED); + SetWindowPos(self->hwnd, nullptr, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED); } } if(auto layout = state().layout) { @@ -159,12 +159,14 @@ auto pWindow::setTitle(string text) -> void { } auto pWindow::setVisible(bool visible) -> void { + lock(); ShowWindow(hwnd, visible ? SW_SHOWNORMAL : SW_HIDE); if(!visible) setModal(false); if(auto layout = state().layout) { if(auto self = layout->self()) self->setVisible(layout->visible(true)); } + unlock(); } // @@ -209,7 +211,7 @@ auto pWindow::onSize() -> void { if(locked()) return; if(auto statusBar = state().statusBar) { if(auto self = statusBar->self()) { - SetWindowPos(self->hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_FRAMECHANGED); + SetWindowPos(self->hwnd, nullptr, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED); } } state().geometry.setSize(_geometry().size());