diff --git a/src/core/fullscreen_ui.cpp b/src/core/fullscreen_ui.cpp index 39fa0a777..dc5933cbe 100644 --- a/src/core/fullscreen_ui.cpp +++ b/src/core/fullscreen_ui.cpp @@ -4435,6 +4435,10 @@ void FullscreenUI::DrawDisplaySettingsPage() FSUI_CSTR("Stretches the display to match the aspect ratio by multiplying vertically instead of horizontally."), "Display", "StretchVertically", false); + DrawToggleSetting(bsi, FSUI_CSTR("Automatically Resize Window"), + FSUI_CSTR("Automatically resizes the window to match the internal resolution."), "Display", + "AutoResizeWindow", false); + DrawToggleSetting( bsi, FSUI_CSTR("Disable Mailbox Presentation"), FSUI_CSTR("Forces the use of FIFO over Mailbox presentation, i.e. double buffering instead of triple buffering. " @@ -7234,8 +7238,10 @@ TRANSLATE_NOOP("FullscreenUI", "Automatic based on window size"); TRANSLATE_NOOP("FullscreenUI", "Automatic mapping completed for {}."); TRANSLATE_NOOP("FullscreenUI", "Automatic mapping failed for {}."); TRANSLATE_NOOP("FullscreenUI", "Automatic mapping failed, no devices are available."); +TRANSLATE_NOOP("FullscreenUI", "Automatically Resize Window"); TRANSLATE_NOOP("FullscreenUI", "Automatically applies patches to disc images when they are present, currently only PPF is supported."); TRANSLATE_NOOP("FullscreenUI", "Automatically loads and applies cheats on game start. Cheats can break games and saves."); +TRANSLATE_NOOP("FullscreenUI", "Automatically resizes the window to match the internal resolution."); TRANSLATE_NOOP("FullscreenUI", "Automatically saves the emulator state when powering down or exiting. You can then resume directly from where you left off next time."); TRANSLATE_NOOP("FullscreenUI", "Automatically switches to fullscreen mode when the program is started."); TRANSLATE_NOOP("FullscreenUI", "Avoids calls to C++ code, significantly speeding up the recompiler."); diff --git a/src/core/gpu.cpp b/src/core/gpu.cpp index 52fa43188..bc0743296 100644 --- a/src/core/gpu.cpp +++ b/src/core/gpu.cpp @@ -1985,6 +1985,13 @@ void GPU::SetDisplayTexture(GPUTexture* texture, GPUTexture* depth_buffer, s32 v s32 view_height) { DebugAssert(texture); + + if (g_settings.display_auto_resize_window && + (view_width != m_display_texture_view_width || view_height != m_display_texture_view_height)) + { + System::RequestDisplaySize(); + } + m_display_texture = texture; m_display_depth_buffer = depth_buffer; m_display_texture_view_x = view_x; diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 9e01752ab..b368efa8b 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -318,6 +318,7 @@ void Settings::Load(SettingsInterface& si, SettingsInterface& controller_si) display_show_inputs = si.GetBoolValue("Display", "ShowInputs", false); display_show_enhancements = si.GetBoolValue("Display", "ShowEnhancements", false); display_stretch_vertically = si.GetBoolValue("Display", "StretchVertically", false); + display_auto_resize_window = si.GetBoolValue("Display", "AutoResizeWindow", false); display_osd_scale = si.GetFloatValue("Display", "OSDScale", DEFAULT_OSD_SCALE); save_state_compression = ParseSaveStateCompressionModeName( @@ -593,6 +594,7 @@ void Settings::Save(SettingsInterface& si, bool ignore_base) const } si.SetBoolValue("Display", "StretchVertically", display_stretch_vertically); + si.SetBoolValue("Display", "AutoResizeWindow", display_auto_resize_window); si.SetIntValue("CDROM", "ReadaheadSectors", cdrom_readahead_sectors); si.SetStringValue("CDROM", "MechaconVersion", GetCDROMMechVersionName(cdrom_mechacon_version)); diff --git a/src/core/settings.h b/src/core/settings.h index 5d1a5b50e..8abd49825 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -173,6 +173,7 @@ struct Settings bool display_show_inputs : 1 = false; bool display_show_enhancements : 1 = false; bool display_stretch_vertically : 1 = false; + bool display_auto_resize_window : 1 = false; float display_pre_frame_sleep_buffer = DEFAULT_DISPLAY_PRE_FRAME_SLEEP_BUFFER; float display_osd_scale = 100.0f; float gpu_pgxp_tolerance = -1.0f; diff --git a/src/duckstation-qt/graphicssettingswidget.cpp b/src/duckstation-qt/graphicssettingswidget.cpp index 086bdc080..d460cccf8 100644 --- a/src/duckstation-qt/graphicssettingswidget.cpp +++ b/src/duckstation-qt/graphicssettingswidget.cpp @@ -123,6 +123,8 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget* "DisableMailboxPresentation", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.stretchDisplayVertically, "Display", "StretchVertically", false); + SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.automaticallyResizeWindow, "Display", "AutoResizeWindow", + false); #ifdef _WIN32 SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.blitSwapChain, "Display", "UseBlitSwapChain", false); #endif @@ -381,6 +383,9 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget* dialog->registerWidgetHelp( m_ui.stretchDisplayVertically, tr("Stretch Vertically"), tr("Unchecked"), tr("Prefers stretching the display vertically instead of horizontally, when applying the display aspect ratio.")); + dialog->registerWidgetHelp(m_ui.stretchDisplayVertically, tr("Automatically Resize Window"), tr("Unchecked"), + tr("Automatically resizes the window to match the internal resolution. For high " + "internal resolutions, this will create very large windows.")); #ifdef _WIN32 dialog->registerWidgetHelp(m_ui.blitSwapChain, tr("Use Blit Swap Chain"), tr("Unchecked"), tr("Uses a blit presentation model instead of flipping when using the Direct3D 11 " diff --git a/src/duckstation-qt/graphicssettingswidget.ui b/src/duckstation-qt/graphicssettingswidget.ui index 89236ca20..6e7ebfcd4 100644 --- a/src/duckstation-qt/graphicssettingswidget.ui +++ b/src/duckstation-qt/graphicssettingswidget.ui @@ -355,6 +355,13 @@ + + + + Automatically Resize Window + + +