diff --git a/CONFIG/MainDlg.cpp b/CONFIG/MainDlg.cpp index 89c72161..dc63995e 100644 --- a/CONFIG/MainDlg.cpp +++ b/CONFIG/MainDlg.cpp @@ -59,6 +59,7 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent) connect(m_ui->sound3DCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckbox3DSound); connect(m_ui->fullscreenCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxFullscreen); 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); connect(m_ui->transitionTypeComboBox, &QComboBox::currentIndexChanged, this, &CMainDialog::TransitionTypeChanged); connect(m_ui->okButton, &QPushButton::clicked, this, &CMainDialog::accept); @@ -71,6 +72,9 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent) connect(m_ui->dataPath, &QLineEdit::editingFinished, this, &CMainDialog::DataPathEdited); connect(m_ui->savePath, &QLineEdit::editingFinished, this, &CMainDialog::SavePathEdited); + connect(m_ui->texturePathOpen, &QPushButton::clicked, this, &CMainDialog::SelectTexturePathDialog); + connect(m_ui->texturePath, &QLineEdit::editingFinished, this, &CMainDialog::TexturePathEdited); + connect(m_ui->maxLoDSlider, &QSlider::valueChanged, this, &CMainDialog::MaxLoDChanged); connect(m_ui->maxActorsSlider, &QSlider::valueChanged, this, &CMainDialog::MaxActorsChanged); @@ -214,9 +218,15 @@ void CMainDialog::UpdateInterface() m_ui->musicCheckBox->setChecked(currentConfigApp->m_music); m_ui->fullscreenCheckBox->setChecked(currentConfigApp->m_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); m_ui->dataPath->setText(QString::fromStdString(currentConfigApp->m_cd_path)); 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)); + + m_ui->texturePath->setEnabled(currentConfigApp->m_texture_load); + m_ui->texturePathOpen->setEnabled(currentConfigApp->m_texture_load); } // FUNCTION: CONFIG 0x004045e0 @@ -298,9 +308,16 @@ void CMainDialog::OnCheckboxRumble(bool checked) UpdateInterface(); } +void CMainDialog::OnCheckboxTexture(bool checked) +{ + currentConfigApp->m_texture_load = checked; + m_modified = true; + UpdateInterface(); +} + void CMainDialog::TouchControlsChanged(int index) { - currentConfigApp->m_touchScheme = index; + currentConfigApp->m_touch_scheme = index; m_modified = true; UpdateInterface(); } @@ -391,3 +408,33 @@ void CMainDialog::MaxActorsChanged(int value) currentConfigApp->m_max_actors = value; m_modified = true; } + +void CMainDialog::SelectTexturePathDialog() +{ + QString texture_path = QString::fromStdString(currentConfigApp->m_texture_path); + texture_path = QFileDialog::getExistingDirectory( + this, + tr("Open Directory"), + texture_path, + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks + ); + + QDir texture_dir = QDir(texture_path); + + if (texture_dir.exists()) { + currentConfigApp->m_texture_path = texture_dir.absolutePath().toStdString(); + m_modified = true; + } + UpdateInterface(); +} + +void CMainDialog::TexturePathEdited() +{ + QDir texture_dir = QDir(m_ui->texturePath->text()); + + if (texture_dir.exists()) { + currentConfigApp->m_texture_path = texture_dir.absolutePath().toStdString(); + m_modified = true; + } + UpdateInterface(); +} diff --git a/CONFIG/MainDlg.h b/CONFIG/MainDlg.h index 3a616607..40156790 100644 --- a/CONFIG/MainDlg.h +++ b/CONFIG/MainDlg.h @@ -43,6 +43,7 @@ private slots: void OnCheckboxMusic(bool checked); void OnCheckboxFullscreen(bool checked); void OnCheckboxRumble(bool checked); + void OnCheckboxTexture(bool checked); void TouchControlsChanged(int index); void TransitionTypeChanged(int index); void accept() override; @@ -54,6 +55,8 @@ private slots: void SavePathEdited(); void MaxLoDChanged(int value); void MaxActorsChanged(int value); + void SelectTexturePathDialog(); + void TexturePathEdited(); }; // SYNTHETIC: CONFIG 0x00403de0 diff --git a/CONFIG/config.cpp b/CONFIG/config.cpp index d063047f..925a74b2 100644 --- a/CONFIG/config.cpp +++ b/CONFIG/config.cpp @@ -79,7 +79,9 @@ bool CConfigApp::InitInstance() m_joystick_index = -1; m_display_bit_depth = 16; m_haptic = TRUE; - m_touchScheme = 2; + m_touch_scheme = 2; + m_texture_load = TRUE; + m_texture_path = "/textures/"; int totalRamMiB = SDL_GetSystemRAM(); if (totalRamMiB < 12) { m_3d_sound = FALSE; @@ -157,7 +159,7 @@ bool CConfigApp::ReadRegisterSettings() 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_transition_type = iniparser_getint(dict, "isle:Transition Type", m_transition_type); - m_touchScheme = iniparser_getint(dict, "isle:Touch Scheme", m_touchScheme); + 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); m_wide_view_angle = iniparser_getboolean(dict, "isle:Wide View Angle", m_wide_view_angle); m_3d_sound = iniparser_getboolean(dict, "isle:3DSound", m_3d_sound); @@ -170,6 +172,8 @@ bool CConfigApp::ReadRegisterSettings() m_joystick_index = iniparser_getint(dict, "isle:JoystickIndex", m_joystick_index); m_max_lod = iniparser_getdouble(dict, "isle:Max LOD", m_max_lod); 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()); iniparser_freedict(dict); return true; } @@ -238,8 +242,8 @@ bool CConfigApp::ValidateSettings() m_use_joystick = true; is_modified = TRUE; } - if (m_touchScheme < 0 || m_touchScheme > 2) { - m_touchScheme = 2; + if (m_touch_scheme < 0 || m_touch_scheme > 2) { + m_touch_scheme = 2; is_modified = TRUE; } @@ -323,7 +327,7 @@ void CConfigApp::WriteRegisterSettings() const SetIniBool(dict, "isle:Wide View Angle", m_wide_view_angle); SetIniInt(dict, "isle:Transition Type", m_transition_type); - SetIniInt(dict, "isle:Touch Scheme", m_touchScheme); + SetIniInt(dict, "isle:Touch Scheme", m_touch_scheme); SetIniBool(dict, "isle:3DSound", m_3d_sound); SetIniBool(dict, "isle:Music", m_music); @@ -333,6 +337,9 @@ void CConfigApp::WriteRegisterSettings() const SetIniInt(dict, "isle:JoystickIndex", m_joystick_index); SetIniBool(dict, "isle:Draw Cursor", m_draw_cursor); + SetIniBool(dict, "extensions:texture loader", m_texture_load); + iniparser_set(dict, "texture loader:texture path", m_texture_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 cbdfec13..796a5659 100644 --- a/CONFIG/config.h +++ b/CONFIG/config.h @@ -76,13 +76,15 @@ class CConfigApp { int m_model_quality; int m_texture_quality; bool m_music; + bool m_texture_load; + std::string m_texture_path; std::string m_iniPath; std::string m_base_path; std::string m_cd_path; std::string m_save_path; float m_max_lod; int m_max_actors; - int m_touchScheme; + int m_touch_scheme; }; extern CConfigApp g_theApp; diff --git a/CONFIG/res/maindialog.ui b/CONFIG/res/maindialog.ui index a8aa5d88..4f724705 100644 --- a/CONFIG/res/maindialog.ui +++ b/CONFIG/res/maindialog.ui @@ -7,7 +7,7 @@ 0 0 550 - 620 + 700 @@ -606,6 +606,57 @@ A higher setting will cause higher quality textures to be drawn regardless of di + + + + Texture Loader Extension + + + + + + false + + + Path to texture replacements. + + + textures/ + + + + + + + false + + + + 0 + 0 + + + + + 50 + 16777215 + + + + Open + + + + + + + Enabled + + + + + +