Add Texture Loader extension config, fix var case

This commit is contained in:
VoxelTek 2025-07-14 14:46:54 +10:00
parent 753c8260ba
commit 47d32c6ef3
5 changed files with 118 additions and 8 deletions

View File

@ -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();
}

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>550</width>
<height>620</height>
<height>700</height>
</rect>
</property>
<property name="sizePolicy">
@ -606,6 +606,57 @@ A higher setting will cause higher quality textures to be drawn regardless of di
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Texture Loader Extension</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="1">
<widget class="QLineEdit" name="texturePath">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Path to texture replacements.</string>
</property>
<property name="placeholderText">
<string>textures/</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="texturePathOpen">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="textureCheckBox">
<property name="text">
<string>Enabled</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="advancedGroup">
<property name="sizePolicy">