diff --git a/CONFIG/MainDlg.cpp b/CONFIG/MainDlg.cpp index 55f06cf3..5ae140c3 100644 --- a/CONFIG/MainDlg.cpp +++ b/CONFIG/MainDlg.cpp @@ -88,6 +88,8 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent) connect(m_ui->msaaSlider, &QSlider::valueChanged, this, &CMainDialog::MSAAChanged); connect(m_ui->msaaSlider, &QSlider::sliderMoved, this, &CMainDialog::MSAAChanged); + connect(m_ui->AFSlider, &QSlider::valueChanged, this, &CMainDialog::AFChanged); + connect(m_ui->AFSlider, &QSlider::sliderMoved, this, &CMainDialog::AFChanged); connect(m_ui->aspectRatioComboBox, &QComboBox::currentIndexChanged, this, &CMainDialog::AspectRatioChanged); connect(m_ui->xResSpinBox, &QSpinBox::valueChanged, this, &CMainDialog::XResChanged); @@ -321,6 +323,8 @@ void CMainDialog::UpdateInterface() m_ui->maxActorsNum->setNum(currentConfigApp->m_max_actors); m_ui->msaaSlider->setValue(log2(currentConfigApp->m_msaa)); m_ui->msaaNum->setNum(currentConfigApp->m_msaa); + m_ui->AFSlider->setValue(log2(currentConfigApp->m_anisotropy)); + m_ui->AFNum->setNum(currentConfigApp->m_anisotropy); } // FUNCTION: CONFIG 0x004045e0 @@ -550,6 +554,13 @@ void CMainDialog::MSAAChanged(int value) UpdateInterface(); } +void CMainDialog::AFChanged(int value) +{ + currentConfigApp->m_anisotropy = exp2(value); + m_modified = true; + UpdateInterface(); +} + void CMainDialog::SelectTexturePathDialog() { QString texture_path = QString::fromStdString(currentConfigApp->m_texture_path); diff --git a/CONFIG/MainDlg.h b/CONFIG/MainDlg.h index c453c785..0aaeeb12 100644 --- a/CONFIG/MainDlg.h +++ b/CONFIG/MainDlg.h @@ -61,6 +61,7 @@ private slots: void MaxLoDChanged(int value); void MaxActorsChanged(int value); void MSAAChanged(int value); + void AFChanged(int value); void SelectTexturePathDialog(); void TexturePathEdited(); void XResChanged(int i); diff --git a/CONFIG/config.cpp b/CONFIG/config.cpp index fd61fbb8..766cecd4 100644 --- a/CONFIG/config.cpp +++ b/CONFIG/config.cpp @@ -85,6 +85,7 @@ bool CConfigApp::InitInstance() m_joystick_index = -1; m_display_bit_depth = 16; m_msaa = 1; + m_anisotropy = 1; m_haptic = TRUE; m_touch_scheme = 2; m_texture_load = TRUE; @@ -184,6 +185,7 @@ bool CConfigApp::ReadRegisterSettings() 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_msaa = iniparser_getint(dict, "isle:MSAA", m_msaa); + 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_aspect_ratio = iniparser_getint(dict, "isle:Aspect Ratio", m_aspect_ratio); @@ -281,6 +283,18 @@ bool CConfigApp::ValidateSettings() m_msaa = 1; is_modified = TRUE; } + if (!(m_anisotropy & (m_anisotropy - 1))) { // Check if anisotropy is power of 2 (1, 2, 4, 8, etc) + m_anisotropy = exp2(round(log2(m_anisotropy))); // Closest power of 2 + is_modified = TRUE; + } + if (m_anisotropy > 16) { + m_anisotropy = 16; + is_modified = TRUE; + } + else if (m_anisotropy < 1) { + m_anisotropy = 1; + is_modified = TRUE; + } return is_modified; } @@ -360,6 +374,7 @@ void CConfigApp::WriteRegisterSettings() const SetIniInt(dict, "isle:Display Bit Depth", m_display_bit_depth); SetIniInt(dict, "isle:MSAA", m_msaa); + SetIniInt(dict, "isle:Anisotropic", m_anisotropy); SetIniBool(dict, "isle:Flip Surfaces", m_flip_surfaces); SetIniBool(dict, "isle:Full Screen", m_full_screen); SetIniBool(dict, "isle:Exclusive Full Screen", m_exclusive_full_screen); diff --git a/CONFIG/config.h b/CONFIG/config.h index 964bad8c..c0dcb851 100644 --- a/CONFIG/config.h +++ b/CONFIG/config.h @@ -71,6 +71,7 @@ public: Direct3DDeviceInfo* m_device; int m_display_bit_depth; int m_msaa; + int m_anisotropy; bool m_flip_surfaces; bool m_full_screen; bool m_exclusive_full_screen; diff --git a/CONFIG/res/maindialog.ui b/CONFIG/res/maindialog.ui index e1a8bf3e..e395159b 100644 --- a/CONFIG/res/maindialog.ui +++ b/CONFIG/res/maindialog.ui @@ -631,7 +631,7 @@ The game will gradually increase the number of actors until this maximum is reac - 3 + 6 0 @@ -823,65 +823,117 @@ The game will gradually increase the number of actors until this maximum is reac - - - MSAA - - + + + + 0 + + + 0 + + + 0 + + + 0 + - - - 0 - - - 4 - - - 1 - - - Qt::Orientation::Horizontal - - - QSlider::TickPosition::TicksBothSides - - - 1 + + + MSAA + + + + + 0 + + + 4 + + + 1 + + + Qt::Orientation::Horizontal + + + QSlider::TickPosition::TicksBothSides + + + 1 + + + + + + + + 16 + 0 + + + + 1 + + + Qt::AlignmentFlag::AlignCenter + + + + - - - - 16 - 0 - - - - 1 - - - Qt::AlignmentFlag::AlignCenter + + + Anisotropic Filtering + + + + + 0 + + + 4 + + + 1 + + + Qt::Orientation::Horizontal + + + QSlider::TickPosition::TicksBothSides + + + 1 + + + + + + + + 16 + 0 + + + + 1 + + + Qt::AlignmentFlag::AlignCenter + + + + - - - - Qt::Orientation::Vertical - - - - 20 - 0 - - - - @@ -1121,6 +1173,7 @@ The game will gradually increase the number of actors until this maximum is reac yResSpinBox exFullResComboBox msaaSlider + AFSlider touchComboBox rumbleCheckBox textureCheckBox