Skip to content

Commit

Permalink
Add option to show/hide directories/folders
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Mar 8, 2018
1 parent 351a4dc commit 80f64c1
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 16 deletions.
18 changes: 13 additions & 5 deletions romsel_dsimenutheme/arm9/source/fileBrowse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ extern bool startMenu;

extern int theme;

extern bool showDirectories;
extern int spawnedtitleboxes;
static int file_count = 0;
extern int cursorPosition;
Expand Down Expand Up @@ -304,11 +305,18 @@ void getDirectoryContents(vector<DirEntry>& dirContents, const vector<string> ex
else
dirEntry.visibleName = dirEntry.name;

if (dirEntry.name.compare(".") != 0 && (dirEntry.isDirectory || nameEndsWith(dirEntry.name, extensionList)))
// if (dirEntry.name.compare(".") != 0 && (nameEndsWith(dirEntry.name, extensionList)))
{
dirContents.push_back(dirEntry);
file_count++;
if (showDirectories) {
if (dirEntry.name.compare(".") != 0 && (dirEntry.isDirectory || nameEndsWith(dirEntry.name, extensionList)))
{
dirContents.push_back(dirEntry);
file_count++;
}
} else {
if (dirEntry.name.compare(".") != 0 && (nameEndsWith(dirEntry.name, extensionList)))
{
dirContents.push_back(dirEntry);
file_count++;
}
}

}
Expand Down
2 changes: 2 additions & 0 deletions romsel_dsimenutheme/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ int subtheme = 0;
int cursorPosition = 0;
int startMenu_cursorPosition = 0;
int pagenum = 0;
bool showDirectories = true;

bool flashcardUsed = false;

Expand Down Expand Up @@ -129,6 +130,7 @@ void LoadSettings(void) {
gotosettings = settingsini.GetInt("SRLOADER", "GOTOSETTINGS", 0);
theme = settingsini.GetInt("SRLOADER", "THEME", 0);
subtheme = settingsini.GetInt("SRLOADER", "SUB_THEME", 0);
showDirectories = settingsini.GetInt("SRLOADER", "SHOW_DIRECTORIES", 1);
is3DS = settingsini.GetInt("SRLOADER", "IS_3DS", 0);

flashcard = settingsini.GetInt("SRLOADER", "FLASHCARD", 0);
Expand Down
39 changes: 28 additions & 11 deletions titleandsettings/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ static bool useGbarunner = false;
static bool autorun = false;
static int theme = 0;
static int subtheme = 0;
static bool showDirectories = true;

static bool bstrap_boostcpu = false; // false == NTR, true == TWL
static bool bstrap_debug = false;
Expand Down Expand Up @@ -109,6 +110,7 @@ void LoadSettings(void) {
// Customizable UI settings.
theme = settingsini.GetInt("SRLOADER", "THEME", 0);
subtheme = settingsini.GetInt("SRLOADER", "SUB_THEME", 0);
showDirectories = settingsini.GetInt("SRLOADER", "SHOW_DIRECTORIES", 1);
is3DS = settingsini.GetInt("SRLOADER", "IS_3DS", 0);

if(!flashcardUsed) {
Expand Down Expand Up @@ -144,6 +146,7 @@ void SaveSettings(void) {
// UI settings.
settingsini.SetInt("SRLOADER", "THEME", theme);
settingsini.SetInt("SRLOADER", "SUB_THEME", subtheme);
settingsini.SetInt("SRLOADER", "SHOW_DIRECTORIES", showDirectories);
settingsini.SetInt("SRLOADER", "IS_3DS", is3DS);
settingsini.SaveIniFile(settingsinipath);

Expand Down Expand Up @@ -416,7 +419,7 @@ int main(int argc, char **argv) {

char vertext[12];
// snprintf(vertext, sizeof(vertext), "Ver %d.%d.%d ", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); // Doesn't work :(
snprintf(vertext, sizeof(vertext), "Ver %d.%d.%d ", 3, 4, 0);
snprintf(vertext, sizeof(vertext), "Ver %d.%d.%d ", 3, 4, 1);

if (showlogo) {
graphicsInit();
Expand Down Expand Up @@ -1039,10 +1042,10 @@ int main(int argc, char **argv) {
yPos = 32;
break;
case 2:
yPos = 48;
yPos = 40;
break;
case 3:
yPos = 64;
yPos = 48;
break;
}

Expand All @@ -1054,17 +1057,23 @@ int main(int argc, char **argv) {
else
printSmall(false, 156, 24, "DSi Menu");

printSmall(false, 12, 32, "Run last played ROM on startup");
printSmall(false, 12, 32, "Last played ROM on startup");
if(autorun)
printSmall(false, 224, 40, "On");
printSmall(false, 224, 32, "Yes");
else
printSmall(false, 224, 40, "Off");
printSmall(false, 224, 32, "No");

printSmall(false, 12, 48, "Show SRLoader logo on startup");
printSmall(false, 12, 40, "SRLoader logo on startup");
if(showlogo)
printSmall(false, 224, 56, "On");
printSmall(false, 216, 40, "Show");
else
printSmall(false, 224, 56, "Off");
printSmall(false, 216, 40, "Hide");

printSmall(false, 12, 48, "Directories/folders");
if(showDirectories)
printSmall(false, 216, 48, "Show");
else
printSmall(false, 216, 48, "Hide");


if (settingscursor == 0) {
Expand All @@ -1079,6 +1088,10 @@ int main(int argc, char **argv) {
printSmall(false, 4, 156, "The SRLoader logo will be");
printSmall(false, 4, 164, "shown when you start");
printSmall(false, 4, 172, "SRLoader.");
} else if (settingscursor == 3) {
printSmall(false, 4, 156, "If you're in a folder where most");
printSmall(false, 4, 164, "of your games are, it is safe to");
printSmall(false, 4, 172, "hide directories/folders.");
}


Expand Down Expand Up @@ -1132,6 +1145,10 @@ int main(int argc, char **argv) {
showlogo = !showlogo;
mmEffectEx(&snd_select);
break;
case 3:
showDirectories = !showDirectories;
mmEffectEx(&snd_select);
break;
}
menuprinted = false;
}
Expand Down Expand Up @@ -1168,8 +1185,8 @@ int main(int argc, char **argv) {
break;
}

if (settingscursor > 2) settingscursor = 0;
else if (settingscursor < 0) settingscursor = 2;
if (settingscursor > 3) settingscursor = 0;
else if (settingscursor < 0) settingscursor = 3;
}

} else {
Expand Down

0 comments on commit 80f64c1

Please sign in to comment.