mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 21:37:42 -07:00
actually add DLDI. bahahahhh
This commit is contained in:
parent
81eda0f19c
commit
5431c469c3
@ -33,6 +33,7 @@ add_library(core STATIC
|
||||
GPU3D_OpenGL.cpp
|
||||
GPU3D_OpenGL_shaders.h
|
||||
GPU3D_Soft.cpp
|
||||
melonDLDI.h
|
||||
NDS.cpp
|
||||
NDSCart.cpp
|
||||
OpenGLSupport.cpp
|
||||
|
@ -31,6 +31,8 @@ const char* kConfigFile = "melonDS.ini";
|
||||
char BIOS9Path[1024];
|
||||
char BIOS7Path[1024];
|
||||
char FirmwarePath[1024];
|
||||
int DLDIEnable;
|
||||
char DLDISDPath[1024];
|
||||
|
||||
char DSiBIOS9Path[1024];
|
||||
char DSiBIOS7Path[1024];
|
||||
@ -54,6 +56,8 @@ ConfigEntry ConfigFile[] =
|
||||
{"BIOS9Path", 1, BIOS9Path, 0, "", 1023},
|
||||
{"BIOS7Path", 1, BIOS7Path, 0, "", 1023},
|
||||
{"FirmwarePath", 1, FirmwarePath, 0, "", 1023},
|
||||
{"DLDIEnable", 0, &DLDIEnable, 0, NULL, 0},
|
||||
{"DLDISDPath", 1, DLDISDPath, 0, "", 1023},
|
||||
|
||||
{"DSiBIOS9Path", 1, DSiBIOS9Path, 0, "", 1023},
|
||||
{"DSiBIOS7Path", 1, DSiBIOS7Path, 0, "", 1023},
|
||||
|
@ -45,6 +45,8 @@ void Save();
|
||||
extern char BIOS9Path[1024];
|
||||
extern char BIOS7Path[1024];
|
||||
extern char FirmwarePath[1024];
|
||||
extern int DLDIEnable;
|
||||
extern char DLDISDPath[1024];
|
||||
|
||||
extern char DSiBIOS9Path[1024];
|
||||
extern char DSiBIOS7Path[1024];
|
||||
|
@ -2537,6 +2537,7 @@ void ARM7Write8(u32 addr, u8 val)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ARM7->R[15] > 0x00002F30) // ARM7 BIOS bug
|
||||
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;
|
||||
GPU::SetPowerCnt(PowerControl9);
|
||||
return;
|
||||
|
||||
case 0x04100010:
|
||||
NDSCart::WriteROMData(val);
|
||||
return;
|
||||
}
|
||||
|
||||
if (addr >= 0x04000000 && addr < 0x04000060)
|
||||
|
259
src/NDSCart.cpp
259
src/NDSCart.cpp
@ -25,7 +25,9 @@
|
||||
#include "CRC32.h"
|
||||
#include "DSi_AES.h"
|
||||
#include "Platform.h"
|
||||
#include "Config.h"
|
||||
#include "ROMList.h"
|
||||
#include "melonDLDI.h"
|
||||
|
||||
|
||||
namespace NDSCart_SRAM
|
||||
@ -464,11 +466,13 @@ u16 SPICnt;
|
||||
u32 ROMCnt;
|
||||
|
||||
u8 ROMCommand[8];
|
||||
u32 ROMDataOut;
|
||||
u32 ROMData;
|
||||
|
||||
u8 DataOut[0x4000];
|
||||
u32 DataOutPos;
|
||||
u32 DataOutLen;
|
||||
u8 TransferData[0x4000];
|
||||
u32 TransferPos;
|
||||
u32 TransferLen;
|
||||
u32 TransferDir;
|
||||
u8 TransferCmd[8];
|
||||
|
||||
bool CartInserted;
|
||||
u8* CartROM;
|
||||
@ -478,6 +482,8 @@ u32 CartID;
|
||||
bool CartIsHomebrew;
|
||||
bool CartIsDSi;
|
||||
|
||||
FILE* CartSD;
|
||||
|
||||
u32 CmdEncMode;
|
||||
u32 DataEncMode;
|
||||
|
||||
@ -489,6 +495,7 @@ u64 Key2_Y;
|
||||
|
||||
void ROMCommand_Retail(u8* cmd);
|
||||
void ROMCommand_RetailNAND(u8* cmd);
|
||||
void ROMCommand_Homebrew(u8* cmd);
|
||||
|
||||
void (*ROMCommandHandler)(u8* cmd);
|
||||
|
||||
@ -615,6 +622,8 @@ bool Init()
|
||||
|
||||
CartROM = NULL;
|
||||
|
||||
CartSD = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -622,6 +631,8 @@ void DeInit()
|
||||
{
|
||||
if (CartROM) delete[] CartROM;
|
||||
|
||||
if (CartSD) fclose(CartSD);
|
||||
|
||||
NDSCart_SRAM::DeInit();
|
||||
}
|
||||
|
||||
@ -635,6 +646,9 @@ void Reset()
|
||||
CartIsHomebrew = false;
|
||||
CartIsDSi = false;
|
||||
|
||||
if (CartSD) fclose(CartSD);
|
||||
CartSD = NULL;
|
||||
|
||||
ROMCommandHandler = NULL;
|
||||
|
||||
NDSCart_SRAM::Reset();
|
||||
@ -650,11 +664,13 @@ void DoSavestate(Savestate* file)
|
||||
file->Var32(&ROMCnt);
|
||||
|
||||
file->VarArray(ROMCommand, 8);
|
||||
file->Var32(&ROMDataOut);
|
||||
file->Var32(&ROMData);
|
||||
|
||||
file->VarArray(DataOut, 0x4000);
|
||||
file->Var32(&DataOutPos);
|
||||
file->Var32(&DataOutLen);
|
||||
file->VarArray(TransferData, 0x4000);
|
||||
file->Var32(&TransferPos);
|
||||
file->Var32(&TransferLen);
|
||||
file->Var32(&TransferDir);
|
||||
file->VarArray(TransferCmd, 8);
|
||||
|
||||
// cart inserted/len/ROM/etc should be already populated
|
||||
// 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 size = *(u32*)&CartROM[0x2C];
|
||||
|
||||
@ -696,23 +710,7 @@ void ApplyDLDIPatch()
|
||||
return;
|
||||
}
|
||||
|
||||
printf("DLDI shit 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);
|
||||
printf("DLDI structure found at %08X (%08X)\n", dldioffset, offset+dldioffset);
|
||||
|
||||
if (*(u32*)&patch[0] != 0xBF8DA5ED ||
|
||||
*(u32*)&patch[4] != 0x69684320 ||
|
||||
@ -743,7 +741,7 @@ void ApplyDLDIPatch()
|
||||
u32 patchsize = 1 << patch[0x0D];
|
||||
u32 patchend = patchbase + patchsize;
|
||||
|
||||
memcpy(&binary[dldioffset], patch, dldisize);
|
||||
memcpy(&binary[dldioffset], patch, len);
|
||||
|
||||
*(u32*)&binary[dldioffset+0x40] += delta;
|
||||
*(u32*)&binary[dldioffset+0x44] += delta;
|
||||
@ -807,7 +805,6 @@ void ApplyDLDIPatch()
|
||||
memset(&binary[dldioffset+fixstart], 0, fixend-fixstart);
|
||||
}
|
||||
|
||||
delete[] patch;
|
||||
printf("applied DLDI patch\n");
|
||||
}
|
||||
|
||||
@ -987,11 +984,13 @@ bool LoadROM(const char* path, const char* sram, bool direct)
|
||||
Key1_Encrypt((u32*)&CartROM[arm9base]);
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
if ((arm9base < 0x4000) || (gamecode == 0x23232323))
|
||||
{
|
||||
CartIsHomebrew = true;
|
||||
//ApplyDLDIPatch();
|
||||
}
|
||||
if (Config::DLDIEnable)
|
||||
ApplyDLDIPatch(melonDLDI, sizeof(melonDLDI));
|
||||
}
|
||||
|
||||
if (direct)
|
||||
@ -1005,7 +1004,9 @@ bool LoadROM(const char* path, const char* sram, bool direct)
|
||||
CartInserted = true;
|
||||
|
||||
// TODO: support more fancy cart types (homebrew?, flashcarts, etc)
|
||||
if (CartID & 0x08000000)
|
||||
if (CartIsHomebrew)
|
||||
ROMCommandHandler = ROMCommand_Homebrew;
|
||||
else if (CartID & 0x08000000)
|
||||
ROMCommandHandler = ROMCommand_RetailNAND;
|
||||
else
|
||||
ROMCommandHandler = ROMCommand_Retail;
|
||||
@ -1017,6 +1018,13 @@ bool LoadROM(const char* path, const char* sram, bool direct)
|
||||
printf("Save file: %s\n", sram);
|
||||
NDSCart_SRAM::LoadSave(sram, romparams.SaveMemType);
|
||||
|
||||
if (CartIsHomebrew && Config::DLDIEnable)
|
||||
{
|
||||
CartSD = Platform::OpenLocalFile(Config::DLDISDPath, "r+b");
|
||||
}
|
||||
else
|
||||
CartSD = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1034,14 +1042,17 @@ void ResetCart()
|
||||
ROMCnt = 0;
|
||||
|
||||
memset(ROMCommand, 0, 8);
|
||||
ROMDataOut = 0;
|
||||
ROMData = 0;
|
||||
|
||||
Key2_X = 0;
|
||||
Key2_Y = 0;
|
||||
|
||||
memset(DataOut, 0, 0x4000);
|
||||
DataOutPos = 0;
|
||||
DataOutLen = 0;
|
||||
memset(TransferData, 0, 0x4000);
|
||||
TransferPos = 0;
|
||||
TransferLen = 0;
|
||||
TransferDir = 0;
|
||||
memset(TransferCmd, 0, 8);
|
||||
TransferCmd[0] = 0xFF;
|
||||
|
||||
CmdEncMode = 0;
|
||||
DataEncMode = 0;
|
||||
@ -1055,7 +1066,7 @@ void ReadROM(u32 addr, u32 len, u32 offset)
|
||||
if ((addr+len) > CartROMSize)
|
||||
len = CartROMSize - addr;
|
||||
|
||||
memcpy(DataOut+offset, CartROM+addr, len);
|
||||
memcpy(TransferData+offset, CartROM+addr, len);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
memcpy(DataOut+offset, CartROM+addr, len);
|
||||
memcpy(TransferData+offset, CartROM+addr, len);
|
||||
}
|
||||
|
||||
|
||||
@ -1079,16 +1090,41 @@ void ROMEndTransfer(u32 param)
|
||||
|
||||
if (SPICnt & (1<<14))
|
||||
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)
|
||||
{
|
||||
if (DataOutPos >= DataOutLen)
|
||||
ROMDataOut = 0;
|
||||
if (TransferDir == 0)
|
||||
{
|
||||
if (TransferPos >= TransferLen)
|
||||
ROMData = 0;
|
||||
else
|
||||
ROMDataOut = *(u32*)&DataOut[DataOutPos];
|
||||
ROMData = *(u32*)&TransferData[TransferPos];
|
||||
|
||||
DataOutPos += 4;
|
||||
TransferPos += 4;
|
||||
}
|
||||
|
||||
ROMCnt |= (1<<23);
|
||||
|
||||
@ -1106,16 +1142,16 @@ void ROMCommand_Retail(u8* cmd)
|
||||
case 0xB7:
|
||||
{
|
||||
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);
|
||||
ReadROM_B7(addr, len1, 0);
|
||||
ReadROM_B7(addr+len1, DataOutLen-len1, len1);
|
||||
ReadROM_B7(addr+len1, TransferLen-len1, len1);
|
||||
}
|
||||
else
|
||||
ReadROM_B7(addr, DataOutLen, 0);
|
||||
ReadROM_B7(addr, TransferLen, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1136,8 +1172,8 @@ void ROMCommand_RetailNAND(u8* cmd)
|
||||
|
||||
// Jam with the Band stores words 6-9 of this at 0x02131BB0
|
||||
// it doesn't seem to use those anywhere later
|
||||
for (u32 pos = 0; pos < DataOutLen; pos += 4)
|
||||
*(u32*)&DataOut[pos] = 0;
|
||||
for (u32 pos = 0; pos < TransferLen; pos += 4)
|
||||
*(u32*)&TransferData[pos] = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1150,16 +1186,16 @@ void ROMCommand_RetailNAND(u8* cmd)
|
||||
case 0xB7:
|
||||
{
|
||||
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);
|
||||
ReadROM_B7(addr, len1, 0);
|
||||
ReadROM_B7(addr+len1, DataOutLen-len1, len1);
|
||||
ReadROM_B7(addr+len1, TransferLen-len1, len1);
|
||||
}
|
||||
else
|
||||
ReadROM_B7(addr, DataOutLen, 0);
|
||||
ReadROM_B7(addr, TransferLen, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1169,13 +1205,59 @@ void ROMCommand_RetailNAND(u8* cmd)
|
||||
// * bit7: busy? error?
|
||||
// * bit5: accessing savemem
|
||||
|
||||
for (u32 pos = 0; pos < DataOutLen; pos += 4)
|
||||
*(u32*)&DataOut[pos] = NDSCart_SRAM::StatusReg * 0x01010101;
|
||||
for (u32 pos = 0; pos < TransferLen; pos += 4)
|
||||
*(u32*)&TransferData[pos] = NDSCart_SRAM::StatusReg * 0x01010101;
|
||||
}
|
||||
break;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -1215,8 +1297,8 @@ void WriteROMCnt(u32 val)
|
||||
else if (datasize > 0)
|
||||
datasize = 0x100 << datasize;
|
||||
|
||||
DataOutPos = 0;
|
||||
DataOutLen = datasize;
|
||||
TransferPos = 0;
|
||||
TransferLen = datasize;
|
||||
|
||||
// handle KEY1 encryption as needed.
|
||||
// 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],
|
||||
datasize);*/
|
||||
|
||||
// default is read
|
||||
// commands that do writes will change this
|
||||
TransferDir = 0;
|
||||
|
||||
switch (cmd[0])
|
||||
{
|
||||
case 0x9F:
|
||||
memset(DataOut, 0xFF, DataOutLen);
|
||||
memset(TransferData, 0xFF, TransferLen);
|
||||
break;
|
||||
|
||||
case 0x00:
|
||||
memset(DataOut, 0, DataOutLen);
|
||||
if (DataOutLen > 0x1000)
|
||||
memset(TransferData, 0, TransferLen);
|
||||
if (TransferLen > 0x1000)
|
||||
{
|
||||
ReadROM(0, 0x1000, 0);
|
||||
for (u32 pos = 0x1000; pos < DataOutLen; pos += 0x1000)
|
||||
memcpy(DataOut+pos, DataOut, 0x1000);
|
||||
for (u32 pos = 0x1000; pos < TransferLen; pos += 0x1000)
|
||||
memcpy(TransferData+pos, TransferData, 0x1000);
|
||||
}
|
||||
else
|
||||
ReadROM(0, DataOutLen, 0);
|
||||
ReadROM(0, TransferLen, 0);
|
||||
break;
|
||||
|
||||
case 0x90:
|
||||
case 0xB8:
|
||||
for (u32 pos = 0; pos < DataOutLen; pos += 4)
|
||||
*(u32*)&DataOut[pos] = CartID;
|
||||
for (u32 pos = 0; pos < TransferLen; pos += 4)
|
||||
*(u32*)&TransferData[pos] = CartID;
|
||||
break;
|
||||
|
||||
case 0x3C:
|
||||
@ -1292,8 +1378,8 @@ void WriteROMCnt(u32 val)
|
||||
break;
|
||||
|
||||
case 0x10:
|
||||
for (u32 pos = 0; pos < DataOutLen; pos += 4)
|
||||
*(u32*)&DataOut[pos] = CartID;
|
||||
for (u32 pos = 0; pos < TransferLen; pos += 4)
|
||||
*(u32*)&TransferData[pos] = CartID;
|
||||
break;
|
||||
|
||||
case 0x20:
|
||||
@ -1343,19 +1429,17 @@ void WriteROMCnt(u32 val)
|
||||
NDS::ScheduleEvent(NDS::Event_ROMTransfer, false, xfercycle*(cmddelay+4), ROMPrepareData, 0);
|
||||
}
|
||||
|
||||
u32 ReadROMData()
|
||||
void AdvanceROMTransfer()
|
||||
{
|
||||
if (ROMCnt & (1<<23))
|
||||
{
|
||||
ROMCnt &= ~(1<<23);
|
||||
|
||||
if (DataOutPos < DataOutLen)
|
||||
if (TransferPos < TransferLen)
|
||||
{
|
||||
u32 xfercycle = (ROMCnt & (1<<27)) ? 8 : 5;
|
||||
u32 delay = 4;
|
||||
if (!(ROMCnt & (1<<30)))
|
||||
{
|
||||
if (!(DataOutPos & 0x1FF))
|
||||
if (!(TransferPos & 0x1FF))
|
||||
delay += ((ROMCnt >> 16) & 0x3F);
|
||||
}
|
||||
|
||||
@ -1363,9 +1447,34 @@ u32 ReadROMData()
|
||||
}
|
||||
else
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,6 +52,7 @@ void ResetCart();
|
||||
|
||||
void WriteROMCnt(u32 val);
|
||||
u32 ReadROMData();
|
||||
void WriteROMData(u32 val);
|
||||
|
||||
void WriteSPICnt(u16 val);
|
||||
u8 ReadSPIData();
|
||||
|
@ -44,6 +44,8 @@ EmuSettingsDialog::EmuSettingsDialog(QWidget* parent) : QDialog(parent), ui(new
|
||||
ui->txtBIOS9Path->setText(Config::BIOS9Path);
|
||||
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);
|
||||
@ -143,6 +145,8 @@ 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();
|
||||
std::string dsiBios9Path = ui->txtDSiBIOS9Path->text().toStdString();
|
||||
std::string dsiBios7Path = ui->txtDSiBIOS7Path->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::BIOS7Path, bios7Path.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::DSiBIOS7Path, dsiBios7Path.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::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';
|
||||
|
||||
strncpy(Config::DSiBIOS9Path, dsiBios9Path.c_str(), 1023); Config::DSiBIOS9Path[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);
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
QString file = QFileDialog::getOpenFileName(this,
|
||||
|
@ -58,6 +58,7 @@ private slots:
|
||||
void on_btnBIOS9Browse_clicked();
|
||||
void on_btnBIOS7Browse_clicked();
|
||||
void on_btnFirmwareBrowse_clicked();
|
||||
void on_btnDLDISDBrowse_clicked();
|
||||
|
||||
void on_btnDSiBIOS9Browse_clicked();
|
||||
void on_btnDSiBIOS7Browse_clicked();
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>514</width>
|
||||
<height>407</height>
|
||||
<width>575</width>
|
||||
<height>254</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -86,19 +86,13 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>BIOS Files</string>
|
||||
<string>DS-mode</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>DS mode</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>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="txtBIOS7Path">
|
||||
<property name="whatsThis">
|
||||
<string><html><head/><body><p>DS-mode ARM7 BIOS</p><p>Size should be 16 KB</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -109,10 +103,31 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="txtBIOS7Path">
|
||||
<property name="whatsThis">
|
||||
<string><html><head/><body><p>DS-mode ARM7 BIOS</p><p>Size should be 16 KB</p></body></html></string>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
@ -132,20 +147,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
@ -153,13 +154,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<widget class="QLineEdit" name="txtBIOS9Path">
|
||||
<property name="sizePolicy">
|
||||
@ -182,15 +176,40 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>DSi mode</string>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>DSi-mode</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<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>
|
||||
<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">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
@ -198,6 +217,48 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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><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="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">
|
||||
<widget class="QLineEdit" name="txtDSiBIOS9Path">
|
||||
<property name="sizePolicy">
|
||||
@ -211,24 +272,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="btnDSiNANDBrowse">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<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>
|
||||
<string>DSi firmware:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -239,52 +286,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="btnDSiBIOS9Browse">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="txtDSiNANDPath">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" 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="5" column="0">
|
||||
<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>
|
||||
<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>
|
||||
@ -298,15 +310,8 @@
|
||||
</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">
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="btnDSiBIOS7Browse">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
@ -314,12 +319,9 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>CPU Emulation</string>
|
||||
<string>CPU emulation</string>
|
||||
</attribute>
|
||||
<layout class="QFormLayout" name="formLayout_5">
|
||||
<item row="0" column="0">
|
||||
@ -385,6 +387,53 @@
|
||||
</item>
|
||||
</layout>
|
||||
</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><html><head/><body><p>Enable the built-in DLDI driver, to let homebrew access files from a given SD image.</p></body></html></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>
|
||||
</item>
|
||||
<item>
|
||||
@ -400,23 +449,8 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
<tabstop>cbxConsoleType</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>spnJITMaximumBlockSize</tabstop>
|
||||
</tabstops>
|
||||
|
Loading…
Reference in New Issue
Block a user