From e65bd269d490e9aa1eab703bb2f3205416f00697 Mon Sep 17 00:00:00 2001 From: VoxelTek <53562267+VoxelTek@users.noreply.github.com> Date: Tue, 15 Jul 2025 10:53:16 +1000 Subject: [PATCH] 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) --- CONFIG/MainDlg.cpp | 94 +++ CONFIG/MainDlg.h | 5 + CONFIG/config.cpp | 16 + CONFIG/config.h | 5 + CONFIG/res/maindialog.ui | 1411 +++++++++++++++++++++----------------- ISLE/isleapp.cpp | 12 +- ISLE/isleapp.h | 2 + 7 files changed, 919 insertions(+), 626 deletions(-) diff --git a/CONFIG/MainDlg.cpp b/CONFIG/MainDlg.cpp index dfba47ea..32001106 100644 --- a/CONFIG/MainDlg.cpp +++ b/CONFIG/MainDlg.cpp @@ -80,7 +80,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(50); + m_ui->maxActorsSlider->setMaximum(40); + } } CMainDialog::~CMainDialog() @@ -125,6 +162,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; } @@ -231,6 +269,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(std::round(1000.0f / currentConfigApp->m_frame_delta))); } // FUNCTION: CONFIG 0x004045e0 @@ -444,3 +487,54 @@ 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(std::round((currentConfigApp->m_y_res) * standardAspect)); + break; + } + case 1: { + float wideAspect = 16.0f / 9.0f; + currentConfigApp->m_x_res = static_cast(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(i)); + m_modified = true; + UpdateInterface(); +} diff --git a/CONFIG/MainDlg.h b/CONFIG/MainDlg.h index 40156790..75f154bb 100644 --- a/CONFIG/MainDlg.h +++ b/CONFIG/MainDlg.h @@ -57,6 +57,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 diff --git a/CONFIG/config.cpp b/CONFIG/config.cpp index c88f779b..52634d76 100644 --- a/CONFIG/config.cpp +++ b/CONFIG/config.cpp @@ -67,6 +67,10 @@ 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; @@ -84,6 +88,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 +96,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 +104,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; @@ -174,6 +181,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; } @@ -350,6 +361,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 diff --git a/CONFIG/config.h b/CONFIG/config.h index 796a5659..a63e8fa4 100644 --- a/CONFIG/config.h +++ b/CONFIG/config.h @@ -59,6 +59,10 @@ 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; @@ -85,6 +89,7 @@ class CConfigApp { float m_max_lod; int m_max_actors; int m_touch_scheme; + int m_ram_quality_limit; }; extern CConfigApp g_theApp; diff --git a/CONFIG/res/maindialog.ui b/CONFIG/res/maindialog.ui index 526c31d8..f2681adf 100644 --- a/CONFIG/res/maindialog.ui +++ b/CONFIG/res/maindialog.ui @@ -6,8 +6,8 @@ 0 0 - 550 - 700 + 600 + 480 @@ -68,654 +68,817 @@ - - - - 0 - 0 - + + + 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 50 - 16777215 - - - - Open - - - - - - - - 0 - 0 - - - - - 50 - 16777215 - - - - Open - - - - - - - - 0 - 0 - - - - Save Path: - - - Qt::PlainText - - - - - - - Path to the game data files. -Set this to the CD image root. - - - - - - - Folder where save files are kept. - - - - - - - - 0 - 0 - - - - Data Path: - - - Qt::PlainText - - - - - - - - - - - 0 - 80 - - - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Maximum number of LEGO actors to exist in the world at a time. -The game will gradually increase the number of actors until this maximum is reached and while performance is acceptable. - - - Maximum Actors (5..40) - - + + + Game + + + + - - - - 0 - 0 - - - - 5 - - - 40 - - - 5 - - - 20 - - - 20 - - - false - - - Qt::Horizontal - - - QSlider::NoTicks - - - 5 - - - - - - - - 0 - 0 - - - - - 15 - 0 - - - - 20 - - - - - - - - - - - 0 - 0 - - - - - 0 - 70 - - - - Maximum Level of Detail (LOD). -A higher setting will cause higher quality textures to be drawn regardless of distance. - - - Maximum LOD - - - - - - - 0 - 0 - - - - 50 - - - 5 - - - 10 - - - 35 - - - false - - - Qt::Horizontal - - - QSlider::NoTicks - - - 10 - - - - - - - - 0 - 0 - - - - - 15 - 0 - - - - 35 - - - - - - - - - - - 0 - 0 - - - - Set 3D model detail level. - - - Island Model Quality - - - - + - Broken, not recommended. - - - color: rgb(255, 0, 0); + Enable 3D positional audio effects. - Low - BROKEN! + 3D Sound - - - Medium + + + Enable in-game background music. - - - - - High + Music - - - - - - true - - - - 0 - 0 - - - - Set texture detail level. - - - Island Texture Quality - - - false - - - - 0 + + + + + Qt::Orientation::Vertical - - 0 + + + 20 + 40 + - - - - Fast - - - - - - - High - - - - - - - - - - - - - - 0 - 0 - - - - - 0 - - - 0 - - - - - Enable 3D positional audio effects. - - - 3D Sound - - - - - - - Enable in-game background music. - - - Music - - - - - - - Toggle fullscreen display mode. - - - Fullscreen - - - - - - - true - - - Enable controller rumble. - - - Rumble - - - true - - - - - - - - - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Sets the transition effect to be used in game. - - - Transition Type - - - - - - Mosaic - - - 3 - - - - Idle - Broken - - - - - No Animation - - - - - Dissolve - - - - + + + + + + + 0 + 0 + + + + Sets the transition effect to be used in game. + + + Transition Type + + + + + Mosaic - - - - Wipe Down + + 3 - - - - Windows + + + Idle - Broken + + + + + No Animation + + + + + Dissolve + + + + + Mosaic + + + + + Wipe Down + + + + + Windows + + + + + Unknown - Broken + + + + + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + + + Folder where save files are kept. - - - - Unknown - Broken + + + + + + Path to the game data files. +Set this to the CD image root. - - - - - - - - - - <html><head/><body><p><span style=" font-weight:600;">Virtual Gamepad (Recommended):</span> Slide your finger to move and turn.</p><p><span style=" font-weight:600;">Virtual Arrow Keys:</span> Tap screen areas to move. The top moves forward, the bottom turns or moves back.</p><p><span style=" font-weight:600;">Virtual Mouse:</span> Emulates classic mouse controls with touch.</p></body></html> - - - Touch Control Scheme - - - - - - 2 - - - - Virtual Mouse + + + + + + + 0 + 0 + - - - Virtual Arrow Keys + Data Path: + + + Qt::TextFormat::PlainText + + + + + + + + 0 + 0 + + + + + 50 + 16777215 + - - - Virtual Gamepad + Open - - - - - - - - - - - - - Texture Loader Extension - - - - - - false - - - Path to texture replacements. - - - textures/ - - - - - - - false - - - - 0 - 0 - - - - - 50 - 16777215 - - - - Open - - - - - - - Enabled - - - - - - - - - - - 0 - 0 - - - - 3D graphics device used to render the game. - - - Graphics Devices - - - false - - - - 6 - - - 6 - - - 6 - - - 6 - - - - - true - - - - 0 - 0 - - - - - 16777215 - 100 - - - - QAbstractItemView::NoEditTriggers - - - true - - - QAbstractItemView::SelectItems - - - - + + + + + + + 0 + 0 + + + + Save Path: + + + Qt::TextFormat::PlainText + + + + + + + + 0 + 0 + + + + + 50 + 16777215 + + + + Open + + + + + + + + + + + Graphics + + + + + + + 0 + 0 + + + + + 0 + 70 + + + + Maximum Level of Detail (LOD). +A higher setting will cause higher quality textures to be drawn regardless of distance. + + + Maximum LOD + + + + + + + 0 + 0 + + + + 50 + + + 5 + + + 10 + + + 35 + + + false + + + Qt::Orientation::Horizontal + + + QSlider::TickPosition::NoTicks + + + 10 + + + + + + + + 0 + 0 + + + + + 15 + 0 + + + + 35 + + + + + + + + + + + 0 + 0 + + + + 3D graphics device used to render the game. + + + Graphics Devices + + + false + + + + 6 + + + 6 + + + 6 + + + 6 + + + + + true + + + + 0 + 0 + + + + + 16777215 + 100 + + + + QAbstractItemView::EditTrigger::NoEditTriggers + + + true + + + QAbstractItemView::SelectionBehavior::SelectItems + + + + + + + + + + true + + + + 0 + 0 + + + + Set texture detail level. + + + Island Texture Quality + + + false + + + + 0 + + + 0 + + + + + Fast + + + + + + + High + + + + + + + + + + + 0 + 0 + + + + Maximum number of LEGO actors to exist in the world at a time. +The game will gradually increase the number of actors until this maximum is reached and while performance is acceptable. + + + Maximum Actors + + + + + + + 0 + 0 + + + + 5 + + + 40 + + + 5 + + + 20 + + + 20 + + + false + + + Qt::Orientation::Horizontal + + + QSlider::TickPosition::NoTicks + + + 5 + + + + + + + + 0 + 0 + + + + + 15 + 0 + + + + 20 + + + + + + + + + + + 0 + 0 + + + + Set 3D model detail level. + + + Island Model Quality + + + + + + Broken, not recommended. + + + color: rgb(255, 0, 0); + + + Low - BROKEN! + + + + + + + Medium + + + + + + + High + + + + + + + + + + + Display + + + + + + Resolution + + + + + + 0 + + + + Standard (4:3) + + + + + Widescreen (16:9) + + + + + Square (1:1) + + + + + Custom + + + + + + + + + + Qt::AlignmentFlag::AlignCenter + + + true + + + 10000 + + + 640 + + + 10 + + + + + + + + 0 + 0 + + + + x + + + Qt::AlignmentFlag::AlignCenter + + + + + + + true + + + Qt::AlignmentFlag::AlignCenter + + + 10000 + + + 480 + + + + + + + + + + + + Screen + + + + + + fps + + + Max Framerate: + + + 200 + + + 100 + + + + + + + Toggle fullscreen display mode. + + + Fullscreen + + + + + + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + + + + + + Controls + + + + + + <html><head/><body><p><span style=" font-weight:600;">Virtual Gamepad (Recommended):</span> Slide your finger to move and turn.</p><p><span style=" font-weight:600;">Virtual Arrow Keys:</span> Tap screen areas to move. The top moves forward, the bottom turns or moves back.</p><p><span style=" font-weight:600;">Virtual Mouse:</span> Emulates classic mouse controls with touch.</p></body></html> + + + Touch Control Scheme + + + + + + 2 + + + + Virtual Mouse + + + + + Virtual Arrow Keys + + + + + Virtual Gamepad + + + + + + + + + + + true + + + Enable controller rumble. + + + Rumble + + + true + + + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + + + + + + Extensions + + + + + + Texture Loader Extension + + + + + + Enabled + + + + + + + false + + + Path to texture replacements. + + + textures/ + + + + + + + false + + + + 0 + 0 + + + + + 50 + 16777215 + + + + Open + + + + + + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + + + @@ -795,8 +958,6 @@ A higher setting will cause higher quality textures to be drawn regardless of di modelQualityHighRadioButton maxLoDSlider maxActorsSlider - sound3DCheckBox - musicCheckBox devicesList okButton launchButton diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 867f1744..cb16ecf2 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -124,6 +124,8 @@ extern const char* g_files[46]; // FUNCTION: ISLE 0x401000 IsleApp::IsleApp() { + m_xRes = 640; + m_yRes = 480; m_hdPath = NULL; m_cdPath = NULL; m_deviceId = NULL; @@ -153,7 +155,7 @@ IsleApp::IsleApp() m_videoParam = MxVideoParam(r, NULL, 1, flags); } #else - m_videoParam = MxVideoParam(MxRect32(0, 0, 639, 479), NULL, 1, MxVideoParamFlags()); + m_videoParam = MxVideoParam(MxRect32(0, 0, (m_xRes - 1), (m_yRes - 1)), NULL, 1, MxVideoParamFlags()); #endif m_videoParam.Flags().Set16Bit(MxDirectDraw::GetPrimaryBitDepth() == 16); @@ -1013,6 +1015,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); @@ -1085,6 +1090,11 @@ 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); + m_videoParam.GetRect() = MxRect32(0, 0, (m_xRes - 1), (m_yRes - 1)); + m_frameDelta = static_cast(std::round(iniparser_getdouble(dict, "isle:Frame Delta", m_frameDelta))); + const char* deviceId = iniparser_getstring(dict, "isle:3D Device ID", NULL); if (deviceId != NULL) { diff --git a/ISLE/isleapp.h b/ISLE/isleapp.h index 4bec7dd6..f321fca2 100644 --- a/ISLE/isleapp.h +++ b/ISLE/isleapp.h @@ -108,6 +108,8 @@ class IsleApp { MxTransitionManager::TransitionType m_transitionType; LegoInputManager::TouchScheme m_touchScheme; MxBool m_haptic; + int m_xRes; + int m_yRes; }; extern IsleApp* g_isle;