aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGloria <32610623+yeah-its-gloria@users.noreply.github.com>2023-03-20 16:56:14 +0100
committerGitHub <noreply@github.com>2023-03-20 16:56:14 +0100
commit19280cff2d3d618f032d0e6ef4b1d4414fa02f58 (patch)
treec7e28e82dbc7c884480c76fa5fe0f79f863f8c7a
parent4ba7a2c5e6f6209eb240d37a4b0c780f618f8836 (diff)
BIOS/NAND UI changes (#1587)
* Remember the last folder for BIOS files Add .mmc to the list of NAND filename extensions * Add .sd file extension for SD images * Fix UI code according to the review --------- Co-authored-by: yeah-its-serena <32610623+yeah-its-serena@users.noreply.github.com>
-rw-r--r--src/frontend/qt_sdl/Config.cpp2
-rw-r--r--src/frontend/qt_sdl/Config.h1
-rw-r--r--src/frontend/qt_sdl/EmuSettingsDialog.cpp59
3 files changed, 48 insertions, 14 deletions
diff --git a/src/frontend/qt_sdl/Config.cpp b/src/frontend/qt_sdl/Config.cpp
index e93ddc4..4e00046 100644
--- a/src/frontend/qt_sdl/Config.cpp
+++ b/src/frontend/qt_sdl/Config.cpp
@@ -122,6 +122,7 @@ int MicInputType;
std::string MicWavPath;
std::string LastROMFolder;
+std::string LastBIOSFolder;
std::string RecentROMList[10];
@@ -294,6 +295,7 @@ ConfigEntry ConfigFile[] =
{"MicWavPath", 2, &MicWavPath, (std::string)"", false},
{"LastROMFolder", 2, &LastROMFolder, (std::string)"", true},
+ {"LastBIOSFolder", 2, &LastBIOSFolder, (std::string)"", true},
{"RecentROM_0", 2, &RecentROMList[0], (std::string)"", true},
{"RecentROM_1", 2, &RecentROMList[1], (std::string)"", true},
diff --git a/src/frontend/qt_sdl/Config.h b/src/frontend/qt_sdl/Config.h
index 1b89cab..42b0a6a 100644
--- a/src/frontend/qt_sdl/Config.h
+++ b/src/frontend/qt_sdl/Config.h
@@ -167,6 +167,7 @@ extern int MicInputType;
extern std::string MicWavPath;
extern std::string LastROMFolder;
+extern std::string LastBIOSFolder;
extern std::string RecentROMList[10];
diff --git a/src/frontend/qt_sdl/EmuSettingsDialog.cpp b/src/frontend/qt_sdl/EmuSettingsDialog.cpp
index bd40568..78d2ac3 100644
--- a/src/frontend/qt_sdl/EmuSettingsDialog.cpp
+++ b/src/frontend/qt_sdl/EmuSettingsDialog.cpp
@@ -32,11 +32,24 @@
EmuSettingsDialog* EmuSettingsDialog::currentDlg = nullptr;
-extern std::string EmuDirectory;
extern bool RunningSomething;
bool EmuSettingsDialog::needsReset = false;
+inline void updateLastBIOSFolder(QString& filename)
+{
+ int pos = filename.lastIndexOf("/");
+ if (pos == -1)
+ {
+ pos = filename.lastIndexOf("\\");
+ }
+
+ QString path_dir = filename.left(pos);
+ QString path_file = filename.mid(pos+1);
+
+ Config::LastBIOSFolder = path_dir.toStdString();
+}
+
EmuSettingsDialog::EmuSettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::EmuSettingsDialog)
{
ui->setupUi(this);
@@ -292,11 +305,13 @@ void EmuSettingsDialog::on_btnBIOS9Browse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DS-mode ARM9 BIOS...",
- QString::fromStdString(EmuDirectory),
+ QString::fromStdString(Config::LastBIOSFolder),
"BIOS files (*.bin *.rom);;Any file (*.*)");
if (file.isEmpty()) return;
+ updateLastBIOSFolder(file);
+
ui->txtBIOS9Path->setText(file);
}
@@ -304,11 +319,13 @@ void EmuSettingsDialog::on_btnBIOS7Browse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DS-mode ARM7 BIOS...",
- QString::fromStdString(EmuDirectory),
+ QString::fromStdString(Config::LastBIOSFolder),
"BIOS files (*.bin *.rom);;Any file (*.*)");
if (file.isEmpty()) return;
+ updateLastBIOSFolder(file);
+
ui->txtBIOS7Path->setText(file);
}
@@ -316,11 +333,13 @@ void EmuSettingsDialog::on_btnFirmwareBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DS-mode firmware...",
- QString::fromStdString(EmuDirectory),
+ QString::fromStdString(Config::LastBIOSFolder),
"Firmware files (*.bin *.rom);;Any file (*.*)");
if (file.isEmpty()) return;
+ updateLastBIOSFolder(file);
+
ui->txtFirmwarePath->setText(file);
}
@@ -328,11 +347,13 @@ void EmuSettingsDialog::on_btnDSiBIOS9Browse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DSi-mode ARM9 BIOS...",
- QString::fromStdString(EmuDirectory),
+ QString::fromStdString(Config::LastBIOSFolder),
"BIOS files (*.bin *.rom);;Any file (*.*)");
if (file.isEmpty()) return;
+ updateLastBIOSFolder(file);
+
ui->txtDSiBIOS9Path->setText(file);
}
@@ -340,11 +361,13 @@ void EmuSettingsDialog::on_btnDSiBIOS7Browse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DSi-mode ARM7 BIOS...",
- QString::fromStdString(EmuDirectory),
+ QString::fromStdString(Config::LastBIOSFolder),
"BIOS files (*.bin *.rom);;Any file (*.*)");
if (file.isEmpty()) return;
+ updateLastBIOSFolder(file);
+
ui->txtDSiBIOS7Path->setText(file);
}
@@ -366,11 +389,13 @@ void EmuSettingsDialog::on_btnDLDISDBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DLDI SD image...",
- QString::fromStdString(EmuDirectory),
+ QString::fromStdString(Config::LastBIOSFolder),
"Image files (*.bin *.rom *.img *.dmg);;Any file (*.*)");
if (file.isEmpty()) return;
+ updateLastBIOSFolder(file);
+
ui->txtDLDISDPath->setText(file);
}
@@ -385,7 +410,7 @@ void EmuSettingsDialog::on_btnDLDIFolderBrowse_clicked()
{
QString dir = QFileDialog::getExistingDirectory(this,
"Select DLDI SD folder...",
- QString::fromStdString(EmuDirectory));
+ QString::fromStdString(Config::LastBIOSFolder));
if (dir.isEmpty()) return;
@@ -396,11 +421,13 @@ void EmuSettingsDialog::on_btnDSiFirmwareBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DSi DS-mode firmware...",
- QString::fromStdString(EmuDirectory),
+ QString::fromStdString(Config::LastBIOSFolder),
"Firmware files (*.bin *.rom);;Any file (*.*)");
if (file.isEmpty()) return;
+ updateLastBIOSFolder(file);
+
ui->txtDSiFirmwarePath->setText(file);
}
@@ -408,11 +435,13 @@ void EmuSettingsDialog::on_btnDSiNANDBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DSi NAND...",
- QString::fromStdString(EmuDirectory),
- "NAND files (*.bin *.rom);;Any file (*.*)");
+ QString::fromStdString(Config::LastBIOSFolder),
+ "NAND files (*.bin *.mmc *.rom);;Any file (*.*)");
if (file.isEmpty()) return;
+ updateLastBIOSFolder(file);
+
ui->txtDSiNANDPath->setText(file);
}
@@ -434,11 +463,13 @@ void EmuSettingsDialog::on_btnDSiSDBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DSi SD image...",
- QString::fromStdString(EmuDirectory),
- "Image files (*.bin *.rom *.img *.dmg);;Any file (*.*)");
+ QString::fromStdString(Config::LastBIOSFolder),
+ "Image files (*.bin *.rom *.img *.sd *.dmg);;Any file (*.*)");
if (file.isEmpty()) return;
+ updateLastBIOSFolder(file);
+
ui->txtDSiSDPath->setText(file);
}
@@ -453,7 +484,7 @@ void EmuSettingsDialog::on_btnDSiSDFolderBrowse_clicked()
{
QString dir = QFileDialog::getExistingDirectory(this,
"Select DSi SD folder...",
- QString::fromStdString(EmuDirectory));
+ QString::fromStdString(Config::LastBIOSFolder));
if (dir.isEmpty()) return;