Rework of isle-config, add resolution adjustment and max framerate settings (#608)

* Add resolution adjustment, framerate limit, etc

- isle-config has been reworked to be a smaller, more organised window
- resolution adjustment has now been added to isle-config, so that the resolution on windowed game start can be set
- max framerate setting added to isle-config
- higher-quality options disabled in isle-config if computer has too little RAM (unlikely)

* Make clang-format happy

* Switch to MxS32, move variable declaration to end

* Adjust sizing of resolution spinboxes

* Add full screen video mode

When full screen is enabled, the game goes full-screen, and the screen resolution changes.

* Rework to add Exclusive Fullscreen option.

* Remove comment

* Raise max LoD value to 60

* Fix tab order

* Simplify code
This commit is contained in:
VoxelTek 2025-07-16 12:29:45 +10:00 committed by GitHub
parent b6a4f65db4
commit 84bd0a1a87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 1017 additions and 627 deletions

View File

@ -58,6 +58,7 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent)
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);
@ -80,7 +81,44 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent)
connect(m_ui->maxActorsSlider, &QSlider::valueChanged, this, &CMainDialog::MaxActorsChanged);
connect(m_ui->maxActorsSlider, &QSlider::sliderMoved, this, &CMainDialog::MaxActorsChanged);
connect(m_ui->aspectRatioComboBox, &QComboBox::currentIndexChanged, this, &CMainDialog::AspectRatioChanged);
connect(m_ui->xResSpinBox, &QSpinBox::valueChanged, this, &CMainDialog::XResChanged);
connect(m_ui->yResSpinBox, &QSpinBox::valueChanged, this, &CMainDialog::YResChanged);
connect(m_ui->framerateSpinBox, &QSpinBox::valueChanged, this, &CMainDialog::FramerateChanged);
layout()->setSizeConstraint(QLayout::SetFixedSize);
if (currentConfigApp->m_ram_quality_limit != 0) {
m_modified = true;
const QString ramError = QString("Insufficient RAM!");
m_ui->sound3DCheckBox->setChecked(false);
m_ui->sound3DCheckBox->setEnabled(false);
m_ui->sound3DCheckBox->setToolTip(ramError);
m_ui->modelQualityHighRadioButton->setEnabled(false);
m_ui->modelQualityHighRadioButton->setToolTip(ramError);
m_ui->modelQualityLowRadioButton->setEnabled(true);
if (currentConfigApp->m_ram_quality_limit == 2) {
m_ui->modelQualityLowRadioButton->setChecked(true);
m_ui->modelQualityMediumRadioButton->setEnabled(false);
m_ui->modelQualityMediumRadioButton->setToolTip(ramError);
m_ui->maxLoDSlider->setMaximum(30);
m_ui->maxActorsSlider->setMaximum(15);
}
else {
m_ui->modelQualityMediumRadioButton->setChecked(true);
m_ui->modelQualityMediumRadioButton->setEnabled(true);
m_ui->maxLoDSlider->setMaximum(40);
m_ui->maxActorsSlider->setMaximum(30);
}
}
else {
m_ui->sound3DCheckBox->setEnabled(true);
m_ui->modelQualityLowRadioButton->setEnabled(true);
m_ui->modelQualityMediumRadioButton->setEnabled(true);
m_ui->modelQualityHighRadioButton->setEnabled(true);
m_ui->maxLoDSlider->setMaximum(60);
m_ui->maxActorsSlider->setMaximum(40);
}
}
CMainDialog::~CMainDialog()
@ -125,6 +163,7 @@ bool CMainDialog::OnInitDialog()
m_ui->LoDNum->setNum((int) currentConfigApp->m_max_lod * 10);
m_ui->maxActorsSlider->setValue(currentConfigApp->m_max_actors);
m_ui->maxActorsNum->setNum(currentConfigApp->m_max_actors);
UpdateInterface();
return true;
}
@ -221,6 +260,8 @@ void CMainDialog::UpdateInterface()
}
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);
@ -231,6 +272,11 @@ void CMainDialog::UpdateInterface()
m_ui->texturePath->setEnabled(currentConfigApp->m_texture_load);
m_ui->texturePathOpen->setEnabled(currentConfigApp->m_texture_load);
m_ui->aspectRatioComboBox->setCurrentIndex(currentConfigApp->m_aspect_ratio);
m_ui->xResSpinBox->setValue(currentConfigApp->m_x_res);
m_ui->yResSpinBox->setValue(currentConfigApp->m_y_res);
m_ui->framerateSpinBox->setValue(static_cast<int>(std::round(1000.0f / currentConfigApp->m_frame_delta)));
}
// FUNCTION: CONFIG 0x004045e0
@ -301,6 +347,14 @@ void CMainDialog::OnCheckboxMusic(bool checked)
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();
}
@ -444,3 +498,59 @@ void CMainDialog::TexturePathEdited()
}
UpdateInterface();
}
void CMainDialog::AspectRatioChanged(int index)
{
currentConfigApp->m_aspect_ratio = index;
EnsureAspectRatio();
m_modified = true;
UpdateInterface();
}
void CMainDialog::XResChanged(int i)
{
currentConfigApp->m_x_res = i;
m_modified = true;
UpdateInterface();
}
void CMainDialog::YResChanged(int i)
{
currentConfigApp->m_y_res = i;
EnsureAspectRatio();
m_modified = true;
UpdateInterface();
}
void CMainDialog::EnsureAspectRatio()
{
if (currentConfigApp->m_aspect_ratio != 3) {
m_ui->xResSpinBox->setReadOnly(true);
switch (currentConfigApp->m_aspect_ratio) {
case 0: {
float standardAspect = 4.0f / 3.0f;
currentConfigApp->m_x_res = static_cast<int>(std::round((currentConfigApp->m_y_res) * standardAspect));
break;
}
case 1: {
float wideAspect = 16.0f / 9.0f;
currentConfigApp->m_x_res = static_cast<int>(std::round((currentConfigApp->m_y_res) * wideAspect));
break;
}
case 2: {
currentConfigApp->m_x_res = currentConfigApp->m_y_res;
break;
}
}
}
else {
m_ui->xResSpinBox->setReadOnly(false);
}
}
void CMainDialog::FramerateChanged(int i)
{
currentConfigApp->m_frame_delta = (1000.0f / static_cast<float>(i));
m_modified = true;
UpdateInterface();
}

