Skip to content

Commit

Permalink
Add support for nested skin folders
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Jan 29, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent ba8bc1f commit fd15e14
Showing 4 changed files with 43 additions and 8 deletions.
30 changes: 22 additions & 8 deletions quickmenu/arm9/source/graphics/graphics.cpp
Original file line number Diff line number Diff line change
@@ -468,19 +468,24 @@ void bottomBgLoad() {
std::string bottomBGFile = "nitro:/graphics/bottombg.png";

char temp[256];
char tempNested[256];

switch (ms().theme) {
case TWLSettings::EThemeDSi: // DSi Theme
sprintf(temp, "%s:/_nds/TWiLightMenu/dsimenu/themes/%s/quickmenu/bottombg.png", sdFound() ? "sd" : "fat", ms().dsi_theme.c_str());
sprintf(temp, "%s:/_nds/TWiLightMenu/dsimenu/themes/%s/quickmenu/bottombg.png", sdFound() ? "sd" : "fat", (ms().dsi_theme.c_str()));
sprintf(tempNested, "%s:/_nds/TWiLightMenu/dsimenu/themes/%s/%s/quickmenu/bottombg.png", sdFound() ? "sd" : "fat", (ms().dsi_theme.c_str()), (ms().dsi_theme.c_str()));
break;
case TWLSettings::ETheme3DS:
sprintf(temp, "%s:/_nds/TWiLightMenu/3dsmenu/themes/%s/quickmenu/bottombg.png", sdFound() ? "sd" : "fat", ms()._3ds_theme.c_str());
sprintf(temp, "%s:/_nds/TWiLightMenu/3dsmenu/themes/%s/quickmenu/bottombg.png", sdFound() ? "sd" : "fat", (ms()._3ds_theme.c_str()));
sprintf(tempNested, "%s:/_nds/TWiLightMenu/3dsmenu/themes/%s/%s/quickmenu/bottombg.png", sdFound() ? "sd" : "fat", (ms()._3ds_theme.c_str()), (ms()._3ds_theme.c_str()));
break;
case TWLSettings::EThemeR4:
sprintf(temp, "%s:/_nds/TWiLightMenu/r4menu/themes/%s/quickmenu/bottombg.png", sdFound() ? "sd" : "fat", ms().r4_theme.c_str());
sprintf(temp, "%s:/_nds/TWiLightMenu/r4menu/themes/%s/quickmenu/bottombg.png", sdFound() ? "sd" : "fat", (ms().r4_theme.c_str()));
sprintf(tempNested, "%s:/_nds/TWiLightMenu/r4menu/themes/%s/%s/quickmenu/bottombg.png", sdFound() ? "sd" : "fat", (ms().r4_theme.c_str()), (ms().r4_theme.c_str()));
break;
case TWLSettings::EThemeWood:
sprintf(temp, "%s:/_nds/TWiLightMenu/akmenu/themes/%s/quickmenu/bottombg.png", sdFound() ? "sd" : "fat", ms().ak_theme.c_str());
sprintf(temp, "%s:/_nds/TWiLightMenu/akmenu/themes/%s/quickmenu/bottombg.png", sdFound() ? "sd" : "fat", (ms().ak_theme.c_str()));
sprintf(tempNested, "%s:/_nds/TWiLightMenu/akmenu/themes/%s/%s/quickmenu/bottombg.png", sdFound() ? "sd" : "fat", (ms().ak_theme.c_str()), (ms().ak_theme.c_str()));
break;
case TWLSettings::EThemeSaturn:
// sprintf(temp, "nitro:/graphics/bottombg_saturn.png");
@@ -492,6 +497,8 @@ void bottomBgLoad() {

if (access(temp, F_OK) == 0)
bottomBGFile = std::string(temp);
else if (access(tempNested, F_OK) == 0)
bottomBGFile = std::string(tempNested);

std::vector<unsigned char> image;
uint imageWidth, imageHeight;
@@ -1140,19 +1147,24 @@ void topBgLoad(void) {
sprintf(filePath, "nitro:/graphics/topbg.png");

char temp[256];
char tempNested[256];

switch (ms().theme) {
case TWLSettings::EThemeDSi: // DSi Theme
sprintf(temp, "%s:/_nds/TWiLightMenu/dsimenu/themes/%s/quickmenu/topbg.png", sdFound() ? "sd" : "fat", ms().dsi_theme.c_str());
sprintf(temp, "%s:/_nds/TWiLightMenu/dsimenu/themes/%s/quickmenu/topbg.png", sdFound() ? "sd" : "fat", (ms().dsi_theme.c_str()));
sprintf(tempNested, "%s:/_nds/TWiLightMenu/dsimenu/themes/%s/%s/quickmenu/topbg.png", sdFound() ? "sd" : "fat", (ms().dsi_theme.c_str()), (ms().dsi_theme.c_str()));
break;
case TWLSettings::ETheme3DS:
sprintf(temp, "%s:/_nds/TWiLightMenu/3dsmenu/themes/%s/quickmenu/topbg.png", sdFound() ? "sd" : "fat", ms()._3ds_theme.c_str());
sprintf(temp, "%s:/_nds/TWiLightMenu/3dsmenu/themes/%s/quickmenu/topbg.png", sdFound() ? "sd" : "fat", (ms()._3ds_theme.c_str()));
sprintf(tempNested, "%s:/_nds/TWiLightMenu/3dsmenu/themes/%s/%s/quickmenu/topbg.png", sdFound() ? "sd" : "fat", (ms()._3ds_theme.c_str()), (ms()._3ds_theme.c_str()));
break;
case TWLSettings::EThemeR4:
sprintf(temp, "%s:/_nds/TWiLightMenu/r4menu/themes/%s/quickmenu/topbg.png", sdFound() ? "sd" : "fat", ms().r4_theme.c_str());
sprintf(temp, "%s:/_nds/TWiLightMenu/r4menu/themes/%s/quickmenu/topbg.png", sdFound() ? "sd" : "fat", (ms().r4_theme.c_str()));
sprintf(tempNested, "%s:/_nds/TWiLightMenu/r4menu/themes/%s/%s/quickmenu/topbg.png", sdFound() ? "sd" : "fat", (ms().r4_theme.c_str()), (ms().r4_theme.c_str()));
break;
case TWLSettings::EThemeWood:
sprintf(temp, "%s:/_nds/TWiLightMenu/akmenu/themes/%s/quickmenu/topbg.png", sdFound() ? "sd" : "fat", ms().ak_theme.c_str());
sprintf(temp, "%s:/_nds/TWiLightMenu/akmenu/themes/%s/quickmenu/topbg.png", sdFound() ? "sd" : "fat", (ms().ak_theme.c_str()));
sprintf(tempNested, "%s:/_nds/TWiLightMenu/akmenu/themes/%s/%s/quickmenu/topbg.png", sdFound() ? "sd" : "fat", (ms().ak_theme.c_str()), (ms().ak_theme.c_str()));
break;
case TWLSettings::EThemeSaturn:
// sprintf(temp, "nitro:/graphics/topbg_saturn.png");
@@ -1164,6 +1176,8 @@ void topBgLoad(void) {

if (access(temp, F_OK) == 0)
sprintf(filePath, "%s", temp);
else if (access(tempNested, F_OK) == 0)
sprintf(filePath, "%s", tempNested);

std::vector<unsigned char> image;
uint imageWidth, imageHeight;
6 changes: 6 additions & 0 deletions romsel_aktheme/arm9/source/graphics/graphics.cpp
Original file line number Diff line number Diff line change
@@ -1798,6 +1798,12 @@ void graphicsLoad()
}

std::string themePath = std::string(sys().isRunFromSD() ? "sd:" : "fat:") + "/_nds/TWiLightMenu/akmenu/themes/" + ms().ak_theme;
{
std::string themePathNested = themePath + "/" + ms().ak_theme;
if (access(themePathNested.c_str(), F_OK) == 0) {
themePath = themePathNested;
}
}
{
std::string pathTop;
if (access((themePath + "/upper_screen.bmp").c_str(), F_OK) == 0) {
9 changes: 9 additions & 0 deletions romsel_dsimenutheme/arm9/source/graphics/themefilenames.cpp
Original file line number Diff line number Diff line change
@@ -9,27 +9,32 @@
ThemeFilenames::ThemeFilenames() {
logPrint("tfn()\n");
std::string systemDirectory;
std::string systemDirectoryNested;
switch (ms().theme) {
case 0:
default:
systemDirectory =
formatString(TFN_SYSTEM_UI_DIRECTORY "%s",
"dsi", ms().dsi_theme.c_str());
systemDirectoryNested = systemDirectory + "/" + ms().dsi_theme.c_str();
break;
case 1:
systemDirectory =
formatString(TFN_SYSTEM_UI_DIRECTORY "%s",
"3ds", ms()._3ds_theme.c_str());
systemDirectoryNested = systemDirectory + "/" + ms()._3ds_theme.c_str();
break;
case 4:
systemDirectory =
formatString(TFN_SYSTEM_UI_DIRECTORY "%s",
"saturn", "default");
systemDirectoryNested = systemDirectory + "/default";
break;
case 5:
systemDirectory =
formatString(TFN_SYSTEM_UI_DIRECTORY "%s",
"hbLauncher", "default");
systemDirectoryNested = systemDirectory + "/default";
break;
}
if (!sys().useNitroFS()) {
@@ -42,6 +47,10 @@ ThemeFilenames::ThemeFilenames() {
// nocashMessage("NITROFSOK");
// nocashMessage(systemDirectory.c_str());
_uiDirectory = systemDirectory;
} else if (access((systemDirectoryNested + "/theme.ini").c_str(), F_OK) == 0) {
// nocashMessage("NITROFSOK");
// nocashMessage(systemDirectoryNested.c_str());
_uiDirectory = systemDirectoryNested;
} else {
switch (ms().theme) {
case 0:
6 changes: 6 additions & 0 deletions romsel_r4theme/arm9/source/graphics/graphics.cpp
Original file line number Diff line number Diff line change
@@ -749,6 +749,12 @@ void graphicsLoad()
} else
for (int startMenu = 0; startMenu < 2; startMenu++) {
std::string themePath = std::string(sys().isRunFromSD() ? "sd:" : "fat:") + "/_nds/TWiLightMenu/r4menu/themes/" + ms().r4_theme;
{
std::string themePathNested = themePath + "/" + ms().r4_theme;
if (access(themePathNested.c_str(), F_OK) == 0) {
themePath = themePathNested;
}
}
std::string pathTop;
if (startMenu) {
if (access((themePath + "/logo.bmp").c_str(), F_OK) == 0) {

0 comments on commit fd15e14

Please sign in to comment.