mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-02 20:11:15 +00:00
Add dropdown for exclusive fullscreen resolutions
This commit is contained in:
parent
e86fd71560
commit
f642707159
@ -13,6 +13,7 @@
|
||||
#include <QKeyEvent>
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <mxdirectx/legodxinfo.h>
|
||||
#include <ui_maindialog.h>
|
||||
|
||||
@ -54,15 +55,33 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent)
|
||||
this,
|
||||
&CMainDialog::OnRadiobuttonTextureHighQuality
|
||||
);
|
||||
|
||||
connect(
|
||||
m_ui->windowedRadioButton,
|
||||
&QRadioButton::toggled,
|
||||
this,
|
||||
&CMainDialog::OnRadioWindowed
|
||||
);
|
||||
connect(
|
||||
m_ui->fullscreenRadioButton,
|
||||
&QRadioButton::toggled,
|
||||
this,
|
||||
&CMainDialog::OnRadioFullscreen
|
||||
);
|
||||
connect(
|
||||
m_ui->exFullscreenRadioButton,
|
||||
&QRadioButton::toggled,
|
||||
this,
|
||||
&CMainDialog::OnRadioExclusiveFullscreen
|
||||
);
|
||||
connect(m_ui->devicesList, &QListWidget::currentRowChanged, this, &CMainDialog::OnList3DevicesSelectionChanged);
|
||||
connect(m_ui->musicCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxMusic);
|
||||
connect(m_ui->sound3DCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckbox3DSound);
|
||||
connect(m_ui->fullscreenCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxFullscreen);
|
||||
connect(m_ui->exclusiveFullscreenCheckbox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxExclusiveFullscreen);
|
||||
connect(m_ui->rumbleCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxRumble);
|
||||
connect(m_ui->textureCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxTexture);
|
||||
connect(m_ui->touchComboBox, &QComboBox::currentIndexChanged, this, &CMainDialog::TouchControlsChanged);
|
||||
connect(m_ui->transitionTypeComboBox, &QComboBox::currentIndexChanged, this, &CMainDialog::TransitionTypeChanged);
|
||||
connect(m_ui->exFullResComboBox, &QComboBox::currentIndexChanged, this, &CMainDialog::ExclusiveResolutionChanged);
|
||||
connect(m_ui->okButton, &QPushButton::clicked, this, &CMainDialog::accept);
|
||||
connect(m_ui->cancelButton, &QPushButton::clicked, this, &CMainDialog::reject);
|
||||
connect(m_ui->launchButton, &QPushButton::clicked, this, &CMainDialog::launch);
|
||||
@ -164,6 +183,20 @@ bool CMainDialog::OnInitDialog()
|
||||
m_ui->maxActorsSlider->setValue(currentConfigApp->m_max_actors);
|
||||
m_ui->maxActorsNum->setNum(currentConfigApp->m_max_actors);
|
||||
|
||||
m_ui->exFullResComboBox->clear();
|
||||
|
||||
int displayModeCount;
|
||||
displayModes = SDL_GetFullscreenDisplayModes(SDL_GetPrimaryDisplay(), &displayModeCount);
|
||||
|
||||
for (int i = 0; i < displayModeCount; ++i) {
|
||||
QString mode = QString("%1x%2 @ %3Hz").arg(displayModes[i]->w).arg(displayModes[i]->h).arg(displayModes[i]->refresh_rate);
|
||||
m_ui->exFullResComboBox->addItem(mode);
|
||||
|
||||
if ((displayModes[i]->w == currentConfigApp->m_exf_x_res) && (displayModes[i]->h == currentConfigApp->m_exf_y_res) && (displayModes[i]->refresh_rate == currentConfigApp->m_exf_fps)) {
|
||||
m_ui->exFullResComboBox->setCurrentIndex(i);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateInterface();
|
||||
return true;
|
||||
}
|
||||
@ -258,10 +291,22 @@ void CMainDialog::UpdateInterface()
|
||||
else {
|
||||
m_ui->textureQualityHighRadioButton->setChecked(true);
|
||||
}
|
||||
if (currentConfigApp->m_exclusive_full_screen) {
|
||||
m_ui->exFullscreenRadioButton->setChecked(true);
|
||||
m_ui->resolutionBox->setEnabled(false);
|
||||
m_ui->exFullResContainer->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
m_ui->resolutionBox->setEnabled(true);
|
||||
m_ui->exFullResContainer->setEnabled(false);
|
||||
if (currentConfigApp->m_full_screen) {
|
||||
m_ui->fullscreenRadioButton->setChecked(true);
|
||||
}
|
||||
else {
|
||||
m_ui->windowedRadioButton->setChecked(true);
|
||||
}
|
||||
}
|
||||
m_ui->musicCheckBox->setChecked(currentConfigApp->m_music);
|
||||
m_ui->fullscreenCheckBox->setChecked(currentConfigApp->m_full_screen);
|
||||
m_ui->exclusiveFullscreenCheckbox->setEnabled(currentConfigApp->m_full_screen);
|
||||
m_ui->exclusiveFullscreenCheckbox->setChecked(currentConfigApp->m_exclusive_full_screen);
|
||||
m_ui->rumbleCheckBox->setChecked(currentConfigApp->m_haptic);
|
||||
m_ui->touchComboBox->setCurrentIndex(currentConfigApp->m_touch_scheme);
|
||||
m_ui->transitionTypeComboBox->setCurrentIndex(currentConfigApp->m_transition_type);
|
||||
@ -336,6 +381,41 @@ void CMainDialog::OnRadiobuttonTextureHighQuality(bool checked)
|
||||
}
|
||||
}
|
||||
|
||||
void CMainDialog::OnRadioWindowed(bool checked) {
|
||||
if (checked) {
|
||||
currentConfigApp->m_full_screen = false;
|
||||
currentConfigApp->m_exclusive_full_screen = false;
|
||||
m_ui->resolutionBox->setEnabled(true);
|
||||
m_ui->exFullResContainer->setEnabled(false);
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
}
|
||||
|
||||
void CMainDialog::OnRadioFullscreen(bool checked)
|
||||
{
|
||||
if (checked) {
|
||||
currentConfigApp->m_full_screen = true;
|
||||
currentConfigApp->m_exclusive_full_screen = false;
|
||||
m_ui->resolutionBox->setEnabled(true);
|
||||
m_ui->exFullResContainer->setEnabled(false);
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
}
|
||||
|
||||
void CMainDialog::OnRadioExclusiveFullscreen(bool checked)
|
||||
{
|
||||
if (checked) {
|
||||
currentConfigApp->m_full_screen = true;
|
||||
currentConfigApp->m_exclusive_full_screen = true;
|
||||
m_ui->resolutionBox->setEnabled(false);
|
||||
m_ui->exFullResContainer->setEnabled(true);
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004048c0
|
||||
void CMainDialog::OnCheckboxMusic(bool checked)
|
||||
{
|
||||
@ -344,21 +424,6 @@ void CMainDialog::OnCheckboxMusic(bool checked)
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
void CMainDialog::OnCheckboxFullscreen(bool checked)
|
||||
{
|
||||
currentConfigApp->m_full_screen = checked;
|
||||
m_ui->exclusiveFullscreenCheckbox->setEnabled(checked);
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
void CMainDialog::OnCheckboxExclusiveFullscreen(bool checked)
|
||||
{
|
||||
currentConfigApp->m_exclusive_full_screen = checked;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
void CMainDialog::OnCheckboxRumble(bool checked)
|
||||
{
|
||||
currentConfigApp->m_haptic = checked;
|
||||
@ -387,6 +452,15 @@ void CMainDialog::TransitionTypeChanged(int index)
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
void CMainDialog::ExclusiveResolutionChanged(int index)
|
||||
{
|
||||
currentConfigApp->m_exf_x_res = displayModes[index]->w;
|
||||
currentConfigApp->m_exf_y_res = displayModes[index]->h;
|
||||
currentConfigApp->m_exf_fps = displayModes[index]->refresh_rate;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
void CMainDialog::SelectDataPathDialog()
|
||||
{
|
||||
QString data_path = QString::fromStdString(currentConfigApp->m_cd_path);
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include <QFileDialog>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@ -29,6 +30,7 @@ class CMainDialog : public QDialog {
|
||||
bool m_modified = false;
|
||||
bool m_advanced = false;
|
||||
Ui::MainDialog* m_ui = nullptr;
|
||||
SDL_DisplayMode ** displayModes;
|
||||
|
||||
void keyReleaseEvent(QKeyEvent* event) override;
|
||||
bool OnInitDialog();
|
||||
@ -40,13 +42,15 @@ private slots:
|
||||
void OnRadiobuttonModelHighQuality(bool checked);
|
||||
void OnRadiobuttonTextureLowQuality(bool checked);
|
||||
void OnRadiobuttonTextureHighQuality(bool checked);
|
||||
void OnRadioWindowed(bool checked);
|
||||
void OnRadioFullscreen(bool checked);
|
||||
void OnRadioExclusiveFullscreen(bool checked);
|
||||
void OnCheckboxMusic(bool checked);
|
||||
void OnCheckboxFullscreen(bool checked);
|
||||
void OnCheckboxExclusiveFullscreen(bool checked);
|
||||
void OnCheckboxRumble(bool checked);
|
||||
void OnCheckboxTexture(bool checked);
|
||||
void TouchControlsChanged(int index);
|
||||
void TransitionTypeChanged(int index);
|
||||
void ExclusiveResolutionChanged(int index);
|
||||
void accept() override;
|
||||
void reject() override;
|
||||
void launch();
|
||||
|
||||
@ -68,8 +68,9 @@ bool CConfigApp::InitInstance()
|
||||
}
|
||||
SDL_DestroyWindow(window);
|
||||
m_aspect_ratio = 0;
|
||||
m_x_res = 640;
|
||||
m_y_res = 480;
|
||||
m_exf_x_res = m_x_res = 640;
|
||||
m_exf_y_res = m_y_res = 480;
|
||||
m_exf_fps = 60.00f;
|
||||
m_frame_delta = 10.0f;
|
||||
m_driver = NULL;
|
||||
m_device = NULL;
|
||||
@ -186,6 +187,9 @@ bool CConfigApp::ReadRegisterSettings()
|
||||
m_aspect_ratio = iniparser_getint(dict, "isle:Aspect Ratio", m_aspect_ratio);
|
||||
m_x_res = iniparser_getint(dict, "isle:Horizontal Resolution", m_x_res);
|
||||
m_y_res = iniparser_getint(dict, "isle:Vertical Resolution", m_y_res);
|
||||
m_exf_x_res = iniparser_getint(dict, "isle:Exclusive X Resolution", m_exf_x_res);
|
||||
m_exf_y_res = iniparser_getint(dict, "isle:Exclusive Y Resolution", m_exf_y_res);
|
||||
m_exf_fps = iniparser_getdouble(dict, "isle:Exclusive Framerate", m_exf_fps);
|
||||
m_frame_delta = iniparser_getdouble(dict, "isle:Frame Delta", m_frame_delta);
|
||||
iniparser_freedict(dict);
|
||||
return true;
|
||||
@ -259,7 +263,10 @@ bool CConfigApp::ValidateSettings()
|
||||
m_touch_scheme = 2;
|
||||
is_modified = TRUE;
|
||||
}
|
||||
|
||||
if (m_exclusive_full_screen && !m_full_screen) {
|
||||
m_full_screen = TRUE;
|
||||
is_modified = TRUE;
|
||||
}
|
||||
return is_modified;
|
||||
}
|
||||
|
||||
@ -367,6 +374,9 @@ void CConfigApp::WriteRegisterSettings() const
|
||||
SetIniInt(dict, "isle:Aspect Ratio", m_aspect_ratio);
|
||||
SetIniInt(dict, "isle:Horizontal Resolution", m_x_res);
|
||||
SetIniInt(dict, "isle:Vertical Resolution", m_y_res);
|
||||
SetIniInt(dict, "isle:Exclusive X Resolution", m_exf_x_res);
|
||||
SetIniInt(dict, "isle:Exclusive Y Resolution", m_exf_y_res);
|
||||
iniparser_set(dict, "isle:Exclusive Framerate", std::to_string(m_exf_fps).c_str());
|
||||
iniparser_set(dict, "isle:Frame Delta", std::to_string(m_frame_delta).c_str());
|
||||
|
||||
#undef SetIniBool
|
||||
|
||||
@ -62,6 +62,9 @@ class CConfigApp {
|
||||
int m_aspect_ratio;
|
||||
int m_x_res;
|
||||
int m_y_res;
|
||||
int m_exf_x_res;
|
||||
int m_exf_y_res;
|
||||
float m_exf_fps;
|
||||
float m_frame_delta;
|
||||
LegoDeviceEnumerate* m_device_enumerator;
|
||||
MxDriver* m_driver;
|
||||
|
||||
@ -623,25 +623,23 @@ The game will gradually increase the number of actors until this maximum is reac
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="fullscreenCheckboxContainer">
|
||||
<layout class="QVBoxLayout" name="fullscreenRadioContainer">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="fullscreenCheckBox">
|
||||
<property name="toolTip">
|
||||
<string>Toggle fullscreen display mode.</string>
|
||||
<widget class="QRadioButton" name="windowedRadioButton">
|
||||
<property name="text">
|
||||
<string>Windowed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="fullscreenRadioButton">
|
||||
<property name="text">
|
||||
<string>Fullscreen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="exclusiveFullscreenCheckbox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Grants the app full control of the display for better performance and lower input lag. May cause slower alt-tabbing.</string>
|
||||
</property>
|
||||
<widget class="QRadioButton" name="exFullscreenRadioButton">
|
||||
<property name="text">
|
||||
<string>Exclusive Fullscreen</string>
|
||||
</property>
|
||||
@ -764,6 +762,25 @@ The game will gradually increase the number of actors until this maximum is reac
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="exFullResContainer">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Exclusive Fullscreen Resolution</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QComboBox" name="exFullResComboBox">
|
||||
<property name="placeholderText">
|
||||
<string>Resolution</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
@ -1007,8 +1024,6 @@ The game will gradually increase the number of actors until this maximum is reac
|
||||
<tabstop>maxLoDSlider</tabstop>
|
||||
<tabstop>maxActorsSlider</tabstop>
|
||||
<tabstop>devicesList</tabstop>
|
||||
<tabstop>fullscreenCheckBox</tabstop>
|
||||
<tabstop>exclusiveFullscreenCheckbox</tabstop>
|
||||
<tabstop>framerateSpinBox</tabstop>
|
||||
<tabstop>aspectRatioComboBox</tabstop>
|
||||
<tabstop>xResSpinBox</tabstop>
|
||||
|
||||
@ -177,6 +177,9 @@ IsleApp::IsleApp()
|
||||
m_haptic = TRUE;
|
||||
m_xRes = 640;
|
||||
m_yRes = 480;
|
||||
m_exclusiveXRes = m_xRes;
|
||||
m_exclusiveYRes = m_yRes;
|
||||
m_exclusiveFrameRate = 60.00f;
|
||||
m_frameRate = 100.0f;
|
||||
m_exclusiveFullScreen = FALSE;
|
||||
}
|
||||
@ -915,7 +918,7 @@ MxResult IsleApp::SetupWindow()
|
||||
if (m_exclusiveFullScreen && m_fullScreen) {
|
||||
SDL_DisplayMode closestMode;
|
||||
SDL_DisplayID displayID = SDL_GetDisplayForWindow(window);
|
||||
if (SDL_GetClosestFullscreenDisplayMode(displayID, m_xRes, m_yRes, m_frameRate, true, &closestMode)) {
|
||||
if (SDL_GetClosestFullscreenDisplayMode(displayID, m_exclusiveXRes, m_exclusiveYRes, m_exclusiveFrameRate, true, &closestMode)) {
|
||||
SDL_SetWindowFullscreenMode(window, &closestMode);
|
||||
}
|
||||
}
|
||||
@ -1093,6 +1096,9 @@ bool IsleApp::LoadConfig()
|
||||
iniparser_set(dict, "isle:Haptic", m_haptic ? "true" : "false");
|
||||
iniparser_set(dict, "isle:Horizontal Resolution", SDL_itoa(m_xRes, buf, 10));
|
||||
iniparser_set(dict, "isle:Vertical Resolution", SDL_itoa(m_yRes, buf, 10));
|
||||
iniparser_set(dict, "isle:Exclusive X Resolution", SDL_itoa(m_exclusiveXRes, buf, 10));
|
||||
iniparser_set(dict, "isle:Exclusive Y Resolution", SDL_itoa(m_exclusiveYRes, buf, 10));
|
||||
iniparser_set(dict, "isle:Exclusive Framerate", SDL_itoa(m_exclusiveFrameRate, buf, 10));
|
||||
iniparser_set(dict, "isle:Frame Delta", SDL_itoa(m_frameDelta, buf, 10));
|
||||
|
||||
#ifdef EXTENSIONS
|
||||
@ -1167,6 +1173,9 @@ bool IsleApp::LoadConfig()
|
||||
m_haptic = iniparser_getboolean(dict, "isle:Haptic", m_haptic);
|
||||
m_xRes = iniparser_getint(dict, "isle:Horizontal Resolution", m_xRes);
|
||||
m_yRes = iniparser_getint(dict, "isle:Vertical Resolution", m_yRes);
|
||||
m_exclusiveXRes = iniparser_getint(dict, "isle:Exclusive X Resolution", m_exclusiveXRes);
|
||||
m_exclusiveYRes = iniparser_getint(dict, "isle:Exclusive Y Resolution", m_exclusiveXRes);
|
||||
m_exclusiveFrameRate = iniparser_getdouble(dict, "isle:Exclusive Framerate", m_exclusiveFrameRate);
|
||||
if (!m_fullScreen) {
|
||||
m_videoParam.GetRect() = MxRect32(0, 0, (m_xRes - 1), (m_yRes - 1));
|
||||
}
|
||||
|
||||
@ -109,6 +109,9 @@ class IsleApp {
|
||||
MxBool m_haptic;
|
||||
MxS32 m_xRes;
|
||||
MxS32 m_yRes;
|
||||
MxS32 m_exclusiveXRes;
|
||||
MxS32 m_exclusiveYRes;
|
||||
MxFloat m_exclusiveFrameRate;
|
||||
MxFloat m_frameRate;
|
||||
MxBool m_exclusiveFullScreen;
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user