diff --git a/CONFIG/MainDlg.cpp b/CONFIG/MainDlg.cpp index 5ae140c3..30be8d36 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); @@ -312,6 +318,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 +458,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 +594,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 +605,49 @@ 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)" + ); + UpdateAssetPaths(); + UpdateInterface(); +} + +void CMainDialog::RemoveCustomAssetPath() +{ + +} + +void CMainDialog::SelectedPathChanged(int currentRow) +{ + m_ui->removeCustomAssetPath->setEnabled(currentRow != -1 ? true : false); +} + +void CMainDialog::EditCustomAssetPath() +{ + +} + +void CMainDialog::UpdateAssetPaths() +{ + +} + 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..920eaca7 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); @@ -394,6 +398,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); 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..2cce27d2 100644 --- a/CONFIG/res/maindialog.ui +++ b/CONFIG/res/maindialog.ui @@ -6,7 +6,7 @@ 0 0 - 600 + 640 480 @@ -1012,72 +1012,197 @@ 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 + + + + Add path. + + + + + + + + + + false + + + QAbstractScrollArea::SizeAdjustPolicy::AdjustToContentsOnFirstShow + + + true + + + QAbstractItemView::DragDropMode::InternalMove + + + + + + + false + + + + 30 + 30 + + + + Remove path. + + + + + + + + + + + + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + + + - - - - Qt::Orientation::Vertical - - - - 20 - 40 - - - - @@ -1176,9 +1301,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