mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Do not clear time, except for GBA ROM dumping
This commit is contained in:
parent
e60993ec3e
commit
35583045b2
@ -6,6 +6,7 @@
|
||||
#include <fstream>
|
||||
|
||||
#include "auxspi.h"
|
||||
#include "date.h"
|
||||
#include "driveOperations.h"
|
||||
#include "ndsheaderbanner.h"
|
||||
#include "read_card.h"
|
||||
@ -48,23 +49,30 @@ void ndsCardSaveDump(const char* filename) {
|
||||
void ndsCardDump(void) {
|
||||
int pressed = 0;
|
||||
|
||||
printf ("\x1b[0;27H");
|
||||
printf ("\x1B[42m"); // Print green color
|
||||
printf ("_____"); // Clear time
|
||||
consoleSelect(&bottomConsole);
|
||||
consoleClear();
|
||||
printf ("\x1B[47m"); // Print foreground white color
|
||||
printf("Dump NDS card ROM to\n");
|
||||
printf("\"%s:/gm9i/out\"?\n", (sdMounted ? "sd" : "fat"));
|
||||
printf("(<A> yes, <Y> trim, <B> no)");
|
||||
while (true) {
|
||||
|
||||
consoleSelect(&topConsole);
|
||||
printf ("\x1B[42m"); // Print green color
|
||||
// Power saving loop. Only poll the keys once per frame and sleep the CPU if there is nothing else to do
|
||||
do {
|
||||
// Move to right side of screen
|
||||
printf ("\x1b[0;26H");
|
||||
// Print time
|
||||
printf ("_%s" ,RetTime().c_str());
|
||||
|
||||
scanKeys();
|
||||
pressed = keysDownRepeat();
|
||||
swiWaitForVBlank();
|
||||
} while (!(pressed & KEY_A) && !(pressed & KEY_Y) && !(pressed & KEY_B));
|
||||
|
||||
consoleSelect(&bottomConsole);
|
||||
printf ("\x1B[47m"); // Print foreground white color
|
||||
|
||||
if ((pressed & KEY_A) || (pressed & KEY_Y)) {
|
||||
consoleClear();
|
||||
char folderPath[2][256];
|
||||
@ -153,6 +161,13 @@ void ndsCardDump(void) {
|
||||
remove(destPath);
|
||||
FILE* destinationFile = fopen(destPath, "wb");
|
||||
for (u32 src = 0; src < romSize; src += 0x200) {
|
||||
consoleSelect(&topConsole);
|
||||
printf ("\x1B[42m"); // Print green color
|
||||
// Move to right side of screen
|
||||
printf ("\x1b[0;26H");
|
||||
// Print time
|
||||
printf ("_%s" ,RetTime().c_str());
|
||||
|
||||
printf ("\x1b[8;0H");
|
||||
printf ("Progress:\n");
|
||||
printf ("%i/%i Bytes ", (int)src, (int)romSize);
|
||||
@ -162,34 +177,42 @@ void ndsCardDump(void) {
|
||||
fclose(destinationFile);
|
||||
ndsCardSaveDump(destSavPath);
|
||||
free(ndsCardHeader);
|
||||
break;
|
||||
}
|
||||
if (pressed & KEY_B) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void gbaCartDump(void) {
|
||||
int pressed = 0;
|
||||
|
||||
printf ("\x1b[0;27H");
|
||||
printf ("\x1B[42m"); // Print green color
|
||||
printf ("_____"); // Clear time
|
||||
consoleSelect(&bottomConsole);
|
||||
consoleClear();
|
||||
printf ("\x1B[47m"); // Print foreground white color
|
||||
printf("Dump GBA cart ROM to\n");
|
||||
printf("\"fat:/gm9i/out\"?\n");
|
||||
printf("(<A> yes, <B> no)");
|
||||
while (true) {
|
||||
|
||||
consoleSelect(&topConsole);
|
||||
printf ("\x1B[42m"); // Print green color
|
||||
// Power saving loop. Only poll the keys once per frame and sleep the CPU if there is nothing else to do
|
||||
do {
|
||||
// Move to right side of screen
|
||||
printf ("\x1b[0;26H");
|
||||
// Print time
|
||||
printf ("_%s" ,RetTime().c_str());
|
||||
|
||||
scanKeys();
|
||||
pressed = keysDownRepeat();
|
||||
swiWaitForVBlank();
|
||||
} while (!(pressed & KEY_A) && !(pressed & KEY_B));
|
||||
|
||||
if (pressed & KEY_A) {
|
||||
printf ("\x1b[0;27H");
|
||||
printf ("\x1B[42m"); // Print green color
|
||||
printf ("_____"); // Clear time
|
||||
}
|
||||
|
||||
consoleSelect(&bottomConsole);
|
||||
printf ("\x1B[47m"); // Print foreground white color
|
||||
|
||||
if (pressed & KEY_A) {
|
||||
consoleClear();
|
||||
if (access("fat:/gm9i", F_OK) != 0) {
|
||||
@ -246,10 +269,5 @@ void gbaCartDump(void) {
|
||||
destinationFile = fopen(destSavPath, "wb");
|
||||
fwrite((void*)0x0A000000, 1, 0x10000, destinationFile);
|
||||
fclose(destinationFile);
|
||||
break;
|
||||
}
|
||||
if (pressed & KEY_B) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#include <dirent.h>
|
||||
#include <vector>
|
||||
|
||||
#include "date.h"
|
||||
#include "file_browse.h"
|
||||
|
||||
using namespace std;
|
||||
@ -13,6 +14,8 @@ using namespace std;
|
||||
|
||||
u32 copyBuf[copyBufSize];
|
||||
|
||||
extern PrintConsole topConsole, bottomConsole;
|
||||
|
||||
char clipboard[256];
|
||||
char clipboardFilename[256];
|
||||
bool clipboardFolder = false;
|
||||
@ -121,6 +124,15 @@ int fcopy(const char *sourcePath, const char *destinationPath)
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
consoleSelect(&topConsole);
|
||||
printf ("\x1B[42m"); // Print green color
|
||||
// Move to right side of screen
|
||||
printf ("\x1b[0;26H");
|
||||
// Print time
|
||||
printf ("_%s" ,RetTime().c_str());
|
||||
|
||||
consoleSelect(&bottomConsole);
|
||||
printf ("\x1B[47m"); // Print foreground white color
|
||||
printf ("\x1b[16;0H");
|
||||
printf ("Progress:\n");
|
||||
printf ("%i/%i Bytes ", (int)offset, (int)fsize);
|
||||
@ -182,6 +194,8 @@ void changeFileAttribs(DirEntry* entry) {
|
||||
printf ("\x1b[%i;0H", 9+cursorScreenPos);
|
||||
printf ("(UDRL to change attributes)");
|
||||
while (1) {
|
||||
consoleSelect(&bottomConsole);
|
||||
printf ("\x1B[47m"); // Print foreground white color
|
||||
printf ("\x1b[%i;1H", 5+cursorScreenPos);
|
||||
printf ((newAttribs & ATTR_READONLY) ? "X" : " ");
|
||||
printf ("\x1b[%i;18H", 5+cursorScreenPos);
|
||||
@ -193,8 +207,15 @@ void changeFileAttribs(DirEntry* entry) {
|
||||
printf ("\x1b[%i;0H", 11+cursorScreenPos);
|
||||
printf ((currentAttribs==newAttribs) ? "(<A> to continue) " : "(<A> to apply, <B> to cancel)");
|
||||
|
||||
consoleSelect(&topConsole);
|
||||
printf ("\x1B[42m"); // Print green color
|
||||
// Power saving loop. Only poll the keys once per frame and sleep the CPU if there is nothing else to do
|
||||
do {
|
||||
// Move to right side of screen
|
||||
printf ("\x1b[0;26H");
|
||||
// Print time
|
||||
printf ("_%s" ,RetTime().c_str());
|
||||
|
||||
scanKeys();
|
||||
pressed = keysDown();
|
||||
swiWaitForVBlank();
|
||||
|
||||
@ -184,9 +184,6 @@ int fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) {
|
||||
int cursorScreenPos = 0;
|
||||
int maxCursors = -1;
|
||||
|
||||
printf ("\x1b[0;27H");
|
||||
printf ("\x1B[42m"); // Print green color
|
||||
printf ("_____"); // Clear time
|
||||
consoleSelect(&bottomConsole);
|
||||
consoleClear();
|
||||
printf ("\x1B[47m"); // Print foreground white color
|
||||
@ -232,6 +229,8 @@ int fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) {
|
||||
}
|
||||
printf("\n");
|
||||
printf("(<A> select, <B> cancel)");
|
||||
consoleSelect(&bottomConsole);
|
||||
printf ("\x1B[47m"); // Print foreground white color
|
||||
while (true) {
|
||||
// Clear old cursors
|
||||
for (int i = OPTIONS_ENTRIES_START_ROW+cursorScreenPos; i < (maxCursors+1) + OPTIONS_ENTRIES_START_ROW+cursorScreenPos; i++) {
|
||||
@ -240,14 +239,24 @@ int fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) {
|
||||
// Show cursor
|
||||
iprintf ("\x1b[%d;0H->", optionOffset + OPTIONS_ENTRIES_START_ROW+cursorScreenPos);
|
||||
|
||||
consoleSelect(&topConsole);
|
||||
printf ("\x1B[42m"); // Print green color for time text
|
||||
// Power saving loop. Only poll the keys once per frame and sleep the CPU if there is nothing else to do
|
||||
do {
|
||||
// Move to right side of screen
|
||||
printf ("\x1b[0;26H");
|
||||
// Print time
|
||||
printf ("_%s" ,RetTime().c_str());
|
||||
|
||||
scanKeys();
|
||||
pressed = keysDownRepeat();
|
||||
swiWaitForVBlank();
|
||||
} while (!(pressed & KEY_UP) && !(pressed & KEY_DOWN)
|
||||
&& !(pressed & KEY_A) && !(pressed & KEY_B));
|
||||
|
||||
consoleSelect(&bottomConsole);
|
||||
printf ("\x1B[47m"); // Print foreground white color
|
||||
|
||||
if (pressed & KEY_UP) optionOffset -= 1;
|
||||
if (pressed & KEY_DOWN) optionOffset += 1;
|
||||
|
||||
@ -317,9 +326,6 @@ bool fileBrowse_paste(char destPath[256]) {
|
||||
|
||||
consoleClear();
|
||||
|
||||
printf ("\x1b[0;27H");
|
||||
printf ("\x1B[42m"); // Print green color
|
||||
printf ("_____"); // Clear time
|
||||
consoleSelect(&bottomConsole);
|
||||
printf ("\x1B[47m"); // Print foreground white color
|
||||
printf(clipboardFolder ? "Paste folder here?" : "Paste file here?");
|
||||
@ -333,6 +339,8 @@ bool fileBrowse_paste(char destPath[256]) {
|
||||
}
|
||||
printf("\n");
|
||||
printf("(<A> select, <B> cancel)");
|
||||
consoleSelect(&bottomConsole);
|
||||
printf ("\x1B[47m"); // Print foreground white color
|
||||
while (true) {
|
||||
// Clear old cursors
|
||||
for (int i = OPTIONS_ENTRIES_START_ROW; i < (maxCursors+1) + OPTIONS_ENTRIES_START_ROW; i++) {
|
||||
@ -341,14 +349,24 @@ bool fileBrowse_paste(char destPath[256]) {
|
||||
// Show cursor
|
||||
iprintf ("\x1b[%d;0H->", optionOffset + OPTIONS_ENTRIES_START_ROW);
|
||||
|
||||
consoleSelect(&topConsole);
|
||||
printf ("\x1B[42m"); // Print green color for time text
|
||||
// Power saving loop. Only poll the keys once per frame and sleep the CPU if there is nothing else to do
|
||||
do {
|
||||
// Move to right side of screen
|
||||
printf ("\x1b[0;26H");
|
||||
// Print time
|
||||
printf ("_%s" ,RetTime().c_str());
|
||||
|
||||
scanKeys();
|
||||
pressed = keysDownRepeat();
|
||||
swiWaitForVBlank();
|
||||
} while (!(pressed & KEY_UP) && !(pressed & KEY_DOWN)
|
||||
&& !(pressed & KEY_A) && !(pressed & KEY_B));
|
||||
|
||||
consoleSelect(&bottomConsole);
|
||||
printf ("\x1B[47m"); // Print foreground white color
|
||||
|
||||
if (pressed & KEY_UP) optionOffset -= 1;
|
||||
if (pressed & KEY_DOWN) optionOffset += 1;
|
||||
|
||||
@ -611,20 +629,26 @@ string browseForFile (void) {
|
||||
|
||||
// Delete file/folder
|
||||
if ((pressed & KEY_X) && (strcmp (entry->name.c_str(), "..") != 0) && (strncmp (path, "nitro:/", 7) != 0)) {
|
||||
printf ("\x1b[0;27H");
|
||||
printf ("\x1B[42m"); // Print green color
|
||||
printf ("_____"); // Clear time
|
||||
consoleSelect(&bottomConsole);
|
||||
consoleClear();
|
||||
printf ("\x1B[47m"); // Print foreground white color
|
||||
iprintf("Delete \"%s\"?\n", entry->name.c_str());
|
||||
printf ("(<A> yes, <B> no)");
|
||||
consoleSelect(&topConsole);
|
||||
printf ("\x1B[42m"); // Print green color for time text
|
||||
while (true) {
|
||||
// Move to right side of screen
|
||||
printf ("\x1b[0;26H");
|
||||
// Print time
|
||||
printf ("_%s" ,RetTime().c_str());
|
||||
|
||||
scanKeys();
|
||||
pressed = keysDownRepeat();
|
||||
swiWaitForVBlank();
|
||||
if (pressed & KEY_A) {
|
||||
consoleSelect(&bottomConsole);
|
||||
consoleClear();
|
||||
printf ("\x1B[47m"); // Print foreground white color
|
||||
if (FAT_getAttr(entry->name.c_str()) & ATTR_READONLY) {
|
||||
printf ("Failed deleting:\n");
|
||||
printf (entry->name.c_str());
|
||||
@ -632,7 +656,14 @@ string browseForFile (void) {
|
||||
printf ("\n");
|
||||
printf ("(<A> to continue)");
|
||||
pressed = 0;
|
||||
consoleSelect(&topConsole);
|
||||
printf ("\x1B[42m"); // Print green color for time text
|
||||
while (!(pressed & KEY_A)) {
|
||||
// Move to right side of screen
|
||||
printf ("\x1b[0;26H");
|
||||
// Print time
|
||||
printf ("_%s" ,RetTime().c_str());
|
||||
|
||||
scanKeys();
|
||||
pressed = keysDown();
|
||||
swiWaitForVBlank();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user