aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/qt_sdl/EmuSettingsDialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/qt_sdl/EmuSettingsDialog.cpp')
-rw-r--r--src/frontend/qt_sdl/EmuSettingsDialog.cpp139
1 files changed, 133 insertions, 6 deletions
diff --git a/src/frontend/qt_sdl/EmuSettingsDialog.cpp b/src/frontend/qt_sdl/EmuSettingsDialog.cpp
index 31e2e52..9413846 100644
--- a/src/frontend/qt_sdl/EmuSettingsDialog.cpp
+++ b/src/frontend/qt_sdl/EmuSettingsDialog.cpp
@@ -48,15 +48,10 @@ EmuSettingsDialog::EmuSettingsDialog(QWidget* parent) : QDialog(parent), ui(new
ui->txtBIOS7Path->setText(Config::BIOS7Path);
ui->txtFirmwarePath->setText(Config::FirmwarePath);
- ui->cbDLDIEnable->setChecked(Config::DLDIEnable != 0);
- ui->txtDLDISDPath->setText(Config::DLDISDPath);
-
ui->txtDSiBIOS9Path->setText(Config::DSiBIOS9Path);
ui->txtDSiBIOS7Path->setText(Config::DSiBIOS7Path);
ui->txtDSiFirmwarePath->setText(Config::DSiFirmwarePath);
ui->txtDSiNANDPath->setText(Config::DSiNANDPath);
- ui->cbDSiSDEnable->setChecked(Config::DSiSDEnable != 0);
- ui->txtDSiSDPath->setText(Config::DSiSDPath);
ui->cbxConsoleType->addItem("DS");
ui->cbxConsoleType->addItem("DSi (experimental)");
@@ -83,6 +78,45 @@ EmuSettingsDialog::EmuSettingsDialog(QWidget* parent) : QDialog(parent), ui(new
on_chkEnableJIT_toggled();
on_chkExternalBIOS_toggled();
+
+ const int imgsizes[] = {256, 512, 1024, 2048, 4096, 0};
+
+ ui->cbxDLDISize->addItem("Auto");
+ ui->cbxDSiSDSize->addItem("Auto");
+
+ for (int i = 0; imgsizes[i] != 0; i++)
+ {
+ int sizedisp = imgsizes[i];
+ QString sizelbl;
+ if (sizedisp >= 1024)
+ {
+ sizedisp >>= 10;
+ sizelbl = QString("%1 GB").arg(sizedisp);
+ }
+ else
+ {
+ sizelbl = QString("%1 MB").arg(sizedisp);
+ }
+
+ ui->cbxDLDISize->addItem(sizelbl);
+ ui->cbxDSiSDSize->addItem(sizelbl);
+ }
+
+ ui->cbDLDIEnable->setChecked(Config::DLDIEnable != 0);
+ ui->txtDLDISDPath->setText(Config::DLDISDPath);
+ ui->cbxDLDISize->setCurrentIndex(Config::DLDISize);
+ ui->cbDLDIReadOnly->setChecked(Config::DLDIReadOnly != 0);
+ ui->cbDLDIFolder->setChecked(Config::DLDIFolderSync != 0);
+ ui->txtDLDIFolder->setText(Config::DLDIFolderPath);
+ on_cbDLDIEnable_toggled();
+
+ ui->cbDSiSDEnable->setChecked(Config::DSiSDEnable != 0);
+ ui->txtDSiSDPath->setText(Config::DSiSDPath);
+ ui->cbxDSiSDSize->setCurrentIndex(Config::DSiSDSize);
+ ui->cbDSiSDReadOnly->setChecked(Config::DSiSDReadOnly != 0);
+ ui->cbDSiSDFolder->setChecked(Config::DSiSDFolderSync != 0);
+ ui->txtDSiSDFolder->setText(Config::DSiSDFolderPath);
+ on_cbDSiSDEnable_toggled();
}
EmuSettingsDialog::~EmuSettingsDialog()
@@ -154,14 +188,25 @@ void EmuSettingsDialog::done(int r)
std::string bios9Path = ui->txtBIOS9Path->text().toStdString();
std::string bios7Path = ui->txtBIOS7Path->text().toStdString();
std::string firmwarePath = ui->txtFirmwarePath->text().toStdString();
+
int dldiEnable = ui->cbDLDIEnable->isChecked() ? 1:0;
std::string dldiSDPath = ui->txtDLDISDPath->text().toStdString();
+ int dldiSize = ui->cbxDLDISize->currentIndex();
+ int dldiReadOnly = ui->cbDLDIReadOnly->isChecked() ? 1:0;
+ int dldiFolderSync = ui->cbDLDIFolder->isChecked() ? 1:0;
+ std::string dldiFolderPath = ui->txtDLDIFolder->text().toStdString();
+
std::string dsiBios9Path = ui->txtDSiBIOS9Path->text().toStdString();
std::string dsiBios7Path = ui->txtDSiBIOS7Path->text().toStdString();
std::string dsiFirmwarePath = ui->txtDSiFirmwarePath->text().toStdString();
std::string dsiNANDPath = ui->txtDSiNANDPath->text().toStdString();
+
int dsiSDEnable = ui->cbDSiSDEnable->isChecked() ? 1:0;
std::string dsiSDPath = ui->txtDSiSDPath->text().toStdString();
+ int dsiSDSize = ui->cbxDSiSDSize->currentIndex();
+ int dsiSDReadOnly = ui->cbDSiSDReadOnly->isChecked() ? 1:0;
+ int dsiSDFolderSync = ui->cbDSiSDFolder->isChecked() ? 1:0;
+ std::string dsiSDFolderPath = ui->txtDSiSDFolder->text().toStdString();
if (consoleType != Config::ConsoleType
|| directBoot != Config::DirectBoot
@@ -178,12 +223,20 @@ void EmuSettingsDialog::done(int r)
|| strcmp(Config::FirmwarePath, firmwarePath.c_str()) != 0
|| dldiEnable != Config::DLDIEnable
|| strcmp(Config::DLDISDPath, dldiSDPath.c_str()) != 0
+ || dldiSize != Config::DLDISize
+ || dldiReadOnly != Config::DLDIReadOnly
+ || dldiFolderSync != Config::DLDIFolderSync
+ || strcmp(Config::DLDIFolderPath, dldiFolderPath.c_str()) != 0
|| strcmp(Config::DSiBIOS9Path, dsiBios9Path.c_str()) != 0
|| strcmp(Config::DSiBIOS7Path, dsiBios7Path.c_str()) != 0
|| strcmp(Config::DSiFirmwarePath, dsiFirmwarePath.c_str()) != 0
|| strcmp(Config::DSiNANDPath, dsiNANDPath.c_str()) != 0
|| dsiSDEnable != Config::DSiSDEnable
- || strcmp(Config::DSiSDPath, dsiSDPath.c_str()) != 0)
+ || strcmp(Config::DSiSDPath, dsiSDPath.c_str()) != 0
+ || dsiSDSize != Config::DSiSDSize
+ || dsiSDReadOnly != Config::DSiSDReadOnly
+ || dsiSDFolderSync != Config::DSiSDFolderSync
+ || strcmp(Config::DSiSDFolderPath, dsiSDFolderPath.c_str()) != 0)
{
if (RunningSomething
&& QMessageBox::warning(this, "Reset necessary to apply changes",
@@ -195,15 +248,25 @@ void EmuSettingsDialog::done(int r)
strncpy(Config::BIOS9Path, bios9Path.c_str(), 1023); Config::BIOS9Path[1023] = '\0';
strncpy(Config::BIOS7Path, bios7Path.c_str(), 1023); Config::BIOS7Path[1023] = '\0';
strncpy(Config::FirmwarePath, firmwarePath.c_str(), 1023); Config::FirmwarePath[1023] = '\0';
+
Config::DLDIEnable = dldiEnable;
strncpy(Config::DLDISDPath, dldiSDPath.c_str(), 1023); Config::DLDISDPath[1023] = '\0';
+ Config::DLDISize = dldiSize;
+ Config::DLDIReadOnly = dldiReadOnly;
+ Config::DLDIFolderSync = dldiFolderSync;
+ strncpy(Config::DLDIFolderPath, dldiFolderPath.c_str(), 1023); Config::DLDIFolderPath[1023] = '\0';
strncpy(Config::DSiBIOS9Path, dsiBios9Path.c_str(), 1023); Config::DSiBIOS9Path[1023] = '\0';
strncpy(Config::DSiBIOS7Path, dsiBios7Path.c_str(), 1023); Config::DSiBIOS7Path[1023] = '\0';
strncpy(Config::DSiFirmwarePath, dsiFirmwarePath.c_str(), 1023); Config::DSiFirmwarePath[1023] = '\0';
strncpy(Config::DSiNANDPath, dsiNANDPath.c_str(), 1023); Config::DSiNANDPath[1023] = '\0';
+
Config::DSiSDEnable = dsiSDEnable;
strncpy(Config::DSiSDPath, dsiSDPath.c_str(), 1023); Config::DSiSDPath[1023] = '\0';
+ Config::DSiSDSize = dsiSDSize;
+ Config::DSiSDReadOnly = dsiSDReadOnly;
+ Config::DSiSDFolderSync = dsiSDFolderSync;
+ strncpy(Config::DSiSDFolderPath, dsiSDFolderPath.c_str(), 1023); Config::DSiSDFolderPath[1023] = '\0';
#ifdef JIT_ENABLED
Config::JIT_Enable = jitEnable;
@@ -287,6 +350,20 @@ void EmuSettingsDialog::on_btnDSiBIOS7Browse_clicked()
ui->txtDSiBIOS7Path->setText(file);
}
+void EmuSettingsDialog::on_cbDLDIEnable_toggled()
+{
+ bool disabled = !ui->cbDLDIEnable->isChecked();
+ ui->txtDLDISDPath->setDisabled(disabled);
+ ui->btnDLDISDBrowse->setDisabled(disabled);
+ ui->cbxDLDISize->setDisabled(disabled);
+ ui->cbDLDIReadOnly->setDisabled(disabled);
+ ui->cbDLDIFolder->setDisabled(disabled);
+
+ if (!disabled) disabled = !ui->cbDLDIFolder->isChecked();
+ ui->txtDLDIFolder->setDisabled(disabled);
+ ui->btnDLDIFolderBrowse->setDisabled(disabled);
+}
+
void EmuSettingsDialog::on_btnDLDISDBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
@@ -299,6 +376,24 @@ void EmuSettingsDialog::on_btnDLDISDBrowse_clicked()
ui->txtDLDISDPath->setText(file);
}
+void EmuSettingsDialog::on_cbDLDIFolder_toggled()
+{
+ bool disabled = !ui->cbDLDIFolder->isChecked();
+ ui->txtDLDIFolder->setDisabled(disabled);
+ ui->btnDLDIFolderBrowse->setDisabled(disabled);
+}
+
+void EmuSettingsDialog::on_btnDLDIFolderBrowse_clicked()
+{
+ QString dir = QFileDialog::getExistingDirectory(this,
+ "Select DLDI SD folder...",
+ EmuDirectory);
+
+ if (dir.isEmpty()) return;
+
+ ui->txtDLDIFolder->setText(dir);
+}
+
void EmuSettingsDialog::on_btnDSiFirmwareBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
@@ -323,6 +418,20 @@ void EmuSettingsDialog::on_btnDSiNANDBrowse_clicked()
ui->txtDSiNANDPath->setText(file);
}
+void EmuSettingsDialog::on_cbDSiSDEnable_toggled()
+{
+ bool disabled = !ui->cbDSiSDEnable->isChecked();
+ ui->txtDSiSDPath->setDisabled(disabled);
+ ui->btnDSiSDBrowse->setDisabled(disabled);
+ ui->cbxDSiSDSize->setDisabled(disabled);
+ ui->cbDSiSDReadOnly->setDisabled(disabled);
+ ui->cbDSiSDFolder->setDisabled(disabled);
+
+ if (!disabled) disabled = !ui->cbDSiSDFolder->isChecked();
+ ui->txtDSiSDFolder->setDisabled(disabled);
+ ui->btnDSiSDFolderBrowse->setDisabled(disabled);
+}
+
void EmuSettingsDialog::on_btnDSiSDBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
@@ -335,6 +444,24 @@ void EmuSettingsDialog::on_btnDSiSDBrowse_clicked()
ui->txtDSiSDPath->setText(file);
}
+void EmuSettingsDialog::on_cbDSiSDFolder_toggled()
+{
+ bool disabled = !ui->cbDSiSDFolder->isChecked();
+ ui->txtDSiSDFolder->setDisabled(disabled);
+ ui->btnDSiSDFolderBrowse->setDisabled(disabled);
+}
+
+void EmuSettingsDialog::on_btnDSiSDFolderBrowse_clicked()
+{
+ QString dir = QFileDialog::getExistingDirectory(this,
+ "Select DSi SD folder...",
+ EmuDirectory);
+
+ if (dir.isEmpty()) return;
+
+ ui->txtDSiSDFolder->setText(dir);
+}
+
void EmuSettingsDialog::on_chkEnableJIT_toggled()
{
bool disabled = !ui->chkEnableJIT->isChecked();