Skip to content

Commit c650136

Browse files
committed
Comment unneeded code
1 parent 347dc8d commit c650136

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

retail/cardenginei/arm7/source/cardengine.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ static bool nandWrite(void) {
12411241
cardReadLED(false);
12421242
}*/
12431243

1244-
static bool readOngoing = false;
1244+
//static bool readOngoing = false;
12451245
//static bool sdReadOngoing = false;
12461246
static bool ongoingIsDma = false;
12471247
//static int currentCmd=0, currentNdmaSlot=0;
@@ -1439,11 +1439,11 @@ void runCardEngineCheck(void) {
14391439

14401440
const bool isDma = (/* sharedAddr[3] == (vu32)0x020FF80A || */ sharedAddr[3] == (vu32)0x025FFB0A);
14411441

1442-
readOngoing = true;
1442+
// readOngoing = true;
14431443
cardReadLED(true, isDma); // When a file is loading, turn on LED for card read indicator
14441444
fileRead((char*)dst, useApFixOverlays ? apFixOverlaysFile : romFile, src, len);
14451445
cardReadLED(false, isDma); // After loading is done, turn off LED for card read indicator
1446-
readOngoing = false;
1446+
// readOngoing = false;
14471447
sharedAddr[3] = 0;
14481448
if (isDma) {
14491449
IPC_SendSync(0x3);
@@ -1909,7 +1909,7 @@ bool eepromRead(u32 src, void *dst, u32 len) {
19091909
}
19101910

19111911
if (tryLockMutex(&saveMutex)) {
1912-
while (readOngoing) { swiDelay(100); }
1912+
// while (readOngoing) { swiDelay(100); }
19131913
#ifdef TWLSDK
19141914
//bool doBak = ((valueBits & gameOnFlashcard) && !(valueBits & saveOnFlashcard));
19151915
//if (doBak) bakSdData();
@@ -1958,7 +1958,7 @@ bool eepromPageWrite(u32 dst, const void *src, u32 len) {
19581958
}
19591959

19601960
if (tryLockMutex(&saveMutex)) {
1961-
while (readOngoing) { swiDelay(100); }
1961+
// while (readOngoing) { swiDelay(100); }
19621962
#ifdef TWLSDK
19631963
//bool doBak = ((valueBits & gameOnFlashcard) && !(valueBits & saveOnFlashcard));
19641964
//if (doBak) bakSdData();
@@ -2008,7 +2008,7 @@ bool eepromPageProg(u32 dst, const void *src, u32 len) {
20082008
}
20092009

20102010
if (tryLockMutex(&saveMutex)) {
2011-
while (readOngoing) { swiDelay(100); }
2011+
// while (readOngoing) { swiDelay(100); }
20122012
#ifdef TWLSDK
20132013
//bool doBak = ((valueBits & gameOnFlashcard) && !(valueBits & saveOnFlashcard));
20142014
//if (doBak) bakSdData();
@@ -2167,7 +2167,7 @@ bool cardRead(u32 dma, u32 src, void *dst, u32 len) {
21672167
if (valueBits & ROMinRAM) {
21682168
cardReadRAM(dst, src, len);
21692169
} else {
2170-
while (readOngoing) { swiDelay(100); }
2170+
// while (readOngoing) { swiDelay(100); }
21712171
//driveInitialize();
21722172
cardReadLED(true, false); // When a file is loading, turn on LED for card read indicator
21732173
//ndmaUsed = false;

retail/cardenginei/arm9/source/cardDma.thumb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ void cardSetDma(u32 * params) {
393393

394394
enableIPC_SYNC();
395395

396-
u32 commandRead=0x025FFB0A;
396+
const u32 commandRead=0x025FFB0A;
397397
u32 sector = (src/ce9->cacheBlockSize)*ce9->cacheBlockSize;
398398
//u32 page = (src / 512) * 512;
399399

@@ -412,7 +412,7 @@ void cardSetDma(u32 * params) {
412412
413413
dmaReadOnArm7 = true;
414414
415-
IPC_SendSync(0x4);
415+
// IPC_SendSync(0x4);
416416
} else { */
417417
// Read via the main RAM cache
418418
int slot = getSlotForSector(sector);

retail/cardenginei/arm9/source/cardengine.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ static u32 newOverlaysSize = 0;
423423

424424
static inline void cardReadNormal(u8* dst, u32 src, u32 len) {
425425
#ifdef DLDI
426-
while (sharedAddr[3]==0x444D4152); // Wait during a RAM dump
426+
// while (sharedAddr[3]==0x444D4152); // Wait during a RAM dump
427427
fileRead((char*)dst, ((ce9->valueBits & overlaysCached) && src >= ce9->overlaysSrc && src < ndsHeader->arm7romOffset) ? apFixOverlaysFile : romFile, src, len);
428428
#else
429429
if (newOverlayOffset == 0) {
@@ -433,6 +433,7 @@ static inline void cardReadNormal(u8* dst, u32 src, u32 len) {
433433
}
434434
}
435435

436+
const u32 commandRead = (isDma ? 0x025FFB0A : 0x025FFB08);
436437
u32 sector = (src/ce9->cacheBlockSize)*ce9->cacheBlockSize;
437438

438439
accessCounter++;
@@ -446,7 +447,18 @@ static inline void cardReadNormal(u8* dst, u32 src, u32 len) {
446447
//}
447448

448449
/* if ((ce9->valueBits & cacheDisabled) && (u32)dst >= 0x02000000 && (u32)dst < 0x03000000) {
449-
fileRead((char*)dst, ((ce9->valueBits & overlaysCached) && src >= newOverlayOffset && src < newOverlayOffset+newOverlaysSize) ? apFixOverlaysFile : romFile, src, len);
450+
DC_InvalidateRange((u32*)dst, len);
451+
452+
// Write the command
453+
sharedAddr[0] = (vu32)dst;
454+
sharedAddr[1] = len;
455+
sharedAddr[2] = ((ce9->valueBits & overlaysCached) && src >= ce9->overlaysSrc && src < ndsHeader->arm7romOffset) ? src+0x80000000 : src;
456+
sharedAddr[3] = commandRead;
457+
458+
while (sharedAddr[3] == commandRead) {
459+
sleepMs(1);
460+
}
461+
// fileRead((char*)dst, ((ce9->valueBits & overlaysCached) && src >= newOverlayOffset && src < newOverlayOffset+newOverlaysSize) ? apFixOverlaysFile : romFile, src, len);
450462
} else { */
451463
// Read via the main RAM cache
452464
//bool runSleep = true;
@@ -478,8 +490,6 @@ static inline void cardReadNormal(u8* dst, u32 src, u32 len) {
478490

479491
DC_InvalidateRange((u32*)buffer, ce9->cacheBlockSize);
480492

481-
const u32 commandRead = (isDma ? 0x025FFB0A : 0x025FFB08);
482-
483493
// Write the command
484494
sharedAddr[0] = (vu32)buffer;
485495
sharedAddr[1] = ce9->cacheBlockSize;

0 commit comments

Comments
 (0)