From fdda4d4f540c008e0066e389841d2a906c39ecc8 Mon Sep 17 00:00:00 2001 From: VoxelTek <53562267+VoxelTek@users.noreply.github.com> Date: Thu, 19 Jun 2025 10:35:48 +1000 Subject: [PATCH] Run clang-format, remove colour bit depth, bug fix Ran clang-format to have the code formatted properly (so it'll pass checks), removed the colour bit depth option from the config tool (and set the default to 16bit), and fixed a bug where it was writing the bit depth (an int) as a bool to the ini file. --- CONFIG/AboutDlg.cpp | 2 +- CONFIG/MainDlg.cpp | 109 ++++++++++++--------------------------- CONFIG/MainDlg.h | 10 ++-- CONFIG/config.cpp | 6 +-- CONFIG/res/maindialog.ui | 39 +------------- 5 files changed, 41 insertions(+), 125 deletions(-) diff --git a/CONFIG/AboutDlg.cpp b/CONFIG/AboutDlg.cpp index 7aa698c1..a853ee52 100644 --- a/CONFIG/AboutDlg.cpp +++ b/CONFIG/AboutDlg.cpp @@ -14,5 +14,5 @@ CAboutDialog::CAboutDialog() : QDialog() { m_ui = new Ui::AboutDialog; m_ui->setupUi(this); - layout()->setSizeConstraint( QLayout::SetFixedSize ); + layout()->setSizeConstraint(QLayout::SetFixedSize); } diff --git a/CONFIG/MainDlg.cpp b/CONFIG/MainDlg.cpp index bf60ac00..375d3461 100644 --- a/CONFIG/MainDlg.cpp +++ b/CONFIG/MainDlg.cpp @@ -30,25 +30,7 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent) // Populate the dialog prior to connecting all signals OnInitDialog(); - connect( - m_ui->colorPalette16bitRadioButton, - &QRadioButton::toggled, - this, - &CMainDialog::OnRadiobuttonPalette16bit - ); - connect( - m_ui->colorPalette256RadioButton, - &QRadioButton::toggled, - this, - &CMainDialog::OnRadiobuttonPalette256 - ); - - connect( - m_ui->modelQualityLowRadioButton, - &QRadioButton::toggled, - this, - &CMainDialog::OnRadiobuttonModelLowQuality - ); + connect(m_ui->modelQualityLowRadioButton, &QRadioButton::toggled, this, &CMainDialog::OnRadiobuttonModelLowQuality); connect( m_ui->modelQualityMediumRadioButton, &QRadioButton::toggled, @@ -96,7 +78,7 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent) connect(m_ui->maxLoDSlider, &QSlider::valueChanged, this, &CMainDialog::MaxLoDChanged); connect(m_ui->maxActorsSlider, &QSlider::valueChanged, this, &CMainDialog::MaxActorsChanged); - layout()->setSizeConstraint( QLayout::SetFixedSize ); + layout()->setSizeConstraint(QLayout::SetFixedSize); } // FUNCTION: CONFIG 0x00403e80 bool CMainDialog::OnInitDialog() @@ -131,7 +113,7 @@ bool CMainDialog::OnInitDialog() } m_ui->devicesList->setCurrentRow(selected); - m_ui->maxLoDSlider->setValue((int)currentConfigApp->m_max_lod * 10); + m_ui->maxLoDSlider->setValue((int) currentConfigApp->m_max_lod * 10); m_ui->maxActorsSlider->setValue(currentConfigApp->m_max_actors); UpdateInterface(); return true; @@ -189,21 +171,9 @@ void CMainDialog::UpdateInterface() m_ui->videomemoryCheckBox->setChecked(currentConfigApp->m_3d_video_ram); bool full_screen = currentConfigApp->m_full_screen; currentConfigApp->AdjustDisplayBitDepthBasedOnRenderStatus(); - if (full_screen) { - if (currentConfigApp->m_display_bit_depth == 8) { - m_ui->colorPalette256RadioButton->setChecked(true); - } - else { - m_ui->colorPalette16bitRadioButton->setChecked(true); - } - } - else { - m_ui->colorPalette256RadioButton->setChecked(false); - m_ui->colorPalette256RadioButton->setChecked(false); + if (!full_screen) { currentConfigApp->m_display_bit_depth = 0; } - m_ui->colorPalette256RadioButton->setEnabled(full_screen && currentConfigApp->GetConditionalDeviceRenderBitDepth()); - m_ui->colorPalette16bitRadioButton->setEnabled(full_screen && currentConfigApp->GetDeviceRenderBitStatus()); m_ui->sound3DCheckBox->setChecked(currentConfigApp->m_3d_sound); switch (currentConfigApp->m_model_quality) { case 0: @@ -246,26 +216,6 @@ void CMainDialog::OnCheckbox3DVideoMemory(bool checked) UpdateInterface(); } -// FUNCTION: CONFIG 0x00404640 -void CMainDialog::OnRadiobuttonPalette16bit(bool checked) -{ - if (checked) { - currentConfigApp->m_display_bit_depth = 16; - m_modified = true; - UpdateInterface(); - } -} - -// FUNCTION: CONFIG 0x00404670 -void CMainDialog::OnRadiobuttonPalette256(bool checked) -{ - if (checked) { - currentConfigApp->m_display_bit_depth = 8; - m_modified = true; - UpdateInterface(); - } -} - // FUNCTION: CONFIG 0x004046a0 void CMainDialog::OnCheckboxFlipVideoMemPages(bool checked) { @@ -348,14 +298,15 @@ void CMainDialog::OnCheckboxMusic(bool checked) UpdateInterface(); } - void CMainDialog::SelectDiskPathDialog() { QString disk_path = QString::fromStdString(currentConfigApp->m_base_path); - disk_path = QFileDialog::getExistingDirectory(this, tr("Open Directory"), - disk_path, - QFileDialog::ShowDirsOnly - | QFileDialog::DontResolveSymlinks); + disk_path = QFileDialog::getExistingDirectory( + this, + tr("Open Directory"), + disk_path, + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks + ); if (disk_path.toStdString() != "") { currentConfigApp->m_base_path = disk_path.toStdString(); @@ -367,10 +318,12 @@ void CMainDialog::SelectDiskPathDialog() void CMainDialog::SelectCDPathDialog() { QString cd_path = QString::fromStdString(currentConfigApp->m_cd_path); - cd_path = QFileDialog::getExistingDirectory(this, tr("Open Directory"), - cd_path, - QFileDialog::ShowDirsOnly - | QFileDialog::DontResolveSymlinks); + cd_path = QFileDialog::getExistingDirectory( + this, + tr("Open Directory"), + cd_path, + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks + ); if (cd_path.toStdString() != "") { currentConfigApp->m_cd_path = cd_path.toStdString(); @@ -382,10 +335,12 @@ void CMainDialog::SelectCDPathDialog() void CMainDialog::SelectMediaPathDialog() { QString media_path = QString::fromStdString(currentConfigApp->m_media_path); - media_path = QFileDialog::getExistingDirectory(this, tr("Open Directory"), - media_path, - QFileDialog::ShowDirsOnly - | QFileDialog::DontResolveSymlinks); + media_path = QFileDialog::getExistingDirectory( + this, + tr("Open Directory"), + media_path, + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks + ); if (media_path.toStdString() != "") { currentConfigApp->m_media_path = media_path.toStdString(); m_modified = true; @@ -396,10 +351,12 @@ void CMainDialog::SelectMediaPathDialog() void CMainDialog::SelectSavePathDialog() { QString save_path = QString::fromStdString(currentConfigApp->m_save_path); - save_path = QFileDialog::getExistingDirectory(this, tr("Open Directory"), - save_path, - QFileDialog::ShowDirsOnly - | QFileDialog::DontResolveSymlinks); + save_path = QFileDialog::getExistingDirectory( + this, + tr("Open Directory"), + save_path, + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks + ); if (save_path.toStdString() != "") { currentConfigApp->m_save_path = save_path.toStdString(); @@ -408,36 +365,34 @@ void CMainDialog::SelectSavePathDialog() } } - -void CMainDialog::DiskPathEdited(const QString &text) +void CMainDialog::DiskPathEdited(const QString& text) { currentConfigApp->m_base_path = text.toStdString(); m_modified = true; UpdateInterface(); } -void CMainDialog::CDPathEdited(const QString &text) +void CMainDialog::CDPathEdited(const QString& text) { currentConfigApp->m_cd_path = text.toStdString(); m_modified = true; UpdateInterface(); } -void CMainDialog::MediaPathEdited(const QString &text) +void CMainDialog::MediaPathEdited(const QString& text) { currentConfigApp->m_media_path = text.toStdString(); m_modified = true; UpdateInterface(); } -void CMainDialog::SavePathEdited(const QString &text) +void CMainDialog::SavePathEdited(const QString& text) { currentConfigApp->m_save_path = text.toStdString(); m_modified = true; UpdateInterface(); } - void CMainDialog::MaxLoDChanged(int value) { currentConfigApp->m_max_lod = static_cast(value) / 10.0f; diff --git a/CONFIG/MainDlg.h b/CONFIG/MainDlg.h index b4eb84ad..f0df6e60 100644 --- a/CONFIG/MainDlg.h +++ b/CONFIG/MainDlg.h @@ -35,8 +35,6 @@ private slots: void OnList3DevicesSelectionChanged(int row); void OnCheckbox3DSound(bool checked); void OnCheckbox3DVideoMemory(bool checked); - void OnRadiobuttonPalette16bit(bool checked); - void OnRadiobuttonPalette256(bool checked); void OnCheckboxFlipVideoMemPages(bool checked); void OnRadiobuttonModelLowQuality(bool checked); void OnRadiobuttonModelMediumQuality(bool checked); @@ -51,10 +49,10 @@ private slots: void SelectCDPathDialog(); void SelectMediaPathDialog(); void SelectSavePathDialog(); - void DiskPathEdited(const QString &text); - void CDPathEdited(const QString &text); - void MediaPathEdited(const QString &text); - void SavePathEdited(const QString &text); + void DiskPathEdited(const QString& text); + void CDPathEdited(const QString& text); + void MediaPathEdited(const QString& text); + void SavePathEdited(const QString& text); void MaxLoDChanged(int value); void MaxActorsChanged(int value); }; diff --git a/CONFIG/config.cpp b/CONFIG/config.cpp index 335bf477..be1f1c83 100644 --- a/CONFIG/config.cpp +++ b/CONFIG/config.cpp @@ -208,7 +208,7 @@ bool CConfigApp::ValidateSettings() } } if ((m_display_bit_depth != 8 && m_display_bit_depth != 16) && (m_display_bit_depth != 0 || m_full_screen)) { - m_display_bit_depth = 8; + m_display_bit_depth = 16; is_modified = TRUE; } if (m_model_quality < 0 || m_model_quality > 2) { @@ -276,7 +276,7 @@ bool CConfigApp::AdjustDisplayBitDepthBasedOnRenderStatus() m_display_bit_depth = 16; return TRUE; } - m_display_bit_depth = 8; + m_display_bit_depth = 16; return TRUE; } @@ -304,7 +304,7 @@ void CConfigApp::WriteRegisterSettings() const iniparser_set(dict, "isle:mediapath", m_media_path.c_str()); iniparser_set(dict, "isle:savepath", m_save_path.c_str()); - SetIniBool(dict, "isle:Display Bit Depth", m_display_bit_depth); + SetIniInt(dict, "isle:Display Bit Depth", m_display_bit_depth); SetIniBool(dict, "isle:Flip Surfaces", m_flip_surfaces); SetIniBool(dict, "isle:Full Screen", m_full_screen); SetIniBool(dict, "isle:Wide View Angle", m_wide_view_angle); diff --git a/CONFIG/res/maindialog.ui b/CONFIG/res/maindialog.ui index a8036892..b7df8d83 100644 --- a/CONFIG/res/maindialog.ui +++ b/CONFIG/res/maindialog.ui @@ -7,7 +7,7 @@ 0 0 575 - 725 + 666 @@ -421,41 +421,6 @@ - - - - - 0 - 50 - - - - Color Palette - - - - 0 - - - 0 - - - - - 256 Color - - - - - - - High Color (16 bit) - - - - - - @@ -675,8 +640,6 @@ modelQualityHighRadioButton maxLoDSlider maxActorsSlider - colorPalette256RadioButton - colorPalette16bitRadioButton sound3DCheckBox musicCheckBox joystickCheckBox