diff options
author | Arisotura <thetotalworm@gmail.com> | 2021-10-28 18:47:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 18:47:13 +0200 |
commit | ff3f661bb54dcb31e2533967aa231d827d2be4b7 (patch) | |
tree | f6b9d4ea0fc42f234bb1dd4f1dc6b0db9069333e /src/frontend/qt_sdl | |
parent | a8613af2bd3ba0cc9d52b6a5d63899cda7ca2864 (diff) |
DLDI/SD folder-sync apparatus (#1251)
guess we can finally have DLDI that isn't obtuse
Diffstat (limited to 'src/frontend/qt_sdl')
-rw-r--r-- | src/frontend/qt_sdl/EmuSettingsDialog.cpp | 139 | ||||
-rw-r--r-- | src/frontend/qt_sdl/EmuSettingsDialog.h | 8 | ||||
-rw-r--r-- | src/frontend/qt_sdl/EmuSettingsDialog.ui | 213 | ||||
-rw-r--r-- | src/frontend/qt_sdl/Platform.cpp | 45 | ||||
-rw-r--r-- | src/frontend/qt_sdl/PlatformConfig.cpp | 28 | ||||
-rw-r--r-- | src/frontend/qt_sdl/PlatformConfig.h | 14 |
6 files changed, 388 insertions, 59 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(); diff --git a/src/frontend/qt_sdl/EmuSettingsDialog.h b/src/frontend/qt_sdl/EmuSettingsDialog.h index b650959..60e2160 100644 --- a/src/frontend/qt_sdl/EmuSettingsDialog.h +++ b/src/frontend/qt_sdl/EmuSettingsDialog.h @@ -58,13 +58,21 @@ private slots: void on_btnBIOS9Browse_clicked(); void on_btnBIOS7Browse_clicked(); void on_btnFirmwareBrowse_clicked(); + + void on_cbDLDIEnable_toggled(); void on_btnDLDISDBrowse_clicked(); + void on_cbDLDIFolder_toggled(); + void on_btnDLDIFolderBrowse_clicked(); void on_btnDSiBIOS9Browse_clicked(); void on_btnDSiBIOS7Browse_clicked(); void on_btnDSiFirmwareBrowse_clicked(); void on_btnDSiNANDBrowse_clicked(); + + void on_cbDSiSDEnable_toggled(); void on_btnDSiSDBrowse_clicked(); + void on_cbDSiSDFolder_toggled(); + void on_btnDSiSDFolderBrowse_clicked(); void on_chkEnableJIT_toggled(); void on_chkExternalBIOS_toggled(); diff --git a/src/frontend/qt_sdl/EmuSettingsDialog.ui b/src/frontend/qt_sdl/EmuSettingsDialog.ui index 41b6e6e..92e2792 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>260</height> + <height>351</height> </rect> </property> <property name="sizePolicy"> @@ -203,6 +203,20 @@ <string>DSi-mode</string> </attribute> <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>DSi ARM9 BIOS:</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> + </property> + </widget> + </item> <item row="1" column="1"> <widget class="QPathInput" name="txtDSiBIOS7Path"> <property name="whatsThis"> @@ -210,41 +224,72 @@ </property> </widget> </item> - <item row="5" column="2"> - <widget class="QPushButton" name="btnDSiSDBrowse"> + <item row="9" 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> + </property> <property name="text"> - <string>Browse...</string> + <string>Sync SD to folder:</string> </property> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_8"> + <item row="2" column="2"> + <widget class="QPushButton" name="btnDSiFirmwareBrowse"> <property name="text"> - <string>DSi NAND:</string> + <string>Browse...</string> </property> </widget> </item> - <item row="3" column="2"> - <widget class="QPushButton" name="btnDSiNANDBrowse"> + <item row="6" column="1"> + <widget class="QPathInput" name="txtDSiSDPath"> + <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> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="label_10"> <property name="text"> - <string>Browse...</string> + <string>SD card image:</string> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_6"> + <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> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="label_13"> <property name="text"> - <string>DSi ARM7 BIOS:</string> + <string>Image size:</string> </property> </widget> </item> - <item row="2" column="2"> - <widget class="QPushButton" name="btnDSiFirmwareBrowse"> + <item row="6" column="2"> + <widget class="QPushButton" name="btnDSiSDBrowse"> <property name="text"> <string>Browse...</string> </property> </widget> </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>DSi NAND:</string> + </property> + </widget> + </item> + <item row="9" column="1"> + <widget class="QLineEdit" name="txtDSiSDFolder"> + <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> + </property> + </widget> + </item> <item row="3" column="1"> <widget class="QPathInput" name="txtDSiNANDPath"> <property name="whatsThis"> @@ -259,13 +304,6 @@ </property> </widget> </item> - <item row="5" column="0"> - <widget class="QLabel" name="label_10"> - <property name="text"> - <string>DSi SD card:</string> - </property> - </widget> - </item> <item row="0" column="1"> <widget class="QPathInput" name="txtDSiBIOS9Path"> <property name="sizePolicy"> @@ -279,6 +317,16 @@ </property> </widget> </item> + <item row="5" 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> + </property> + <property name="text"> + <string>Enable DSi SD card</string> + </property> + </widget> + </item> <item row="2" column="0"> <widget class="QLabel" name="label_7"> <property name="text"> @@ -286,44 +334,51 @@ </property> </widget> </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_5"> + <item row="1" column="2"> + <widget class="QPushButton" name="btnDSiBIOS7Browse"> <property name="text"> - <string>DSi ARM9 BIOS:</string> + <string>Browse...</string> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QPathInput" name="txtDSiFirmwarePath"> + <item row="8" column="0"> + <widget class="QCheckBox" name="cbDSiSDReadOnly"> <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> + <string><html><head/><body><p>Make the emulated SD card read-only.</p></body></html></string> + </property> + <property name="text"> + <string>Read-only SD</string> </property> </widget> </item> - <item row="5" column="1"> - <widget class="QPathInput" name="txtDSiSDPath"> - <property name="whatsThis"> - <string><html><head/><body><p>SD image file for emulating the DSi's SD card</p></body></html></string> + <item row="3" 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="QCheckBox" name="cbDSiSDEnable"> - <property name="whatsThis"> - <string><html><head/><body><p>Simulate a SD card being inserted in the DSi's SD slot. Requires a SD card image.</p></body></html></string> - </property> + <item row="1" column="0"> + <widget class="QLabel" name="label_6"> <property name="text"> - <string>Enable DSi SD card</string> + <string>DSi ARM7 BIOS:</string> </property> </widget> </item> - <item row="1" column="2"> - <widget class="QPushButton" name="btnDSiBIOS7Browse"> + <item row="9" column="2"> + <widget class="QPushButton" name="btnDSiSDFolderBrowse"> <property name="text"> <string>Browse...</string> </property> </widget> </item> + <item row="4" column="0" colspan="3"> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string/> + </property> + </widget> + </item> </layout> </widget> <widget class="QWidget" name="tab_3"> @@ -399,34 +454,69 @@ <string>DLDI</string> </attribute> <layout class="QGridLayout" name="gridLayout_4"> - <item row="0" column="0" colspan="3"> - <widget class="QCheckBox" name="cbDLDIEnable"> + <item row="1" column="2"> + <widget class="QPushButton" name="btnDLDISDBrowse"> + <property name="text"> + <string>Browse...</string> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QPushButton" name="btnDLDIFolderBrowse"> + <property name="text"> + <string>Browse...</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QLineEdit" name="txtDLDIFolder"> <property name="whatsThis"> - <string><html><head/><body><p>Enable the built-in DLDI driver, to let homebrew access files from a given SD image.</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="2" column="0"> + <widget class="QLabel" name="label_12"> <property name="text"> - <string>Enable DLDI (for homebrew)</string> + <string>Image size:</string> </property> </widget> </item> - <item row="1" column="2"> - <widget class="QPushButton" name="btnDLDISDBrowse"> + <item row="4" column="0"> + <widget class="QCheckBox" name="cbDLDIFolder"> + <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> + </property> <property name="text"> - <string>Browse...</string> + <string>Sync SD to folder:</string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QPathInput" name="txtDLDISDPath"/> + <item row="2" column="1"> + <widget class="QComboBox" name="cbxDLDISize"> + <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="1" column="0"> - <widget class="QLabel" name="label_11"> + <item row="0" column="0" colspan="3"> + <widget class="QCheckBox" name="cbDLDIEnable"> + <property name="whatsThis"> + <string><html><head/><body><p>Enable the built-in DLDI driver, to let homebrew access files from an emulated SD card.</p></body></html></string> + </property> <property name="text"> - <string>DLDI SD card:</string> + <string>Enable DLDI (for homebrew)</string> </property> </widget> </item> - <item row="2" column="0"> + <item row="1" column="1"> + <widget class="QPathInput" name="txtDLDISDPath"> + <property name="whatsThis"> + <string><html><head/><body><p>SD card image file to be used for DLDI. A blank image file will be created if it doesn't already exist.</p></body></html></string> + </property> + </widget> + </item> + <item row="5" column="0"> <spacer name="verticalSpacer_3"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -439,6 +529,23 @@ </property> </spacer> </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_11"> + <property name="text"> + <string>SD card image:</string> + </property> + </widget> + </item> + <item row="3" column="0" colspan="3"> + <widget class="QCheckBox" name="cbDLDIReadOnly"> + <property name="whatsThis"> + <string><html><head/><body><p>Make the emulated SD card read-only.</p></body></html></string> + </property> + <property name="text"> + <string>Read-only SD</string> + </property> + </widget> + </item> </layout> </widget> </widget> diff --git a/src/frontend/qt_sdl/Platform.cpp b/src/frontend/qt_sdl/Platform.cpp index 81d86d3..08190d6 100644 --- a/src/frontend/qt_sdl/Platform.cpp +++ b/src/frontend/qt_sdl/Platform.cpp @@ -127,6 +127,51 @@ void StopEmu() } +int GetConfigInt(ConfigEntry entry) +{ + const int imgsizes[] = {0, 256, 512, 1024, 2048, 4096}; + + switch (entry) + { + case DLDI_ImageSize: return imgsizes[Config::DLDISize]; + + case DSiSD_ImageSize: return imgsizes[Config::DSiSDSize]; + } + + return 0; +} + +bool GetConfigBool(ConfigEntry entry) +{ + switch (entry) + { + case DLDI_Enable: return Config::DLDIEnable != 0; + case DLDI_ReadOnly: return Config::DLDIReadOnly != 0; + case DLDI_FolderSync: return Config::DLDIFolderSync != 0; + + case DSiSD_Enable: return Config::DSiSDEnable != 0; + case DSiSD_ReadOnly: return Config::DSiSDReadOnly != 0; + case DSiSD_FolderSync: return Config::DSiSDFolderSync != 0; + } + + return false; +} + +std::string GetConfigString(ConfigEntry entry) +{ + switch (entry) + { + case DLDI_ImagePath: return Config::DLDISDPath; + case DLDI_FolderPath: return Config::DLDIFolderPath; + + case DSiSD_ImagePath: return Config::DSiSDPath; + case DSiSD_FolderPath: return Config::DSiSDFolderPath; + } + + return ""; +} + + FILE* OpenFile(const char* path, const char* mode, bool mustexist) { QFile f(path); diff --git a/src/frontend/qt_sdl/PlatformConfig.cpp b/src/frontend/qt_sdl/PlatformConfig.cpp index 40f55ba..e01e4c9 100644 --- a/src/frontend/qt_sdl/PlatformConfig.cpp +++ b/src/frontend/qt_sdl/PlatformConfig.cpp @@ -63,6 +63,20 @@ int ShowOSD; int ConsoleType; int DirectBoot; +int DLDIEnable; +char DLDISDPath[1024]; +int DLDISize; +int DLDIReadOnly; +int DLDIFolderSync; +char DLDIFolderPath[1024]; + +int DSiSDEnable; +char DSiSDPath[1024]; +int DSiSDSize; +int DSiSDReadOnly; +int DSiSDFolderSync; +char DSiSDFolderPath[1024]; + int SocketBindAnyAddr; char LANDevice[128]; int DirectLAN; @@ -172,6 +186,20 @@ ConfigEntry PlatformConfigFile[] = {"ConsoleType", 0, &ConsoleType, 0, NULL, 0}, {"DirectBoot", 0, &DirectBoot, 1, NULL, 0}, + {"DLDIEnable", 0, &DLDIEnable, 0, NULL, 0}, + {"DLDISDPath", 1, DLDISDPath, 0, "dldi.bin", 1023}, + {"DLDISize", 0, &DLDISize, 0, NULL, 0}, + {"DLDIReadOnly", 0, &DLDIReadOnly, 0, NULL, 0}, + {"DLDIFolderSync", 0, &DLDIFolderSync, 0, NULL, 0}, + {"DLDIFolderPath", 1, DLDIFolderPath, 0, "", 1023}, + + {"DSiSDEnable", 0, &DSiSDEnable, 0, NULL, 0}, + {"DSiSDPath", 1, DSiSDPath, 0, "dsisd.bin", 1023}, + {"DSiSDSize", 0, &DSiSDSize, 0, NULL, 0}, + {"DSiSDReadOnly", 0, &DSiSDReadOnly, 0, NULL, 0}, + {"DSiSDFolderSync", 0, &DSiSDFolderSync, 0, NULL, 0}, + {"DSiSDFolderPath", 1, DSiSDFolderPath, 0, "", 1023}, + {"SockBindAnyAddr", 0, &SocketBindAnyAddr, 0, NULL, 0}, {"LANDevice", 1, LANDevice, 0, "", 127}, {"DirectLAN", 0, &DirectLAN, 0, NULL, 0}, diff --git a/src/frontend/qt_sdl/PlatformConfig.h b/src/frontend/qt_sdl/PlatformConfig.h index 202e36a..3e7bf85 100644 --- a/src/frontend/qt_sdl/PlatformConfig.h +++ b/src/frontend/qt_sdl/PlatformConfig.h @@ -79,6 +79,20 @@ extern int ShowOSD; extern int ConsoleType; extern int DirectBoot; +extern int DLDIEnable; +extern char DLDISDPath[1024]; +extern int DLDISize; +extern int DLDIReadOnly; +extern int DLDIFolderSync; +extern char DLDIFolderPath[1024]; + +extern int DSiSDEnable; +extern char DSiSDPath[1024]; +extern int DSiSDSize; +extern int DSiSDReadOnly; +extern int DSiSDFolderSync; +extern char DSiSDFolderPath[1024]; + extern int SocketBindAnyAddr; extern char LANDevice[128]; extern int DirectLAN; |