actually connect the DLDI thing to the config and the shit and all. yay
This commit is contained in:
parent
239499f6a4
commit
8fd2aa15f3
|
@ -937,7 +937,7 @@ bool FATStorage::Load(std::string filename, u64 size, std::string sourcedir)
|
||||||
// * if an index exists: the size from the index is used
|
// * if an index exists: the size from the index is used
|
||||||
// * if no index, and an image file exists: the file size is used
|
// * if no index, and an image file exists: the file size is used
|
||||||
// * if no image: if sourcing from a directory, size is calculated from that
|
// * if no image: if sourcing from a directory, size is calculated from that
|
||||||
// with a 64MB extra, otherwise size is defaulted to 512MB
|
// with a minimum 128MB extra, otherwise size is defaulted to 512MB
|
||||||
|
|
||||||
bool isnew = false;
|
bool isnew = false;
|
||||||
FF_File = Platform::OpenLocalFile(filename.c_str(), "r+b");
|
FF_File = Platform::OpenLocalFile(filename.c_str(), "r+b");
|
||||||
|
@ -949,7 +949,7 @@ bool FATStorage::Load(std::string filename, u64 size, std::string sourcedir)
|
||||||
|
|
||||||
isnew = true;
|
isnew = true;
|
||||||
}
|
}
|
||||||
printf("IMAGE FILE NEW: %d\n", isnew);
|
|
||||||
IndexPath = FilePath + ".idx";
|
IndexPath = FilePath + ".idx";
|
||||||
if (isnew)
|
if (isnew)
|
||||||
{
|
{
|
||||||
|
@ -960,7 +960,7 @@ printf("IMAGE FILE NEW: %d\n", isnew);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LoadIndex();
|
LoadIndex();
|
||||||
printf("INDEX SIZE %016llX\n", FileSize);
|
|
||||||
if (FileSize == 0)
|
if (FileSize == 0)
|
||||||
{
|
{
|
||||||
fseek(FF_File, 0, SEEK_END);
|
fseek(FF_File, 0, SEEK_END);
|
||||||
|
@ -1014,7 +1014,7 @@ printf("IMAGE FILE NEW: %d\n", isnew);
|
||||||
else
|
else
|
||||||
FileSize = 0x20000000ULL; // 512MB
|
FileSize = 0x20000000ULL; // 512MB
|
||||||
}
|
}
|
||||||
printf("CREATING IMAGE FILE WITH SIZE %016llX\n", FileSize);
|
|
||||||
FF_FileSize = FileSize;
|
FF_FileSize = FileSize;
|
||||||
ff_disk_close();
|
ff_disk_close();
|
||||||
ff_disk_open(FF_ReadStorage, FF_WriteStorage, (LBA_t)(FF_FileSize>>9));
|
ff_disk_open(FF_ReadStorage, FF_WriteStorage, (LBA_t)(FF_FileSize>>9));
|
||||||
|
@ -1044,7 +1044,7 @@ printf("CREATING IMAGE FILE WITH SIZE %016llX\n", FileSize);
|
||||||
if (res == FR_OK)
|
if (res == FR_OK)
|
||||||
res = f_mount(&fs, "0:", 1);
|
res = f_mount(&fs, "0:", 1);
|
||||||
}
|
}
|
||||||
printf("USING IMAGE FILE WITH SIZE %016llX\n", FileSize);
|
|
||||||
if (res == FR_OK)
|
if (res == FR_OK)
|
||||||
{
|
{
|
||||||
if (hasdir)
|
if (hasdir)
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include "ARM.h"
|
#include "ARM.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"
|
#include "melonDLDI.h"
|
||||||
#include "NDSCart_SRAMManager.h"
|
#include "NDSCart_SRAMManager.h"
|
||||||
|
@ -1165,16 +1164,22 @@ u8 CartRetailBT::SPIWrite(u8 val, u32 pos, bool last)
|
||||||
|
|
||||||
CartHomebrew::CartHomebrew(u8* rom, u32 len, u32 chipid) : CartCommon(rom, len, chipid)
|
CartHomebrew::CartHomebrew(u8* rom, u32 len, u32 chipid) : CartCommon(rom, len, chipid)
|
||||||
{
|
{
|
||||||
ReadOnly = false; // TODO
|
ReadOnly = Platform::GetConfigBool(Platform::DLDI_ReadOnly);
|
||||||
|
|
||||||
//if (Config::DLDIEnable)
|
if (Platform::GetConfigBool(Platform::DLDI_Enable))
|
||||||
if (true)
|
|
||||||
{
|
{
|
||||||
ApplyDLDIPatch(melonDLDI, sizeof(melonDLDI), ReadOnly);
|
std::string folderpath;
|
||||||
SD = new FATStorage("melonDLDI.bin", 0, ReadOnly, "dldi");
|
if (Platform::GetConfigBool(Platform::DLDI_FolderSync))
|
||||||
SD->Open();
|
folderpath = Platform::GetConfigString(Platform::DLDI_FolderPath);
|
||||||
|
else
|
||||||
|
folderpath = "";
|
||||||
|
|
||||||
// fat:/rom.nds
|
ApplyDLDIPatch(melonDLDI, sizeof(melonDLDI), ReadOnly);
|
||||||
|
SD = new FATStorage(Platform::GetConfigString(Platform::DLDI_ImagePath),
|
||||||
|
(u64)Platform::GetConfigInt(Platform::DLDI_ImageSize) * 1024 * 1024,
|
||||||
|
ReadOnly,
|
||||||
|
folderpath);
|
||||||
|
SD->Open();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SD = nullptr;
|
SD = nullptr;
|
||||||
|
@ -1192,8 +1197,6 @@ CartHomebrew::~CartHomebrew()
|
||||||
void CartHomebrew::Reset()
|
void CartHomebrew::Reset()
|
||||||
{
|
{
|
||||||
CartCommon::Reset();
|
CartCommon::Reset();
|
||||||
|
|
||||||
// TODO??? something about the FATStorage thing?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CartHomebrew::SetupDirectBoot()
|
void CartHomebrew::SetupDirectBoot()
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace Platform
|
namespace Platform
|
||||||
{
|
{
|
||||||
|
@ -31,6 +32,29 @@ void DeInit();
|
||||||
|
|
||||||
void StopEmu();
|
void StopEmu();
|
||||||
|
|
||||||
|
// configuration values
|
||||||
|
|
||||||
|
enum ConfigEntry
|
||||||
|
{
|
||||||
|
DLDI_Enable,
|
||||||
|
DLDI_ImagePath,
|
||||||
|
DLDI_ImageSize,
|
||||||
|
DLDI_ReadOnly,
|
||||||
|
DLDI_FolderSync,
|
||||||
|
DLDI_FolderPath,
|
||||||
|
|
||||||
|
DSiSD_Enable,
|
||||||
|
DSiSD_ImagePath,
|
||||||
|
DSiSD_ImageSize,
|
||||||
|
DSiSD_ReadOnly,
|
||||||
|
DSiSD_FolderSync,
|
||||||
|
DSiSD_FolderPath,
|
||||||
|
};
|
||||||
|
|
||||||
|
int GetConfigInt(ConfigEntry entry);
|
||||||
|
bool GetConfigBool(ConfigEntry entry);
|
||||||
|
std::string GetConfigString(ConfigEntry entry);
|
||||||
|
|
||||||
// fopen() wrappers
|
// fopen() wrappers
|
||||||
// * OpenFile():
|
// * OpenFile():
|
||||||
// simple fopen() wrapper that supports UTF8.
|
// simple fopen() wrapper that supports UTF8.
|
||||||
|
|
|
@ -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)
|
FILE* OpenFile(const char* path, const char* mode, bool mustexist)
|
||||||
{
|
{
|
||||||
QFile f(path);
|
QFile f(path);
|
||||||
|
|
Loading…
Reference in New Issue