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>
This commit is contained in:
Gloria 2023-03-20 16:56:14 +01:00 committed by GitHub
parent 4ba7a2c5e6
commit 19280cff2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 14 deletions

View File

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

View File

@ -167,6 +167,7 @@ extern int MicInputType;
extern std::string MicWavPath;
extern std::string LastROMFolder;
extern std::string LastBIOSFolder;
extern std::string RecentROMList[10];

View File

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