Skip to content

Commit

Permalink
Try to fix IR breaking after accessing DS Classic Menu
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Apr 2, 2020
1 parent 9c8f8ab commit e361784
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion quickmenu/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ void refreshNdsCard() {

if (arm7SCFGLocked && showBoxArt) {
loadBoxArt("nitro:/graphics/boxart_unknown.png");
} else if ((cardInit() == 0) && showBoxArt) {
} else if ((cardInit(true) == 0) && showBoxArt) {
char game_TID[5] = {0};
tonccpy(&game_TID, ndsCardHeader.gameCode, 4);

Expand Down
2 changes: 1 addition & 1 deletion settings/arm9/source/common/flashcard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ TWL_CODE void twl_flashcardInit(void) {
}

// Reset Slot-1 to allow reading title name and ID
cardInit();
cardInit(false);

//char gamename[13];
//char gameid[5];
Expand Down
2 changes: 1 addition & 1 deletion title/arm9/source/common/flashcard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ TWL_CODE void twl_flashcardInit(void) {
}

// Reset Slot-1 to allow reading title name and ID
cardInit();
cardInit(false);

//char gamename[13];
//char gameid[5];
Expand Down
2 changes: 1 addition & 1 deletion universal/include/read_card.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extern "C" {
extern bool cardInited;
extern sNDSHeaderExt ndsCardHeader;

int cardInit (void);
int cardInit (bool properReset);

void cardRead (u32 src, void* dest, size_t len);

Expand Down
15 changes: 9 additions & 6 deletions universal/source/read_card.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ static void switchToTwlBlowfish(void) {
}


int cardInit (void)
int cardInit (bool properReset)
{
u32 portFlagsKey1, portFlagsSecRead;
normalChip = false; // As defined by GBAtek, normal chip secure area is accessed in blocks of 0x200, other chip in blocks of 0x1000
Expand All @@ -293,11 +293,14 @@ int cardInit (void)
enableSlot1();
for(i = 0; i < 15; i++) { swiWaitForVBlank(); }

// Dummy command sent after card reset
cardParamCommand (CARD_CMD_DUMMY, 0,
CARD_ACTIVATE | CARD_nRESET | CARD_CLK_SLOW | CARD_BLK_SIZE(1) | CARD_DELAY1(0x1FFF) | CARD_DELAY2(0x3F),
NULL, 0);
} else {
if (!properReset) {
// Dummy command sent after card reset
cardParamCommand (CARD_CMD_DUMMY, 0,
CARD_ACTIVATE | CARD_nRESET | CARD_CLK_SLOW | CARD_BLK_SIZE(1) | CARD_DELAY1(0x1FFF) | CARD_DELAY2(0x3F),
NULL, 0);
}
}
if (!isDSiMode() || properReset) {
REG_ROMCTRL=0;
REG_AUXSPICNT=0;
//ioDelay2(167550);
Expand Down

0 comments on commit e361784

Please sign in to comment.