mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Add touch keyboard based file renaming (#16)
This commit is contained in:
parent
554c2a3efa
commit
d6ca3e7dfd
@ -80,7 +80,7 @@ int main() {
|
|||||||
// Start the RTC tracking IRQ
|
// Start the RTC tracking IRQ
|
||||||
initClockIRQ();
|
initClockIRQ();
|
||||||
|
|
||||||
//touchInit();
|
touchInit();
|
||||||
|
|
||||||
fifoInit();
|
fifoInit();
|
||||||
|
|
||||||
|
|||||||
@ -56,6 +56,11 @@ bool nameEndsWith (const string& name) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnKeyPressed(int key) {
|
||||||
|
if(key > 0)
|
||||||
|
iprintf("%c", key);
|
||||||
|
}
|
||||||
|
|
||||||
bool dirEntryPredicate (const DirEntry& lhs, const DirEntry& rhs) {
|
bool dirEntryPredicate (const DirEntry& lhs, const DirEntry& rhs) {
|
||||||
|
|
||||||
if (!lhs.isDirectory && rhs.isDirectory) {
|
if (!lhs.isDirectory && rhs.isDirectory) {
|
||||||
@ -224,6 +229,9 @@ int fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) {
|
|||||||
assignedOp[maxCursors] = 2;
|
assignedOp[maxCursors] = 2;
|
||||||
printf(" Copy to fat:/gm9i/out\n");
|
printf(" Copy to fat:/gm9i/out\n");
|
||||||
}
|
}
|
||||||
|
maxCursors++;
|
||||||
|
assignedOp[maxCursors] = 4;
|
||||||
|
printf(" Rename file\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("(<A> select, <B> cancel)");
|
printf("(<A> select, <B> cancel)");
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -294,6 +302,20 @@ int fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) {
|
|||||||
nitroSecondaryDrive = secondaryDrive;
|
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];
|
return assignedOp[optionOffset];
|
||||||
}
|
}
|
||||||
if (pressed & KEY_B) {
|
if (pressed & KEY_B) {
|
||||||
@ -525,7 +547,7 @@ string browseForFile (void) {
|
|||||||
if (getOp == 0) {
|
if (getOp == 0) {
|
||||||
// Return the chosen file
|
// Return the chosen file
|
||||||
return entry->name;
|
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
|
getDirectoryContents (dirContents); // Refresh directory listing
|
||||||
if (getOp == 3 && nitroMounted) {
|
if (getOp == 3 && nitroMounted) {
|
||||||
screenOffset = 0;
|
screenOffset = 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user