Skip to content

Commit 71aaad9

Browse files
committed
Display box art for folders/directories
Closes #2625 Also: 3DS: Keep playing rotating cubes video if box art is not found
1 parent 9394c2a commit 71aaad9

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

romsel_dsimenutheme/arm9/source/fileBrowse.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -616,23 +616,18 @@ void updateBoxArt(void) {
616616
showSTARTborder = true;
617617
if (ms().theme == TWLSettings::EThemeHBL || ms().macroMode || !ms().showBoxArt || boxArtLoaded) return;
618618

619-
if (ms().theme == TWLSettings::ETheme3DS && rocketVideo_playVideo) {
620-
rocketVideo_playVideo = false;
621-
while (dmaBusy(1)); // Wait for frame to finish rendering
622-
tex().drawOverRotatingCubes(); // Clear top screen cubes for 3DS theme
619+
if (ms().theme != TWLSettings::ETheme3DS) {
620+
clearBoxArt();
623621
}
624-
clearBoxArt();
625622

626-
if (isDirectory[CURPOS]) {
623+
sprintf(boxArtPath, "%s:/_nds/TWiLightMenu/boxart/%s.png", sys().isRunFromSD() ? "sd" : "fat", boxArtFilename);
624+
if (!isDirectory[CURPOS] && (bnrRomType[CURPOS] == 0) && (access(boxArtPath, F_OK) != 0)) {
625+
sprintf(boxArtPath, "%s:/_nds/TWiLightMenu/boxart/%s.png", sys().isRunFromSD() ? "sd" : "fat", gameTid[CURPOS]);
626+
}
627+
if (!tex().drawBoxArt(boxArtPath, (dsiFeatures() && ms().showBoxArt == 2))) { // Load box art
627628
if (ms().theme == TWLSettings::ETheme3DS && !rocketVideo_playVideo) {
628629
rocketVideo_playVideo = true;
629630
}
630-
} else {
631-
sprintf(boxArtPath, "%s:/_nds/TWiLightMenu/boxart/%s.png", sys().isRunFromSD() ? "sd" : "fat", boxArtFilename);
632-
if ((bnrRomType[CURPOS] == 0) && (access(boxArtPath, F_OK) != 0)) {
633-
sprintf(boxArtPath, "%s:/_nds/TWiLightMenu/boxart/%s.png", sys().isRunFromSD() ? "sd" : "fat", gameTid[CURPOS]);
634-
}
635-
tex().drawBoxArt(boxArtPath, (dsiFeatures() && ms().showBoxArt == 2)); // Load box art
636631
}
637632
boxArtLoaded = true;
638633
}

romsel_dsimenutheme/arm9/source/graphics/ThemeTextures.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -983,10 +983,8 @@ void ThemeTextures::loadBoxArtToMem(const char *filename, int num) {
983983
fclose(file);
984984
}
985985

986-
void ThemeTextures::drawBoxArt(const char *filename, bool inMem) {
987-
if (inMem ? !boxArtFound[CURPOS] : access(filename, F_OK) != 0) return;
988-
989-
beginBgSubModify();
986+
bool ThemeTextures::drawBoxArt(const char *filename, bool inMem) {
987+
if (inMem ? !boxArtFound[CURPOS] : access(filename, F_OK) != 0) return false;
990988

991989
std::vector<unsigned char> image;
992990
uint imageXpos, imageYpos;
@@ -996,7 +994,20 @@ void ThemeTextures::drawBoxArt(const char *filename, bool inMem) {
996994
lodepng::decode(image, boxArtWidth, boxArtHeight, filename);
997995
}
998996
bool alternatePixel = false;
999-
if (boxArtWidth > 256 || boxArtHeight > 192) return;
997+
if (boxArtWidth > 256 || boxArtHeight > 192) return false;
998+
999+
if (ms().theme == TWLSettings::ETheme3DS && rocketVideo_playVideo) {
1000+
rocketVideo_playVideo = false;
1001+
while (dmaBusy(1)); // Wait for frame to finish rendering
1002+
drawOverRotatingCubes(); // Clear top screen cubes for 3DS theme
1003+
}
1004+
1005+
if (ms().theme == TWLSettings::ETheme3DS) {
1006+
extern uint photoWidth, photoHeight;
1007+
tex().drawOverBoxArt(photoWidth, photoHeight);
1008+
}
1009+
1010+
beginBgSubModify();
10001011

10011012
u16* bmpImageBuffer = new u16[256 * 192];
10021013
u16* bmpImageBuffer2 = boxArtColorDeband ? new u16[256 * 192] : NULL;
@@ -1103,6 +1114,8 @@ void ThemeTextures::drawBoxArt(const char *filename, bool inMem) {
11031114
if (boxArtColorDeband) {
11041115
delete[] bmpImageBuffer2;
11051116
}
1117+
1118+
return true;
11061119
}
11071120

11081121
#define MAX_PHOTO_WIDTH 208

romsel_dsimenutheme/arm9/source/graphics/ThemeTextures.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class ThemeTextures
7878
void drawBottomBg(int bg);
7979

8080
void loadBoxArtToMem(const char *filename, int num);
81-
void drawBoxArt(const char* filename, bool inMem);
81+
bool drawBoxArt(const char* filename, bool inMem);
8282
void drawOverBoxArt(uint photoWidth, uint photoHeight);
8383
void drawOverRotatingCubes();
8484

0 commit comments

Comments
 (0)