Skip to content

Commit

Permalink
Assign custom icons to individual argv files
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Sep 21, 2024
1 parent 824c743 commit 8aef783
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 32 deletions.
14 changes: 8 additions & 6 deletions quickmenu/arm9/source/iconTitle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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!
Expand Down
2 changes: 1 addition & 1 deletion quickmenu/arm9/source/iconTitle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions quickmenu/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions romsel_aktheme/arm9/source/fileBrowse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ void getGameInfo0(const int fileOffset, std::vector<DirEntry> 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"})) {
Expand Down Expand Up @@ -474,7 +474,7 @@ void loadIcons(const int screenOffset, std::vector<DirEntry> 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;
Expand Down Expand Up @@ -586,7 +586,7 @@ void loadIconUp(const int screenOffset, std::vector<DirEntry> 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;
Expand Down Expand Up @@ -697,7 +697,7 @@ void loadIconDown(const int screenOffset, std::vector<DirEntry> 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;
Expand Down
14 changes: 8 additions & 6 deletions romsel_aktheme/arm9/source/iconTitle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,25 +922,27 @@ 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;
isHomebrew[num] = true;
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];
Expand Down Expand Up @@ -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!
Expand Down
2 changes: 1 addition & 1 deletion romsel_aktheme/arm9/source/iconTitle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion romsel_dsimenutheme/arm9/source/iconTitle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion romsel_r4theme/arm9/source/fileBrowse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ std::string browseForFile(const std::vector<std::string_view> 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;
Expand Down
14 changes: 8 additions & 6 deletions romsel_r4theme/arm9/source/iconTitle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,25 +898,27 @@ 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;
isHomebrew = true;
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;

Expand Down Expand Up @@ -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!
Expand Down
2 changes: 1 addition & 1 deletion romsel_r4theme/arm9/source/iconTitle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8aef783

Please sign in to comment.