Add proper green border

This commit is contained in:
RocketRobz 2020-02-04 16:29:25 -07:00
parent 5cd3a707d3
commit 3cbb99e0bc
5 changed files with 94 additions and 36 deletions

View File

@ -54,6 +54,11 @@ static u8 gbaFixedValue = 0;
extern PrintConsole topConsole, bottomConsole;
extern void printBorderTop(void);
extern void printBorderBottom(void);
extern void clearBorderTop(void);
extern void clearBorderBottom(void);
void dm_drawTopScreen(void) {
/*if (!ramDumped) {
printf ("Dumping RAM...");
@ -66,8 +71,11 @@ void dm_drawTopScreen(void) {
consoleClear();
printf ("\x1B[42m"); // Print green color
printf ("___________________________%s", RetTime().c_str());
printf ("\x1B[30m"); // Print background black color
// Print time
printf ("\x1b[0;27H");
printf (RetTime().c_str());
printf ("\x1b[0;0H");
printf ("[root]");
printf ("\x1B[47m"); // Print foreground white color
@ -225,7 +233,7 @@ void driveMenu (void) {
stored_SCFG_MC = REG_SCFG_MC;
printf ("\x1B[42m"); // Print green color for time text
printf ("\x1B[30m"); // Print black 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 {
@ -335,11 +343,13 @@ void driveMenu (void) {
screenshotbmp(snapPath);
// Seamlessly swap top and bottom screens
lcdMainOnBottom();
printBorderBottom();
consoleSelect(&bottomConsole);
dm_drawTopScreen();
printf("\x1B[42m"); // Print green color for time text
printf("\x1B[30m"); // Print black color for time text
printf("\x1b[0;27H");
printf(timeText);
clearBorderTop();
consoleSelect(&topConsole);
dm_drawBottomScreen();
// Take bottom screenshot
@ -347,6 +357,8 @@ void driveMenu (void) {
screenshotbmp(snapPath);
dmTextPrinted = false;
lcdMainOnTop();
printBorderTop();
clearBorderBottom();
}
}

View File

@ -59,13 +59,13 @@ void ndsCardDump(void) {
printf("(<A> yes, <Y> trim, <B> no)");
consoleSelect(&topConsole);
printf ("\x1B[42m"); // Print green color
printf ("\x1B[30m"); // Print black 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());
printf (" %s" ,RetTime().c_str());
scanKeys();
pressed = keysDownRepeat();
@ -161,11 +161,11 @@ void ndsCardDump(void) {
FILE* destinationFile = fopen(destPath, "wb");
for (u32 src = 0; src < romSize; src += 0x200) {
consoleSelect(&topConsole);
printf ("\x1B[42m"); // Print green color
printf ("\x1B[30m"); // Print black color
// Move to right side of screen
printf ("\x1b[0;26H");
// Print time
printf ("_%s" ,RetTime().c_str());
printf (" %s" ,RetTime().c_str());
consoleSelect(&bottomConsole);
printf ("\x1B[47m"); // Print foreground white color
@ -191,13 +191,13 @@ void gbaCartDump(void) {
printf("(<A> yes, <B> no)");
consoleSelect(&topConsole);
printf ("\x1B[42m"); // Print green color
printf ("\x1B[30m"); // Print black 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());
printf (" %s" ,RetTime().c_str());
scanKeys();
pressed = keysDownRepeat();
@ -206,8 +206,7 @@ void gbaCartDump(void) {
if (pressed & KEY_A) {
printf ("\x1b[0;27H");
printf ("\x1B[42m"); // Print green color
printf ("_____"); // Clear time
printf (" "); // Clear time
}
consoleSelect(&bottomConsole);

View File

@ -125,11 +125,11 @@ int fcopy(const char *sourcePath, const char *destinationPath)
break;
}
consoleSelect(&topConsole);
printf ("\x1B[42m"); // Print green color
printf ("\x1B[30m"); // Print black color
// Move to right side of screen
printf ("\x1b[0;26H");
// Print time
printf ("_%s" ,RetTime().c_str());
printf (" %s" ,RetTime().c_str());
consoleSelect(&bottomConsole);
printf ("\x1B[47m"); // Print foreground white color
@ -208,13 +208,13 @@ void changeFileAttribs(DirEntry* entry) {
printf ((currentAttribs==newAttribs) ? "(<A> to continue) " : "(<A> to apply, <B> to cancel)");
consoleSelect(&topConsole);
printf ("\x1B[42m"); // Print green color
printf ("\x1B[30m"); // Print black 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());
printf (" %s" ,RetTime().c_str());
scanKeys();
pressed = keysDown();

View File

@ -47,6 +47,11 @@
bool bigJump = false;
extern PrintConsole topConsole, bottomConsole;
extern void printBorderTop(void);
extern void printBorderBottom(void);
extern void clearBorderTop(void);
extern void clearBorderBottom(void);
static char path[PATH_MAX];
bool nameEndsWith (const string& name) {
@ -131,8 +136,11 @@ void showDirectoryContents (const vector<DirEntry>& dirContents, int fileOffset,
consoleClear();
// Print the path
printf ("\x1B[42m"); // Print green color
printf ("___________________________%s", RetTime().c_str());
printf ("\x1B[30m"); // Print black color
// Print time
printf ("\x1b[0;27H");
printf (RetTime().c_str());
printf ("\x1b[0;0H");
if (strlen(path) < SCREEN_COLS) {
iprintf ("%s", path);
@ -236,13 +244,13 @@ int fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) {
iprintf ("\x1b[%d;0H->", optionOffset + OPTIONS_ENTRIES_START_ROW+cursorScreenPos);
consoleSelect(&topConsole);
printf ("\x1B[42m"); // Print green color for time text
printf ("\x1B[30m"); // Print black 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());
printf (" %s" ,RetTime().c_str());
scanKeys();
pressed = keysDownRepeat();
@ -346,13 +354,13 @@ bool fileBrowse_paste(char destPath[256]) {
iprintf ("\x1b[%d;0H->", optionOffset + OPTIONS_ENTRIES_START_ROW);
consoleSelect(&topConsole);
printf ("\x1B[42m"); // Print green color for time text
printf ("\x1B[30m"); // Print black 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());
printf (" %s" ,RetTime().c_str());
scanKeys();
pressed = keysDownRepeat();
@ -467,14 +475,14 @@ string browseForFile (void) {
stored_SCFG_MC = REG_SCFG_MC;
printf ("\x1B[42m"); // Print green color for time text
printf ("\x1B[30m"); // Print black 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());
printf (" %s" ,RetTime().c_str());
scanKeys();
pressed = keysDownRepeat();
@ -587,8 +595,7 @@ string browseForFile (void) {
// Rename file/folder
if ((held & KEY_R) && (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
printf (" "); // Clear time
pressed = 0;
consoleDemoInit();
Keyboard *kbd = keyboardDemoInit();
@ -634,12 +641,12 @@ string browseForFile (void) {
iprintf("Delete \"%s\"?\n", entry->name.c_str());
printf ("(<A> yes, <B> no)");
consoleSelect(&topConsole);
printf ("\x1B[42m"); // Print green color for time text
printf ("\x1B[30m"); // Print black color for time text
while (true) {
// Move to right side of screen
printf ("\x1b[0;26H");
// Print time
printf ("_%s" ,RetTime().c_str());
printf (" %s" ,RetTime().c_str());
scanKeys();
pressed = keysDownRepeat();
@ -656,12 +663,12 @@ string browseForFile (void) {
printf ("(<A> to continue)");
pressed = 0;
consoleSelect(&topConsole);
printf ("\x1B[42m"); // Print green color for time text
printf ("\x1B[30m"); // Print black 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());
printf (" %s" ,RetTime().c_str());
scanKeys();
pressed = keysDown();
@ -698,8 +705,7 @@ string browseForFile (void) {
// Create new folder
if ((held & KEY_R) && (pressed & KEY_Y) && (strncmp (path, "nitro:/", 7) != 0)) {
printf ("\x1b[0;27H");
printf ("\x1B[42m"); // Print green color
printf ("_____"); // Clear time
printf (" "); // Clear time
pressed = 0;
consoleDemoInit();
Keyboard *kbd = keyboardDemoInit();
@ -786,11 +792,13 @@ string browseForFile (void) {
screenshotbmp(snapPath);
// Seamlessly swap top and bottom screens
lcdMainOnBottom();
printBorderBottom();
consoleSelect(&bottomConsole);
showDirectoryContents (dirContents, fileOffset, screenOffset);
printf("\x1B[42m"); // Print green color for time text
printf("\x1B[30m"); // Print black color for time text
printf ("\x1b[0;26H");
printf ("_%s" ,timeText);
printf (" %s" ,timeText);
clearBorderTop();
consoleSelect(&topConsole);
fileBrowse_drawBottomScreen(entry);
// Take bottom screenshot
@ -800,6 +808,8 @@ string browseForFile (void) {
getDirectoryContents (dirContents);
}
lcdMainOnTop();
printBorderTop();
clearBorderBottom();
}
}
}

View File

@ -50,7 +50,7 @@ bool applaunch = false;
static int bg3;
PrintConsole topConsole, bottomConsole;
PrintConsole topConsoleBG, topConsole, bottomConsoleBG, bottomConsole;
using namespace std;
@ -72,6 +72,32 @@ bool extention(const std::string& filename, const char* ext) {
}
}
void printBorderTop(void) {
consoleSelect(&topConsoleBG);
printf ("\x1B[42m"); // Print green color
for (int i = 0; i < 32; i++) {
printf ("\x02"); // Print top border
}
}
void printBorderBottom(void) {
consoleSelect(&bottomConsoleBG);
printf ("\x1B[42m"); // Print green color
for (int i = 0; i < 32; i++) {
printf ("\x02"); // Print top border
}
}
void clearBorderTop(void) {
consoleSelect(&topConsoleBG);
consoleClear();
}
void clearBorderBottom(void) {
consoleSelect(&bottomConsoleBG);
consoleClear();
}
//---------------------------------------------------------------------------------
int main(int argc, char **argv) {
//---------------------------------------------------------------------------------
@ -101,6 +127,7 @@ int main(int argc, char **argv) {
// Subscreen as a console
videoSetModeSub(MODE_0_2D);
vramSetBankH(VRAM_H_SUB_BG);
consoleInit(&bottomConsoleBG, 1, BgType_Text4bpp, BgSize_T_256x256, 7, 0, false, true);
consoleInit(&bottomConsole, 0, BgType_Text4bpp, BgSize_T_256x256, 15, 0, false, true);
// Display GM9i logo
@ -158,11 +185,21 @@ int main(int argc, char **argv) {
// Top screen as a console
videoSetMode(MODE_0_2D);
vramSetBankG(VRAM_G_MAIN_BG);
consoleInit(&topConsoleBG, 1, BgType_Text4bpp, BgSize_T_256x256, 7, 0, true, true);
consoleInit(&topConsole, 0, BgType_Text4bpp, BgSize_T_256x256, 15, 0, true, true);
// Overwrite background white color
BG_PALETTE[15+(7*16)] = 0x656A;
BG_PALETTE_SUB[15+(7*16)] = 0x656A;
// Overwrite 2nd smiley face with filled tile
for (int i = 0; i < 8*8; i++) {
*(u8*)(0x6000040+i) = 0xFF; // Top screen
*(u8*)(0x6200040+i) = 0xFF; // Bottom screen
}
printBorderTop();
keysSetRepeat(25,5);
appInited = true;