Skip to content

Commit 757c939

Browse files
committed
Allow *Zelda: Four Swords* to launch without a MEP on DS flashcards
1 parent a0c4b6a commit 757c939

File tree

6 files changed

+60
-13
lines changed

6 files changed

+60
-13
lines changed

romsel_aktheme/arm9/source/fileBrowse.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,8 +1240,8 @@ bool dsiWareRAMLimitMsg(std::string filename) {
12401240
for (unsigned int i = 0; i < sizeof(compatibleGameListB4DSDebugRAMLimited)/sizeof(compatibleGameListB4DSDebugRAMLimited[0]); i++) {
12411241
if (memcmp(gameTid[cursorPosOnScreen], compatibleGameListB4DSDebugRAMLimited[i], 3) == 0) {
12421242
// Found match
1243-
showMsg = true;
12441243
msgId = compatibleGameListB4DSDebugRAMLimitedID[i];
1244+
showMsg = true;
12451245
break;
12461246
}
12471247
}
@@ -1250,8 +1250,18 @@ bool dsiWareRAMLimitMsg(std::string filename) {
12501250
for (unsigned int i = 0; i < sizeof(compatibleGameListB4DSRAMLimited)/sizeof(compatibleGameListB4DSRAMLimited[0]); i++) {
12511251
if (memcmp(gameTid[cursorPosOnScreen], compatibleGameListB4DSRAMLimited[i], 3) == 0) {
12521252
// Found match
1253-
showMsg = true;
12541253
msgId = compatibleGameListB4DSRAMLimitedID[i];
1254+
if (msgId == 9) {
1255+
if (io_dldi_data->ioInterface.features & FEATURE_SLOT_NDS) {
1256+
const u16 hwordBak = *(vu16*)(0x08240000);
1257+
*(vu16*)(0x08240000) = 1; // Detect Memory Expansion Pak
1258+
mepFound = (*(vu16*)(0x08240000) == 1);
1259+
*(vu16*)(0x08240000) = hwordBak;
1260+
}
1261+
showMsg = (!mepFound && *(u16*)0x020000C0 == 0); // Show message if not found
1262+
} else {
1263+
showMsg = true;
1264+
}
12551265
break;
12561266
}
12571267
}
@@ -1262,8 +1272,8 @@ bool dsiWareRAMLimitMsg(std::string filename) {
12621272
for (unsigned int i = 0; i < sizeof(compatibleGameListB4DSAllRAMLimited)/sizeof(compatibleGameListB4DSAllRAMLimited[0]); i++) {
12631273
if (memcmp(gameTid[cursorPosOnScreen], compatibleGameListB4DSAllRAMLimited[i], 3) == 0) {
12641274
// Found match
1265-
showMsg = true;
12661275
msgId = compatibleGameListB4DSAllRAMLimitedID[i];
1276+
showMsg = true;
12671277
break;
12681278
}
12691279
}
@@ -1319,6 +1329,12 @@ bool dsiWareRAMLimitMsg(std::string filename) {
13191329
printSmall(false, 0, 114, "game with sound effects, launch this on", Alignment::center, FontPalette::formText);
13201330
printSmall(false, 0, 126, "Nintendo DSi or 3DS systems.", Alignment::center, FontPalette::formText);
13211331
break;
1332+
case 9:
1333+
printSmall(false, 0, 90, "Due to memory limitations, audio", Alignment::center, FontPalette::formText);
1334+
printSmall(false, 0, 102, "will not be played. To play this", Alignment::center, FontPalette::formText);
1335+
printSmall(false, 0, 114, "game with audio, insert the", Alignment::center, FontPalette::formText);
1336+
printSmall(false, 0, 126, "Memory Expansion Pak.", Alignment::center, FontPalette::formText);
1337+
break;
13221338
case 10:
13231339
if (sys().isRegularDS()) {
13241340
printSmall(false, 0, 102, "To launch this title, please", Alignment::center, FontPalette::formText);

romsel_dsimenutheme/arm9/source/fileBrowse.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,8 +2218,8 @@ void dsiWareRAMLimitMsgPrep(void) {
22182218
for (unsigned int i = 0; i < sizeof(compatibleGameListB4DSDebugRAMLimited)/sizeof(compatibleGameListB4DSDebugRAMLimited[0]); i++) {
22192219
if (memcmp(gameTid[CURPOS], compatibleGameListB4DSDebugRAMLimited[i], 3) == 0) {
22202220
// Found match
2221-
showMsg = true;
22222221
msgId = compatibleGameListB4DSDebugRAMLimitedID[i];
2222+
showMsg = true;
22232223
break;
22242224
}
22252225
}
@@ -2228,8 +2228,18 @@ void dsiWareRAMLimitMsgPrep(void) {
22282228
for (unsigned int i = 0; i < sizeof(compatibleGameListB4DSRAMLimited)/sizeof(compatibleGameListB4DSRAMLimited[0]); i++) {
22292229
if (memcmp(gameTid[CURPOS], compatibleGameListB4DSRAMLimited[i], 3) == 0) {
22302230
// Found match
2231-
showMsg = true;
22322231
msgId = compatibleGameListB4DSRAMLimitedID[i];
2232+
if (msgId == 9) {
2233+
if (io_dldi_data->ioInterface.features & FEATURE_SLOT_NDS) {
2234+
const u16 hwordBak = *(vu16*)(0x08240000);
2235+
*(vu16*)(0x08240000) = 1; // Detect Memory Expansion Pak
2236+
mepFound = (*(vu16*)(0x08240000) == 1);
2237+
*(vu16*)(0x08240000) = hwordBak;
2238+
}
2239+
showMsg = (!mepFound && *(u16*)0x020000C0 == 0); // Show message if not found
2240+
} else {
2241+
showMsg = true;
2242+
}
22332243
break;
22342244
}
22352245
}
@@ -2240,8 +2250,8 @@ void dsiWareRAMLimitMsgPrep(void) {
22402250
for (unsigned int i = 0; i < sizeof(compatibleGameListB4DSAllRAMLimited)/sizeof(compatibleGameListB4DSAllRAMLimited[0]); i++) {
22412251
if (memcmp(gameTid[CURPOS], compatibleGameListB4DSAllRAMLimited[i], 3) == 0) {
22422252
// Found match
2243-
showMsg = true;
22442253
msgId = compatibleGameListB4DSAllRAMLimitedID[i];
2254+
showMsg = true;
22452255
break;
22462256
}
22472257
}
@@ -2324,6 +2334,9 @@ bool dsiWareRAMLimitMsg(std::string filename) {
23242334
case 8:
23252335
printSmall(false, 0, yPos - ((calcSmallFontHeight(STR_RAM_LIMIT_NO_SOUND_FX) - smallFontHeight()) / 2), STR_RAM_LIMIT_NO_SOUND_FX, Alignment::center, FontPalette::dialog);
23262336
break;
2337+
case 9:
2338+
printSmall(false, 0, yPos - ((calcSmallFontHeight(STR_RAM_LIMIT_NO_AUDIO_MEP) - smallFontHeight()) / 2), STR_RAM_LIMIT_NO_AUDIO_MEP, Alignment::center, FontPalette::dialog);
2339+
break;
23272340
case 10:
23282341
if (sys().isRegularDS()) {
23292342
printSmall(false, 0, yPos - ((calcSmallFontHeight(STR_INSERT_MEMORY_EXPANSION_PAK) - smallFontHeight()) / 2), STR_INSERT_MEMORY_EXPANSION_PAK, Alignment::center, FontPalette::dialog);

romsel_dsimenutheme/arm9/source/language.inl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ STRING(DSIWARE_DS_MODE_P1, "You are attempting to launch\na DSiWare title in DS
5353
STRING(DSIWARE_DS_MODE_P2, "For increased compatibility,\nand saving data in\nmore titles, please relaunch\nTWiLight Menu++ from the\nconsole's SD Card slot.")
5454
STRING(RAM_LIMIT_GAME_PART_ONLY, "Due to memory limitations,\nonly part of this game can be\nplayed. To play the full game,\nlaunch this on Nintendo DSi\nor 3DS systems.")
5555
STRING(RAM_LIMIT_NO_AUDIO, "Due to memory limitations,\naudio will not be played.\nTo play this game with audio,\nlaunch this on Nintendo DSi\nor 3DS systems.")
56+
STRING(RAM_LIMIT_NO_AUDIO_MEP, "Due to memory limitations,\naudio will not be played.\nTo play this game with audio,\ninsert the Memory Expansion Pak.")
5657
STRING(RAM_LIMIT_NO_MUSIC, "Due to memory limitations,\nmusic will not be played.\nTo play this game with music,\nlaunch this on Nintendo DSi\nor 3DS systems.")
5758
STRING(RAM_LIMIT_NO_FMV, "Due to memory limitations,\nFMVs will not be played.\nFor playback of FMVs,\nlaunch this on Nintendo DSi\nor 3DS systems.")
5859
STRING(RAM_LIMIT_SPECIFIC_AREA, "Due to memory limitations, the\ngame will crash at a specific\narea. To work around the crash,\nlaunch this on Nintendo DSi\nor 3DS systems.")

romsel_dsimenutheme/nitrofiles/languages/en/language.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ DSIWARE_DS_MODE_P1 = You are attempting to launch\na DSiWare title in DS mode\no
5050
DSIWARE_DS_MODE_P2 = For increased compatibility,\nand saving data in\nmore titles, please relaunch\nTWiLight Menu++ from the\nconsole's SD Card slot.
5151
RAM_LIMIT_GAME_PART_ONLY = Due to memory limitations,\nonly part of this game can be\nplayed. To play the full game,\nlaunch this on Nintendo DSi\nor 3DS systems.
5252
RAM_LIMIT_NO_AUDIO = Due to memory limitations,\naudio will not be played.\nTo play this game with audio,\nlaunch this on Nintendo DSi\nor 3DS systems.
53+
RAM_LIMIT_NO_AUDIO_MEP = Due to memory limitations,\naudio will not be played.\nTo play this game with audio,\ninsert the Memory Expansion Pak.
5354
RAM_LIMIT_NO_MUSIC = Due to memory limitations,\nmusic will not be played.\nTo play this game with music,\nlaunch this on Nintendo DSi\nor 3DS systems.
5455
RAM_LIMIT_NO_FMV = Due to memory limitations,\nFMVs will not be played.\nFor playback of FMVs,\nlaunch this on Nintendo DSi\nor 3DS systems.
5556
RAM_LIMIT_SPECIFIC_AREA = Due to memory limitations, the\ngame will crash at a specific\narea. To work around the crash,\nlaunch this on Nintendo DSi\nor 3DS systems.

romsel_r4theme/arm9/source/fileBrowse.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -877,8 +877,8 @@ bool dsiWareRAMLimitMsg(std::string filename) {
877877
for (unsigned int i = 0; i < sizeof(compatibleGameListB4DSDebugRAMLimited)/sizeof(compatibleGameListB4DSDebugRAMLimited[0]); i++) {
878878
if (memcmp(gameTid, compatibleGameListB4DSDebugRAMLimited[i], 3) == 0) {
879879
// Found match
880-
showMsg = true;
881880
msgId = compatibleGameListB4DSDebugRAMLimitedID[i];
881+
showMsg = true;
882882
break;
883883
}
884884
}
@@ -887,8 +887,18 @@ bool dsiWareRAMLimitMsg(std::string filename) {
887887
for (unsigned int i = 0; i < sizeof(compatibleGameListB4DSRAMLimited)/sizeof(compatibleGameListB4DSRAMLimited[0]); i++) {
888888
if (memcmp(gameTid, compatibleGameListB4DSRAMLimited[i], 3) == 0) {
889889
// Found match
890-
showMsg = true;
891890
msgId = compatibleGameListB4DSRAMLimitedID[i];
891+
if (msgId == 9) {
892+
if (io_dldi_data->ioInterface.features & FEATURE_SLOT_NDS) {
893+
const u16 hwordBak = *(vu16*)(0x08240000);
894+
*(vu16*)(0x08240000) = 1; // Detect Memory Expansion Pak
895+
mepFound = (*(vu16*)(0x08240000) == 1);
896+
*(vu16*)(0x08240000) = hwordBak;
897+
}
898+
showMsg = (!mepFound && *(u16*)0x020000C0 == 0); // Show message if not found
899+
} else {
900+
showMsg = true;
901+
}
892902
break;
893903
}
894904
}
@@ -899,8 +909,8 @@ bool dsiWareRAMLimitMsg(std::string filename) {
899909
for (unsigned int i = 0; i < sizeof(compatibleGameListB4DSAllRAMLimited)/sizeof(compatibleGameListB4DSAllRAMLimited[0]); i++) {
900910
if (memcmp(gameTid, compatibleGameListB4DSAllRAMLimited[i], 3) == 0) {
901911
// Found match
902-
showMsg = true;
903912
msgId = compatibleGameListB4DSAllRAMLimitedID[i];
913+
showMsg = true;
904914
break;
905915
}
906916
}
@@ -959,6 +969,12 @@ bool dsiWareRAMLimitMsg(std::string filename) {
959969
printSmall(false, 0, 114, "game with sound effects, launch this on", Alignment::center);
960970
printSmall(false, 0, 126, "Nintendo DSi or 3DS systems.", Alignment::center);
961971
break;
972+
case 9:
973+
printSmall(false, 0, 90, "Due to memory limitations, audio", Alignment::center);
974+
printSmall(false, 0, 102, "will not be played. To play this", Alignment::center);
975+
printSmall(false, 0, 114, "game with audio, insert the", Alignment::center);
976+
printSmall(false, 0, 126, "Memory Expansion Pak.", Alignment::center);
977+
break;
962978
case 10:
963979
if (sys().isRegularDS()) {
964980
printSmall(false, 0, 102, "To launch this title, please", Alignment::center);

universal/include/compatibleDSiWareMap.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ static const char compatibleGameListB4DS[][5] = {
502502
};
503503

504504
// Titles requiring more RAM
505-
// Total: 27
505+
// Total: 26
506506
static const char compatibleGameListB4DSMEP[][5] = {
507507
"K5I", // 5 in 1 Solitaire
508508
"K2Z", // G.G Series: Altered Weapon
@@ -519,7 +519,6 @@ static const char compatibleGameListB4DSMEP[][5] = {
519519
"KD5", // Jinia Supasonaru: Waei Rakubiki Jiten
520520
"KY3", // Kuniya Burete Sanga Ari: Hills and Rivers Remain
521521
"K5M", // G.G Series: The Last Knight
522-
"KQ9", // The Legend of Zelda: Four Swords: Anniversary Edition
523522
"KYL", // Make Up & Style
524523
"KWF", // Mario Calculator
525524
"KD4", // Meikyou Kokugo: Rakubiki Jiten
@@ -555,7 +554,6 @@ static int compatibleGameListB4DSMEPID[] = {
555554
1, // Jinia Supasonaru: Waei Rakubiki Jiten
556555
4, // Kuniya Burete Sanga Ari: Hills and Rivers Remain
557556
3, // G.G Series: The Last Knight
558-
0, // The Legend of Zelda: Four Swords: Anniversary Edition
559557
0, // Make Up & Style
560558
0, // Mario Calculator
561559
2, // Meikyou Kokugo: Rakubiki Jiten
@@ -570,7 +568,7 @@ static int compatibleGameListB4DSMEPID[] = {
570568
};
571569

572570
// Show RAM limitation message
573-
// Total: 47
571+
// Total: 48
574572
static const char compatibleGameListB4DSRAMLimited[][4] = {
575573
"KII", // 101 Pinball World
576574
"KOK", // 1001 Crystal Mazes Collection
@@ -594,6 +592,7 @@ static const char compatibleGameListB4DSRAMLimited[][4] = {
594592
"KK6", // Hakokoro
595593
"KZH", // Halloween Trick or Treat
596594
"KIS", // Ice Hockey Slovakia 2011
595+
"KQ9", // The Legend of Zelda: Four Swords: Anniversary Edition
597596
"KPT", // Link 'n' Launch
598597
"KYL", // Make Up & Style
599598
"K59", // Metal Torrent
@@ -645,6 +644,7 @@ static int compatibleGameListB4DSRAMLimitedID[] = {
645644
1, // Hakokoro (No audio)
646645
2, // Halloween Trick or Treat (No music)
647646
8, // Ice Hockey Slovakia 2011 (No sound effects)
647+
9, // The Legend of Zelda: Four Swords: Anniversary Edition (No audio without Memory Expansion Pak)
648648
2, // Link 'n' Launch (No music)
649649
5, // Make Up & Style (No FMV)
650650
2, // Metal Torrent (No music)

0 commit comments

Comments
 (0)