Skip to content
Permalink
Browse files

Do not rebuild FAT table cache after flashcard ROM boot

  • Loading branch information...
RocketRobz committed Jun 12, 2019
1 parent 4d89ae9 commit 3060015fe583c01944cf18a72b745c1e1cd79208
@@ -715,11 +715,12 @@ int arm7_main(void) {
pleaseWaitOutput();
buildFatTableCache(romFile, 0);
} else {
tonccpy((char*)ROM_FILE_LOCATION, (char*)0x27C0000, 0x20);
tonccpy((char*)ROM_FILE_LOCATION, (char*)0x27C0000, sizeof(aFile));
}
/*if (gameOnFlashcard) {
if (gameOnFlashcard) {
romFile->fatTableCache = 0x2700000;
tonccpy((char*)ROM_FILE_LOCATION_MAINMEM, (char*)ROM_FILE_LOCATION, sizeof(aFile));
}*/
}

if (gameOnFlashcard) sdRead = true;

@@ -731,16 +732,16 @@ int arm7_main(void) {
if (fatTableEmpty) {
buildFatTableCache(savFile, 0); // Bugged, if ROM is being loaded from flashcard
} else {
tonccpy((char*)SAV_FILE_LOCATION, (char*)0x27C0020, 0x20);
tonccpy((char*)SAV_FILE_LOCATION, (char*)0x27C0020, sizeof(aFile));
}
}

if (gameOnFlashcard) sdRead = false;

if (fatTableEmpty) {
tonccpy((char*)0x27C0000, (char*)ROM_FILE_LOCATION, 0x20);
tonccpy((char*)0x27C0000, (char*)ROM_FILE_LOCATION, sizeof(aFile));
if (!gameOnFlashcard) {
tonccpy((char*)0x27C0020, (char*)SAV_FILE_LOCATION, 0x20);
tonccpy((char*)0x27C0020, (char*)SAV_FILE_LOCATION, sizeof(aFile));
}
*(u32*)(0x27C0040) = storedFileCluster;
*(u32*)(0x27C0044) = romSize;
@@ -753,9 +754,9 @@ int arm7_main(void) {
} else {
fileRead((char*)0x3700000, fatTableFile, 0x200, 0x80000, 0);
}
/*if (gameOnFlashcard) {
tonccpy((char*)0x2700000, (char*)0x3700000, 0x80000);
}*/
if (gameOnFlashcard) {
tonccpy((char*)0x2700000, (char*)0x3700000, 0x7FFE0);
}

toncset((u32*)0x027C0000, 0, 0x400);

@@ -62,8 +62,7 @@ vu32* volatile sharedAddr = (vu32*)CARDENGINE_SHARED_ADDRESS;
static tNDSHeader* ndsHeader = (tNDSHeader*)NDS_HEADER;

#ifdef DLDI
//static aFile* romFile = (aFile*)ROM_FILE_LOCATION_MAINMEM;
static aFile romFile;
static aFile* romFile = (aFile*)ROM_FILE_LOCATION_MAINMEM;

bool sdRead = false;
#else
@@ -188,7 +187,7 @@ static void clearIcache (void) {

static inline int cardReadNormal(vu32* volatile cardStruct, u32* cacheStruct, u8* dst, u32 src, u32 len, u32 page, u8* cacheBuffer, u32* cachePage) {
#ifdef DLDI
fileRead((char*)dst, romFile, src, len, 0);
fileRead((char*)dst, *romFile, src, len, 0);
#else
u32 commandRead;
u32 sector = (src/readSize)*readSize;
@@ -409,7 +408,7 @@ u32 cardReadDma() {
static int counter=0;
int cardReadPDash(vu32* volatile cardStruct, u32 src, u8* dst, u32 len) {
#ifdef DLDI
fileRead((char*)dst, romFile, src, len, 0);
fileRead((char*)dst, *romFile, src, len, 0);
#else
u32 commandRead;
u32 sector = (src/readSize)*readSize;
@@ -503,8 +502,6 @@ int cardRead(u32* cacheStruct, u8* dst0, u32 src0, u32 len0) {
//nocashMessage("!FAT_InitFiles");
return -1;
}
romFile = getFileFromCluster(ce9->fileCluster);
buildFatTableCache(&romFile, 0);

const char* romTid = getRomTid(ndsHeader);
if (strncmp(romTid, "UBR", 3) != 0) {
@@ -56,8 +56,7 @@ vu32* volatile sharedAddr = (vu32*)CARDENGINE_SHARED_ADDRESS;
static tNDSHeader* ndsHeader = (tNDSHeader*)NDS_HEADER_SDK5;

#ifdef DLDI
//static aFile* romFile = (aFile*)ROM_FILE_LOCATION_MAINMEM;
static aFile romFile;
static aFile* romFile = (aFile*)ROM_FILE_LOCATION_MAINMEM;

bool sdRead = false;
#else
@@ -156,7 +155,7 @@ static void clearIcache (void) {

static inline int cardReadNormal(u8* dst, u32 src, u32 len) {
#ifdef DLDI
fileRead((char*)dst, romFile, src, len, 0);
fileRead((char*)dst, *romFile, src, len, 0);
#else
u32 commandRead;
u32 sector = (src/readSize)*readSize;
@@ -351,8 +350,6 @@ int cardRead(u32* cacheStruct, u8* dst, u32 src, u32 len) {
//nocashMessage("!FAT_InitFiles");
return -1;
}
romFile = getFileFromCluster(ce9->fileCluster);
buildFatTableCache(&romFile, 0);
#else
//if (isGameLaggy(ndsHeader)) {
if (ce9->consoleModel > 0) {
@@ -4,7 +4,7 @@
#define EXCEPTION_STACK_LOCATION 0x23EFFFC

#define ROM_FILE_LOCATION 0x37D5000
#define ROM_FILE_LOCATION_MAINMEM 0x23FFF00
#define ROM_FILE_LOCATION_MAINMEM 0x277FFE0
#define SAV_FILE_LOCATION (ROM_FILE_LOCATION + 32) //+ sizeof(aFile)

#define LOAD_CRT0_LOCATION 0x06860000 // LCDC_BANK_D

0 comments on commit 3060015

Please sign in to comment.
You can’t perform that action at this time.