actually add DLDI. bahahahhh

This commit is contained in:
Arisotura 2020-09-03 20:28:07 +02:00
parent 81eda0f19c
commit 5431c469c3
9 changed files with 507 additions and 330 deletions

View File

@ -33,6 +33,7 @@ add_library(core STATIC
GPU3D_OpenGL.cpp GPU3D_OpenGL.cpp
GPU3D_OpenGL_shaders.h GPU3D_OpenGL_shaders.h
GPU3D_Soft.cpp GPU3D_Soft.cpp
melonDLDI.h
NDS.cpp NDS.cpp
NDSCart.cpp NDSCart.cpp
OpenGLSupport.cpp OpenGLSupport.cpp

View File

@ -31,6 +31,8 @@ const char* kConfigFile = "melonDS.ini";
char BIOS9Path[1024]; char BIOS9Path[1024];
char BIOS7Path[1024]; char BIOS7Path[1024];
char FirmwarePath[1024]; char FirmwarePath[1024];
int DLDIEnable;
char DLDISDPath[1024];
char DSiBIOS9Path[1024]; char DSiBIOS9Path[1024];
char DSiBIOS7Path[1024]; char DSiBIOS7Path[1024];
@ -54,6 +56,8 @@ ConfigEntry ConfigFile[] =
{"BIOS9Path", 1, BIOS9Path, 0, "", 1023}, {"BIOS9Path", 1, BIOS9Path, 0, "", 1023},
{"BIOS7Path", 1, BIOS7Path, 0, "", 1023}, {"BIOS7Path", 1, BIOS7Path, 0, "", 1023},
{"FirmwarePath", 1, FirmwarePath, 0, "", 1023}, {"FirmwarePath", 1, FirmwarePath, 0, "", 1023},
{"DLDIEnable", 0, &DLDIEnable, 0, NULL, 0},
{"DLDISDPath", 1, DLDISDPath, 0, "", 1023},
{"DSiBIOS9Path", 1, DSiBIOS9Path, 0, "", 1023}, {"DSiBIOS9Path", 1, DSiBIOS9Path, 0, "", 1023},
{"DSiBIOS7Path", 1, DSiBIOS7Path, 0, "", 1023}, {"DSiBIOS7Path", 1, DSiBIOS7Path, 0, "", 1023},

View File

@ -45,6 +45,8 @@ void Save();
extern char BIOS9Path[1024]; extern char BIOS9Path[1024];
extern char BIOS7Path[1024]; extern char BIOS7Path[1024];
extern char FirmwarePath[1024]; extern char FirmwarePath[1024];
extern int DLDIEnable;
extern char DLDISDPath[1024];
extern char DSiBIOS9Path[1024]; extern char DSiBIOS9Path[1024];
extern char DSiBIOS7Path[1024]; extern char DSiBIOS7Path[1024];

View File

@ -2537,6 +2537,7 @@ void ARM7Write8(u32 addr, u8 val)
return; return;
} }
if (ARM7->R[15] > 0x00002F30) // ARM7 BIOS bug
printf("unknown arm7 write8 %08X %02X @ %08X\n", addr, val, ARM7->R[15]); printf("unknown arm7 write8 %08X %02X @ %08X\n", addr, val, ARM7->R[15]);
} }
@ -3455,6 +3456,10 @@ void ARM9IOWrite32(u32 addr, u32 val)
PowerControl9 = val & 0x820F; PowerControl9 = val & 0x820F;
GPU::SetPowerCnt(PowerControl9); GPU::SetPowerCnt(PowerControl9);
return; return;
case 0x04100010:
NDSCart::WriteROMData(val);
return;
} }
if (addr >= 0x04000000 && addr < 0x04000060) if (addr >= 0x04000000 && addr < 0x04000060)

View File