View File

@ -42,6 +42,7 @@ private slots:
void OnRadiobuttonTextureHighQuality(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);
@ -57,6 +58,11 @@ private slots:
void MaxActorsChanged(int value);
void SelectTexturePathDialog();
void TexturePathEdited();
void XResChanged(int i);
void YResChanged(int i);
void AspectRatioChanged(int index);
void EnsureAspectRatio();
void FramerateChanged(int i);
};
// SYNTHETIC: CONFIG 0x00403de0

View File

@ -67,9 +67,14 @@ bool CConfigApp::InitInstance()
return FALSE;
}
SDL_DestroyWindow(window);
m_aspect_ratio = 0;
m_x_res = 640;
m_y_res = 480;
m_frame_delta = 10.0f;
m_driver = NULL;
m_device = NULL;
m_full_screen = TRUE;
m_exclusive_full_screen = FALSE;
m_transition_type = 3; // 3: Mosaic
m_wide_view_angle = TRUE;
m_use_joystick = TRUE;
@ -84,6 +89,7 @@ bool CConfigApp::InitInstance()
m_texture_path = "/textures/";
int totalRamMiB = SDL_GetSystemRAM();
if (totalRamMiB < 12) {
m_ram_quality_limit = 2;
m_3d_sound = FALSE;
m_model_quality = 0;
m_texture_quality = 1;
@ -91,6 +97,7 @@ bool CConfigApp::InitInstance()
m_max_actors = 5;
}
else if (totalRamMiB < 20) {
m_ram_quality_limit = 1;
m_3d_sound = FALSE;
m_model_quality = 1;
m_texture_quality = 1;
@ -98,6 +105,7 @@ bool CConfigApp::InitInstance()
m_max_actors = 10;
}
else {
m_ram_quality_limit = 0;
m_model_quality = 2;
m_3d_sound = TRUE;
m_texture_quality = 1;
@ -158,6 +166,7 @@ bool CConfigApp::ReadRegisterSettings()
m_display_bit_depth = iniparser_getint(dict, "isle:Display Bit Depth", -1);
m_flip_surfaces = iniparser_getboolean(dict, "isle:Flip Surfaces", m_flip_surfaces);
m_full_screen = iniparser_getboolean(dict, "isle:Full Screen", m_full_screen);
m_exclusive_full_screen = iniparser_getboolean(dict, "isle:Exclusive Full Screen", m_exclusive_full_screen);
m_transition_type = iniparser_getint(dict, "isle:Transition Type", m_transition_type);
m_touch_scheme = iniparser_getint(dict, "isle:Touch Scheme", m_touch_scheme);
m_3d_video_ram = iniparser_getboolean(dict, "isle:Back Buffers in Video RAM", m_3d_video_ram);
@ -174,6 +183,10 @@ bool CConfigApp::ReadRegisterSettings()
m_max_actors = iniparser_getint(dict, "isle:Max Allowed Extras", m_max_actors);
m_texture_load = iniparser_getboolean(dict, "extensions:texture loader", m_texture_load);
m_texture_path = iniparser_getstring(dict, "texture loader:texture path", m_texture_path.c_str());
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_frame_delta = iniparser_getdouble(dict, "isle:Frame Delta", m_frame_delta);
iniparser_freedict(dict);
return true;
}
@ -230,7 +243,7 @@ bool CConfigApp::ValidateSettings()
is_modified = TRUE;
}
if (m_max_lod < 0.0f || m_max_lod > 5.0f) {
if (m_max_lod < 0.0f || m_max_lod > 6.0f) {
m_max_lod = 3.5f;
is_modified = TRUE;
}
@ -326,6 +339,7 @@ void CConfigApp::WriteRegisterSettings() const
SetIniInt(dict, "isle:Display Bit Depth", m_display_bit_depth);
SetIniBool(dict, "isle:Flip Surfaces", m_flip_surfaces);
SetIniBool(dict, "isle:Full Screen", m_full_screen);
SetIniBool(dict, "isle:Exclusive Full Screen", m_exclusive_full_screen);
SetIniBool(dict, "isle:Wide View Angle", m_wide_view_angle);
SetIniInt(dict, "isle:Transition Type", m_transition_type);
@ -350,6 +364,11 @@ void CConfigApp::WriteRegisterSettings() const
iniparser_set(dict, "isle:Max LOD", std::to_string(m_max_lod).c_str());
SetIniInt(dict, "isle:Max Allowed Extras", m_max_actors);
SetIniInt(dict, "isle:Aspect Ratio", m_aspect_ratio);
SetIniInt(dict, "isle:Horizontal Resolution", m_x_res);
SetIniInt(dict, "isle:Vertical Resolution", m_y_res);
iniparser_set(dict, "isle:Frame Delta", std::to_string(m_frame_delta).c_str());
#undef SetIniBool
#undef SetIniInt

View File

@ -59,12 +59,17 @@ class CConfigApp {
// DECLARE_MESSAGE_MAP()
public:
int m_aspect_ratio;
int m_x_res;
int m_y_res;
float m_frame_delta;
LegoDeviceEnumerate* m_device_enumerator;
MxDriver* m_driver;
Direct3DDeviceInfo* m_device;
int m_display_bit_depth;
bool m_flip_surfaces;
bool m_full_screen;
bool m_exclusive_full_screen;
int m_transition_type;
bool m_3d_video_ram;
bool m_wide_view_angle;
@ -85,6 +90,7 @@ class CConfigApp {
float m_max_lod;
int m_max_actors;
int m_touch_scheme;
int m_ram_quality_limit;
};
extern CConfigApp g_theApp;

File diff suppressed because it is too large Load Diff

View File

@ -175,6 +175,10 @@ IsleApp::IsleApp()
m_cursorSensitivity = 4;
m_touchScheme = LegoInputManager::e_gamepad;
m_haptic = TRUE;
m_xRes = 640;
m_yRes = 480;
m_frameRate = 100.0f;
m_exclusiveFullScreen = FALSE;
}
// FUNCTION: ISLE 0x4011a0
@ -888,6 +892,15 @@ MxResult IsleApp::SetupWindow()
#endif
window = SDL_CreateWindowWithProperties(props);
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)) {
SDL_SetWindowFullscreenMode(window, &closestMode);
}
}
#ifdef MINIWIN
m_windowHandle = reinterpret_cast<HWND>(window);
#else
@ -1040,6 +1053,7 @@ bool IsleApp::LoadConfig()
iniparser_set(dict, "isle:Flip Surfaces", m_flipSurfaces ? "true" : "false");
iniparser_set(dict, "isle:Full Screen", m_fullScreen ? "true" : "false");
iniparser_set(dict, "isle:Exclusive Full Screen", m_exclusiveFullScreen ? "true" : "false");
iniparser_set(dict, "isle:Wide View Angle", m_wideViewAngle ? "true" : "false");
iniparser_set(dict, "isle:3DSound", m_use3dSound ? "true" : "false");
@ -1058,6 +1072,9 @@ bool IsleApp::LoadConfig()
iniparser_set(dict, "isle:Transition Type", SDL_itoa(m_transitionType, buf, 10));
iniparser_set(dict, "isle:Touch Scheme", SDL_itoa(m_touchScheme, buf, 10));
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:Frame Delta", SDL_itoa(m_frameDelta, buf, 10));
#ifdef EXTENSIONS
iniparser_set(dict, "extensions", NULL);
@ -1100,6 +1117,7 @@ bool IsleApp::LoadConfig()
m_flipSurfaces = iniparser_getboolean(dict, "isle:Flip Surfaces", m_flipSurfaces);
m_fullScreen = iniparser_getboolean(dict, "isle:Full Screen", m_fullScreen);
m_exclusiveFullScreen = iniparser_getboolean(dict, "isle:Exclusive Full Screen", m_exclusiveFullScreen);
m_wideViewAngle = iniparser_getboolean(dict, "isle:Wide View Angle", m_wideViewAngle);
m_use3dSound = iniparser_getboolean(dict, "isle:3DSound", m_use3dSound);
m_useMusic = iniparser_getboolean(dict, "isle:Music", m_useMusic);
@ -1128,6 +1146,13 @@ bool IsleApp::LoadConfig()
(MxTransitionManager::TransitionType) iniparser_getint(dict, "isle:Transition Type", m_transitionType);
m_touchScheme = (LegoInputManager::TouchScheme) iniparser_getint(dict, "isle:Touch Scheme", m_touchScheme);
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);
if (!m_fullScreen) {
m_videoParam.GetRect() = MxRect32(0, 0, (m_xRes - 1), (m_yRes - 1));
}
m_frameRate = (1000.0f / iniparser_getdouble(dict, "isle:Frame Delta", m_frameDelta));
m_frameDelta = static_cast<int>(std::round(iniparser_getdouble(dict, "isle:Frame Delta", m_frameDelta)));
const char* deviceId = iniparser_getstring(dict, "isle:3D Device ID", NULL);
if (deviceId != NULL) {

View File

@ -72,7 +72,7 @@ class IsleApp {
char* m_cdPath; // 0x04
char* m_deviceId; // 0x08
char* m_savePath; // 0x0c
MxS32 m_fullScreen; // 0x10
MxBool m_fullScreen; // 0x10
MxS32 m_flipSurfaces; // 0x14
MxS32 m_backBuffersInVram; // 0x18
MxS32 m_using8bit; // 0x1c
@ -107,6 +107,10 @@ class IsleApp {
MxTransitionManager::TransitionType m_transitionType;
LegoInputManager::TouchScheme m_touchScheme;
MxBool m_haptic;
MxS32 m_xRes;
MxS32 m_yRes;
MxFloat m_frameRate;
MxBool m_exclusiveFullScreen;
};
extern IsleApp* g_isle;