From 2ccf09d429abc327ec4104668c3f622f9be38bb4 Mon Sep 17 00:00:00 2001 From: VoxelTek <53562267+VoxelTek@users.noreply.github.com> Date: Tue, 12 Aug 2025 12:13:18 +1000 Subject: [PATCH 1/4] Add options for `si loader` extension to `isle-config`. (#667) * Begin work on adding SI extension to cfg tool * Finish work on adding `si loader` extension * Add tooltip * Replace symbols with unicode, other misc fixes * Update "version" to 2.0, other small CLI changes --- CONFIG/MainDlg.cpp | 89 ++++++++++- CONFIG/MainDlg.h | 7 + CONFIG/config.cpp | 18 ++- CONFIG/config.h | 2 + CONFIG/res/maindialog.ui | 332 ++++++++++++++++++++++++++++----------- 5 files changed, 346 insertions(+), 102 deletions(-) diff --git a/CONFIG/MainDlg.cpp b/CONFIG/MainDlg.cpp index 5ae140c3..59f321b7 100644 --- a/CONFIG/MainDlg.cpp +++ b/CONFIG/MainDlg.cpp @@ -65,6 +65,7 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent) connect(m_ui->sound3DCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckbox3DSound); connect(m_ui->rumbleCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxRumble); connect(m_ui->textureCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxTexture); + connect(m_ui->customAssetsCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxCustomAssets); 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); @@ -81,6 +82,11 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent) connect(m_ui->texturePathOpen, &QPushButton::clicked, this, &CMainDialog::SelectTexturePathDialog); connect(m_ui->texturePath, &QLineEdit::editingFinished, this, &CMainDialog::TexturePathEdited); + connect(m_ui->addCustomAssetPath, &QPushButton::clicked, this, &CMainDialog::AddCustomAssetPath); + connect(m_ui->removeCustomAssetPath, &QPushButton::clicked, this, &CMainDialog::RemoveCustomAssetPath); + connect(m_ui->customAssetPaths, &QListWidget::currentRowChanged, this, &CMainDialog::SelectedPathChanged); + connect(m_ui->customAssetPaths, &QListWidget::itemActivated, this, &CMainDialog::EditCustomAssetPath); + connect(m_ui->maxLoDSlider, &QSlider::valueChanged, this, &CMainDialog::MaxLoDChanged); connect(m_ui->maxLoDSlider, &QSlider::sliderMoved, this, &CMainDialog::MaxLoDChanged); connect(m_ui->maxActorsSlider, &QSlider::valueChanged, this, &CMainDialog::MaxActorsChanged); @@ -96,8 +102,6 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent) 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!"); @@ -312,6 +316,16 @@ void CMainDialog::UpdateInterface() m_ui->texturePath->setEnabled(currentConfigApp->m_texture_load); m_ui->texturePathOpen->setEnabled(currentConfigApp->m_texture_load); + m_ui->customAssetsCheckBox->setChecked(currentConfigApp->m_custom_assets_enabled); + m_ui->customAssetPathContainer->setEnabled(currentConfigApp->m_custom_assets_enabled); + m_ui->customAssetPaths->setEnabled(currentConfigApp->m_custom_assets_enabled); + m_ui->addCustomAssetPath->setEnabled(currentConfigApp->m_custom_assets_enabled); + m_ui->removeCustomAssetPath->setEnabled(false); + + m_ui->customAssetPaths->clear(); + assetPaths = QString::fromStdString(currentConfigApp->m_custom_asset_path).split(u','); + m_ui->customAssetPaths->addItems(assetPaths); + m_ui->aspectRatioComboBox->setCurrentIndex(currentConfigApp->m_aspect_ratio); m_ui->xResSpinBox->setValue(currentConfigApp->m_x_res); m_ui->yResSpinBox->setValue(currentConfigApp->m_y_res); @@ -442,6 +456,13 @@ void CMainDialog::OnCheckboxTexture(bool checked) UpdateInterface(); } +void CMainDialog::OnCheckboxCustomAssets(bool checked) +{ + currentConfigApp->m_custom_assets_enabled = checked; + m_modified = true; + UpdateInterface(); +} + void CMainDialog::TouchControlsChanged(int index) { currentConfigApp->m_touch_scheme = index; @@ -571,10 +592,10 @@ void CMainDialog::SelectTexturePathDialog() QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks ); - QDir texture_dir = QDir(texture_path); + QDir data_path = QDir(QString::fromStdString(currentConfigApp->m_cd_path)); - if (texture_dir.exists()) { - currentConfigApp->m_texture_path = texture_dir.absolutePath().toStdString(); + if (data_path.exists(texture_path)) { + currentConfigApp->m_texture_path = data_path.relativeFilePath(texture_path).toStdString(); m_modified = true; } UpdateInterface(); @@ -582,15 +603,67 @@ void CMainDialog::SelectTexturePathDialog() void CMainDialog::TexturePathEdited() { - QDir texture_dir = QDir(m_ui->texturePath->text()); + QString texture_path = m_ui->texturePath->text(); + QDir data_path = QDir(QString::fromStdString(currentConfigApp->m_cd_path)); - if (texture_dir.exists()) { - currentConfigApp->m_texture_path = texture_dir.absolutePath().toStdString(); + if (data_path.exists(texture_path)) { + currentConfigApp->m_texture_path = data_path.relativeFilePath(texture_path).toStdString(); m_modified = true; } UpdateInterface(); } +void CMainDialog::AddCustomAssetPath() +{ + QDir data_path = QDir(QString::fromStdString(currentConfigApp->m_cd_path)); + QStringList new_files = QFileDialog::getOpenFileNames( + this, + "Select one or more files to open", + data_path.absolutePath(), + "Interleaf files (*.si)" + ); + for (QString& item : new_files) { + item = data_path.relativeFilePath(item); + } + assetPaths += new_files; + UpdateAssetPaths(); +} + +void CMainDialog::RemoveCustomAssetPath() +{ + assetPaths.removeAt(m_ui->customAssetPaths->currentRow()); + UpdateAssetPaths(); +} + +void CMainDialog::SelectedPathChanged(int currentRow) +{ + m_ui->removeCustomAssetPath->setEnabled(currentRow != -1 ? true : false); +} + +void CMainDialog::EditCustomAssetPath() +{ + QDir data_path = QDir(QString::fromStdString(currentConfigApp->m_cd_path)); + QString prev_asset_path = assetPaths[m_ui->customAssetPaths->currentRow()]; + QString new_file = QFileDialog::getOpenFileName( + this, + "Open File", + data_path.absoluteFilePath(prev_asset_path), + "Interleaf files (*.si)" + ); + if (!new_file.isEmpty()) { + new_file = data_path.relativeFilePath(new_file); + assetPaths[m_ui->customAssetPaths->currentRow()] = new_file; + } + UpdateAssetPaths(); +} + +void CMainDialog::UpdateAssetPaths() +{ + assetPaths.removeDuplicates(); + currentConfigApp->m_custom_asset_path = assetPaths.join(u',').toStdString(); + UpdateInterface(); +} + void CMainDialog::AspectRatioChanged(int index) { currentConfigApp->m_aspect_ratio = index; diff --git a/CONFIG/MainDlg.h b/CONFIG/MainDlg.h index 0aaeeb12..22cf7895 100644 --- a/CONFIG/MainDlg.h +++ b/CONFIG/MainDlg.h @@ -29,6 +29,7 @@ class CMainDialog : public QDialog { private: bool m_modified = false; bool m_advanced = false; + QStringList assetPaths = QStringList(); Ui::MainDialog* m_ui = nullptr; SDL_DisplayMode** displayModes; @@ -48,6 +49,7 @@ private slots: void OnCheckboxMusic(bool checked); void OnCheckboxRumble(bool checked); void OnCheckboxTexture(bool checked); + void OnCheckboxCustomAssets(bool checked); void TouchControlsChanged(int index); void TransitionTypeChanged(int index); void ExclusiveResolutionChanged(int index); @@ -64,6 +66,11 @@ private slots: void AFChanged(int value); void SelectTexturePathDialog(); void TexturePathEdited(); + void AddCustomAssetPath(); + void RemoveCustomAssetPath(); + void SelectedPathChanged(int currentRow); + void EditCustomAssetPath(); + void UpdateAssetPaths(); void XResChanged(int i); void YResChanged(int i); void AspectRatioChanged(int index); diff --git a/CONFIG/config.cpp b/CONFIG/config.cpp index 766cecd4..f75838f6 100644 --- a/CONFIG/config.cpp +++ b/CONFIG/config.cpp @@ -89,7 +89,9 @@ bool CConfigApp::InitInstance() m_haptic = TRUE; m_touch_scheme = 2; m_texture_load = TRUE; - m_texture_path = "/textures/"; + m_texture_path = "textures/"; + m_custom_assets_enabled = TRUE; + m_custom_asset_path = "assets/widescreen.si"; int totalRamMiB = SDL_GetSystemRAM(); if (totalRamMiB < 12) { m_ram_quality_limit = 2; @@ -188,6 +190,8 @@ bool CConfigApp::ReadRegisterSettings() m_anisotropy = iniparser_getint(dict, "isle:Anisotropic", m_anisotropy); 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_custom_assets_enabled = iniparser_getboolean(dict, "extensions:si loader", m_custom_assets_enabled); + m_custom_asset_path = iniparser_getstring(dict, "si loader:files", m_custom_asset_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); @@ -364,7 +368,8 @@ void CConfigApp::WriteRegisterSettings() const dictionary* dict = dictionary_new(0); iniparser_set(dict, "isle", NULL); iniparser_set(dict, "extensions", NULL); - iniparser_set(dict, "texture loader", NULL); + iniparser_set(dict, "si loader", NULL); + if (m_device_enumerator->FormatDeviceName(buffer, m_driver, m_device) >= 0) { iniparser_set(dict, "isle:3D Device ID", buffer); } @@ -394,6 +399,9 @@ void CConfigApp::WriteRegisterSettings() const SetIniBool(dict, "extensions:texture loader", m_texture_load); iniparser_set(dict, "texture loader:texture path", m_texture_path.c_str()); + SetIniBool(dict, "extensions:si loader", m_custom_assets_enabled); + iniparser_set(dict, "si loader:files", m_custom_asset_path.c_str()); + SetIniBool(dict, "isle:Back Buffers in Video RAM", m_3d_video_ram); SetIniInt(dict, "isle:Island Quality", m_model_quality); @@ -451,8 +459,8 @@ CConfigApp g_theApp; int main(int argc, char* argv[]) { QApplication app(argc, argv); - QCoreApplication::setApplicationName("config"); - QCoreApplication::setApplicationVersion("1.0"); + QCoreApplication::setApplicationName("Isle-Config"); + QCoreApplication::setApplicationVersion("2.0"); QCommandLineParser parser; parser.setApplicationDescription("Configure LEGO Island"); @@ -470,7 +478,7 @@ int main(int argc, char* argv[]) if (parser.isSet(iniOption)) { g_theApp.SetIniPath(parser.value(iniOption).toStdString()); } - qInfo() << "Ini path =" << QString::fromStdString(g_theApp.GetIniPath()); + qInfo() << "INI path =" << QString::fromStdString(g_theApp.GetIniPath()); int result = 1; if (g_theApp.InitInstance()) { diff --git a/CONFIG/config.h b/CONFIG/config.h index c0dcb851..71e876f6 100644 --- a/CONFIG/config.h +++ b/CONFIG/config.h @@ -87,7 +87,9 @@ class CConfigApp { int m_texture_quality; bool m_music; bool m_texture_load; + bool m_custom_assets_enabled; std::string m_texture_path; + std::string m_custom_asset_path; std::string m_iniPath; std::string m_base_path; std::string m_cd_path; diff --git a/CONFIG/res/maindialog.ui b/CONFIG/res/maindialog.ui index e395159b..aca3685b 100644 --- a/CONFIG/res/maindialog.ui +++ b/CONFIG/res/maindialog.ui @@ -6,7 +6,7 @@ 0 0 - 600 + 640 480 @@ -24,6 +24,9 @@ :/lego1.png:/lego1.png + + QLayout::SizeConstraint::SetFixedSize + @@ -72,6 +75,12 @@ + + + 425 + 0 + + 0 @@ -80,30 +89,6 @@ Game - - - - - - Enable 3D positional audio effects. - - - 3D Sound - - - - - - - Enable in-game background music. - - - Music - - - - - @@ -283,6 +268,32 @@ Set this to the CD image root. + + + + + + + Enable 3D positional audio effects. + + + 3D Sound + + + + + + + Enable in-game background music. + + + Music + + + + + + @@ -766,7 +777,10 @@ The game will gradually increase the number of actors until this maximum is reac - x + + + + Qt::TextFormat::PlainText Qt::AlignmentFlag::AlignCenter @@ -1012,72 +1026,207 @@ The game will gradually increase the number of actors until this maximum is reac - - - Settings for Texture Loader extension. + + + true - - Texture Loader - - - - - - Enabled - - - - - - - false - - - Path to texture replacements. - - - textures/ - - - - - - - false - - - - 0 - 0 - - - - - 50 - 16777215 - - - - Open - - - - + + + + 0 + 0 + 449 + 369 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Settings for Texture Loader extension. + + + Texture Loader + + + + + + Enabled + + + + + + + false + + + Path to texture replacements. Relative to the Data Path. + + + textures/ + + + + + + + false + + + + 0 + 0 + + + + + 50 + 16777215 + + + + Open + + + + + + + + + + Settings for Custom Assets. + + + Custom Assets + + + + + + Enabled + + + + + + + false + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + false + + + + 30 + 30 + + + + + 13 + NoAntialias + + + + Add path. + + + + + + + + + + false + + + Paths used by the SI Loader extension. + +Double-click a path to edit it. + + + QAbstractScrollArea::SizeAdjustPolicy::AdjustToContentsOnFirstShow + + + + + + + false + + + + 30 + 30 + + + + + 12 + + + + Remove path. + + + + + + + + + + + + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + + + - - - - Qt::Orientation::Vertical - - - - 20 - 40 - - - - @@ -1176,9 +1325,14 @@ The game will gradually increase the number of actors until this maximum is reac AFSlider touchComboBox rumbleCheckBox + scrollArea textureCheckBox texturePath texturePathOpen + customAssetsCheckBox + customAssetPaths + addCustomAssetPath + removeCustomAssetPath okButton launchButton cancelButton From 5c99921bfcef40f315e0ce024147ddfcf0b19edf Mon Sep 17 00:00:00 2001 From: VoxelTek <53562267+VoxelTek@users.noreply.github.com> Date: Tue, 12 Aug 2025 12:33:45 +1000 Subject: [PATCH 2/4] Slightly change icons in `isle-config` for `si loader` extension (#668) * Begin work on adding SI extension to cfg tool * Finish work on adding `si loader` extension * Add tooltip * Replace symbols with unicode, other misc fixes * Update "version" to 2.0, other small CLI changes * Replace icons, other misc small changes * Slightly reduce button size --- CONFIG/res/add.svg | 46 ++++++++++++++++++++++++++++++++++++++++ CONFIG/res/config.qrc | 14 ++++++------ CONFIG/res/maindialog.ui | 41 ++++++++++++++++++----------------- CONFIG/res/remove.svg | 10 +++++++++ 4 files changed, 86 insertions(+), 25 deletions(-) create mode 100644 CONFIG/res/add.svg create mode 100644 CONFIG/res/remove.svg diff --git a/CONFIG/res/add.svg b/CONFIG/res/add.svg new file mode 100644 index 00000000..174d9847 --- /dev/null +++ b/CONFIG/res/add.svg @@ -0,0 +1,46 @@ + + + + + + + + diff --git a/CONFIG/res/config.qrc b/CONFIG/res/config.qrc index a2fa0bcb..fc01d9e4 100644 --- a/CONFIG/res/config.qrc +++ b/CONFIG/res/config.qrc @@ -1,7 +1,9 @@ - - shark.png - lego1.png - lego2.png - - \ No newline at end of file + + add.svg + remove.svg + shark.png + lego1.png + lego2.png + + diff --git a/CONFIG/res/maindialog.ui b/CONFIG/res/maindialog.ui index aca3685b..99931197 100644 --- a/CONFIG/res/maindialog.ui +++ b/CONFIG/res/maindialog.ui @@ -1145,23 +1145,24 @@ The game will gradually increase the number of actors until this maximum is reac false - + - 30 - 30 + 28 + 28 - - - 13 - NoAntialias - + + + 28 + 28 + Add path. - - + + + :/add.svg:/add.svg @@ -1185,22 +1186,24 @@ Double-click a path to edit it. false - + - 30 - 30 + 28 + 28 - - - 12 - + + + 28 + 28 + Remove path. - - + + + :/remove.svg:/remove.svg diff --git a/CONFIG/res/remove.svg b/CONFIG/res/remove.svg new file mode 100644 index 00000000..0e601431 --- /dev/null +++ b/CONFIG/res/remove.svg @@ -0,0 +1,10 @@ + + + + From f4a28f27f9d4b0e3511a86170d5b626c86720841 Mon Sep 17 00:00:00 2001 From: VoxelTek <53562267+VoxelTek@users.noreply.github.com> Date: Wed, 13 Aug 2025 00:30:36 +1000 Subject: [PATCH 3/4] Fix problems with extensions in config tool (#669) --- CONFIG/MainDlg.cpp | 46 ++++++++++++++++++++++++++++++++++++++-------- CONFIG/config.cpp | 1 + 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/CONFIG/MainDlg.cpp b/CONFIG/MainDlg.cpp index 59f321b7..a1a07cf9 100644 --- a/CONFIG/MainDlg.cpp +++ b/CONFIG/MainDlg.cpp @@ -312,7 +312,11 @@ void CMainDialog::UpdateInterface() m_ui->savePath->setText(QString::fromStdString(currentConfigApp->m_save_path)); m_ui->textureCheckBox->setChecked(currentConfigApp->m_texture_load); - m_ui->texturePath->setText(QString::fromStdString(currentConfigApp->m_texture_path)); + QString texture_path = QString::fromStdString(currentConfigApp->m_texture_path); + if (texture_path.startsWith(QDir::separator())) { + texture_path.remove(0, 1); + } + m_ui->texturePath->setText(texture_path); m_ui->texturePath->setEnabled(currentConfigApp->m_texture_load); m_ui->texturePathOpen->setEnabled(currentConfigApp->m_texture_load); @@ -324,6 +328,11 @@ void CMainDialog::UpdateInterface() m_ui->customAssetPaths->clear(); assetPaths = QString::fromStdString(currentConfigApp->m_custom_asset_path).split(u','); + for (QString& path : assetPaths) { + if (path.startsWith(QDir::separator())) { + path.remove(0, 1); + } + } m_ui->customAssetPaths->addItems(assetPaths); m_ui->aspectRatioComboBox->setCurrentIndex(currentConfigApp->m_aspect_ratio); @@ -584,7 +593,12 @@ void CMainDialog::AFChanged(int value) void CMainDialog::SelectTexturePathDialog() { + QDir data_path = QDir(QString::fromStdString(currentConfigApp->m_cd_path)); QString texture_path = QString::fromStdString(currentConfigApp->m_texture_path); + if (texture_path.startsWith(QDir::separator())) { + texture_path.remove(0, 1); + } + texture_path = data_path.absoluteFilePath(texture_path); texture_path = QFileDialog::getExistingDirectory( this, tr("Open Directory"), @@ -592,10 +606,10 @@ void CMainDialog::SelectTexturePathDialog() QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks ); - QDir data_path = QDir(QString::fromStdString(currentConfigApp->m_cd_path)); - if (data_path.exists(texture_path)) { - currentConfigApp->m_texture_path = data_path.relativeFilePath(texture_path).toStdString(); + texture_path = data_path.relativeFilePath(texture_path); + texture_path.prepend(QDir::separator()); + currentConfigApp->m_texture_path = texture_path.toStdString(); m_modified = true; } UpdateInterface(); @@ -606,8 +620,13 @@ void CMainDialog::TexturePathEdited() QString texture_path = m_ui->texturePath->text(); QDir data_path = QDir(QString::fromStdString(currentConfigApp->m_cd_path)); + if (texture_path.startsWith(QDir::separator())) { + texture_path.remove(0, 1); + } if (data_path.exists(texture_path)) { - currentConfigApp->m_texture_path = data_path.relativeFilePath(texture_path).toStdString(); + texture_path = data_path.relativeFilePath(texture_path); + texture_path.prepend(QDir::separator()); + currentConfigApp->m_texture_path = texture_path.toStdString(); m_modified = true; } UpdateInterface(); @@ -622,16 +641,20 @@ void CMainDialog::AddCustomAssetPath() data_path.absolutePath(), "Interleaf files (*.si)" ); - for (QString& item : new_files) { - item = data_path.relativeFilePath(item); + if (!new_files.isEmpty()) { + for (QString& item : new_files) { + item = data_path.relativeFilePath(item); + } + assetPaths += new_files; + m_modified = true; } - assetPaths += new_files; UpdateAssetPaths(); } void CMainDialog::RemoveCustomAssetPath() { assetPaths.removeAt(m_ui->customAssetPaths->currentRow()); + m_modified = true; UpdateAssetPaths(); } @@ -653,6 +676,7 @@ void CMainDialog::EditCustomAssetPath() if (!new_file.isEmpty()) { new_file = data_path.relativeFilePath(new_file); assetPaths[m_ui->customAssetPaths->currentRow()] = new_file; + m_modified = true; } UpdateAssetPaths(); } @@ -660,6 +684,12 @@ void CMainDialog::EditCustomAssetPath() void CMainDialog::UpdateAssetPaths() { assetPaths.removeDuplicates(); + + for (QString& path : assetPaths) { + if (!path.startsWith(QDir::separator())) { + path.prepend(QDir::separator()); + } + } currentConfigApp->m_custom_asset_path = assetPaths.join(u',').toStdString(); UpdateInterface(); } diff --git a/CONFIG/config.cpp b/CONFIG/config.cpp index f75838f6..4e9d414d 100644 --- a/CONFIG/config.cpp +++ b/CONFIG/config.cpp @@ -368,6 +368,7 @@ void CConfigApp::WriteRegisterSettings() const dictionary* dict = dictionary_new(0); iniparser_set(dict, "isle", NULL); iniparser_set(dict, "extensions", NULL); + iniparser_set(dict, "texture loader", NULL); iniparser_set(dict, "si loader", NULL); if (m_device_enumerator->FormatDeviceName(buffer, m_driver, m_device) >= 0) { From e8140f9d519f10b7fab02c97992a5dc27e46b4c9 Mon Sep 17 00:00:00 2001 From: VoxelTek <53562267+VoxelTek@users.noreply.github.com> Date: Thu, 14 Aug 2025 00:29:07 +1000 Subject: [PATCH 4/4] Fix debug, improve `isle-config` (#672) * Fix debug, improve `isle-config` * Change to const char, rename to p_execName --- CONFIG/AboutDlg.cpp | 3 --- CONFIG/MainDlg.cpp | 34 +++++++++++++++++----------------- CONFIG/res/about.ui | 9 ++++++--- ISLE/isleapp.cpp | 8 ++++---- ISLE/isleapp.h | 2 +- ISLE/isledebug.cpp | 4 ++-- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/CONFIG/AboutDlg.cpp b/CONFIG/AboutDlg.cpp index a853ee52..651b382b 100644 --- a/CONFIG/AboutDlg.cpp +++ b/CONFIG/AboutDlg.cpp @@ -7,12 +7,9 @@ DECOMP_SIZE_ASSERT(CDialog, 0x60) DECOMP_SIZE_ASSERT(CAboutDialog, 0x60) -// FIXME: disable dialog resizing - // FUNCTION: CONFIG 0x00403c20 CAboutDialog::CAboutDialog() : QDialog() { m_ui = new Ui::AboutDialog; m_ui->setupUi(this); - layout()->setSizeConstraint(QLayout::SetFixedSize); } diff --git a/CONFIG/MainDlg.cpp b/CONFIG/MainDlg.cpp index a1a07cf9..73a85ab3 100644 --- a/CONFIG/MainDlg.cpp +++ b/CONFIG/MainDlg.cpp @@ -505,14 +505,15 @@ void CMainDialog::SelectDataPathDialog() QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks ); - QDir data_dir = QDir(data_path); - - if (data_dir.exists()) { - currentConfigApp->m_cd_path = data_dir.absolutePath().toStdString(); - data_dir.cd(QString("DATA")); - data_dir.cd(QString("disk")); - currentConfigApp->m_base_path = data_dir.absolutePath().toStdString(); - m_modified = true; + if (!data_path.isEmpty()) { + QDir data_dir = QDir(data_path); + if (data_dir.exists()) { + currentConfigApp->m_cd_path = data_dir.absolutePath().toStdString(); + data_dir.cd(QString("DATA")); + data_dir.cd(QString("disk")); + currentConfigApp->m_base_path = data_dir.absolutePath().toStdString(); + m_modified = true; + } } UpdateInterface(); } @@ -527,11 +528,12 @@ void CMainDialog::SelectSavePathDialog() QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks ); - QDir save_dir = QDir(save_path); - - if (save_dir.exists()) { - currentConfigApp->m_save_path = save_dir.absolutePath().toStdString(); - m_modified = true; + if (!save_path.isEmpty()) { + QDir save_dir = QDir(save_path); + if (save_dir.exists()) { + currentConfigApp->m_save_path = save_dir.absolutePath().toStdString(); + m_modified = true; + } } UpdateInterface(); } @@ -547,13 +549,11 @@ void CMainDialog::DataPathEdited() currentConfigApp->m_base_path = data_dir.absolutePath().toStdString(); m_modified = true; } - UpdateInterface(); } void CMainDialog::SavePathEdited() { - QDir save_dir = QDir(m_ui->savePath->text()); if (save_dir.exists()) { @@ -606,7 +606,7 @@ void CMainDialog::SelectTexturePathDialog() QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks ); - if (data_path.exists(texture_path)) { + if (!texture_path.isEmpty() && data_path.exists(texture_path)) { texture_path = data_path.relativeFilePath(texture_path); texture_path.prepend(QDir::separator()); currentConfigApp->m_texture_path = texture_path.toStdString(); @@ -623,7 +623,7 @@ void CMainDialog::TexturePathEdited() if (texture_path.startsWith(QDir::separator())) { texture_path.remove(0, 1); } - if (data_path.exists(texture_path)) { + if (data_path.exists(data_path.absoluteFilePath(texture_path))) { texture_path = data_path.relativeFilePath(texture_path); texture_path.prepend(QDir::separator()); currentConfigApp->m_texture_path = texture_path.toStdString(); diff --git a/CONFIG/res/about.ui b/CONFIG/res/about.ui index a716ebc8..ce51ea2a 100644 --- a/CONFIG/res/about.ui +++ b/CONFIG/res/about.ui @@ -14,6 +14,9 @@ About Configure LEGO© Island + + QLayout::SizeConstraint::SetFixedSize + @@ -36,14 +39,14 @@ - Configure LEGO Island Version 1.0 + Configure LEGO Island Version 2.0 - Copyright © 1997 mindscape + Copyright © 2025 @@ -53,7 +56,7 @@ - QDialogButtonBox::Ok + QDialogButtonBox::StandardButton::Ok diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 1ccc90a8..83a7927c 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -1391,12 +1391,12 @@ SDL_AppResult IsleApp::ParseArguments(int argc, char** argv) consumed = 1; } else if (strcmp(argv[i], "--help") == 0) { - DisplayArgumentHelp(); + DisplayArgumentHelp(argv[0]); return SDL_APP_SUCCESS; } if (consumed <= 0) { SDL_Log("Invalid argument(s): %s", argv[i]); - DisplayArgumentHelp(); + DisplayArgumentHelp(argv[0]); return SDL_APP_FAILURE; } } @@ -1404,9 +1404,9 @@ SDL_AppResult IsleApp::ParseArguments(int argc, char** argv) return SDL_APP_CONTINUE; } -void IsleApp::DisplayArgumentHelp() +void IsleApp::DisplayArgumentHelp(const char* p_execName) { - SDL_Log("Usage: isle [options]"); + SDL_Log("Usage: %s [options]", p_execName); SDL_Log("Options:"); SDL_Log(" --ini Set custom path to .ini config"); #ifdef ISLE_DEBUG diff --git a/ISLE/isleapp.h b/ISLE/isleapp.h index 66e8e6e1..470a5a72 100644 --- a/ISLE/isleapp.h +++ b/ISLE/isleapp.h @@ -99,7 +99,7 @@ class IsleApp { const CursorBitmap* m_cursorCurrentBitmap; char* m_mediaPath; MxFloat m_cursorSensitivity; - void DisplayArgumentHelp(); + void DisplayArgumentHelp(const char* p_execName); char* m_iniPath; MxFloat m_maxLod; diff --git a/ISLE/isledebug.cpp b/ISLE/isledebug.cpp index 2eca3421..ab3433a5 100644 --- a/ISLE/isledebug.cpp +++ b/ISLE/isledebug.cpp @@ -68,10 +68,10 @@ class DebugViewer { static void InsideBuildingManager() { auto buildingManager = Lego()->GetBuildingManager(); - ImGui::Text("nextVariant: %d", buildingManager->m_nextVariant); + ImGui::Text("nextVariant: %u", buildingManager->m_nextVariant); ImGui::Text("m_boundariesDetermined: %d", buildingManager->m_boundariesDetermined); ImGui::Text("m_hideAfterAnimation: %d", buildingManager->m_hideAfterAnimation); - ImGui::Text("#Animated Entries", buildingManager->m_numEntries); + ImGui::Text("#Animated Entries: %d", buildingManager->m_numEntries); if (buildingManager->m_numEntries) { if (ImGui::BeginTable("Animated Entries", 6, ImGuiTableFlags_Borders)) { ImGui::TableSetupColumn("ROI Name");