diff --git a/quickmenu/arm9/source/iconTitle.cpp b/quickmenu/arm9/source/iconTitle.cpp index 5c8cbc6c7c..59e98dcfed 100644 --- a/quickmenu/arm9/source/iconTitle.cpp +++ b/quickmenu/arm9/source/iconTitle.cpp @@ -32,6 +32,7 @@ #include "graphics/graphics.h" #include "graphics/fontHandler.h" #include "common/lodepng.h" +#include "common/logging.h" #include "ndsheaderbanner.h" #include "myDSiMode.h" #include "language.h" @@ -678,14 +679,19 @@ void iconUpdate(int num, bool isDir, const char* name) { clearText(false); + logPrint("iconUpdate: "); + const auto isNds = (bnrRomType[num] == ROM_TYPE_NDS); if (customIcon[num] > 0 || (customIcon[num] && isNds)) { if (customIcon[num] == -1) { + logPrint(isDir ? "Custom icon invalid!" : "Banner not found or custom icon invalid!"); loadIconTileset(icon_unk, num); } else if (bnriconisDSi[num]) { + logPrint("Custom icon found!"); loadIcon(num, ndsBanner.dsi_icon[0], ndsBanner.dsi_palette[0], true); } else { + logPrint("Custom icon found!"); loadIcon(num, ndsBanner.icon, ndsBanner.palette, false); } } else if (extension(name, {".argv"})) { @@ -698,6 +704,7 @@ void iconUpdate(int num, bool isDir, const char* name) // open the argv file fp = fopen(name, "rb"); if (fp == NULL) { + logPrint("Icon not found!\n"); clearIcon(num); fclose(fp); return; @@ -732,9 +739,11 @@ void iconUpdate(int num, bool isDir, const char* name) rc = stat(p, &st); if (rc != 0) { // stat failed + logPrint("Icon not found!"); clearIcon(num); } else if (S_ISDIR(st.st_mode)) { // this is a directory! + logPrint("Folder found!"); clearIcon(num); } else { iconUpdate(num, false, p); @@ -750,8 +759,7 @@ void iconUpdate(int num, bool isDir, const char* name) free(line); } else if (isNds) { // this is an nds/app file! - - // icon + logPrint("NDS icon found!"); if (bnriconisDSi[num]) { loadIcon(num, ndsBanner.dsi_icon[0], ndsBanner.dsi_palette[0], true); } else { @@ -806,6 +814,7 @@ void iconUpdate(int num, bool isDir, const char* name) } else { loadIconTileset(icon_unk, num); } + logPrint("\n"); } void titleUpdate(int num, bool top, bool isDir, const char* name) diff --git a/romsel_aktheme/arm9/source/iconTitle.cpp b/romsel_aktheme/arm9/source/iconTitle.cpp index b3811b0bbd..02b36e5bbe 100644 --- a/romsel_aktheme/arm9/source/iconTitle.cpp +++ b/romsel_aktheme/arm9/source/iconTitle.cpp @@ -35,6 +35,7 @@ #include "fileBrowse.h" #include "graphics/fontHandler.h" #include "common/lodepng.h" +#include "common/logging.h" #include "language.h" #include "ndsheaderbanner.h" #include "myDSiMode.h" @@ -872,7 +873,7 @@ void iconTitleInit() blackPalette = new u16[16*8](); tilesModified = new u8[(32 * 256) / 2]; - for (int i = 0; i < 4; i++) { + for (int i = 0; i < 8; i++) { clearIcon(i); } } @@ -1363,19 +1364,25 @@ void getGameInfo(int num, bool isDir, const char* name) void iconUpdate(int num, bool isDir, const char* name) { + logPrint("iconUpdate: "); + const bool isNds = (bnrRomType[num] == 0); - if (customIcon[num] > 0 || (customIcon[num] && isNds)) { + if (customIcon[num] > 0 || (customIcon[num] && !isDir && isNds)) { sNDSBannerExt &ndsBanner = bnriconTile[num]; if (customIcon[num] == -1) { + logPrint(isDir ? "Custom icon invalid!" : "Banner not found or custom icon invalid!"); loadUnkIcon(num); } else if (bnriconisDSi[num]) { + logPrint("Custom icon found!"); loadIcon(num, ndsBanner.dsi_icon[0], ndsBanner.dsi_palette[bnriconPalLine[num]], true); bnriconPalLoaded[num] = bnriconPalLine[num]; } else { + logPrint("Custom icon found!"); loadIcon(num, ndsBanner.icon, ndsBanner.palette, false); } } else if (isDir) { + logPrint("Folder found!"); loadFolderIcon(num); } else if (extension(name, {".argv"})) { // look through the argv file for the corresponding nds/app file @@ -1387,6 +1394,7 @@ void iconUpdate(int num, bool isDir, const char* name) // open the argv file fp = fopen(name, "rb"); if (fp == NULL) { + logPrint("Icon not found!\n"); clearIcon(num); fclose(fp); return; @@ -1420,9 +1428,11 @@ void iconUpdate(int num, bool isDir, const char* name) rc = stat(p, &st); if (rc != 0) { // stat failed + logPrint("Icon not found!"); clearIcon(num); } else if (S_ISDIR(st.st_mode)) { // this is a directory! + logPrint("Folder found!"); loadFolderIcon(num); } else { iconUpdate(num, false, p); @@ -1438,6 +1448,7 @@ void iconUpdate(int num, bool isDir, const char* name) free(line); } else if (isNds) { // this is an nds/app file! + logPrint("NDS icon found!"); sNDSBannerExt &ndsBanner = bnriconTile[num]; if (bnriconisDSi[num]) { loadIcon(num, ndsBanner.dsi_icon[0], ndsBanner.dsi_palette[bnriconPalLine[num]], true); @@ -1494,6 +1505,7 @@ void iconUpdate(int num, bool isDir, const char* name) } else { loadUnkIcon(num); } + logPrint("\n"); } void titleUpdate(int num, bool isDir, const char* name, const bool highlighted) diff --git a/romsel_dsimenutheme/arm9/source/iconTitle.cpp b/romsel_dsimenutheme/arm9/source/iconTitle.cpp index b7f7438edf..099a8c62d3 100644 --- a/romsel_dsimenutheme/arm9/source/iconTitle.cpp +++ b/romsel_dsimenutheme/arm9/source/iconTitle.cpp @@ -32,6 +32,7 @@ #include "graphics/fontHandler.h" #include "graphics/iconHandler.h" #include "common/lodepng.h" +#include "common/logging.h" #include "graphics/paletteEffects.h" #include "graphics/queueControl.h" #include "graphics/ThemeConfig.h" @@ -620,23 +621,29 @@ void getGameInfo(bool isDir, const char *name, int num, bool fromArgv) { } void iconUpdate(bool isDir, const char *name, int num) { + logPrint("iconUpdate: "); + int spriteIdx = num == -1 ? 6 : num % 6; if (num == -1) num = 40; const bool isNds = (bnrRomType[num] == 0); - if (customIcon[num] > 0 || (customIcon[num] && isNds)) { + if (customIcon[num] > 0 || (customIcon[num] && !isDir && isNds)) { sNDSBannerExt &ndsBanner = bnriconTile[num]; if (customIcon[num] == -1) { + logPrint(isDir ? "Custom icon invalid!" : "Banner not found or custom icon invalid!"); loadUnkIcon(spriteIdx); } else if (bnriconisDSi[num]) { + logPrint("Custom icon found!"); loadIcon(ndsBanner.dsi_icon[0], ndsBanner.dsi_palette[bnriconPalLine[num]], spriteIdx, true); bnriconPalLoaded[num] = bnriconPalLine[num]; } else { + logPrint("Custom icon found!"); loadIcon(ndsBanner.icon, ndsBanner.palette, spriteIdx, false); } } else if (isDir) { + logPrint("Folder found!"); clearIcon(spriteIdx); } else if (extension(name, {".argv"})) { // look through the argv file for the corresponding nds file @@ -648,6 +655,7 @@ void iconUpdate(bool isDir, const char *name, int num) { // open the argv file fp = fopen(name, "rb"); if (fp == NULL) { + logPrint("Icon not found!\n"); clearIcon(spriteIdx); fclose(fp); return; @@ -681,9 +689,11 @@ void iconUpdate(bool isDir, const char *name, int num) { rc = stat(p, &st); if (rc != 0) { // stat failed + logPrint("Icon not found!"); clearIcon(spriteIdx); } else if (S_ISDIR(st.st_mode)) { // this is a directory! + logPrint("Folder found!"); clearIcon(spriteIdx); } else { iconUpdate(false, p, spriteIdx); @@ -699,6 +709,7 @@ void iconUpdate(bool isDir, const char *name, int num) { free(line); } else if (isNds) { // this is an nds/app file! + logPrint("NDS icon found!"); sNDSBannerExt &ndsBanner = bnriconTile[num]; if (bnriconisDSi[num]) { loadIcon(ndsBanner.dsi_icon[0], ndsBanner.dsi_palette[bnriconPalLine[num]], spriteIdx, true); @@ -778,6 +789,7 @@ void iconUpdate(bool isDir, const char *name, int num) { } else { loadUnkIcon(spriteIdx); } + logPrint("\n"); } void writeBannerText(std::string_view text) { writeBannerText(FontGraphic::utf8to16(text)); } diff --git a/romsel_r4theme/arm9/source/iconTitle.cpp b/romsel_r4theme/arm9/source/iconTitle.cpp index 1f465f731e..04f60049f3 100644 --- a/romsel_r4theme/arm9/source/iconTitle.cpp +++ b/romsel_r4theme/arm9/source/iconTitle.cpp @@ -35,6 +35,7 @@ #include "fileBrowse.h" #include "graphics/fontHandler.h" #include "common/lodepng.h" +#include "common/logging.h" #include "language.h" #include "ndsheaderbanner.h" #include "myDSiMode.h" @@ -1316,17 +1317,23 @@ void iconUpdate(bool isDir, const char* name) clearText(false); } + logPrint("iconUpdate: "); + const bool isNds = (bnrRomType == 0); - if (customIcon > 0 || (customIcon && isNds)) { + if (customIcon > 0 || (customIcon && !isDir && isNds)) { if (customIcon == -1) { + logPrint(isDir ? "Custom icon invalid!" : "Banner not found or custom icon invalid!"); loadUnkIcon(); } else if (bnriconisDSi) { + logPrint("Custom icon found!"); loadIcon(ndsBanner.dsi_icon[0], ndsBanner.dsi_palette[0], true); } else { + logPrint("Custom icon found!"); loadIcon(ndsBanner.icon, ndsBanner.palette, false); } } else if (isDir) { + logPrint("Folder found!"); loadFolderIcon(); } else if (extension(name, {".argv"})) { // look through the argv file for the corresponding nds/app file @@ -1338,6 +1345,7 @@ void iconUpdate(bool isDir, const char* name) // open the argv file fp = fopen(name, "rb"); if (fp == NULL) { + logPrint("Icon not found!\n"); clearIcon(); fclose(fp); return; @@ -1372,9 +1380,11 @@ void iconUpdate(bool isDir, const char* name) rc = stat(p, &st); if (rc != 0) { // stat failed + logPrint("Icon not found!"); clearIcon(); } else if (S_ISDIR(st.st_mode)) { // this is a directory! + logPrint("Folder found!"); clearIcon(); } else { iconUpdate(false, p); @@ -1398,12 +1408,12 @@ void iconUpdate(bool isDir, const char* name) fp = fopen(name, "rb"); if (fp == NULL) { // icon + logPrint("Icon not found!\n"); clearIcon(); fclose(fp); return; } - ret = fseek(fp, offsetof(tNDSHeader, bannerOffset), SEEK_SET); if (ret == 0) ret = fread(&iconTitleOffset, sizeof (int), 1, fp); // read if seek succeed @@ -1412,6 +1422,7 @@ void iconUpdate(bool isDir, const char* name) if (ret != 1) { // icon + logPrint("Icon not found!\n"); loadUnkIcon(); fclose(fp); return; @@ -1419,6 +1430,7 @@ void iconUpdate(bool isDir, const char* name) if (iconTitleOffset == 0) { // icon + logPrint("Icon not found!\n"); loadUnkIcon(); fclose(fp); return; @@ -1439,6 +1451,7 @@ void iconUpdate(bool isDir, const char* name) if (ret != 1) { // icon + logPrint("Icon not found!\n"); loadUnkIcon(); fclose(fp); return; @@ -1449,6 +1462,7 @@ void iconUpdate(bool isDir, const char* name) fclose(fp); // icon + logPrint("NDS icon found!"); if (bnriconisDSi) { loadIcon(ndsBanner.dsi_icon[0], ndsBanner.dsi_palette[0], true); } else { @@ -1503,6 +1517,7 @@ void iconUpdate(bool isDir, const char* name) } else { loadUnkIcon(); } + logPrint("\n"); } void titleUpdate(bool isDir, const char* name)