mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 06:10:03 -06:00
make SD support actually be a thing
This commit is contained in:
@ -36,6 +36,8 @@ char DSiBIOS9Path[1024];
|
|||||||
char DSiBIOS7Path[1024];
|
char DSiBIOS7Path[1024];
|
||||||
char DSiFirmwarePath[1024];
|
char DSiFirmwarePath[1024];
|
||||||
char DSiNANDPath[1024];
|
char DSiNANDPath[1024];
|
||||||
|
int DSiSDEnable;
|
||||||
|
char DSiSDPath[1024];
|
||||||
|
|
||||||
int RandomizeMAC;
|
int RandomizeMAC;
|
||||||
|
|
||||||
@ -57,6 +59,8 @@ ConfigEntry ConfigFile[] =
|
|||||||
{"DSiBIOS7Path", 1, DSiBIOS7Path, 0, "", 1023},
|
{"DSiBIOS7Path", 1, DSiBIOS7Path, 0, "", 1023},
|
||||||
{"DSiFirmwarePath", 1, DSiFirmwarePath, 0, "", 1023},
|
{"DSiFirmwarePath", 1, DSiFirmwarePath, 0, "", 1023},
|
||||||
{"DSiNANDPath", 1, DSiNANDPath, 0, "", 1023},
|
{"DSiNANDPath", 1, DSiNANDPath, 0, "", 1023},
|
||||||
|
{"DSiSDEnable", 0, &DSiSDEnable, 0, NULL, 0},
|
||||||
|
{"DSiSDPath", 1, DSiSDPath, 0, "", 1023},
|
||||||
|
|
||||||
{"RandomizeMAC", 0, &RandomizeMAC, 0, NULL, 0},
|
{"RandomizeMAC", 0, &RandomizeMAC, 0, NULL, 0},
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@ extern char DSiBIOS9Path[1024];
|
|||||||
extern char DSiBIOS7Path[1024];
|
extern char DSiBIOS7Path[1024];
|
||||||
extern char DSiFirmwarePath[1024];
|
extern char DSiFirmwarePath[1024];
|
||||||
extern char DSiNANDPath[1024];
|
extern char DSiNANDPath[1024];
|
||||||
|
extern int DSiSDEnable;
|
||||||
|
extern char DSiSDPath[1024];
|
||||||
|
|
||||||
extern int RandomizeMAC;
|
extern int RandomizeMAC;
|
||||||
|
|
||||||
|
@ -117,13 +117,19 @@ void DSi_SDHost::Reset()
|
|||||||
|
|
||||||
if (Num == 0)
|
if (Num == 0)
|
||||||
{
|
{
|
||||||
// TODO: eventually pull from host filesystem
|
DSi_MMCStorage* sd;
|
||||||
/*DSi_MMCStorage* sd = new DSi_MMCStorage(this, false, "sd.bin");
|
DSi_MMCStorage* mmc;
|
||||||
u8 sd_cid[16] = {0xBD, 0x12, 0x34, 0x56, 0x78, 0x03, 0x4D, 0x30, 0x30, 0x46, 0x50, 0x41, 0x00, 0x00, 0x15, 0x00};
|
|
||||||
sd->SetCID(sd_cid);*/
|
|
||||||
DSi_MMCStorage* sd = NULL;
|
|
||||||
|
|
||||||
DSi_MMCStorage* mmc = new DSi_MMCStorage(this, true, Config::DSiNANDPath);
|
if (Config::DSiSDEnable)
|
||||||
|
{
|
||||||
|
sd = new DSi_MMCStorage(this, false, Config::DSiSDPath);
|
||||||
|
u8 sd_cid[16] = {0xBD, 0x12, 0x34, 0x56, 0x78, 0x03, 0x4D, 0x30, 0x30, 0x46, 0x50, 0x41, 0x00, 0x00, 0x15, 0x00};
|
||||||
|
sd->SetCID(sd_cid);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sd = nullptr;
|
||||||
|
|
||||||
|
mmc = new DSi_MMCStorage(this, true, Config::DSiNANDPath);
|
||||||
mmc->SetCID(DSi::eMMC_CID);
|
mmc->SetCID(DSi::eMMC_CID);
|
||||||
|
|
||||||
Ports[0] = sd;
|
Ports[0] = sd;
|
||||||
@ -429,14 +435,14 @@ u16 DSi_SDHost::Read(u32 addr)
|
|||||||
if (!Num)
|
if (!Num)
|
||||||
{
|
{
|
||||||
if (Ports[0]) // basic check of whether the SD card is inserted
|
if (Ports[0]) // basic check of whether the SD card is inserted
|
||||||
ret |= 0x0030;
|
ret |= 0x00B0;
|
||||||
else
|
else
|
||||||
ret |= 0x0008;
|
ret |= 0x0008;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// SDIO wifi is always inserted, I guess
|
// SDIO wifi is always inserted, I guess
|
||||||
ret |= 0x0030;
|
ret |= 0x00B0;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,8 @@ EmuSettingsDialog::EmuSettingsDialog(QWidget* parent) : QDialog(parent), ui(new
|
|||||||
ui->txtDSiBIOS7Path->setText(Config::DSiBIOS7Path);
|
ui->txtDSiBIOS7Path->setText(Config::DSiBIOS7Path);
|
||||||
ui->txtDSiFirmwarePath->setText(Config::DSiFirmwarePath);
|
ui->txtDSiFirmwarePath->setText(Config::DSiFirmwarePath);
|
||||||
ui->txtDSiNANDPath->setText(Config::DSiNANDPath);
|
ui->txtDSiNANDPath->setText(Config::DSiNANDPath);
|
||||||
|
ui->cbDSiSDEnable->setChecked(Config::DSiSDEnable != 0);
|
||||||
|
ui->txtDSiSDPath->setText(Config::DSiSDPath);
|
||||||
|
|
||||||
ui->cbxConsoleType->addItem("DS");
|
ui->cbxConsoleType->addItem("DS");
|
||||||
ui->cbxConsoleType->addItem("DSi (experimental)");
|
ui->cbxConsoleType->addItem("DSi (experimental)");
|
||||||
@ -145,6 +147,8 @@ void EmuSettingsDialog::done(int r)
|
|||||||
std::string dsiBios7Path = ui->txtDSiBIOS7Path->text().toStdString();
|
std::string dsiBios7Path = ui->txtDSiBIOS7Path->text().toStdString();
|
||||||
std::string dsiFirmwarePath = ui->txtDSiFirmwarePath->text().toStdString();
|
std::string dsiFirmwarePath = ui->txtDSiFirmwarePath->text().toStdString();
|
||||||
std::string dsiNANDPath = ui->txtDSiNANDPath->text().toStdString();
|
std::string dsiNANDPath = ui->txtDSiNANDPath->text().toStdString();
|
||||||
|
int dsiSDEnable = ui->cbDSiSDEnable->isChecked() ? 1:0;
|
||||||
|
std::string dsiSDPath = ui->txtDSiSDPath->text().toStdString();
|
||||||
|
|
||||||
if (consoleType != Config::ConsoleType
|
if (consoleType != Config::ConsoleType
|
||||||
|| directBoot != Config::DirectBoot
|
|| directBoot != Config::DirectBoot
|
||||||
@ -161,7 +165,9 @@ void EmuSettingsDialog::done(int r)
|
|||||||
|| strcmp(Config::DSiBIOS9Path, dsiBios9Path.c_str()) != 0
|
|| strcmp(Config::DSiBIOS9Path, dsiBios9Path.c_str()) != 0
|
||||||
|| strcmp(Config::DSiBIOS7Path, dsiBios7Path.c_str()) != 0
|
|| strcmp(Config::DSiBIOS7Path, dsiBios7Path.c_str()) != 0
|
||||||
|| strcmp(Config::DSiFirmwarePath, dsiFirmwarePath.c_str()) != 0
|
|| strcmp(Config::DSiFirmwarePath, dsiFirmwarePath.c_str()) != 0
|
||||||
|| strcmp(Config::DSiNANDPath, dsiNANDPath.c_str()) != 0)
|
|| strcmp(Config::DSiNANDPath, dsiNANDPath.c_str()) != 0
|
||||||
|
|| dsiSDEnable != Config::DSiSDEnable
|
||||||
|
|| strcmp(Config::DSiSDPath, dsiSDPath.c_str()) != 0)
|
||||||
{
|
{
|
||||||
if (RunningSomething
|
if (RunningSomething
|
||||||
&& QMessageBox::warning(this, "Reset necessary to apply changes",
|
&& QMessageBox::warning(this, "Reset necessary to apply changes",
|
||||||
@ -177,6 +183,8 @@ void EmuSettingsDialog::done(int r)
|
|||||||
strncpy(Config::DSiBIOS7Path, dsiBios7Path.c_str(), 1023); Config::DSiBIOS7Path[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::DSiFirmwarePath, dsiFirmwarePath.c_str(), 1023); Config::DSiFirmwarePath[1023] = '\0';
|
||||||
strncpy(Config::DSiNANDPath, dsiNANDPath.c_str(), 1023); Config::DSiNANDPath[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';
|
||||||
|
|
||||||
#ifdef JIT_ENABLED
|
#ifdef JIT_ENABLED
|
||||||
Config::JIT_Enable = jitEnable;
|
Config::JIT_Enable = jitEnable;
|
||||||
@ -284,6 +292,18 @@ void EmuSettingsDialog::on_btnDSiNANDBrowse_clicked()
|
|||||||
ui->txtDSiNANDPath->setText(file);
|
ui->txtDSiNANDPath->setText(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EmuSettingsDialog::on_btnDSiSDBrowse_clicked()
|
||||||
|
{
|
||||||
|
QString file = QFileDialog::getOpenFileName(this,
|
||||||
|
"Select DSi SD image...",
|
||||||
|
EmuDirectory,
|
||||||
|
"Image files (*.bin *.rom *.img);;Any file (*.*)");
|
||||||
|
|
||||||
|
if (file.isEmpty()) return;
|
||||||
|
|
||||||
|
ui->txtDSiSDPath->setText(file);
|
||||||
|
}
|
||||||
|
|
||||||
void EmuSettingsDialog::on_chkEnableJIT_toggled()
|
void EmuSettingsDialog::on_chkEnableJIT_toggled()
|
||||||
{
|
{
|
||||||
bool disabled = !ui->chkEnableJIT->isChecked();
|
bool disabled = !ui->chkEnableJIT->isChecked();
|
||||||
|
@ -63,6 +63,7 @@ private slots:
|
|||||||
void on_btnDSiBIOS7Browse_clicked();
|
void on_btnDSiBIOS7Browse_clicked();
|
||||||
void on_btnDSiFirmwareBrowse_clicked();
|
void on_btnDSiFirmwareBrowse_clicked();
|
||||||
void on_btnDSiNANDBrowse_clicked();
|
void on_btnDSiNANDBrowse_clicked();
|
||||||
|
void on_btnDSiSDBrowse_clicked();
|
||||||
|
|
||||||
void on_chkEnableJIT_toggled();
|
void on_chkEnableJIT_toggled();
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>514</width>
|
<width>514</width>
|
||||||
<height>359</height>
|
<height>407</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -191,59 +191,10 @@
|
|||||||
<string>DSi mode</string>
|
<string>DSi mode</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="0" column="2">
|
<item row="3" column="0">
|
||||||
<widget class="QPushButton" name="btnDSiBIOS9Browse">
|
<widget class="QLabel" name="label_8">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Browse...</string>
|
<string>DSi NAND:</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<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="2">
|
|
||||||
<widget class="QPushButton" name="btnDSiFirmwareBrowse">
|
|
||||||
<property name="text">
|
|
||||||
<string>Browse...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" 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>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLineEdit" 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="0">
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>DSi ARM7 BIOS:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_7">
|
|
||||||
<property name="text">
|
|
||||||
<string>DSi firmware:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QPushButton" name="btnDSiBIOS7Browse">
|
|
||||||
<property name="text">
|
|
||||||
<string>Browse...</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -260,10 +211,38 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="2">
|
||||||
<widget class="QLabel" name="label_8">
|
<widget class="QPushButton" name="btnDSiNANDBrowse">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>DSi NAND:</string>
|
<string>Browse...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" 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="QLineEdit" 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>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>DSi ARM9 BIOS:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QPushButton" name="btnDSiBIOS9Browse">
|
||||||
|
<property name="text">
|
||||||
|
<string>Browse...</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -274,8 +253,60 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2">
|
<item row="5" column="0">
|
||||||
<widget class="QPushButton" name="btnDSiNANDBrowse">
|
<widget class="QLabel" name="label_10">
|
||||||
|
<property name="text">
|
||||||
|
<string>DSi SD card:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>DSi ARM7 BIOS:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QPushButton" name="btnDSiBIOS7Browse">
|
||||||
|
<property name="text">
|
||||||
|
<string>Browse...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QPushButton" name="btnDSiFirmwareBrowse">
|
||||||
|
<property name="text">
|
||||||
|
<string>Browse...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>DSi firmware:</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>
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable DSi SD card</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QLineEdit" name="txtDSiSDPath">
|
||||||
|
<property name="whatsThis">
|
||||||
|
<string><html><head/><body><p>SD image file for emulating the DSi's SD card</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="2">
|
||||||
|
<widget class="QPushButton" name="btnDSiSDBrowse">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Browse...</string>
|
<string>Browse...</string>
|
||||||
</property>
|
</property>
|
||||||
|
Reference in New Issue
Block a user