diff --git a/arm7/source/main.c b/arm7/source/main.c index 7c8aab2..825af61 100644 --- a/arm7/source/main.c +++ b/arm7/source/main.c @@ -80,7 +80,7 @@ int main() { // Start the RTC tracking IRQ initClockIRQ(); - //touchInit(); + touchInit(); fifoInit(); diff --git a/arm9/source/file_browse.cpp b/arm9/source/file_browse.cpp index afc3f8c..ebfb86f 100644 --- a/arm9/source/file_browse.cpp +++ b/arm9/source/file_browse.cpp @@ -56,6 +56,11 @@ bool nameEndsWith (const string& name) { return true; } +void OnKeyPressed(int key) { + if(key > 0) + iprintf("%c", key); +} + bool dirEntryPredicate (const DirEntry& lhs, const DirEntry& rhs) { if (!lhs.isDirectory && rhs.isDirectory) { @@ -224,6 +229,9 @@ int fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) { assignedOp[maxCursors] = 2; printf(" Copy to fat:/gm9i/out\n"); } + maxCursors++; + assignedOp[maxCursors] = 4; + printf(" Rename file\n"); printf("\n"); printf("( select, cancel)"); while (true) { @@ -294,6 +302,20 @@ int fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) { nitroSecondaryDrive = secondaryDrive; } } + else if (assignedOp[optionOffset] == 4) { + consoleDemoInit(); + Keyboard *kbd = keyboardDemoInit(); + char newName[256]; + kbd->OnKeyPressed = OnKeyPressed; + + keyboardShow(); + printf("Rename to: "); + iscanf("%s", newName); + keyboardHide(); + consoleClear(); + + rename(entry->name.c_str(), newName); + } return assignedOp[optionOffset]; } if (pressed & KEY_B) { @@ -525,7 +547,7 @@ string browseForFile (void) { if (getOp == 0) { // Return the chosen file return entry->name; - } else if (getOp == 1 || getOp == 2 || (getOp == 3 && nitroMounted)) { + } else if (getOp == 1 || getOp == 2 || (getOp == 3 && nitroMounted) || getOp == 4) { getDirectoryContents (dirContents); // Refresh directory listing if (getOp == 3 && nitroMounted) { screenOffset = 0;