From 93cfb6071052d4b782bb34e0953cd6dd977d7ddc Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Sun, 7 Oct 2018 12:28:55 -0600 Subject: [PATCH] Bug fix --- arm9/source/driveOperations.cpp | 2 +- arm9/source/file_browse.cpp | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/arm9/source/driveOperations.cpp b/arm9/source/driveOperations.cpp index a0ba972..4aee774 100644 --- a/arm9/source/driveOperations.cpp +++ b/arm9/source/driveOperations.cpp @@ -32,7 +32,7 @@ bool flashcardFound(void) { } bool bothSDandFlashcard(void) { - if ((access("sd:/", F_OK) == 0) && (access("fat:/", F_OK) == 0)) { + if (sdMounted && flashcardMounted) { return true; } else { return false; diff --git a/arm9/source/file_browse.cpp b/arm9/source/file_browse.cpp index 10ac4aa..b01c297 100644 --- a/arm9/source/file_browse.cpp +++ b/arm9/source/file_browse.cpp @@ -152,15 +152,13 @@ void showDirectoryContents (const vector& dirContents, int startRow) { } } -int fileBrowse_A(DirEntry* entry) { +int fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) { int pressed = 0; int assignedOp[3] = {0}; int optionOffset = 0; int cursorScreenPos = 0; int maxCursors = -1; - char path[PATH_MAX]; - getcwd(path, PATH_MAX); printf ("\x1b[0;27H"); printf (" "); // Clear time consoleInit(NULL, 1, BgType_Text4bpp, BgSize_T_256x256, 15, 0, false, true); @@ -426,12 +424,18 @@ string browseForFile (void) { screenOffset = 0; fileOffset = 0; } else { - int getOp = fileBrowse_A(entry); - if (getOp == 0) { - // Return the chosen file - return entry->name; - } else if (getOp == 1 || getOp == 2) { - getDirectoryContents (dirContents); // Refresh directory listing + char path[PATH_MAX]; + getcwd(path, PATH_MAX); + if (bothSDandFlashcard() || entry->isApp + || strcmp (path, (secondaryDrive ? "fat:/gm9i/out/" : "sd:/gm9i/out/")) != 0) + { + int getOp = fileBrowse_A(entry, path); + if (getOp == 0) { + // Return the chosen file + return entry->name; + } else if (getOp == 1 || getOp == 2) { + getDirectoryContents (dirContents); // Refresh directory listing + } } } }