@ -25,7 +25,9 @@
#include "CRC32.h" #include "CRC32.h"
#include "DSi_AES.h" #include "DSi_AES.h"
#include "Platform.h" #include "Platform.h"
#include "Config.h"
#include "ROMList.h" #include "ROMList.h"
#include "melonDLDI.h"
namespace NDSCart_SRAM namespace NDSCart_SRAM
@ -464,11 +466,13 @@ u16 SPICnt;
u32 ROMCnt; u32 ROMCnt;
u8 ROMCommand[8]; u8 ROMCommand[8];
u32 ROMDataOut; u32 ROMData;
u8 DataOut[0x4000]; u8 TransferData[0x4000];
u32 DataOutPos; u32 TransferPos;
u32 DataOutLen; u32 TransferLen;
u32 TransferDir;
u8 TransferCmd[8];
bool CartInserted; bool CartInserted;
u8* CartROM; u8* CartROM;
@ -478,6 +482,8 @@ u32 CartID;
bool CartIsHomebrew; bool CartIsHomebrew;
bool CartIsDSi; bool CartIsDSi;
FILE* CartSD;
u32 CmdEncMode; u32 CmdEncMode;
u32 DataEncMode; u32 DataEncMode;
@ -489,6 +495,7 @@ u64 Key2_Y;
void ROMCommand_Retail(u8* cmd); void ROMCommand_Retail(u8* cmd);
void ROMCommand_RetailNAND(u8* cmd); void ROMCommand_RetailNAND(u8* cmd);
void ROMCommand_Homebrew(u8* cmd);
void (*ROMCommandHandler)(u8* cmd); void (*ROMCommandHandler)(u8* cmd);
@ -615,6 +622,8 @@ bool Init()
CartROM = NULL; CartROM = NULL;
CartSD = NULL;
return true; return true;
} }
@ -622,6 +631,8 @@ void DeInit()
{ {
if (CartROM) delete[] CartROM; if (CartROM) delete[] CartROM;
if (CartSD) fclose(CartSD);
NDSCart_SRAM::DeInit(); NDSCart_SRAM::DeInit();
} }
@ -635,6 +646,9 @@ void Reset()
CartIsHomebrew = false; CartIsHomebrew = false;
CartIsDSi = false; CartIsDSi = false;
if (CartSD) fclose(CartSD);
CartSD = NULL;
ROMCommandHandler = NULL; ROMCommandHandler = NULL;
NDSCart_SRAM::Reset(); NDSCart_SRAM::Reset();
@ -650,11 +664,13 @@ void DoSavestate(Savestate* file)
file->Var32(&ROMCnt); file->Var32(&ROMCnt);
file->VarArray(ROMCommand, 8); file->VarArray(ROMCommand, 8);
file->Var32(&ROMDataOut); file->Var32(&ROMData);
file->VarArray(DataOut, 0x4000); file->VarArray(TransferData, 0x4000);
file->Var32(&DataOutPos); file->Var32(&TransferPos);
file->Var32(&DataOutLen); file->Var32(&TransferLen);
file->Var32(&TransferDir);
file->VarArray(TransferCmd, 8);
// cart inserted/len/ROM/etc should be already populated // cart inserted/len/ROM/etc should be already populated
// savestate should be loaded after the right game is loaded // savestate should be loaded after the right game is loaded
@ -670,10 +686,8 @@ void DoSavestate(Savestate* file)
} }
void ApplyDLDIPatch() void ApplyDLDIPatch(const u8* patch, u32 len)
{ {
// TODO: embed patches? let the user choose? default to some builtin driver?
u32 offset = *(u32*)&CartROM[0x20]; u32 offset = *(u32*)&CartROM[0x20];
u32 size = *(u32*)&CartROM[0x2C]; u32 size = *(u32*)&CartROM[0x2C];
@ -696,23 +710,7 @@ void ApplyDLDIPatch()
return; return;
} }
printf("DLDI shit found at %08X (%08X)\n", dldioffset, offset+dldioffset); printf("DLDI structure found at %08X (%08X)\n", dldioffset, offset+dldioffset);
FILE* f = fopen("dldi.bin", "rb");
if (!f)
{
printf("no DLDI patch available. oh well\n");
return;
}
u32 dldisize;
fseek(f, 0, SEEK_END);
dldisize = ftell(f);
fseek(f, 0, SEEK_SET);
u8* patch = new u8[dldisize];
fread(patch, dldisize, 1, f);
fclose(f);
if (*(u32*)&patch[0] != 0xBF8DA5ED || if (*(u32*)&patch[0] != 0xBF8DA5ED ||
*(u32*)&patch[4] != 0x69684320 || *(u32*)&patch[4] != 0x69684320 ||
@ -743,7 +741,7 @@ void ApplyDLDIPatch()
u32 patchsize = 1 << patch[0x0D]; u32 patchsize = 1 << patch[0x0D];
u32 patchend = patchbase + patchsize; u32 patchend = patchbase + patchsize;
memcpy(&binary[dldioffset], patch, dldisize); memcpy(&binary[dldioffset], patch, len);
*(u32*)&binary[dldioffset+0x40] += delta; *(u32*)&binary[dldioffset+0x40] += delta;
*(u32*)&binary[dldioffset+0x44] += delta; *(u32*)&binary[dldioffset+0x44] += delta;
@ -807,7 +805,6 @@ void ApplyDLDIPatch()
memset(&binary[dldioffset+fixstart], 0, fixend-fixstart); memset(&binary[dldioffset+fixstart], 0, fixend-fixstart);
} }
delete[] patch;
printf("applied DLDI patch\n"); printf("applied DLDI patch\n");
} }
@ -987,11 +984,13 @@ bool LoadROM(const char* path, const char* sram, bool direct)
Key1_Encrypt((u32*)&CartROM[arm9base]); Key1_Encrypt((u32*)&CartROM[arm9base]);
} }
} }
else }
if ((arm9base < 0x4000) || (gamecode == 0x23232323))
{ {
CartIsHomebrew = true; CartIsHomebrew = true;
//ApplyDLDIPatch(); if (Config::DLDIEnable)
} ApplyDLDIPatch(melonDLDI, sizeof(melonDLDI));
} }
if (direct) if (direct)
@ -1005,7 +1004,9 @@ bool LoadROM(const char* path, const char* sram, bool direct)
CartInserted = true; CartInserted = true;
// TODO: support more fancy cart types (homebrew?, flashcarts, etc) // TODO: support more fancy cart types (homebrew?, flashcarts, etc)
if (CartID & 0x08000000) if (CartIsHomebrew)
ROMCommandHandler = ROMCommand_Homebrew;
else if (CartID & 0x08000000)
ROMCommandHandler = ROMCommand_RetailNAND; ROMCommandHandler = ROMCommand_RetailNAND;
else else
ROMCommandHandler = ROMCommand_Retail; ROMCommandHandler = ROMCommand_Retail;
@ -1017,6 +1018,13 @@ bool LoadROM(const char* path, const char* sram, bool direct)
printf("Save file: %s\n", sram); printf("Save file: %s\n", sram);
NDSCart_SRAM::LoadSave(sram, romparams.SaveMemType); NDSCart_SRAM::LoadSave(sram, romparams.SaveMemType);
if (CartIsHomebrew && Config::DLDIEnable)
{
CartSD = Platform::OpenLocalFile(Config::DLDISDPath, "r+b");
}
else
CartSD = NULL;
return true; return true;
} }
@ -1034,14 +1042,17 @@ void ResetCart()
ROMCnt = 0; ROMCnt = 0;
memset(ROMCommand, 0, 8); memset(ROMCommand, 0, 8);
ROMDataOut = 0; ROMData = 0;
Key2_X = 0; Key2_X = 0;
Key2_Y = 0; Key2_Y = 0;
memset(DataOut, 0, 0x4000); memset(TransferData, 0, 0x4000);
DataOutPos = 0; TransferPos = 0;
DataOutLen = 0; TransferLen = 0;
TransferDir = 0;
memset(TransferCmd, 0, 8);
TransferCmd[0] = 0xFF;
CmdEncMode = 0; CmdEncMode = 0;
DataEncMode = 0; DataEncMode = 0;
@ -1055,7 +1066,7 @@ void ReadROM(u32 addr, u32 len, u32 offset)
if ((addr+len) > CartROMSize) if ((addr+len) > CartROMSize)
len = CartROMSize - addr; len = CartROMSize - addr;
memcpy(DataOut+offset, CartROM+addr, len); memcpy(TransferData+offset, CartROM+addr, len);
} }
void ReadROM_B7(u32 addr, u32 len, u32 offset) void ReadROM_B7(u32 addr, u32 len, u32 offset)
@ -1069,7 +1080,7 @@ void ReadROM_B7(u32 addr, u32 len, u32 offset)
addr = 0x8000 + (addr & 0x1FF); addr = 0x8000 + (addr & 0x1FF);
} }
memcpy(DataOut+offset, CartROM+addr, len); memcpy(TransferData+offset, CartROM+addr, len);
} }
@ -1079,16 +1090,41 @@ void ROMEndTransfer(u32 param)
if (SPICnt & (1<<14)) if (SPICnt & (1<<14))
NDS::SetIRQ((NDS::ExMemCnt[0]>>11)&0x1, NDS::IRQ_CartSendDone); NDS::SetIRQ((NDS::ExMemCnt[0]>>11)&0x1, NDS::IRQ_CartSendDone);
if (TransferDir == 1)
{
// finish a write
u8* cmd = TransferCmd;
switch (cmd[0])
{
case 0xC1:
{
u32 sector = (cmd[1]<<24) | (cmd[2]<<16) | (cmd[3]<<8) | cmd[4];
u64 addr = sector * 0x200ULL;
if (CartSD)
{
fseek(CartSD, addr, SEEK_SET);
fwrite(TransferData, TransferLen, 1, CartSD);
}
}
break;
}
}
} }
void ROMPrepareData(u32 param) void ROMPrepareData(u32 param)
{ {
if (DataOutPos >= DataOutLen) if (TransferDir == 0)
ROMDataOut = 0; {
if (TransferPos >= TransferLen)
ROMData = 0;
else else
ROMDataOut = *(u32*)&DataOut[DataOutPos]; ROMData = *(u32*)&TransferData[TransferPos];
DataOutPos += 4; TransferPos += 4;
}
ROMCnt |= (1<<23); ROMCnt |= (1<<23);
@ -1106,16 +1142,16 @@ void ROMCommand_Retail(u8* cmd)
case 0xB7: case 0xB7:
{ {
u32 addr = (cmd[1]<<24) | (cmd[2]<<16) | (cmd[3]<<8) | cmd[4]; u32 addr = (cmd[1]<<24) | (cmd[2]<<16) | (cmd[3]<<8) | cmd[4];
memset(DataOut, 0, DataOutLen); memset(TransferData, 0, TransferLen);
if (((addr + DataOutLen - 1) >> 12) != (addr >> 12)) if (((addr + TransferLen - 1) >> 12) != (addr >> 12))
{ {
u32 len1 = 0x1000 - (addr & 0xFFF); u32 len1 = 0x1000 - (addr & 0xFFF);
ReadROM_B7(addr, len1, 0); ReadROM_B7(addr, len1, 0);
ReadROM_B7(addr+len1, DataOutLen-len1, len1); ReadROM_B7(addr+len1, TransferLen-len1, len1);
} }
else else
ReadROM_B7(addr, DataOutLen, 0); ReadROM_B7(addr, TransferLen, 0);
} }
break; break;
@ -1136,8 +1172,8 @@ void ROMCommand_RetailNAND(u8* cmd)
// Jam with the Band stores words 6-9 of this at 0x02131BB0 // Jam with the Band stores words 6-9 of this at 0x02131BB0
// it doesn't seem to use those anywhere later // it doesn't seem to use those anywhere later
for (u32 pos = 0; pos < DataOutLen; pos += 4) for (u32 pos = 0; pos < TransferLen; pos += 4)
*(u32*)&DataOut[pos] = 0; *(u32*)&TransferData[pos] = 0;
} }
break; break;
@ -1150,16 +1186,16 @@ void ROMCommand_RetailNAND(u8* cmd)
case 0xB7: case 0xB7:
{ {
u32 addr = (cmd[1]<<24) | (cmd[2]<<16) | (cmd[3]<<8) | cmd[4]; u32 addr = (cmd[1]<<24) | (cmd[2]<<16) | (cmd[3]<<8) | cmd[4];
memset(DataOut, 0, DataOutLen); memset(TransferData, 0, TransferLen);
if (((addr + DataOutLen - 1) >> 12) != (addr >> 12)) if (((addr + TransferLen - 1) >> 12) != (addr >> 12))
{ {
u32 len1 = 0x1000 - (addr & 0xFFF); u32 len1 = 0x1000 - (addr & 0xFFF);
ReadROM_B7(addr, len1, 0); ReadROM_B7(addr, len1, 0);
ReadROM_B7(addr+len1, DataOutLen-len1, len1); ReadROM_B7(addr+len1, TransferLen-len1, len1);
} }
else else
ReadROM_B7(addr, DataOutLen, 0); ReadROM_B7(addr, TransferLen, 0);
} }
break; break;
@ -1169,13 +1205,59 @@ void ROMCommand_RetailNAND(u8* cmd)
// * bit7: busy? error? // * bit7: busy? error?
// * bit5: accessing savemem // * bit5: accessing savemem
for (u32 pos = 0; pos < DataOutLen; pos += 4) for (u32 pos = 0; pos < TransferLen; pos += 4)
*(u32*)&DataOut[pos] = NDSCart_SRAM::StatusReg * 0x01010101; *(u32*)&TransferData[pos] = NDSCart_SRAM::StatusReg * 0x01010101;
} }
break; break;
default: default:
printf("unknown NAND command %02X %04Xn", cmd[0], DataOutLen); printf("unknown NAND command %02X %04Xn", cmd[0], TransferLen);
break;
}
}
void ROMCommand_Homebrew(u8* cmd)
{
switch (cmd[0])
{
case 0xB7:
{
u32 addr = (cmd[1]<<24) | (cmd[2]<<16) | (cmd[3]<<8) | cmd[4];
memset(TransferData, 0, TransferLen);
if (((addr + TransferLen - 1) >> 12) != (addr >> 12))
{
u32 len1 = 0x1000 - (addr & 0xFFF);
ReadROM_B7(addr, len1, 0);
ReadROM_B7(addr+len1, TransferLen-len1, len1);
}
else
ReadROM_B7(addr, TransferLen, 0);
}
break;
case 0xC0: // SD read
{
u32 sector = (cmd[1]<<24) | (cmd[2]<<16) | (cmd[3]<<8) | cmd[4];
u64 addr = sector * 0x200ULL;
if (CartSD)
{
fseek(CartSD, addr, SEEK_SET);
fread(TransferData, TransferLen, 1, CartSD);
}
}
break;
case 0xC1: // SD write
{
TransferDir = 1;
memcpy(TransferCmd, cmd, 8);
}
break;
default:
printf("unknown homebrew cart command %02X\n", cmd[0]);
break; break;
} }
} }
@ -1215,8 +1297,8 @@ void WriteROMCnt(u32 val)
else if (datasize > 0) else if (datasize > 0)
datasize = 0x100 << datasize; datasize = 0x100 << datasize;
DataOutPos = 0; TransferPos = 0;
DataOutLen = datasize; TransferLen = datasize;
// handle KEY1 encryption as needed. // handle KEY1 encryption as needed.
// KEY2 encryption is implemented in hardware and doesn't need to be handled. // KEY2 encryption is implemented in hardware and doesn't need to be handled.
@ -1242,28 +1324,32 @@ void WriteROMCnt(u32 val)
cmd[4], cmd[5], cmd[6], cmd[7], cmd[4], cmd[5], cmd[6], cmd[7],
datasize);*/ datasize);*/
// default is read
// commands that do writes will change this
TransferDir = 0;
switch (cmd[0]) switch (cmd[0])
{ {
case 0x9F: case 0x9F:
memset(DataOut, 0xFF, DataOutLen); memset(TransferData, 0xFF, TransferLen);
break; break;
case 0x00: case 0x00:
memset(DataOut, 0, DataOutLen); memset(TransferData, 0, TransferLen);
if (DataOutLen > 0x1000) if (TransferLen > 0x1000)
{ {
ReadROM(0, 0x1000, 0); ReadROM(0, 0x1000, 0);
for (u32 pos = 0x1000; pos < DataOutLen; pos += 0x1000) for (u32 pos = 0x1000; pos < TransferLen; pos += 0x1000)
memcpy(DataOut+pos, DataOut, 0x1000); memcpy(TransferData+pos, TransferData, 0x1000);
} }
else else
ReadROM(0, DataOutLen, 0); ReadROM(0, TransferLen, 0);
break; break;
case 0x90: case 0x90:
case 0xB8: case 0xB8:
for (u32 pos = 0; pos < DataOutLen; pos += 4) for (u32 pos = 0; pos < TransferLen; pos += 4)
*(u32*)&DataOut[pos] = CartID; *(u32*)&TransferData[pos] = CartID;
break; break;
case 0x3C: case 0x3C:
@ -1292,8 +1378,8 @@ void WriteROMCnt(u32 val)
break; break;
case 0x10: case 0x10:
for (u32 pos = 0; pos < DataOutLen; pos += 4) for (u32 pos = 0; pos < TransferLen; pos += 4)
*(u32*)&DataOut[pos] = CartID; *(u32*)&TransferData[pos] = CartID;
break; break;
case 0x20: case 0x20:
@ -1343,19 +1429,17 @@ void WriteROMCnt(u32 val)
NDS::ScheduleEvent(NDS::Event_ROMTransfer, false, xfercycle*(cmddelay+4), ROMPrepareData, 0); NDS::ScheduleEvent(NDS::Event_ROMTransfer, false, xfercycle*(cmddelay+4), ROMPrepareData, 0);
} }
u32 ReadROMData() void AdvanceROMTransfer()
{ {
if (ROMCnt & (1<<23))
{
ROMCnt &= ~(1<<23); ROMCnt &= ~(1<<23);
if (DataOutPos < DataOutLen) if (TransferPos < TransferLen)
{ {
u32 xfercycle = (ROMCnt & (1<<27)) ? 8 : 5; u32 xfercycle = (ROMCnt & (1<<27)) ? 8 : 5;
u32 delay = 4; u32 delay = 4;
if (!(ROMCnt & (1<<30))) if (!(ROMCnt & (1<<30)))
{ {
if (!(DataOutPos & 0x1FF)) if (!(TransferPos & 0x1FF))
delay += ((ROMCnt >> 16) & 0x3F); delay += ((ROMCnt >> 16) & 0x3F);
} }
@ -1363,9 +1447,34 @@ u32 ReadROMData()
} }
else else
ROMEndTransfer(0); ROMEndTransfer(0);
}
u32 ReadROMData()
{
if (ROMCnt & (1<<23))
{
AdvanceROMTransfer();
} }
return ROMDataOut; return ROMData;
}
void WriteROMData(u32 val)
{
ROMData = val;
if (ROMCnt & (1<<23))
{
if (TransferDir == 1)
{
if (TransferPos < TransferLen)
*(u32*)&TransferData[TransferPos] = ROMData;
TransferPos += 4;
}
AdvanceROMTransfer();
}
} }

