From 8aef7835753f669855ecc9646eb03f831231c178 Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Sat, 21 Sep 2024 15:22:30 -0600 Subject: [PATCH] Assign custom icons to individual argv files --- quickmenu/arm9/source/iconTitle.cpp | 14 ++++++++------ quickmenu/arm9/source/iconTitle.h | 2 +- quickmenu/arm9/source/main.cpp | 10 +++++----- romsel_aktheme/arm9/source/fileBrowse.cpp | 8 ++++---- romsel_aktheme/arm9/source/iconTitle.cpp | 14 ++++++++------ romsel_aktheme/arm9/source/iconTitle.h | 2 +- romsel_dsimenutheme/arm9/source/iconTitle.cpp | 2 +- romsel_r4theme/arm9/source/fileBrowse.cpp | 2 +- romsel_r4theme/arm9/source/iconTitle.cpp | 14 ++++++++------ romsel_r4theme/arm9/source/iconTitle.h | 2 +- 10 files changed, 38 insertions(+), 32 deletions(-) diff --git a/quickmenu/arm9/source/iconTitle.cpp b/quickmenu/arm9/source/iconTitle.cpp index 59e98dcfed..23d16a7ebf 100644 --- a/quickmenu/arm9/source/iconTitle.cpp +++ b/quickmenu/arm9/source/iconTitle.cpp @@ -294,21 +294,23 @@ void loadFixedBanner(bool isSlot1) { } } -void getGameInfo(int num, bool isDir, const char* name) +void getGameInfo(int num, bool isDir, const char* name, bool fromArgv) { bnriconPalLine[num] = 0; bnriconPalLoaded[num] = 0; bnriconframenumY[num] = 0; bannerFlip[num] = GL_FLIP_NONE; - bnriconisDSi[num] = false; bnrWirelessIcon[num] = 0; - customIcon[num] = 0; isDSiWare[num] = false; isHomebrew[num] = true; isModernHomebrew[num] = true; - infoFound[num] = false; + if (!fromArgv) { + bnriconisDSi[num] = false; + customIcon[num] = 0; + infoFound[num] = false; + } - if (ms().showCustomIcons) { + if (ms().showCustomIcons && customIcon[num] < 2 && (!fromArgv || customIcon[num] <= 0)) { toncset(&ndsBanner, 0, sizeof(sNDSBannerExt)); bool customIconGood = false; @@ -448,7 +450,7 @@ void getGameInfo(int num, bool isDir, const char* name) // this is a directory! clearBannerSequence(num); } else { - getGameInfo(num, false, p); + getGameInfo(num, false, p, true); } } else { // this is not an nds/app file! diff --git a/quickmenu/arm9/source/iconTitle.h b/quickmenu/arm9/source/iconTitle.h index 7a08fb77d3..1d68e9e97d 100644 --- a/quickmenu/arm9/source/iconTitle.h +++ b/quickmenu/arm9/source/iconTitle.h @@ -16,7 +16,7 @@ void iconTitleInit(); void reloadIconPalettes(); void loadConsoleIcons(); -void getGameInfo(int num, bool isDir, const char* name); +void getGameInfo(int num, bool isDir, const char* name, bool fromArgv); void iconUpdate(int num, bool isDir, const char* name); void titleUpdate(int num, bool top, bool isDir, const char* name); void drawIcon(int num, int Xpos, int Ypos); diff --git a/quickmenu/arm9/source/main.cpp b/quickmenu/arm9/source/main.cpp index 54cadd6f15..395c6a8624 100644 --- a/quickmenu/arm9/source/main.cpp +++ b/quickmenu/arm9/source/main.cpp @@ -1105,7 +1105,7 @@ void refreshNdsCard(bool refreshBoxArt) { } */ } - getGameInfo(1, false, "slot1"); + getGameInfo(1, false, "slot1", false); iconUpdate (1, false, "slot1"); bnrRomType[1] = ROM_TYPE_NDS; boxArtType[1] = 0; @@ -1257,16 +1257,16 @@ void parseRomInformationForDevice(int device, std::string& filename, char* boxAr romfolder[device].resize(romfolder[device].size()-1); } chdir(romfolder[device].data()); - + filename = ms().romPath[device]; const size_t last_slash_idx = filename.find_last_of("/"); if (std::string::npos != last_slash_idx) { filename.erase(0, last_slash_idx + 1); } - + getFiletypeFromFilename(filename, bnrRomType[device], boxArtType[device]); - - getGameInfo(device, false, filename.data()); + + getGameInfo(device, false, filename.data(), false); iconUpdate(device, false, filename.data()); /* if (ms().showBoxArt) { diff --git a/romsel_aktheme/arm9/source/fileBrowse.cpp b/romsel_aktheme/arm9/source/fileBrowse.cpp index 562735fe23..6c061dd1dc 100644 --- a/romsel_aktheme/arm9/source/fileBrowse.cpp +++ b/romsel_aktheme/arm9/source/fileBrowse.cpp @@ -379,7 +379,7 @@ void getGameInfo0(const int fileOffset, std::vector dirContents) { isDirectory[0] = false; std::string std_romsel_filename = dirContents.at(fileOffset).name.c_str(); displayDiskIcon(ms().secondaryDevice); - getGameInfo(0, isDirectory[0], dirContents.at(fileOffset).name.c_str()); + getGameInfo(0, isDirectory[0], dirContents.at(fileOffset).name.c_str(), false); displayDiskIcon(false); if (extension(std_romsel_filename, {".nds", ".dsi", ".ids", ".srl", ".app", ".argv"})) { @@ -474,7 +474,7 @@ void loadIcons(const int screenOffset, std::vector dirContents) { } else { isDirectory[n] = false; std::string std_romsel_filename = dirContents.at(i).name.c_str(); - getGameInfo(n, isDirectory[n], dirContents.at(i).name.c_str()); + getGameInfo(n, isDirectory[n], dirContents.at(i).name.c_str(), false); if (extension(std_romsel_filename, {".nds", ".dsi", ".ids", ".srl", ".app", ".argv"})) { bnrRomType[n] = 0; @@ -586,7 +586,7 @@ void loadIconUp(const int screenOffset, std::vector dirContents) { } else { isDirectory[n] = false; std::string std_romsel_filename = dirContents.at(i).name.c_str(); - getGameInfo(n, isDirectory[n], dirContents.at(i).name.c_str()); + getGameInfo(n, isDirectory[n], dirContents.at(i).name.c_str(), false); if (extension(std_romsel_filename, {".nds", ".dsi", ".ids", ".srl", ".app", ".argv"})) { bnrRomType[n] = 0; @@ -697,7 +697,7 @@ void loadIconDown(const int screenOffset, std::vector dirContents) { } else { isDirectory[n] = false; std::string std_romsel_filename = dirContents.at(i).name.c_str(); - getGameInfo(n, isDirectory[n], dirContents.at(i).name.c_str()); + getGameInfo(n, isDirectory[n], dirContents.at(i).name.c_str(), false); if (extension(std_romsel_filename, {".nds", ".dsi", ".ids", ".srl", ".app", ".argv"})) { bnrRomType[n] = 0; diff --git a/romsel_aktheme/arm9/source/iconTitle.cpp b/romsel_aktheme/arm9/source/iconTitle.cpp index 02b36e5bbe..05090174a0 100644 --- a/romsel_aktheme/arm9/source/iconTitle.cpp +++ b/romsel_aktheme/arm9/source/iconTitle.cpp @@ -922,15 +922,13 @@ void copyGameInfo(int numDst, int numSrc) bnriconisDSi[numDst] = bnriconisDSi[numSrc]; } -void getGameInfo(int num, bool isDir, const char* name) +void getGameInfo(int num, bool isDir, const char* name, bool fromArgv) { - bnriconisDSi[num] = false; bnriconPalLine[num] = 0; bnriconPalLoaded[num] = 0; bnriconframenumY[num] = 0; bannerFlip[num] = GL_FLIP_NONE; bnrWirelessIcon[num] = 0; - customIcon[num] = 0; toncset(gameTid[num], 0, 4); isTwlm[num] = false; isDSiWare[num] = false; @@ -938,9 +936,13 @@ void getGameInfo(int num, bool isDir, const char* name) isModernHomebrew[num] = true; requiresRamDisk[num] = false; requiresDonorRom[num] = false; - infoFound[num] = false; + if (!fromArgv) { + bnriconisDSi[num] = false; + customIcon[num] = 0; + infoFound[num] = false; + } - if (ms().showCustomIcons && customIcon[num] < 2) { + if (ms().showCustomIcons && customIcon[num] < 2 && (!fromArgv || customIcon[num] <= 0)) { sNDSBannerExt &banner = bnriconTile[num]; bool argvHadPng = customIcon[num] == 1; u8 iconCopy[512]; @@ -1116,7 +1118,7 @@ void getGameInfo(int num, bool isDir, const char* name) if (customIcon[num] != 2) clearBannerSequence(num); } else { - getGameInfo(num, true, p); + getGameInfo(num, true, p, true); } } else { // this is not an nds/app file! diff --git a/romsel_aktheme/arm9/source/iconTitle.h b/romsel_aktheme/arm9/source/iconTitle.h index af3b588972..60aebb6442 100644 --- a/romsel_aktheme/arm9/source/iconTitle.h +++ b/romsel_aktheme/arm9/source/iconTitle.h @@ -19,7 +19,7 @@ void reloadIconPalettes(); void loadConsoleIcons(); void copyGameInfo(int numDst, int numSrc); -void getGameInfo(int num, bool isDir, const char* name); +void getGameInfo(int num, bool isDir, const char* name, bool fromArgv); void iconUpdate(int num, bool isDir, const char* name); void titleUpdate(int num, bool isDir, const char* name, const bool highlighted); void drawIconFolder(int Xpos, int Ypos, s32 scale); diff --git a/romsel_dsimenutheme/arm9/source/iconTitle.cpp b/romsel_dsimenutheme/arm9/source/iconTitle.cpp index 099a8c62d3..29cf1f668f 100644 --- a/romsel_dsimenutheme/arm9/source/iconTitle.cpp +++ b/romsel_dsimenutheme/arm9/source/iconTitle.cpp @@ -201,7 +201,7 @@ void getGameInfo(bool isDir, const char *name, int num, bool fromArgv) { infoFound[num] = false; } - if (ms().showCustomIcons && customIcon[num] < 2) { + if (ms().showCustomIcons && customIcon[num] < 2 && (!fromArgv || customIcon[num] <= 0)) { sNDSBannerExt &banner = bnriconTile[num]; bool argvHadPng = customIcon[num] == 1; u8 iconCopy[512]; diff --git a/romsel_r4theme/arm9/source/fileBrowse.cpp b/romsel_r4theme/arm9/source/fileBrowse.cpp index 8ef82eaa24..bcf6f6fea8 100644 --- a/romsel_r4theme/arm9/source/fileBrowse.cpp +++ b/romsel_r4theme/arm9/source/fileBrowse.cpp @@ -1113,7 +1113,7 @@ std::string browseForFile(const std::vector extensionList) { } else { isDirectory = false; std::string std_romsel_filename = dirContents.at(fileOffset).name.c_str(); - getGameInfo(isDirectory, dirContents.at(fileOffset).name.c_str()); + getGameInfo(isDirectory, dirContents.at(fileOffset).name.c_str(), false); if (extension(std_romsel_filename, {".nds", ".dsi", ".ids", ".srl", ".app", ".argv"})) { bnrRomType = 0; diff --git a/romsel_r4theme/arm9/source/iconTitle.cpp b/romsel_r4theme/arm9/source/iconTitle.cpp index 04f60049f3..d889ee8e75 100644 --- a/romsel_r4theme/arm9/source/iconTitle.cpp +++ b/romsel_r4theme/arm9/source/iconTitle.cpp @@ -898,15 +898,13 @@ void drawIcon(int Xpos, int Ypos) { } } -void getGameInfo(bool isDir, const char* name) +void getGameInfo(bool isDir, const char* name, bool fromArgv) { bnriconPalLine = 0; bnriconPalLoaded = 0; bnriconframenumY = 0; bannerFlip = GL_FLIP_NONE; - bnriconisDSi = false; bnrWirelessIcon = 0; - customIcon = 0; toncset(gameTid, 0, 4); isTwlm = false; isDSiWare = false; @@ -914,9 +912,13 @@ void getGameInfo(bool isDir, const char* name) isModernHomebrew = true; requiresRamDisk = false; requiresDonorRom = false; - infoFound = false; + if (!fromArgv) { + bnriconisDSi = false; + customIcon = 0; + infoFound = false; + } - if (ms().showCustomIcons) { + if (ms().showCustomIcons && customIcon < 2 && (!fromArgv || customIcon <= 0)) { toncset(&ndsBanner, 0, sizeof(sNDSBannerExt)); bool customIconGood = false; @@ -1059,7 +1061,7 @@ void getGameInfo(bool isDir, const char* name) // this is a directory! clearBannerSequence(); } else { - getGameInfo(false, p); + getGameInfo(false, p, true); } } else { // this is not an nds/app file! diff --git a/romsel_r4theme/arm9/source/iconTitle.h b/romsel_r4theme/arm9/source/iconTitle.h index d37edc9cd3..a26ea3b211 100644 --- a/romsel_r4theme/arm9/source/iconTitle.h +++ b/romsel_r4theme/arm9/source/iconTitle.h @@ -14,7 +14,7 @@ void iconTitleInit(); void reloadIconPalettes(); void loadConsoleIcons(); -void getGameInfo(bool isDir, const char* name); +void getGameInfo(bool isDir, const char* name, bool fromArgv); void iconUpdate(bool isDir, const char* name); void titleUpdate(bool isDir, const char* name); void drawIconFolder(int Xpos, int Ypos);