Added and implemented hybrid ratio option on View menu

This commit is contained in:
KDOXG 2025-05-20 22:07:26 -03:00
parent 7baeb26e32
commit 163b80730c
5 changed files with 49 additions and 3 deletions

View File

@ -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}},

View File

@ -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<ScreenLayoutType>(screenLayout),
static_cast<ScreenRotation>(screenRotation),
static_cast<ScreenSizing>(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;

View File

@ -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;

View File

@ -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();

View File

@ -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;