diff options
author | Arisotura <thetotalworm@gmail.com> | 2021-11-18 18:17:48 +0100 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2021-11-18 18:17:48 +0100 |
commit | f73df85d1c66b1b2f028a5aec4ebc04874863b8f (patch) | |
tree | b6e71f6881700acbce11ab2eedad8f06254c2f66 /src | |
parent | 19ddaee13b5400b14ef3d3a6299474e7f715a948 (diff) |
make external-BIOS toggle also explicitly control external firmware
make things a tad more consistent and explicit
Diffstat (limited to 'src')
-rw-r--r-- | src/SPI.cpp | 67 | ||||
-rw-r--r-- | src/frontend/Util_ROM.cpp | 2 | ||||
-rw-r--r-- | src/frontend/qt_sdl/EmuSettingsDialog.cpp | 6 | ||||
-rw-r--r-- | src/frontend/qt_sdl/EmuSettingsDialog.ui | 166 | ||||
-rw-r--r-- | src/frontend/qt_sdl/FirmwareSettingsDialog.ui | 11 |
5 files changed, 143 insertions, 109 deletions
diff --git a/src/SPI.cpp b/src/SPI.cpp index e8a7d35..7db04e2 100644 --- a/src/SPI.cpp +++ b/src/SPI.cpp @@ -143,18 +143,16 @@ void LoadFirmwareFromFile(FILE* f) fseek(f, 0, SEEK_SET); fread(Firmware, 1, FirmwareLength, f); - fclose(f); - // take a backup std::string fwBackupPath = FirmwarePath + ".bak"; - f = Platform::OpenLocalFile(fwBackupPath, "rb"); - if (!f) + FILE* bf = Platform::OpenLocalFile(fwBackupPath, "rb"); + if (!bf) { - f = Platform::OpenLocalFile(fwBackupPath, "wb"); - if (f) + bf = Platform::OpenLocalFile(fwBackupPath, "wb"); + if (bf) { - fwrite(Firmware, 1, FirmwareLength, f); - fclose(f); + fwrite(Firmware, 1, FirmwareLength, bf); + fclose(bf); } else { @@ -163,7 +161,7 @@ void LoadFirmwareFromFile(FILE* f) } else { - fclose(f); + fclose(bf); } } @@ -197,22 +195,32 @@ void LoadUserSettingsFromConfig() void Reset() { if (Firmware) delete[] Firmware; - Firmware = NULL; - - if (NDS::ConsoleType == 1) - FirmwarePath = Platform::GetConfigString(Platform::DSi_FirmwarePath); - else - FirmwarePath = Platform::GetConfigString(Platform::FirmwarePath); + Firmware = nullptr; + FirmwarePath = ""; - FILE* f = Platform::OpenLocalFile(FirmwarePath, "rb"); - if (!f) + if (Platform::GetConfigBool(Platform::ExternalBIOSEnable)) { - printf("Firmware not found! Generating default firmware.\n"); - LoadDefaultFirmware(); + if (NDS::ConsoleType == 1) + FirmwarePath = Platform::GetConfigString(Platform::DSi_FirmwarePath); + else + FirmwarePath = Platform::GetConfigString(Platform::FirmwarePath); + + FILE* f = Platform::OpenLocalFile(FirmwarePath, "rb"); + if (!f) + { + printf("Firmware not found! Generating default firmware.\n"); + FirmwarePath = ""; + } + else + { + LoadFirmwareFromFile(f); + fclose(f); + } } - else + + if (FirmwarePath.empty()) { - LoadFirmwareFromFile(f); + LoadDefaultFirmware(); } FirmwareMask = FirmwareLength - 1; @@ -226,7 +234,7 @@ void Reset() UserSettings = userdata; - if (!f || Platform::GetConfigBool(Platform::Firm_OverrideSettings)) + if (FirmwarePath.empty() || Platform::GetConfigBool(Platform::Firm_OverrideSettings)) LoadUserSettingsFromConfig(); // fix touchscreen coords @@ -422,13 +430,16 @@ void Write(u8 val, u32 hold) if (!hold && (CurCmd == 0x02 || CurCmd == 0x0A)) { - FILE* f = Platform::OpenLocalFile(FirmwarePath, "r+b"); - if (f) + if (!FirmwarePath.empty()) { - u32 cutoff = 0x7FA00 & FirmwareMask; - fseek(f, cutoff, SEEK_SET); - fwrite(&Firmware[cutoff], FirmwareLength-cutoff, 1, f); - fclose(f); + FILE* f = Platform::OpenLocalFile(FirmwarePath, "r+b"); + if (f) + { + u32 cutoff = 0x7FA00 & FirmwareMask; + fseek(f, cutoff, SEEK_SET); + fwrite(&Firmware[cutoff], FirmwareLength-cutoff, 1, f); + fclose(f); + } } } } diff --git a/src/frontend/Util_ROM.cpp b/src/frontend/Util_ROM.cpp index 99c7054..2fb8dac 100644 --- a/src/frontend/Util_ROM.cpp +++ b/src/frontend/Util_ROM.cpp @@ -163,6 +163,8 @@ int VerifyDSFirmware() FILE* f; long len; + if (!Config::ExternalBIOSEnable) return Load_FirmwareNotBootable; + f = Platform::OpenLocalFile(Config::FirmwarePath, "rb"); if (!f) return Load_FirmwareNotBootable; diff --git a/src/frontend/qt_sdl/EmuSettingsDialog.cpp b/src/frontend/qt_sdl/EmuSettingsDialog.cpp index 379300f..fd2ca85 100644 --- a/src/frontend/qt_sdl/EmuSettingsDialog.cpp +++ b/src/frontend/qt_sdl/EmuSettingsDialog.cpp @@ -475,6 +475,10 @@ void EmuSettingsDialog::on_chkEnableJIT_toggled() void EmuSettingsDialog::on_chkExternalBIOS_toggled() { bool disabled = !ui->chkExternalBIOS->isChecked(); - ui->txtBIOS7Path->setDisabled(disabled); ui->txtBIOS9Path->setDisabled(disabled); + ui->btnBIOS9Browse->setDisabled(disabled); + ui->txtBIOS7Path->setDisabled(disabled); + ui->btnBIOS7Browse->setDisabled(disabled); + ui->txtFirmwarePath->setDisabled(disabled); + ui->btnFirmwareBrowse->setDisabled(disabled); } diff --git a/src/frontend/qt_sdl/EmuSettingsDialog.ui b/src/frontend/qt_sdl/EmuSettingsDialog.ui index 2a94ffa..465c38c 100644 --- a/src/frontend/qt_sdl/EmuSettingsDialog.ui +++ b/src/frontend/qt_sdl/EmuSettingsDialog.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>575</width> - <height>351</height> + <height>370</height> </rect> </property> <property name="sizePolicy"> @@ -191,8 +191,11 @@ </item> <item row="0" column="0" colspan="3"> <widget class="QCheckBox" name="chkExternalBIOS"> + <property name="whatsThis"> + <string><html><head/><body><p>Allows using external user-provided BIOS and firmware dumps.</p></body></html></string> + </property> <property name="text"> - <string>Use external BIOS files</string> + <string>Use external BIOS/firmware files</string> </property> </widget> </item> @@ -203,28 +206,31 @@ <string>DSi-mode</string> </attribute> <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label_5"> + <item row="9" column="0"> + <widget class="QCheckBox" name="cbDSiSDReadOnly"> + <property name="whatsThis"> + <string><html><head/><body><p>Make the emulated SD card read-only.</p></body></html></string> + </property> <property name="text"> - <string>DSi ARM9 BIOS:</string> + <string>Read-only SD</string> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QPathInput" name="txtDSiFirmwarePath"> - <property name="whatsThis"> - <string><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></string> + <item row="10" column="2"> + <widget class="QPushButton" name="btnDSiSDFolderBrowse"> + <property name="text"> + <string>Browse...</string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QPathInput" name="txtDSiBIOS7Path"> - <property name="whatsThis"> - <string><html><head/><body><p>DSi-mode ARM7 BIOS</p><p><br/></p><p>Size should be 64 KB</p></body></html></string> + <item row="5" column="0" colspan="3"> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string/> </property> </widget> </item> - <item row="9" column="0"> + <item row="10" column="0"> <widget class="QCheckBox" name="cbDSiSDFolder"> <property name="whatsThis"> <string><html><head/><body><p>Sync the emulated SD card to the given folder. The folder's contents will be copied to the SD image, and any change made to the SD image will be reflected to the folder.</p></body></html></string> @@ -234,90 +240,77 @@ </property> </widget> </item> - <item row="2" column="2"> - <widget class="QPushButton" name="btnDSiFirmwareBrowse"> - <property name="text"> - <string>Browse...</string> + <item row="8" column="1"> + <widget class="QComboBox" name="cbxDSiSDSize"> + <property name="whatsThis"> + <string><html><head/><body><p>Size of the SD image.</p><p><br/></p><p>If set to Auto:</p><p>* if an image file exists, the volume size will be that of the image file</p><p>* if no image file exists and folder sync is enabled, the volume size will be determined from the synced folder's contents</p><p>* otherwise, the volume size will default to 512 MB</p></body></html></string> </property> </widget> </item> - <item row="6" column="1"> - <widget class="QPathInput" name="txtDSiSDPath"> + <item row="10" column="1"> + <widget class="QLineEdit" name="txtDSiSDFolder"> <property name="whatsThis"> - <string><html><head/><body><p>SD image file for emulating the DSi's SD card. A blank image file will be created if it doesn't already exist.</p></body></html></string> + <string><html><head/><body><p>Sync the emulated SD card to the given folder. The folder's contents will be copied to the SD image, and any change made to the SD image will be reflected to the folder.</p></body></html></string> </property> </widget> </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_10"> + <item row="3" column="0"> + <widget class="QLabel" name="label_7"> <property name="text"> - <string>SD card image:</string> - </property> - </widget> - </item> - <item row="7" column="1"> - <widget class="QComboBox" name="cbxDSiSDSize"> - <property name="whatsThis"> - <string><html><head/><body><p>Size of the SD image.</p><p><br/></p><p>If set to Auto:</p><p>* if an image file exists, the volume size will be that of the image file</p><p>* if no image file exists and folder sync is enabled, the volume size will be determined from the synced folder's contents</p><p>* otherwise, the volume size will default to 512 MB</p></body></html></string> + <string>DSi firmware:</string> </property> </widget> </item> - <item row="7" column="0"> - <widget class="QLabel" name="label_13"> + <item row="3" column="2"> + <widget class="QPushButton" name="btnDSiFirmwareBrowse"> <property name="text"> - <string>Image size:</string> + <string>Browse...</string> </property> </widget> </item> - <item row="6" column="2"> - <widget class="QPushButton" name="btnDSiSDBrowse"> + <item row="2" column="0"> + <widget class="QLabel" name="label_6"> <property name="text"> - <string>Browse...</string> + <string>DSi ARM7 BIOS:</string> </property> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>DSi NAND:</string> + <item row="4" column="1"> + <widget class="QPathInput" name="txtDSiNANDPath"> + <property name="whatsThis"> + <string><html><head/><body><p>DSi NAND dump</p><p><br/></p><p>Should have 'nocash footer' at the end</p></body></html></string> </property> </widget> </item> - <item row="9" column="1"> - <widget class="QLineEdit" name="txtDSiSDFolder"> + <item row="7" column="1"> + <widget class="QPathInput" name="txtDSiSDPath"> <property name="whatsThis"> - <string><html><head/><body><p>Sync the emulated SD card to the given folder. The folder's contents will be copied to the SD image, and any change made to the SD image will be reflected to the folder.</p></body></html></string> + <string><html><head/><body><p>SD image file for emulating the DSi's SD card. A blank image file will be created if it doesn't already exist.</p></body></html></string> </property> </widget> </item> <item row="3" column="1"> - <widget class="QPathInput" name="txtDSiNANDPath"> + <widget class="QPathInput" name="txtDSiFirmwarePath"> <property name="whatsThis"> - <string><html><head/><body><p>DSi NAND dump</p><p><br/></p><p>Should have 'nocash footer' at the end</p></body></html></string> + <string><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></string> </property> </widget> </item> - <item row="0" column="2"> - <widget class="QPushButton" name="btnDSiBIOS9Browse"> + <item row="1" column="0"> + <widget class="QLabel" name="label_5"> <property name="text"> - <string>Browse...</string> + <string>DSi ARM9 BIOS:</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QPathInput" name="txtDSiBIOS9Path"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="whatsThis"> - <string><html><head/><body><p>DSi-mode ARM9 BIOS</p><p><br/></p><p>Size should be 64 KB</p></body></html></string> + <item row="8" column="0"> + <widget class="QLabel" name="label_13"> + <property name="text"> + <string>Image size:</string> </property> </widget> </item> - <item row="5" column="0" colspan="3"> + <item row="6" column="0" colspan="3"> <widget class="QCheckBox" name="cbDSiSDEnable"> <property name="whatsThis"> <string><html><head/><body><p>Simulate a SD card being inserted in the DSi's SD slot.</p></body></html></string> @@ -327,55 +320,72 @@ </property> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_7"> + <item row="7" column="2"> + <widget class="QPushButton" name="btnDSiSDBrowse"> <property name="text"> - <string>DSi firmware:</string> + <string>Browse...</string> </property> </widget> </item> - <item row="1" column="2"> + <item row="2" column="2"> <widget class="QPushButton" name="btnDSiBIOS7Browse"> <property name="text"> <string>Browse...</string> </property> </widget> </item> - <item row="8" column="0"> - <widget class="QCheckBox" name="cbDSiSDReadOnly"> + <item row="2" column="1"> + <widget class="QPathInput" name="txtDSiBIOS7Path"> <property name="whatsThis"> - <string><html><head/><body><p>Make the emulated SD card read-only.</p></body></html></string> + <string><html><head/><body><p>DSi-mode ARM7 BIOS</p><p><br/></p><p>Size should be 64 KB</p></body></html></string> </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="label_10"> <property name="text"> - <string>Read-only SD</string> + <string>SD card image:</string> </property> </widget> </item> - <item row="3" column="2"> - <widget class="QPushButton" name="btnDSiNANDBrowse"> + <item row="1" column="2"> + <widget class="QPushButton" name="btnDSiBIOS9Browse"> <property name="text"> <string>Browse...</string> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_6"> + <item row="4" column="0"> + <widget class="QLabel" name="label_8"> <property name="text"> - <string>DSi ARM7 BIOS:</string> + <string>DSi NAND:</string> </property> </widget> </item> - <item row="9" column="2"> - <widget class="QPushButton" name="btnDSiSDFolderBrowse"> + <item row="1" column="1"> + <widget class="QPathInput" name="txtDSiBIOS9Path"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="whatsThis"> + <string><html><head/><body><p>DSi-mode ARM9 BIOS</p><p><br/></p><p>Size should be 64 KB</p></body></html></string> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QPushButton" name="btnDSiNANDBrowse"> <property name="text"> <string>Browse...</string> </property> </widget> </item> - <item row="4" column="0" colspan="3"> - <widget class="QLabel" name="label_14"> + <item row="0" column="0" colspan="3"> + <widget class="QLabel" name="label_15"> <property name="text"> - <string/> + <string>DSi mode requires external DSi BIOS/firmware/NAND</string> </property> </widget> </item> diff --git a/src/frontend/qt_sdl/FirmwareSettingsDialog.ui b/src/frontend/qt_sdl/FirmwareSettingsDialog.ui index b079429..6377e94 100644 --- a/src/frontend/qt_sdl/FirmwareSettingsDialog.ui +++ b/src/frontend/qt_sdl/FirmwareSettingsDialog.ui @@ -63,7 +63,14 @@ </widget> </item> <item row="2" column="1"> - <widget class="QDateEdit" name="birthdayEdit"/> + <widget class="QDateEdit" name="birthdayEdit"> + <property name="displayFormat"> + <string>dd/MM</string> + </property> + <property name="calendarPopup"> + <bool>true</bool> + </property> + </widget> </item> <item row="3" column="0"> <widget class="QLabel" name="label_2"> @@ -88,7 +95,7 @@ <item row="5" column="0" colspan="2"> <widget class="QCheckBox" name="overrideFirmwareBox"> <property name="text"> - <string>Override firmware settings</string> + <string>Override settings from external firmware</string> </property> </widget> </item> |