From d7b846619b7f1d392b7b5644ddf856290b44e7e1 Mon Sep 17 00:00:00 2001 From: Arisotura Date: Mon, 1 Jun 2020 19:11:44 +0200 Subject: [PATCH] add DSi-mode settings --- src/Config.cpp | 18 ++- src/Config.h | 9 +- src/frontend/qt_sdl/EmuSettingsDialog.cpp | 66 +++++++++++ src/frontend/qt_sdl/EmuSettingsDialog.h | 5 + src/frontend/qt_sdl/EmuSettingsDialog.ui | 129 +++++++++++++++++++++- src/frontend/qt_sdl/PlatformConfig.cpp | 14 +++ src/frontend/qt_sdl/PlatformConfig.h | 7 ++ src/frontend/qt_sdl/main.cpp | 1 + 8 files changed, 232 insertions(+), 17 deletions(-) diff --git a/src/Config.cpp b/src/Config.cpp index 84c83d8e..5745f348 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -32,11 +32,10 @@ char BIOS9Path[1024]; char BIOS7Path[1024]; char FirmwarePath[1024]; -int _3DRenderer; -int Threaded3D; - -int GL_ScaleFactor; -int GL_Antialias; +char DSiBIOS9Path[1024]; +char DSiBIOS7Path[1024]; +char DSiFirmwarePath[1024]; +char DSiNANDPath[1024]; ConfigEntry ConfigFile[] = { @@ -44,11 +43,10 @@ ConfigEntry ConfigFile[] = {"BIOS7Path", 1, BIOS7Path, 0, "", 1023}, {"FirmwarePath", 1, FirmwarePath, 0, "", 1023}, - {"3DRenderer", 0, &_3DRenderer, 1, NULL, 0}, - {"Threaded3D", 0, &Threaded3D, 1, NULL, 0}, - - {"GL_ScaleFactor", 0, &GL_ScaleFactor, 1, NULL, 0}, - {"GL_Antialias", 0, &GL_Antialias, 0, NULL, 0}, + {"DSiBIOS9Path", 1, DSiBIOS9Path, 0, "", 1023}, + {"DSiBIOS7Path", 1, DSiBIOS7Path, 0, "", 1023}, + {"DSiFirmwarePath", 1, DSiFirmwarePath, 0, "", 1023}, + {"DSiNANDPath", 1, DSiNANDPath, 0, "", 1023}, {"", -1, NULL, 0, NULL, 0} }; diff --git a/src/Config.h b/src/Config.h index 05b9b8b9..3947598f 100644 --- a/src/Config.h +++ b/src/Config.h @@ -46,11 +46,10 @@ extern char BIOS9Path[1024]; extern char BIOS7Path[1024]; extern char FirmwarePath[1024]; -extern int _3DRenderer; -extern int Threaded3D; - -extern int GL_ScaleFactor; -extern int GL_Antialias; +extern char DSiBIOS9Path[1024]; +extern char DSiBIOS7Path[1024]; +extern char DSiFirmwarePath[1024]; +extern char DSiNANDPath[1024]; } diff --git a/src/frontend/qt_sdl/EmuSettingsDialog.cpp b/src/frontend/qt_sdl/EmuSettingsDialog.cpp index 5c2efc0e..7760a88b 100644 --- a/src/frontend/qt_sdl/EmuSettingsDialog.cpp +++ b/src/frontend/qt_sdl/EmuSettingsDialog.cpp @@ -42,6 +42,16 @@ EmuSettingsDialog::EmuSettingsDialog(QWidget* parent) : QDialog(parent), ui(new ui->txtBIOS9Path->setText(Config::BIOS9Path); ui->txtBIOS7Path->setText(Config::BIOS7Path); ui->txtFirmwarePath->setText(Config::FirmwarePath); + + ui->txtDSiBIOS9Path->setText(Config::DSiBIOS9Path); + ui->txtDSiBIOS7Path->setText(Config::DSiBIOS7Path); + ui->txtDSiFirmwarePath->setText(Config::DSiFirmwarePath); + ui->txtDSiNANDPath->setText(Config::DSiNANDPath); + + ui->cbxConsoleType->addItem("DS"); + ui->cbxConsoleType->addItem("DSi"); + ui->cbxConsoleType->setCurrentIndex(Config::ConsoleType); + ui->chkDirectBoot->setChecked(Config::DirectBoot != 0); } @@ -99,7 +109,15 @@ void EmuSettingsDialog::on_EmuSettingsDialog_accepted() strncpy(Config::BIOS9Path, ui->txtBIOS9Path->text().toStdString().c_str(), 1023); Config::BIOS9Path[1023] = '\0'; strncpy(Config::BIOS7Path, ui->txtBIOS7Path->text().toStdString().c_str(), 1023); Config::BIOS7Path[1023] = '\0'; strncpy(Config::FirmwarePath, ui->txtFirmwarePath->text().toStdString().c_str(), 1023); Config::FirmwarePath[1023] = '\0'; + + strncpy(Config::DSiBIOS9Path, ui->txtDSiBIOS9Path->text().toStdString().c_str(), 1023); Config::DSiBIOS9Path[1023] = '\0'; + strncpy(Config::DSiBIOS7Path, ui->txtDSiBIOS7Path->text().toStdString().c_str(), 1023); Config::DSiBIOS7Path[1023] = '\0'; + strncpy(Config::DSiFirmwarePath, ui->txtDSiFirmwarePath->text().toStdString().c_str(), 1023); Config::DSiFirmwarePath[1023] = '\0'; + strncpy(Config::DSiNANDPath, ui->txtDSiNANDPath->text().toStdString().c_str(), 1023); Config::DSiNANDPath[1023] = '\0'; + + Config::ConsoleType = ui->cbxConsoleType->currentIndex(); Config::DirectBoot = ui->chkDirectBoot->isChecked() ? 1:0; + Config::Save(); closeDlg(); @@ -145,3 +163,51 @@ void EmuSettingsDialog::on_btnFirmwareBrowse_clicked() ui->txtFirmwarePath->setText(file); } + +void EmuSettingsDialog::on_btnDSiBIOS9Browse_clicked() +{ + QString file = QFileDialog::getOpenFileName(this, + "Select DSi-mode ARM9 BIOS...", + EmuDirectory, + "BIOS files (*.bin *.rom);;Any file (*.*)"); + + if (file.isEmpty()) return; + + ui->txtDSiBIOS9Path->setText(file); +} + +void EmuSettingsDialog::on_btnDSiBIOS7Browse_clicked() +{ + QString file = QFileDialog::getOpenFileName(this, + "Select DSi-mode ARM7 BIOS...", + EmuDirectory, + "BIOS files (*.bin *.rom);;Any file (*.*)"); + + if (file.isEmpty()) return; + + ui->txtDSiBIOS7Path->setText(file); +} + +void EmuSettingsDialog::on_btnDSiFirmwareBrowse_clicked() +{ + QString file = QFileDialog::getOpenFileName(this, + "Select DSi DS-mode firmware...", + EmuDirectory, + "Firmware files (*.bin *.rom);;Any file (*.*)"); + + if (file.isEmpty()) return; + + ui->txtDSiFirmwarePath->setText(file); +} + +void EmuSettingsDialog::on_btnDSiNANDBrowse_clicked() +{ + QString file = QFileDialog::getOpenFileName(this, + "Select DSi NAND...", + EmuDirectory, + "NAND files (*.bin *.rom);;Any file (*.*)"); + + if (file.isEmpty()) return; + + ui->txtDSiNANDPath->setText(file); +} diff --git a/src/frontend/qt_sdl/EmuSettingsDialog.h b/src/frontend/qt_sdl/EmuSettingsDialog.h index 73786417..f604ba50 100644 --- a/src/frontend/qt_sdl/EmuSettingsDialog.h +++ b/src/frontend/qt_sdl/EmuSettingsDialog.h @@ -58,6 +58,11 @@ private slots: void on_btnBIOS7Browse_clicked(); void on_btnFirmwareBrowse_clicked(); + void on_btnDSiBIOS9Browse_clicked(); + void on_btnDSiBIOS7Browse_clicked(); + void on_btnDSiFirmwareBrowse_clicked(); + void on_btnDSiNANDBrowse_clicked(); + private: void verifyFirmware(); diff --git a/src/frontend/qt_sdl/EmuSettingsDialog.ui b/src/frontend/qt_sdl/EmuSettingsDialog.ui index c70c3a23..4894fa5e 100644 --- a/src/frontend/qt_sdl/EmuSettingsDialog.ui +++ b/src/frontend/qt_sdl/EmuSettingsDialog.ui @@ -7,7 +7,7 @@ 0 0 490 - 217 + 392 @@ -119,13 +119,138 @@ + + + + DSi mode + + + + + + Browse... + + + + + + + DSi ARM9 BIOS: + + + + + + + Browse... + + + + + + + <html><head/><body><p>DSi-mode ARM7 BIOS</p><p><br/></p><p>Size should be 64 KB</p></body></html> + + + + + + + <html><head/><body><p>DSi-mode firmware (used for DS-mode backwards compatibility)</p><p><br/></p><p>Size should be 128 KB</p></body></html> + + + + + + + DSi ARM7 BIOS: + + + + + + + DSi firmware: + + + + + + + Browse... + + + + + + + + 0 + 0 + + + + <html><head/><body><p>DSi-mode ARM9 BIOS</p><p><br/></p><p>Size should be 64 KB</p></body></html> + + + + + + + DSi NAND: + + + + + + + <html><head/><body><p>DSi NAND dump</p><p><br/></p><p>Should have 'nocash footer' at the end</p></body></html> + + + + + + + Browse... + + + + + + - Startup + General + + + + 0 + 0 + + + + Console type: + + + + + + + + 0 + 0 + + + + <html><head/><body><p>The type of console to emulate</p></body></html> + + + + <html><head/><body><p>When loading a ROM, completely skip the regular boot process (&quot;Nintendo DS&quot; screen) to boot the ROM directly.</p><p><br/></p><p>Note: if your firmware dump isn't bootable, the ROM will be booted directly regardless of this setting.</p></body></html> diff --git a/src/frontend/qt_sdl/PlatformConfig.cpp b/src/frontend/qt_sdl/PlatformConfig.cpp index 03fd2ac0..06128d79 100644 --- a/src/frontend/qt_sdl/PlatformConfig.cpp +++ b/src/frontend/qt_sdl/PlatformConfig.cpp @@ -47,10 +47,17 @@ int ScreenUseGL; int ScreenVSync; int ScreenVSyncInterval; +int _3DRenderer; +int Threaded3D; + +int GL_ScaleFactor; +int GL_Antialias; + int LimitFPS; int AudioSync; int ShowOSD; +int ConsoleType; int DirectBoot; int SocketBindAnyAddr; @@ -129,10 +136,17 @@ ConfigEntry PlatformConfigFile[] = {"ScreenVSync", 0, &ScreenVSync, 0, NULL, 0}, {"ScreenVSyncInterval", 0, &ScreenVSyncInterval, 1, NULL, 0}, + {"3DRenderer", 0, &_3DRenderer, 1, NULL, 0}, + {"Threaded3D", 0, &Threaded3D, 1, NULL, 0}, + + {"GL_ScaleFactor", 0, &GL_ScaleFactor, 1, NULL, 0}, + {"GL_Antialias", 0, &GL_Antialias, 0, NULL, 0}, + {"LimitFPS", 0, &LimitFPS, 0, NULL, 0}, {"AudioSync", 0, &AudioSync, 1, NULL, 0}, {"ShowOSD", 0, &ShowOSD, 1, NULL, 0}, + {"ConsoleType", 0, &ConsoleType, 0, NULL, 0}, {"DirectBoot", 0, &DirectBoot, 1, NULL, 0}, {"SockBindAnyAddr", 0, &SocketBindAnyAddr, 0, NULL, 0}, diff --git a/src/frontend/qt_sdl/PlatformConfig.h b/src/frontend/qt_sdl/PlatformConfig.h index cc288b65..791bb071 100644 --- a/src/frontend/qt_sdl/PlatformConfig.h +++ b/src/frontend/qt_sdl/PlatformConfig.h @@ -60,10 +60,17 @@ extern int ScreenUseGL; extern int ScreenVSync; extern int ScreenVSyncInterval; +extern int _3DRenderer; +extern int Threaded3D; + +extern int GL_ScaleFactor; +extern int GL_Antialias; + extern int LimitFPS; extern int AudioSync; extern int ShowOSD; +extern int ConsoleType; extern int DirectBoot; extern int SocketBindAnyAddr; diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index a3207c74..ef21bc76 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -1889,6 +1889,7 @@ int main(int argc, char** argv) Config::Load(); #define SANITIZE(var, min, max) { if (var < min) var = min; else if (var > max) var = max; } + SANITIZE(Config::ConsoleType, 0, 1); SANITIZE(Config::_3DRenderer, 0, 1); SANITIZE(Config::ScreenVSyncInterval, 1, 20); SANITIZE(Config::GL_ScaleFactor, 1, 16);