Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an option to access boxart in Flashcart #2384

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions quickmenu/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ void refreshNdsCard(bool refreshBoxArt) {
tonccpy(&game_TID, ndsCardHeader.gameCode, 4);

char boxArtPath[256];
sprintf (boxArtPath, (sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/boxart/%s.png" : "fat:/_nds/TWiLightMenu/boxart/%s.png"), game_TID);
sprintf (boxArtPath, sys().boxArtPath(), game_TID);
loadBoxArt(boxArtPath, true); // Load box art
} else if (refreshBoxArt) {
loadBoxArt("nitro:/graphics/boxart_unknown.png", true);
Expand Down Expand Up @@ -1438,7 +1438,7 @@ int dsClassicMenu(void) {
if (ms().showBoxArt) {
// Store box art path
std::string temp_filename = filename[0];
sprintf (boxArtPath[0], (sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/boxart/%s.png" : "fat:/_nds/TWiLightMenu/boxart/%s.png"), filename[0].c_str());
sprintf (boxArtPath[0], sys().boxArtPath(), filename[0].c_str());
if ((access(boxArtPath[0], F_OK) != 0) && (bnrRomType[0] == 0)) {
if (extension(filename[0], {".argv"})) {
vector<char*> argarray;
Expand All @@ -1463,7 +1463,7 @@ int dsClassicMenu(void) {
fclose(argfile);
temp_filename = argarray.at(0);
}
sprintf (boxArtPath[0], (sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/boxart/%s.png" : "fat:/_nds/TWiLightMenu/boxart/%s.png"), gameTid[0]);
sprintf (boxArtPath[0], sys().boxArtPath(), gameTid[0]);
}
}
}
Expand Down Expand Up @@ -1586,7 +1586,7 @@ int dsClassicMenu(void) {
if (ms().showBoxArt) {
// Store box art path
std::string temp_filename = filename[1];
sprintf (boxArtPath[1], (sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/boxart/%s.png" : "fat:/_nds/TWiLightMenu/boxart/%s.png"), filename[1].c_str());
sprintf (boxArtPath[1], sys().boxArtPath(), filename[1].c_str());
if ((access(boxArtPath[1], F_OK) != 0) && (bnrRomType[1] == 0)) {
if (extension(filename[1], {".argv"})) {
vector<char*> argarray;
Expand All @@ -1611,7 +1611,7 @@ int dsClassicMenu(void) {
fclose(argfile);
temp_filename = argarray.at(0);
}
sprintf (boxArtPath[1], (sys().isRunFromSD() ? "sd:/_nds/TWiLightMenu/boxart/%s.png" : "fat:/_nds/TWiLightMenu/boxart/%s.png"), gameTid[1]);
sprintf (boxArtPath[1], sys().boxArtPath(), gameTid[1]);
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions romsel_aktheme/arm9/source/common/dsimenusettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ TWLSettings::TWLSettings()
previousUsedDevice = false;
secondaryDevice = false;
fcSaveOnSd = false;
fcBoxArtOnSd = false;

slot1LaunchMethod = EReboot;

Expand Down Expand Up @@ -133,6 +134,7 @@ void TWLSettings::loadSettings()
previousUsedDevice = settingsini.GetInt("SRLOADER", "PREVIOUS_USED_DEVICE", previousUsedDevice);
secondaryDevice = bothSDandFlashcard() ? settingsini.GetInt("SRLOADER", "SECONDARY_DEVICE", secondaryDevice) : flashcardFound();
fcSaveOnSd = settingsini.GetInt("SRLOADER", "FC_SAVE_ON_SD", fcSaveOnSd);
fcBoxArtOnSd = settingsini.GetInt("SRLOADER", "FC_BOX_ART_ON_SD", fcBoxArtOnSd);

theme = settingsini.GetInt("SRLOADER", "THEME", theme);
hideEmptyBoxes = settingsini.GetInt("SRLOADER", "HIDE_EMPTY_BOXES", hideEmptyBoxes);
Expand Down Expand Up @@ -210,6 +212,8 @@ void TWLSettings::saveSettings()
if (bothSDandFlashcard()) {
settingsini.SetInt("SRLOADER", "SECONDARY_DEVICE", secondaryDevice);
}

settingsini.SetInt("SRLOADER", "FC_BOX_ART_ON_SD", fcBoxArtOnSd);
settingsini.SetInt("SRLOADER", "THEME", theme);
settingsini.SetInt("SRLOADER", "HIDE_EMPTY_BOXES", hideEmptyBoxes);
settingsini.SetInt("SRLOADER", "SHOW_DIRECTORIES", showDirectories);
Expand Down
1 change: 1 addition & 0 deletions romsel_aktheme/arm9/source/common/dsimenusettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ class TWLSettings
bool previousUsedDevice;
bool secondaryDevice;
bool fcSaveOnSd;
bool fcBoxArtOnSd;

int slot1LaunchMethod;
bool useBootstrap;
Expand Down
10 changes: 4 additions & 6 deletions romsel_dsimenutheme/arm9/source/fileBrowse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,9 @@ void updateBoxArt(void) {
rocketVideo_playVideo = false; // Clear top screen cubes
}
clearBoxArt();
sprintf(boxArtPath, "%s:/_nds/TWiLightMenu/boxart/%s.png", sys().isRunFromSD() ? "sd" : "fat", boxArtFilename);
sprintf(boxArtPath, sys().boxArtPath(), boxArtFilename);
if ((bnrRomType[CURPOS] == 0) && (access(boxArtPath, F_OK) != 0)) {
sprintf(boxArtPath, "%s:/_nds/TWiLightMenu/boxart/%s.png", sys().isRunFromSD() ? "sd" : "fat", gameTid[CURPOS]);
sprintf(boxArtPath, sys().boxArtPath(), gameTid[CURPOS]);
}
tex().drawBoxArt(boxArtPath, (dsiFeatures() && ms().showBoxArt == 2)); // Load box art
}
Expand Down Expand Up @@ -2678,12 +2678,10 @@ void getFileInfo(SwitchState scrn, vector<vector<DirEntry>> dirContents, bool re
}

if (dsiFeatures() && !ms().macroMode && ms().showBoxArt == 2 && ms().theme != TWLSettings::EThemeHBL && !isDirectory[i]) {
snprintf(boxArtPath, sizeof(boxArtPath), "%s:/_nds/TWiLightMenu/boxart/%s.png",
sys().isRunFromSD() ? "sd" : "fat",
snprintf(boxArtPath, sizeof(boxArtPath), sys().boxArtPath(),
dirContents[scrn][i + PAGENUM * 40].name.c_str());
if ((bnrRomType[i] == 0) && (access(boxArtPath, F_OK) != 0)) {
snprintf(boxArtPath, sizeof(boxArtPath), "%s:/_nds/TWiLightMenu/boxart/%s.png",
(sys().isRunFromSD() ? "sd" : "fat"),
snprintf(boxArtPath, sizeof(boxArtPath), sys().boxArtPath(),
gameTid[i]);
}
tex().loadBoxArtToMem(boxArtPath, i);
Expand Down
2 changes: 2 additions & 0 deletions settings/arm9/source/language.inl
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ STRING(S1SD_B4DSMODE, "S1SD: B4DS Mode")
STRING(ESRBRATINGSCREEN, "ESRB Rating Screen")
STRING(HOTKEY, "Menu hotkey")
STRING(FCSAVELOCATION, "Slot-1 SD save location")
STRING(FCBOXARTLOCATION, "Slot-1 SD box art location")
STRING(FORCESLEEPPATCH, "Force sleep mode patch")
STRING(SYSSD_FORCESLEEPPATCH, "Sys SD: Force sleep mode patch")
STRING(SLOT1SDACCESS, "SD access in Slot-1")
Expand Down Expand Up @@ -242,6 +243,7 @@ STRING(DESCRIPTION_B4DSMODE, "Only use for testing. Activates the mode used when
STRING(DESCRIPTION_ESRBRATINGSCREEN, "Displays a screen with USA DS title's ESRB rating and content descriptor(s), when launched via nds-bootstrap. Does not work with all DS titles.")
STRING(DESCRIPTION_HOTKEY, "Set the hotkey to open the nds-bootstrap in-game menu.")
STRING(DESCRIPTION_FCSAVELOCATION, "Pick the location of Slot-1 SD (or flashcard) saves.")
STRING(DESCRIPTION_FCBOXARTLOCATION, "Pick the location of Slot-1 SD (or flashcard) box art.")
STRING(DESCRIPTION_FORCESLEEPMODE, "If a certain Slot-1 card is preventing sleep mode from working, please turn this on. Remember to turn this off if you have a retail game card inserted.")
STRING(DESCRIPTION_SLOT1SDACCESS, "Have access to the console's SD card while running a Slot-1 flashcard.")
STRING(DESCRIPTION_SLOT1SCFGUNLOCK, "Have access to SCFG while running a Slot-1 flashcard. Allows setting extended memory mode and/or clock speed in flashcard homebrew.")
Expand Down
1 change: 1 addition & 0 deletions settings/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,7 @@ int settingsMode(void)
if (dsiFeatures()) {
bootstrapPage
.option(STR_FCSAVELOCATION, STR_DESCRIPTION_FCSAVELOCATION, Option::Bool(&ms().fcSaveOnSd), {STR_CONSOLE_SD, STR_SLOT_1_SD}, {true, false})
.option(STR_FCBOXARTLOCATION, STR_DESCRIPTION_FCBOXARTLOCATION, Option::Bool(&ms().fcBoxArtOnSd), {STR_CONSOLE_SD, STR_SLOT_1_SD}, {true, false})
.option(STR_S1SD_B4DSMODE, STR_DESCRIPTION_B4DSMODE, Option::Int(&bs().b4dsMode), {STR_OFF, STR_4MB_RAM, STR_8MB_RAM}, {0, 1, 2});
}
} else if (isDSiMode()) {
Expand Down
2 changes: 2 additions & 0 deletions settings/nitrofiles/languages/en/language.ini
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ S1SD_B4DSMODE=S1SD: B4DS Mode
ESRBRATINGSCREEN=ESRB Rating Screen
HOTKEY=Menu hotkey
FCSAVELOCATION=Slot-1 SD save location
FCBOXARTLOCATION=Slot-1 SD box art location
FORCESLEEPPATCH=Force sleep mode patch
SYSSD_FORCESLEEPPATCH=Sys SD: Force sleep mode patch
SLOT1SDACCESS=SD access in Slot-1
Expand Down Expand Up @@ -234,6 +235,7 @@ DESCRIPTION_B4DSMODE=Only use for testing. Activates the mode used when running
DESCRIPTION_ESRBRATINGSCREEN=Displays a screen with USA DS title's ESRB rating and content descriptor(s), when launched via nds-bootstrap. Does not work with all DS titles.
DESCRIPTION_HOTKEY=Set the hotkey to open the nds-bootstrap in-game menu.
DESCRIPTION_FCSAVELOCATION=Pick the location of Slot-1 SD (or flashcard) saves.
DESCRIPTION_FCBOXARTLOCATION=Pick the location of Slot-1 SD (or flashcard) box art.
DESCRIPTION_FORCESLEEPMODE=If a certain Slot-1 card is preventing sleep mode from working, please turn this on. Remember to turn this off if you have a retail game card inserted.
DESCRIPTION_SLOT1SDACCESS=Have access to the console's SD card while running a Slot-1 flashcard.
DESCRIPTION_SLOT1SCFGUNLOCK=Have access to SCFG while running a Slot-1 flashcard. Allows setting extended memory mode and/or clock speed in flashcard homebrew.
Expand Down
2 changes: 2 additions & 0 deletions universal/include/common/systemdetails.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class SystemDetails
int volumeStatus();
ESDStatus sdStatus();

const char *boxArtPath();

private:
bool _dsiWramAccess;
bool _arm7SCFGLocked;
Expand Down
1 change: 1 addition & 0 deletions universal/include/common/twlmenusettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ class TWLSettings
bool previousUsedDevice;
bool secondaryDevice;
bool fcSaveOnSd;
bool fcBoxArtOnSd;
std::vector<std::string> blockedExtensions;

TSlot1LaunchMethod slot1LaunchMethod;
Expand Down
13 changes: 13 additions & 0 deletions universal/source/common/systemdetails.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "common/systemdetails.h"
#include "common/flashcard.h"
#include "common/arm7status.h"
#include "common/twlmenusettings.h"
#include "myDSiMode.h"

#include <nds/arm9/dldi.h>
Expand Down Expand Up @@ -99,6 +100,18 @@ SystemDetails::ESDStatus SystemDetails::sdStatus() {
return (SystemDetails::ESDStatus)_sdStatus;
}

const char *SystemDetails::boxArtPath() {
if (!_isRunFromSD) {
return "fat:/_nds/TWiLightMenu/boxart/%s.png";
}

if (!ms().fcBoxArtOnSd) {
return "fat:/_nds/TWiLightMenu/boxart/%s.png";
}

return "sd:/_nds/TWiLightMenu/boxart/%s.png";
}

void SystemDetails::initFilesystem(const char *runningPath)
{
extern const DISC_INTERFACE __my_io_dsisd;
Expand Down
3 changes: 3 additions & 0 deletions universal/source/common/twlmenusettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ TWLSettings::TWLSettings()
previousUsedDevice = !sys().isRunFromSD();
secondaryDevice = !sys().isRunFromSD();
fcSaveOnSd = false;
fcBoxArtOnSd = false;

slot1LaunchMethod = EDirect;

Expand Down Expand Up @@ -272,6 +273,7 @@ void TWLSettings::loadSettings()
previousUsedDevice = settingsini.GetInt("SRLOADER", "PREVIOUS_USED_DEVICE", previousUsedDevice);
secondaryDevice = bothSDandFlashcard() ? settingsini.GetInt("SRLOADER", "SECONDARY_DEVICE", secondaryDevice) : flashcardFound();
fcSaveOnSd = settingsini.GetInt("SRLOADER", "FC_SAVE_ON_SD", fcSaveOnSd);
fcBoxArtOnSd = settingsini.GetInt("SRLOADER", "FC_BOX_ART_ON_SD", fcBoxArtOnSd);
settingsini.GetStringVector("SRLOADER", "BLOCKED_EXTENSIONS", blockedExtensions, ':');

slot1LaunchMethod = (TSlot1LaunchMethod)settingsini.GetInt("SRLOADER", "SLOT1_LAUNCHMETHOD", slot1LaunchMethod);
Expand Down Expand Up @@ -428,6 +430,7 @@ void TWLSettings::saveSettings()
settingsini.SetInt("SRLOADER", "SECONDARY_DEVICE", secondaryDevice);
}
settingsini.SetInt("SRLOADER", "FC_SAVE_ON_SD", fcSaveOnSd);
settingsini.SetInt("SRLOADER", "FC_BOX_ART_ON_SD", fcBoxArtOnSd);

settingsini.SetInt("SRLOADER", "SLOT1_LAUNCHMETHOD", slot1LaunchMethod);

Expand Down
Loading