mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-22 02:29:19 +01:00
Further work
This commit is contained in:
parent
40017a53a6
commit
37f6352eec
@ -13,8 +13,8 @@
|
|||||||
#include "menu_fileinfo.h"
|
#include "menu_fileinfo.h"
|
||||||
#include "rom_database.h"
|
#include "rom_database.h"
|
||||||
|
|
||||||
static int scroll_menu_position = 0;
|
static int scroll_menu_position = 1;
|
||||||
static int items_in_dir = 0;
|
static int items_in_dir = 1;
|
||||||
|
|
||||||
static FILINFO current_fileinfo;
|
static FILINFO current_fileinfo;
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ FRESULT scan_file_path (char* path) {
|
|||||||
DIR dir;
|
DIR dir;
|
||||||
char sfno[280];
|
char sfno[280];
|
||||||
int counter = 0; //FIXME: we dont account for an empty dir or only one valid file!
|
int counter = 0; //FIXME: we dont account for an empty dir or only one valid file!
|
||||||
|
|
||||||
res = f_opendir(&dir, path);
|
res = f_opendir(&dir, path);
|
||||||
|
|
||||||
if (res == FR_OK) {
|
if (res == FR_OK) {
|
||||||
@ -57,7 +57,7 @@ FRESULT scan_file_path (char* path) {
|
|||||||
((file_info.fattrib & AM_HID) ? 'H' : '-'),
|
((file_info.fattrib & AM_HID) ? 'H' : '-'),
|
||||||
(int)file_info.fsize, file_info.fname);
|
(int)file_info.fsize, file_info.fname);
|
||||||
|
|
||||||
if (scroll_menu_position == counter -1) {
|
if (scroll_menu_position == counter) {
|
||||||
printf("-> %s\n", sfno);
|
printf("-> %s\n", sfno);
|
||||||
current_fileinfo = file_info;
|
current_fileinfo = file_info;
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ FRESULT scan_file_path (char* path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
items_in_dir = counter -1;
|
items_in_dir = counter;
|
||||||
f_closedir(&dir);
|
f_closedir(&dir);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -74,7 +74,8 @@ FRESULT scan_file_path (char* path) {
|
|||||||
void menu_main_refresh (char *dir_path) {
|
void menu_main_refresh (char *dir_path) {
|
||||||
console_clear();
|
console_clear();
|
||||||
printf("SC64 Flashcart Menu Rev: 0.0.2\n\n");
|
printf("SC64 Flashcart Menu Rev: 0.0.2\n\n");
|
||||||
printf("SD Card Directory list:\n\n");
|
printf("SD Card Directory list: %s\n\n", dir_path);
|
||||||
|
printf("SD Card Directory files: %d of %d\n\n", scroll_menu_position, items_in_dir);
|
||||||
printf(" | DRH | FILE SIZE | FILE NAME\n");
|
printf(" | DRH | FILE SIZE | FILE NAME\n");
|
||||||
printf(" |-----|------------|----------\n");
|
printf(" |-----|------------|----------\n");
|
||||||
scan_file_path(dir_path);
|
scan_file_path(dir_path);
|
||||||
@ -112,7 +113,7 @@ void menu_main_init (settings_t *settings) {
|
|||||||
|
|
||||||
if (joypad.c[0].up) {
|
if (joypad.c[0].up) {
|
||||||
//console_clear();
|
//console_clear();
|
||||||
if (scroll_menu_position > 0) {
|
if (scroll_menu_position > 1 && scroll_menu_position <= items_in_dir) {
|
||||||
scroll_menu_position --;
|
scroll_menu_position --;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -123,11 +124,11 @@ void menu_main_init (settings_t *settings) {
|
|||||||
|
|
||||||
if (joypad.c[0].down) {
|
if (joypad.c[0].down) {
|
||||||
//console_clear();
|
//console_clear();
|
||||||
if ((scroll_menu_position >= 0) && (scroll_menu_position < items_in_dir)) {
|
if (scroll_menu_position < items_in_dir) {
|
||||||
scroll_menu_position ++;
|
scroll_menu_position ++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scroll_menu_position = 0;
|
scroll_menu_position = 1;
|
||||||
}
|
}
|
||||||
menu_main_refresh(current_dir);
|
menu_main_refresh(current_dir);
|
||||||
}
|
}
|
||||||
@ -150,10 +151,10 @@ void menu_main_init (settings_t *settings) {
|
|||||||
else {
|
else {
|
||||||
if (current_fileinfo.fattrib & AM_DIR) {
|
if (current_fileinfo.fattrib & AM_DIR) {
|
||||||
// if this is a directory we need to transverse to it!
|
// if this is a directory we need to transverse to it!
|
||||||
|
items_in_dir = 1;
|
||||||
|
scroll_menu_position = 1;
|
||||||
last_dir = current_dir;
|
last_dir = current_dir;
|
||||||
current_dir = current_fileinfo.fname;
|
current_dir = current_fileinfo.fname;
|
||||||
scroll_menu_position = 0;
|
|
||||||
items_in_dir = 0;
|
|
||||||
menu_main_refresh(current_dir);
|
menu_main_refresh(current_dir);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user