From e429f941be0ea626b805a2d8ff22d6cf125ffd26 Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Mon, 22 Oct 2018 14:40:58 -0600 Subject: [PATCH] Hold R+Y to create new folder --- arm9/source/file_browse.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/arm9/source/file_browse.cpp b/arm9/source/file_browse.cpp index edc3128..92026de 100644 --- a/arm9/source/file_browse.cpp +++ b/arm9/source/file_browse.cpp @@ -396,7 +396,10 @@ void fileBrowse_drawBottomScreen(DirEntry* entry, int fileOffset) { printf ("X - DELETE/[+R] RENAME file"); printf ("\n"); printf (clipboardOn ? "Y - PASTE file" : "Y - COPY file"); - printf ("\n"); + printf ("/[+R] CREATE entry"); + if (!clipboardOn) { + printf ("\n"); + } printf (SCREENSHOTTEXT); printf ("\n"); printf (clipboardOn ? "SELECT - Clear Clipboard" : "SELECT - Restore Clipboard"); @@ -613,6 +616,28 @@ string browseForFile (void) { } } + // Create new folder + if ((held & KEY_R) && (pressed & KEY_Y)) { + pressed = 0; + consoleDemoInit(); + Keyboard *kbd = keyboardDemoInit(); + char newName[256]; + kbd->OnKeyPressed = OnKeyPressed; + + keyboardShow(); + printf("Name for new folder: \n"); + iscanf("%s", newName); + keyboardHide(); + consoleClear(); + + if (newName[0] != '\0') { + if (mkdir(newName, 0777) == 0) { + getDirectoryContents (dirContents); + } + } + } + + // Copy file/folder if (pressed & KEY_Y) { if (clipboardOn) { char destPath[256];