Skip to content

Commit b4a5c92

Browse files
committed
DSi-based UIs: Free up box art cache when launching a title
1 parent a8f1f8e commit b4a5c92

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

romsel_dsimenutheme/arm9/source/fileBrowse.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4027,13 +4027,16 @@ std::string browseForFile(const std::vector<std::string_view> extensionList) {
40274027
if (ms().theme == TWLSettings::EThemeHBL) {
40284028
currentBg = 0;
40294029
snd().fadeOutStream();
4030-
} else if (ms().theme != TWLSettings::EThemeSaturn) {
4031-
fadeType = false; // Fade to white
4032-
snd().fadeOutStream();
4030+
} else {
4031+
if (ms().theme != TWLSettings::EThemeSaturn) {
4032+
fadeType = false; // Fade to white
4033+
snd().fadeOutStream();
40334034

4034-
// Clear screen with white
4035-
rocketVideo_playVideo = false;
4036-
tex().unloadRotatingCubes();
4035+
// Clear screen with white
4036+
rocketVideo_playVideo = false;
4037+
tex().unloadRotatingCubes();
4038+
}
4039+
tex().unloadBoxArt();
40374040
}
40384041

40394042
if (ms().updateRecentlyPlayedList) {

romsel_dsimenutheme/arm9/source/graphics/ThemeTextures.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,6 +1541,15 @@ void ThemeTextures::unloadRotatingCubes() {
15411541
delete[] rotatingCubesLocation;
15421542
}
15431543
}
1544+
void ThemeTextures::unloadBoxArt() {
1545+
if (dsiFeatures() && !ms().macroMode && ms().theme != TWLSettings::EThemeHBL && ms().consoleModel == 0 && ms().showBoxArt == 2) {
1546+
toncset32(boxArtCache, 0, 0x1B8000/sizeof(u32)); // Clear box art cache before freeing
1547+
for (int i = 0; i < 40; i++) {
1548+
boxArtFound[i] = false;
1549+
}
1550+
delete[] boxArtCache;
1551+
}
1552+
}
15441553
void ThemeTextures::videoSetup() {
15451554
logPrint("tex().videoSetup()\n");
15461555
//////////////////////////////////////////////////////////

romsel_dsimenutheme/arm9/source/graphics/ThemeTextures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class ThemeTextures
9898

9999
void clearTopScreen();
100100
void unloadRotatingCubes();
101+
void unloadBoxArt();
101102
static void videoSetup();
102103
private:
103104
void applyUserPaletteToAllGrfTextures();

0 commit comments

Comments
 (0)