diff --git a/src/frontend/qt_sdl/Config.cpp b/src/frontend/qt_sdl/Config.cpp index 73161809..4be23c99 100644 --- a/src/frontend/qt_sdl/Config.cpp +++ b/src/frontend/qt_sdl/Config.cpp @@ -85,6 +85,7 @@ RangeList IntRanges = {"Mic.InputType", {0, micInputType_MAX-1}}, {"Instance*.Window*.ScreenRotation", {0, screenRot_MAX-1}}, {"Instance*.Window*.ScreenGap", {0, 500}}, + {"Instance*.Window*.HybridRatio", {0, 960}}, {"Instance*.Window*.ScreenLayout", {0, screenLayout_MAX-1}}, {"Instance*.Window*.ScreenSizing", {0, screenSizing_MAX-1}}, {"Instance*.Window*.ScreenAspectTop", {0, AspectRatiosNum-1}}, diff --git a/src/frontend/qt_sdl/Screen.cpp b/src/frontend/qt_sdl/Screen.cpp index bc63d3ac..305ef325 100644 --- a/src/frontend/qt_sdl/Screen.cpp +++ b/src/frontend/qt_sdl/Screen.cpp @@ -118,13 +118,16 @@ void ScreenPanel::loadConfig() auto& cfg = mainWindow->getWindowConfig(); screenRotation = cfg.GetInt("ScreenRotation"); - screenGap = cfg.GetInt("ScreenGap"); screenLayout = cfg.GetInt("ScreenLayout"); + screenGap = cfg.GetInt("ScreenGap"); + hybridRatio = cfg.GetInt("HybridRatio"); screenSwap = cfg.GetBool("ScreenSwap"); screenSizing = cfg.GetInt("ScreenSizing"); integerScaling = cfg.GetBool("IntegerScaling"); screenAspectTop = cfg.GetInt("ScreenAspectTop"); screenAspectBot = cfg.GetInt("ScreenAspectBot"); + + currentScreenGap = screenLayout != screenLayout_Hybrid ? screenGap : hybridRatio; } void ScreenPanel::setFilter(bool filter) @@ -168,7 +171,7 @@ void ScreenPanel::setupScreenLayout() static_cast(screenLayout), static_cast(screenRotation), static_cast(sizing), - screenGap, + currentScreenGap, integerScaling != 0, screenSwap != 0, aspectTop, @@ -183,7 +186,7 @@ QSize ScreenPanel::screenGetMinSize(int factor = 1) { bool isHori = (screenRotation == screenRot_90Deg || screenRotation == screenRot_270Deg); - int gap = screenGap * factor; + int gap = currentScreenGap * factor; int w = 256 * factor; int h = 192 * factor; diff --git a/src/frontend/qt_sdl/Screen.h b/src/frontend/qt_sdl/Screen.h index a988815e..4fb84c14 100644 --- a/src/frontend/qt_sdl/Screen.h +++ b/src/frontend/qt_sdl/Screen.h @@ -82,12 +82,15 @@ protected: int screenRotation; int screenGap; + int hybridRatio; int screenLayout; bool screenSwap; int screenSizing; bool integerScaling; int screenAspectTop, screenAspectBot; + int currentScreenGap; + int autoScreenSizing; ScreenLayout layout; diff --git a/src/frontend/qt_sdl/Window.cpp b/src/frontend/qt_sdl/Window.cpp index 661a5af1..e830d32a 100644 --- a/src/frontend/qt_sdl/Window.cpp +++ b/src/frontend/qt_sdl/Window.cpp @@ -511,6 +511,24 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) : connect(grpScreenGap, &QActionGroup::triggered, this, &MainWindow::onChangeScreenGap); } + { + QMenu * submenu = menu->addMenu("Hybrid ratio"); + grpHybridRatio = new QActionGroup(submenu); + + const char *hybridRatio[] = {"2:1", "3:1", "4:1", "5:1", "6:1", "7:1", "5:2", "7:3", "9:4"}; + const int screengap[] = {0, 192, 384, 576, 768, 960, 96, 64, 48}; + + for (int i = 0; i < 9; i++) + { + int screenGapData = screengap[i]; + actHybridRatio[i] = submenu->addAction(QString(hybridRatio[i])); + actHybridRatio[i]->setActionGroup(grpHybridRatio); + actHybridRatio[i]->setData(QVariant(screenGapData)); + actHybridRatio[i]->setCheckable(true); + } + + connect(grpHybridRatio, &QActionGroup::triggered, this, &MainWindow::onChangeHybridRatio); + } { QMenu * submenu = menu->addMenu("Screen layout"); grpScreenLayout = new QActionGroup(submenu); @@ -750,6 +768,16 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) : } } + int hybridRatio = windowCfg.GetInt("HybridRatio"); + for (int i = 0; i < 9; i++) + { + if (actHybridRatio[i]->data() == hybridRatio) + { + actHybridRatio[i]->setChecked(true); + break; + } + } + actScreenLayout[windowCfg.GetInt("ScreenLayout")]->setChecked(true); actScreenSizing[windowCfg.GetInt("ScreenSizing")]->setChecked(true); actIntegerScaling->setChecked(windowCfg.GetBool("IntegerScaling")); @@ -2037,6 +2065,14 @@ void MainWindow::onChangeScreenGap(QAction* act) emit screenLayoutChange(); } +void MainWindow::onChangeHybridRatio(QAction* act) +{ + int gap = act->data().toInt(); + windowCfg.SetInt("HybridRatio", gap); + + emit screenLayoutChange(); +} + void MainWindow::onChangeScreenLayout(QAction* act) { int layout = act->data().toInt(); diff --git a/src/frontend/qt_sdl/Window.h b/src/frontend/qt_sdl/Window.h index 9f652f54..704864c7 100644 --- a/src/frontend/qt_sdl/Window.h +++ b/src/frontend/qt_sdl/Window.h @@ -217,6 +217,7 @@ private slots: void onChangeScreenSize(); void onChangeScreenRotation(QAction* act); void onChangeScreenGap(QAction* act); + void onChangeHybridRatio(QAction* act); void onChangeScreenLayout(QAction* act); void onChangeScreenSwap(bool checked); void onChangeScreenSizing(QAction* act); @@ -335,6 +336,8 @@ public: QAction* actScreenRotation[screenRot_MAX]; QActionGroup* grpScreenGap; QAction* actScreenGap[6]; + QActionGroup* grpHybridRatio; + QAction* actHybridRatio[9]; QActionGroup* grpScreenLayout; QAction* actScreenLayout[screenLayout_MAX]; QAction* actScreenSwap;