View File

@ -52,6 +52,7 @@ void ResetCart();
void WriteROMCnt(u32 val); void WriteROMCnt(u32 val);
u32 ReadROMData(); u32 ReadROMData();
void WriteROMData(u32 val);
void WriteSPICnt(u16 val); void WriteSPICnt(u16 val);
u8 ReadSPIData(); u8 ReadSPIData();

View File

@ -44,6 +44,8 @@ EmuSettingsDialog::EmuSettingsDialog(QWidget* parent) : QDialog(parent), ui(new
ui->txtBIOS9Path->setText(Config::BIOS9Path); ui->txtBIOS9Path->setText(Config::BIOS9Path);
ui->txtBIOS7Path->setText(Config::BIOS7Path); ui->txtBIOS7Path->setText(Config::BIOS7Path);
ui->txtFirmwarePath->setText(Config::FirmwarePath); ui->txtFirmwarePath->setText(Config::FirmwarePath);
ui->cbDLDIEnable->setChecked(Config::DLDIEnable != 0);
ui->txtDLDISDPath->setText(Config::DLDISDPath);
ui->txtDSiBIOS9Path->setText(Config::DSiBIOS9Path); ui->txtDSiBIOS9Path->setText(Config::DSiBIOS9Path);
ui->txtDSiBIOS7Path->setText(Config::DSiBIOS7Path); ui->txtDSiBIOS7Path->setText(Config::DSiBIOS7Path);
@ -143,6 +145,8 @@ void EmuSettingsDialog::done(int r)
std::string bios9Path = ui->txtBIOS9Path->text().toStdString(); std::string bios9Path = ui->txtBIOS9Path->text().toStdString();
std::string bios7Path = ui->txtBIOS7Path->text().toStdString(); std::string bios7Path = ui->txtBIOS7Path->text().toStdString();
std::string firmwarePath = ui->txtFirmwarePath->text().toStdString(); std::string firmwarePath = ui->txtFirmwarePath->text().toStdString();
int dldiEnable = ui->cbDLDIEnable->isChecked() ? 1:0;
std::string dldiSDPath = ui->txtDLDISDPath->text().toStdString();
std::string dsiBios9Path = ui->txtDSiBIOS9Path->text().toStdString(); std::string dsiBios9Path = ui->txtDSiBIOS9Path->text().toStdString();
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();
@ -162,6 +166,8 @@ void EmuSettingsDialog::done(int r)
|| strcmp(Config::BIOS9Path, bios9Path.c_str()) != 0 || strcmp(Config::BIOS9Path, bios9Path.c_str()) != 0
|| strcmp(Config::BIOS7Path, bios7Path.c_str()) != 0 || strcmp(Config::BIOS7Path, bios7Path.c_str()) != 0
|| strcmp(Config::FirmwarePath, firmwarePath.c_str()) != 0 || strcmp(Config::FirmwarePath, firmwarePath.c_str()) != 0
|| dldiEnable != Config::DLDIEnable
|| strcmp(Config::DLDISDPath, dldiSDPath.c_str()) != 0
|| 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
@ -178,6 +184,8 @@ void EmuSettingsDialog::done(int r)
strncpy(Config::BIOS9Path, bios9Path.c_str(), 1023); Config::BIOS9Path[1023] = '\0'; strncpy(Config::BIOS9Path, bios9Path.c_str(), 1023); Config::BIOS9Path[1023] = '\0';
strncpy(Config::BIOS7Path, bios7Path.c_str(), 1023); Config::BIOS7Path[1023] = '\0'; strncpy(Config::BIOS7Path, bios7Path.c_str(), 1023); Config::BIOS7Path[1023] = '\0';
strncpy(Config::FirmwarePath, firmwarePath.c_str(), 1023); Config::FirmwarePath[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';
strncpy(Config::DSiBIOS9Path, dsiBios9Path.c_str(), 1023); Config::DSiBIOS9Path[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::DSiBIOS7Path, dsiBios7Path.c_str(), 1023); Config::DSiBIOS7Path[1023] = '\0';
@ -268,6 +276,18 @@ void EmuSettingsDialog::on_btnDSiBIOS7Browse_clicked()
ui->txtDSiBIOS7Path->setText(file); ui->txtDSiBIOS7Path->setText(file);
} }
void EmuSettingsDialog::on_btnDLDISDBrowse_clicked()
{
QString file = QFileDialog::getOpenFileName(this,
"Select DLDI SD image...",
EmuDirectory,
"Image files (*.bin *.rom *.img);;Any file (*.*)");
if (file.isEmpty()) return;
ui->txtDLDISDPath->setText(file);
}
void EmuSettingsDialog::on_btnDSiFirmwareBrowse_clicked() void EmuSettingsDialog::on_btnDSiFirmwareBrowse_clicked()
{ {
QString file = QFileDialog::getOpenFileName(this, QString file = QFileDialog::getOpenFileName(this,

View File

@ -58,6 +58,7 @@ private slots:
void on_btnBIOS9Browse_clicked(); void on_btnBIOS9Browse_clicked();
void on_btnBIOS7Browse_clicked(); void on_btnBIOS7Browse_clicked();
void on_btnFirmwareBrowse_clicked(); void on_btnFirmwareBrowse_clicked();
void on_btnDLDISDBrowse_clicked();
void on_btnDSiBIOS9Browse_clicked(); void on_btnDSiBIOS9Browse_clicked();
void on_btnDSiBIOS7Browse_clicked(); void on_btnDSiBIOS7Browse_clicked();

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>514</width> <width>575</width>
<height>407</height> <height>254</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -86,19 +86,13 @@
</widget> </widget>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="tab_2">
<attribute name="title"> <attribute name="title">
<string>BIOS Files</string> <string>DS-mode</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QGridLayout" name="gridLayout">
<item> <item row="1" column="1">
<widget class="QGroupBox" name="groupBox"> <widget class="QLineEdit" name="txtBIOS7Path">
<property name="title"> <property name="whatsThis">
<string>DS mode</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;DS-mode ARM7 BIOS&lt;/p&gt;&lt;p&gt;Size should be 16 KB&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>DS firmware:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -109,10 +103,31 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="0">
<widget class="QLineEdit" name="txtBIOS7Path"> <widget class="QLabel" name="label_3">
<property name="whatsThis"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;DS-mode ARM7 BIOS&lt;/p&gt;&lt;p&gt;Size should be 16 KB&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>DS firmware:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>DS ARM7 BIOS:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="btnBIOS7Browse">
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="btnFirmwareBrowse">
<property name="text">
<string>Browse...</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -132,20 +147,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2">
<widget class="QPushButton" name="btnFirmwareBrowse">
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>DS ARM7 BIOS:</string>
</property>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
@ -153,13 +154,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2">
<widget class="QPushButton" name="btnBIOS7Browse">
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLineEdit" name="txtBIOS9Path"> <widget class="QLineEdit" name="txtBIOS9Path">
<property name="sizePolicy"> <property name="sizePolicy">
@ -182,15 +176,40 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> <widget class="QWidget" name="tab_4">
<item> <attribute name="title">
<widget class="QGroupBox" name="groupBox_3"> <string>DSi-mode</string>
<property name="title"> </attribute>
<string>DSi mode</string> <layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="1">
<widget class="QLineEdit" name="txtDSiBIOS7Path">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;DSi-mode ARM7 BIOS&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Size should be 64 KB&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> </widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="btnDSiSDBrowse">
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
@ -198,6 +217,48 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2">
<widget class="QPushButton" name="btnDSiNANDBrowse">
<property name="text">
<string>Browse...</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="2">
<widget class="QPushButton" name="btnDSiFirmwareBrowse">
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="txtDSiNANDPath">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;DSi NAND dump&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Should have 'nocash footer' at the end&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="btnDSiBIOS9Browse">
<property name="text">
<string>Browse...</string>
</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"> <item row="0" column="1">
<widget class="QLineEdit" name="txtDSiBIOS9Path"> <widget class="QLineEdit" name="txtDSiBIOS9Path">
<property name="sizePolicy"> <property name="sizePolicy">
@ -211,24 +272,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2"> <item row="2" column="0">
<widget class="QPushButton" name="btnDSiNANDBrowse"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Browse...</string> <string>DSi firmware:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="txtDSiFirmwarePath">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;DSi-mode firmware (used for DS-mode backwards compatibility)&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Size should be 128 KB&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="txtDSiBIOS7Path">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;DSi-mode ARM7 BIOS&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Size should be 64 KB&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -239,52 +286,17 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="2" column="1">
<widget class="QPushButton" name="btnDSiBIOS9Browse"> <widget class="QLineEdit" name="txtDSiFirmwarePath">
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="txtDSiNANDPath">
<property name="whatsThis"> <property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;DSi NAND dump&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Should have 'nocash footer' at the end&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;DSi-mode firmware (used for DS-mode backwards compatibility)&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Size should be 128 KB&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="5" column="1">
<widget class="QLabel" name="label_10"> <widget class="QLineEdit" name="txtDSiSDPath">
<property name="text"> <property name="whatsThis">
<string>DSi SD card:</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;SD image file for emulating the DSi's SD card&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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> </property>
</widget> </widget>
</item> </item>
@ -298,15 +310,8 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="1" column="2">
<widget class="QLineEdit" name="txtDSiSDPath"> <widget class="QPushButton" name="btnDSiBIOS7Browse">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;SD image file for emulating the DSi's SD card&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>
@ -314,12 +319,9 @@
</item> </item>
</layout> </layout>
</widget> </widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3"> <widget class="QWidget" name="tab_3">
<attribute name="title"> <attribute name="title">
<string>CPU Emulation</string> <string>CPU emulation</string>
</attribute> </attribute>
<layout class="QFormLayout" name="formLayout_5"> <layout class="QFormLayout" name="formLayout_5">
<item row="0" column="0"> <item row="0" column="0">
@ -385,6 +387,53 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_5">
<attribute name="title">
<string>DLDI</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" colspan="3">
<widget class="QCheckBox" name="cbDLDIEnable">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable the built-in DLDI driver, to let homebrew access files from a given SD image.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Enable DLDI (for homebrew)</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="btnDLDISDBrowse">
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="txtDLDISDPath"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>DLDI SD card:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
<item> <item>
@ -400,23 +449,8 @@
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>cbxConsoleType</tabstop> <tabstop>cbxConsoleType</tabstop>
<tabstop>chkDirectBoot</tabstop> <tabstop>chkDirectBoot</tabstop>
<tabstop>txtBIOS9Path</tabstop>
<tabstop>txtBIOS7Path</tabstop>
<tabstop>txtFirmwarePath</tabstop>
<tabstop>txtDSiBIOS9Path</tabstop>
<tabstop>txtDSiBIOS7Path</tabstop>
<tabstop>txtDSiFirmwarePath</tabstop>
<tabstop>txtDSiNANDPath</tabstop>
<tabstop>btnBIOS9Browse</tabstop>
<tabstop>btnBIOS7Browse</tabstop>
<tabstop>btnFirmwareBrowse</tabstop>
<tabstop>btnDSiBIOS9Browse</tabstop>
<tabstop>btnDSiBIOS7Browse</tabstop>
<tabstop>btnDSiFirmwareBrowse</tabstop>
<tabstop>btnDSiNANDBrowse</tabstop>
<tabstop>chkEnableJIT</tabstop> <tabstop>chkEnableJIT</tabstop>
<tabstop>spnJITMaximumBlockSize</tabstop> <tabstop>spnJITMaximumBlockSize</tabstop>
</tabstops> </tabstops>