Support file paths up to 256 in length, allows for sorting in directories
This commit is contained in:
parent
1fb85d8afe
commit
7f04ea7c58
26
src/main.c
26
src/main.c
@ -63,6 +63,8 @@
|
||||
|
||||
#define MAX_LIST 20
|
||||
|
||||
#define MAX_SUPPORTED_PATH_LEN 256
|
||||
|
||||
struct glyph
|
||||
{
|
||||
int xoff;
|
||||
@ -189,7 +191,7 @@ int save_after_reboot = 0;
|
||||
unsigned char cartID[4];
|
||||
char curr_dirname[64];
|
||||
char pwd[64];
|
||||
TCHAR rom_filename[256];
|
||||
TCHAR rom_filename[MAX_SUPPORTED_PATH_LEN];
|
||||
|
||||
u32 rom_buff[128]; //rom buffer
|
||||
u8 *rom_buff8; //rom buffer
|
||||
@ -915,7 +917,7 @@ void clearScreen(display_context_t disp)
|
||||
|
||||
void romInfoScreen(display_context_t disp, u8 *buff, int silent)
|
||||
{
|
||||
TCHAR filename[64];
|
||||
TCHAR filename[MAX_SUPPORTED_PATH_LEN];
|
||||
sprintf(filename, "%s", buff);
|
||||
|
||||
int swapped = 0;
|
||||
@ -1338,7 +1340,7 @@ void loadrom(display_context_t disp, u8 *buff, int fast)
|
||||
|
||||
printText("Loading ROM, Please wait:", 3, 4, disp);
|
||||
|
||||
TCHAR filename[64];
|
||||
TCHAR filename[MAX_SUPPORTED_PATH_LEN];
|
||||
sprintf(filename, "%s", buff);
|
||||
|
||||
FRESULT result;
|
||||
@ -1516,7 +1518,7 @@ void loadrom(display_context_t disp, u8 *buff, int fast)
|
||||
int backupSaveData(display_context_t disp)
|
||||
{
|
||||
//backup cart-save on sd after reboot
|
||||
TCHAR config_file_path[32];
|
||||
TCHAR config_file_path[MAX_SUPPORTED_PATH_LEN];
|
||||
sprintf(config_file_path, "/"ED64_FIRMWARE_PATH"/%s/LASTROM.CFG", save_path);
|
||||
|
||||
u8 save_format;
|
||||
@ -1626,7 +1628,7 @@ int saveTypeFromSd(display_context_t disp, char *rom_name, int stype)
|
||||
TRACE(disp, rom_filename);
|
||||
|
||||
const char* save_type_extension = saveTypeToExtension(stype, ext_type);
|
||||
TCHAR fname[256] = {0};
|
||||
TCHAR fname[MAX_SUPPORTED_PATH_LEN] = {0};
|
||||
int save_count = 0; //TODO: once this crosses 9999 bad infinite-loop type things happen, look into that one day
|
||||
FRESULT result;
|
||||
FILINFO fnoba;
|
||||
@ -1728,7 +1730,7 @@ int saveTypeToSd(display_context_t disp, char *rom_name, int stype)
|
||||
{
|
||||
//after reset create new savefile
|
||||
const char* save_type_extension = saveTypeToExtension(stype, ext_type);
|
||||
TCHAR fname[256]; //TODO: change filename buffers to 256!!!
|
||||
TCHAR fname[MAX_SUPPORTED_PATH_LEN];
|
||||
int save_count = 0; //TODO: once this crosses 9999 bad infinite-loop type things happen, look into that one day
|
||||
FRESULT result;
|
||||
FILINFO fnoba;
|
||||
@ -1796,7 +1798,7 @@ int saveTypeToSd(display_context_t disp, char *rom_name, int stype)
|
||||
//check out the userfriendly ini file for config-information
|
||||
int readConfigFile(void)
|
||||
{
|
||||
TCHAR filename[32];
|
||||
TCHAR filename[MAX_SUPPORTED_PATH_LEN];
|
||||
sprintf(filename, "/"ED64_FIRMWARE_PATH"/ALT64.INI");
|
||||
|
||||
FRESULT result;
|
||||
@ -1911,7 +1913,7 @@ void readSDcard(display_context_t disp, char *directory)
|
||||
// for (int i = 0; i < dir->size; i++)
|
||||
// {
|
||||
// frec = dir->rec[i];
|
||||
// u8 rom_cfg_file[128];
|
||||
// u8 rom_cfg_file[MAX_SUPPORTED_PATH_LEN];
|
||||
|
||||
// //set rom_cfg
|
||||
// sprintf(rom_cfg_file, "/"ED64_FIRMWARE_PATH"/CFG/%s", frec->name);
|
||||
@ -2241,7 +2243,7 @@ void bootRom(display_context_t disp, int silent)
|
||||
{
|
||||
if (boot_save != 0)
|
||||
{
|
||||
TCHAR cfg_file[32];
|
||||
TCHAR cfg_file[MAX_SUPPORTED_PATH_LEN];
|
||||
|
||||
//set cfg file with last loaded cart info and save-type
|
||||
sprintf(cfg_file, "/"ED64_FIRMWARE_PATH"/%s/LASTROM.CFG", save_path);
|
||||
@ -2434,7 +2436,7 @@ void drawShortInfoBox(display_context_t disp, char *text, u8 mode)
|
||||
|
||||
void readRomConfig(display_context_t disp, char *short_filename, char *full_filename)
|
||||
{
|
||||
TCHAR cfg_filename[256];
|
||||
TCHAR cfg_filename[MAX_SUPPORTED_PATH_LEN];
|
||||
sprintf(rom_filename, "%s", short_filename);
|
||||
rom_filename[strlen(rom_filename) - 4] = '\0'; // cut extension
|
||||
sprintf(cfg_filename, "/"ED64_FIRMWARE_PATH"/CFG/%s.CFG", rom_filename);
|
||||
@ -2672,7 +2674,7 @@ void drawToplistBox(display_context_t disp, int line)
|
||||
// if (res != FR_OK) break;
|
||||
// path[i] = 0;
|
||||
} else { /* It is a file. */
|
||||
TCHAR rom_cfg_file[128];
|
||||
TCHAR rom_cfg_file[MAX_SUPPORTED_PATH_LEN];
|
||||
|
||||
//set rom_cfg
|
||||
sprintf(rom_cfg_file, path, fno.fname);
|
||||
@ -4197,7 +4199,7 @@ void handleInput(display_context_t disp, sprite_t *contr)
|
||||
else
|
||||
sprintf(name_file, "%s/%s", pwd, list[cursor].filename);
|
||||
|
||||
TCHAR rom_cfg_file[128];
|
||||
TCHAR rom_cfg_file[MAX_SUPPORTED_PATH_LEN];
|
||||
|
||||
u8 resp = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user