mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Fix file highlighting
This commit is contained in:
parent
33f59410cd
commit
2b6d19efd2
@ -38,15 +38,13 @@
|
|||||||
#include "nitrofs.h"
|
#include "nitrofs.h"
|
||||||
|
|
||||||
#define SCREEN_COLS 32
|
#define SCREEN_COLS 32
|
||||||
#define ENTRIES_PER_SCREEN 22
|
#define ENTRIES_PER_SCREEN 23
|
||||||
#define ENTRIES_START_ROW 1
|
#define ENTRIES_START_ROW 1
|
||||||
#define OPTIONS_ENTRIES_START_ROW 2
|
#define OPTIONS_ENTRIES_START_ROW 2
|
||||||
#define ENTRY_PAGE_LENGTH 10
|
#define ENTRY_PAGE_LENGTH 10
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static int fileOffset = 0;
|
|
||||||
|
|
||||||
static char path[PATH_MAX];
|
static char path[PATH_MAX];
|
||||||
|
|
||||||
struct DirEntry {
|
struct DirEntry {
|
||||||
@ -117,7 +115,7 @@ void getDirectoryContents (vector<DirEntry>& dirContents) {
|
|||||||
sort(dirContents.begin(), dirContents.end(), dirEntryPredicate);
|
sort(dirContents.begin(), dirContents.end(), dirEntryPredicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showDirectoryContents (const vector<DirEntry>& dirContents, int startRow) {
|
void showDirectoryContents (const vector<DirEntry>& dirContents, int fileOffset, int startRow) {
|
||||||
getcwd(path, PATH_MAX);
|
getcwd(path, PATH_MAX);
|
||||||
|
|
||||||
// Clear the screen
|
// Clear the screen
|
||||||
@ -143,7 +141,7 @@ void showDirectoryContents (const vector<DirEntry>& dirContents, int startRow) {
|
|||||||
|
|
||||||
// Set row
|
// Set row
|
||||||
iprintf ("\x1b[%d;0H", i + ENTRIES_START_ROW);
|
iprintf ("\x1b[%d;0H", i + ENTRIES_START_ROW);
|
||||||
if (fileOffset == i) {
|
if ((fileOffset - startRow) == i) {
|
||||||
printf ("\x1B[47m"); // Print foreground white color
|
printf ("\x1B[47m"); // Print foreground white color
|
||||||
} else {
|
} else {
|
||||||
printf ("\x1B[40m"); // Print foreground black color
|
printf ("\x1B[40m"); // Print foreground black color
|
||||||
@ -357,7 +355,7 @@ bool fileBrowse_paste(char path[PATH_MAX]) {
|
|||||||
string browseForFile (void) {
|
string browseForFile (void) {
|
||||||
int pressed = 0;
|
int pressed = 0;
|
||||||
int screenOffset = 0;
|
int screenOffset = 0;
|
||||||
fileOffset = 0;
|
int fileOffset = 0;
|
||||||
off_t fileSize = 0;
|
off_t fileSize = 0;
|
||||||
vector<DirEntry> dirContents;
|
vector<DirEntry> dirContents;
|
||||||
|
|
||||||
@ -397,7 +395,7 @@ string browseForFile (void) {
|
|||||||
printf ((!isDSiMode() && isRegularDS) ? POWERTEXT_DS : POWERTEXT);
|
printf ((!isDSiMode() && isRegularDS) ? POWERTEXT_DS : POWERTEXT);
|
||||||
|
|
||||||
consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 15, 0, true, true);
|
consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 15, 0, true, true);
|
||||||
showDirectoryContents (dirContents, screenOffset);
|
showDirectoryContents (dirContents, fileOffset, screenOffset);
|
||||||
|
|
||||||
stored_SCFG_MC = REG_SCFG_MC;
|
stored_SCFG_MC = REG_SCFG_MC;
|
||||||
|
|
||||||
@ -441,11 +439,11 @@ string browseForFile (void) {
|
|||||||
// Scroll screen if needed
|
// Scroll screen if needed
|
||||||
if (fileOffset < screenOffset) {
|
if (fileOffset < screenOffset) {
|
||||||
screenOffset = fileOffset;
|
screenOffset = fileOffset;
|
||||||
showDirectoryContents (dirContents, screenOffset);
|
showDirectoryContents (dirContents, fileOffset, screenOffset);
|
||||||
}
|
}
|
||||||
if (fileOffset > screenOffset + ENTRIES_PER_SCREEN - 1) {
|
if (fileOffset > screenOffset + ENTRIES_PER_SCREEN - 1) {
|
||||||
screenOffset = fileOffset - ENTRIES_PER_SCREEN + 1;
|
screenOffset = fileOffset - ENTRIES_PER_SCREEN + 1;
|
||||||
showDirectoryContents (dirContents, screenOffset);
|
showDirectoryContents (dirContents, fileOffset, screenOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
getcwd(path, PATH_MAX);
|
getcwd(path, PATH_MAX);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user