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 59f321b7..73a85ab3 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); @@ -496,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(); } @@ -518,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(); } @@ -538,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()) { @@ -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(); + 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(); 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 (data_path.exists(texture_path)) { - currentConfigApp->m_texture_path = data_path.relativeFilePath(texture_path).toStdString(); + if (texture_path.startsWith(QDir::separator())) { + texture_path.remove(0, 1); + } + 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(); 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) { 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 3553f010..1039f68e 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -1401,12 +1401,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; } } @@ -1414,9 +1414,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");