diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 4335caa3d..600f6b183 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -53,6 +53,7 @@ FrameBuffer::FrameBuffer(OSystem& osystem) myStatsEnabled(false), myLastScanlines(0), myGrabMouse(false), + myHiDPIAllowed(false), myHiDPIEnabled(false), myCurrentModeList(nullptr) { @@ -85,9 +86,9 @@ bool FrameBuffer::initialize() myDesktopSize = myAbsDesktopSize; // Check for HiDPI mode (is it activated, and can we use it?) - myHiDPIEnabled = myOSystem.settings().getBool("hidpi") && - ((myAbsDesktopSize.w / 2) >= FBMinimum::Width) && - ((myAbsDesktopSize.h / 2) >= FBMinimum::Height); + myHiDPIAllowed = ((myAbsDesktopSize.w / 2) >= FBMinimum::Width) && + ((myAbsDesktopSize.h / 2) >= FBMinimum::Height); + myHiDPIEnabled = myHiDPIAllowed && myOSystem.settings().getBool("hidpi"); // In HiDPI mode, the desktop resolution is essentially halved // Later, the output is scaled and rendered in 2x mode diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx index ba53f8fc4..a14aca188 100644 --- a/src/emucore/FrameBuffer.hxx +++ b/src/emucore/FrameBuffer.hxx @@ -259,6 +259,12 @@ class FrameBuffer */ void stateChanged(EventHandlerState state); + /** + Answer whether hidpi mode is allowed. In this mode, all FBSurfaces + are scaled to 2x normal size. + */ + bool hidpiAllowed() const { return myHiDPIAllowed; } + /** Answer whether hidpi mode is enabled. In this mode, all FBSurfaces are scaled to 2x normal size. @@ -562,6 +568,7 @@ class FrameBuffer uInt32 myLastScanlines; bool myGrabMouse; + bool myHiDPIAllowed; bool myHiDPIEnabled; // The list of all available video modes for this framebuffer diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 22f7aa274..e3116080f 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -41,7 +41,6 @@ Settings::Settings() setPermanent("center", "false"); setPermanent("palette", "standard"); setPermanent("uimessages", "true"); - setPermanent("hidpi", "false"); // TIA specific options setPermanent("tia.zoom", "3"); @@ -122,6 +121,7 @@ Settings::Settings() DebuggerDialog::kMediumFontMinH)); #endif setPermanent("uipalette", "standard"); + setPermanent("hidpi", "false"); setPermanent("listdelay", "300"); setPermanent("mwheel", "4"); setPermanent("basic_settings", false); @@ -462,13 +462,16 @@ void Settings::usage() const << " -launcherroms <1|0> Show only ROMs in the launcher (vs. all files)\n" << " -romviewer <0|1|2> Show ROM info viewer at given zoom level in ROM\n" << " launcher (0 for off)\n" + << " -uipalette \n" + << " -hidpi <0|1> Enable HiDPI mode\n" + << " -dialogpos <0..4> Display all dialogs at given positions\n" << " -listdelay Time to wait between keypresses in list widgets\n" << " (300-1000)\n" << " -mwheel Number of lines the mouse wheel will scroll in\n" << " UI\n" << " -basic_settings <0|1> Display only a basic settings dialog\n" - << " -dialogpos <0..4> Display all dialogs at given positions\n" - << " -romdir Directory in which to load ROM files\n" + << " -romdir Directory from which to load ROM files\n" << " -avoxport The name of the serial port where an AtariVox is\n" << " connected\n" << " -holdreset Start the emulator with the Game Reset switch\n" diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx index 52b4759d7..e708b82f5 100644 --- a/src/gui/UIDialog.cxx +++ b/src/gui/UIDialog.cxx @@ -96,6 +96,11 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent, myPositionPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items, "Dialogs position ", lwidth); wid.push_back(myPositionPopup); + ypos += lineHeight + V_GAP; + + // Enable HiDPI mode + myHidpiWidget = new CheckboxWidget(myTab, font, xpos, ypos, "HiDPI mode"); + wid.push_back(myHidpiWidget); ypos += lineHeight + V_GAP * 4; // Delay between quick-selecting characters in ListWidget @@ -276,6 +281,17 @@ void UIDialog::loadConfig() const string& pal = settings.getString("uipalette"); myPalettePopup->setSelected(pal, "standard"); + // Enable HiDPI mode + if (!instance().frameBuffer().hidpiAllowed()) + { + myHidpiWidget->setState(false); + myHidpiWidget->setEnabled(false); + } + else + { + myHidpiWidget->setState(settings.getBool("hidpi")); + } + // Dialog position myPositionPopup->setSelected(settings.getString("dialogpos"), "0"); @@ -324,6 +340,9 @@ void UIDialog::saveConfig() myPalettePopup->getSelectedTag().toString()); instance().frameBuffer().setUIPalette(); + // Enable HiDPI mode + settings.setValue("hidpi", myHidpiWidget->getState()); + // Dialog position settings.setValue("dialogpos", myPositionPopup->getSelectedTag().toString()); @@ -347,6 +366,7 @@ void UIDialog::setDefaults() { case 0: // Misc. options myPalettePopup->setSelected("standard"); + myHidpiWidget->setState(false); myPositionPopup->setSelected("0"); myListDelayPopup->setValue(300); myWheelLinesPopup->setValue(4); diff --git a/src/gui/UIDialog.hxx b/src/gui/UIDialog.hxx index 5de735433..899265eea 100644 --- a/src/gui/UIDialog.hxx +++ b/src/gui/UIDialog.hxx @@ -63,6 +63,7 @@ class UIDialog : public Dialog, public CommandSender // Misc options PopUpWidget* myPalettePopup; + CheckboxWidget* myHidpiWidget; PopUpWidget* myPositionPopup; SliderWidget* myListDelayPopup; SliderWidget* myWheelLinesPopup;