diff --git a/src/main.c b/src/main.c index b09e481e..2b6d4ddc 100644 --- a/src/main.c +++ b/src/main.c @@ -11,7 +11,7 @@ static void init (void) { assertf(usb_initialize() != CART_NONE, "No flashcart was detected"); - debug_init_usblog(); + //debug_init_usblog(); assertf(debug_init_sdfs("sd:/", -1), "Couldn't initialize SD card"); flashcart_error_t error = flashcart_init(); assertf(error != FLASHCART_ERROR_OUTDATED, "Outdated flashcart firmware"); diff --git a/src/menu/menu_info.c b/src/menu/menu_info.c index dee96d69..dc17b782 100644 --- a/src/menu/menu_info.c +++ b/src/menu/menu_info.c @@ -12,7 +12,7 @@ void menu_info(void) { draw_header(disp); graphics_draw_text(disp, 30, 50, "Authors:"); - graphics_draw_text(disp, 30, 58, "JonesAlmighty / Networkfusion"); + graphics_draw_text(disp, 30, 58, "JonesAlmighty / NetworkFusion"); graphics_draw_text(disp, 30, 66, "korgeaux / Polprzewodnikowy"); graphics_draw_text(disp, 30, 80, "Github:"); diff --git a/src/menu/menu_main.c b/src/menu/menu_main.c index 0b0da05d..e6d391f7 100644 --- a/src/menu/menu_main.c +++ b/src/menu/menu_main.c @@ -1,4 +1,5 @@ #include +#include // TODO: does this work... will unlock qsort! #include #include @@ -27,7 +28,7 @@ FRESULT scan_file_path (char* path) { FRESULT res; DIR dir; - char sfno[273]; + char sfno[280]; int counter = 0; res = f_opendir(&dir, path); @@ -42,21 +43,25 @@ FRESULT scan_file_path (char* path) { break; } + if (fno.fattrib & AM_SYS) { + continue; // we do not want to show system files ever... + } + counter ++; - - sprintf(sfno, "%c%c%c%c %10d %s/%s", + + // TODO: convert these to icons... + sprintf(sfno, "| %c%c%c | %10d | %s", ((fno.fattrib & AM_DIR) ? 'D' : '-'), ((fno.fattrib & AM_RDO) ? 'R' : '-'), - ((fno.fattrib & AM_SYS) ? 'S' : '-'), ((fno.fattrib & AM_HID) ? 'H' : '-'), - (int)fno.fsize, path, fno.fname); + (int)fno.fsize, fno.fname); if (scroll_menu_position == counter -1) { - printf("> %s\n", sfno); - sprintf(current_filename, "%s", fno.fname); + printf("-> %s\n", sfno); + sprintf(current_filename, fno.fname); } else { - printf(" %s\n", sfno); + printf(" %s\n", sfno); } } } @@ -67,8 +72,10 @@ FRESULT scan_file_path (char* path) { void menu_main_refresh (char *dir_path) { console_clear(); - printf("N64 Flashcart Menu V0.0.0\n\n"); + printf("SC64 Flashcart Menu Rev: 0.0.1\n\n"); printf("SD Card Directory list:\n\n"); + printf(" | DRH | FILE SIZE | FILE NAME\n"); + printf(" |-----|------------|----------\n"); scan_file_path(dir_path); } @@ -100,7 +107,7 @@ void menu_main_init (settings_t *settings) { joypad = get_keys_down(); if (joypad.c[0].up) { - console_clear(); + //console_clear(); if (scroll_menu_position > 0) { scroll_menu_position --; } @@ -111,7 +118,7 @@ void menu_main_init (settings_t *settings) { } if (joypad.c[0].down) { - console_clear(); + //console_clear(); if ((scroll_menu_position >= 0) && (scroll_menu_position < items_in_dir)) { scroll_menu_position ++; } @@ -122,28 +129,34 @@ void menu_main_init (settings_t *settings) { } if (joypad.c[0].A) { - console_clear(); + //console_clear(); printf("Loading ROM...\n"); printf("%s\n", current_filename); - if (str_endswith(current_filename, ".z64") || str_endswith(current_filename, ".n64") || str_endswith(current_filename, ".v64")) { + // TODO: move this to a function and check that the ROM is valid by checking the header... + if (str_endswith(current_filename, ".z64") || str_endswith(current_filename, ".n64") || str_endswith(current_filename, ".v64") || str_endswith(current_filename, ".rom")) { assertf(flashcart_load_rom(current_filename) == FLASHCART_OK, "ROM load error"); - // FIXME: we now need the header ID and CRC HI... + // FIXME: we now need the header ID and CRC HI... + // ed64_dma_read_rom(buff, 0, 1); + // crc_high = (buff[0x10] << 24) | (buff[0x11] << 16) | (buff[0x12] << 8) | (buff[0x13] << 0); + // crc_low = (buff[0x14] << 24) | (buff[0x15] << 16) | (buff[0x16] << 8) | (buff[0x17] << 0); + // id = (buff[0x3c] << 8) | buff[0x3d]; //assertf(flashcart_load_save("current_filename.sav", rom_db_match_save_type(id, crc), false) == FLASHCART_OK, "ROM load save error"); break; //required! } else { + // TODO: if this is a directory we need to transverse to it! printf("Failed... Returning to menu...\n"); wait_ms(1000); menu_main_refresh(settings->last_state.current_directory); } } if (joypad.c[0].start) { // FIXME: the START button on any controller! - console_clear(); + //console_clear(); menu_info(); menu_main_refresh(settings->last_state.current_directory); } - if (joypad.c[0].B) { - console_clear(); + if (joypad.c[0].Z) { + //console_clear(); menu_fileinfo(); menu_main_refresh(settings->last_state.current_directory); } diff --git a/src/menu/settings.h b/src/menu/settings.h index 0dc9fddc..7bb8496f 100644 --- a/src/menu/settings.h +++ b/src/menu/settings.h @@ -19,6 +19,12 @@ typedef struct { typedef struct { bool auto_load_last_rom; char* current_directory; + // TODO: + // Menu layout: list vs grid + // Hide extensions + // Hide hidden files and dirs + // colour scheme + // background pic } settings_last_state_t; typedef struct { @@ -27,13 +33,6 @@ typedef struct { boot_params_t boot_params; } settings_t; -// TODO: -// Menu layout: list vs grid -// Hide extensions -// Hide hidden files and dirs -// colour scheme -// background pic - void settings_load_from_file (settings_t *settings); void settings_save (void); void settings_reset (void);