Skip to content

Commit

Permalink
increase max files per dir from 3072 to 10240
Browse files Browse the repository at this point in the history
  • Loading branch information
rsn8887 committed Nov 16, 2018
1 parent 8a02ac9 commit 4606071
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions README.MD
@@ -1,7 +1,8 @@
Changes in this Version
======
1.77 (Switch only)
1.77

- increase max files per dir from 3072 to 10240
- on Switch, in split JoyCon mode, make SL/SR act as L/R also in menu
- on Switch, in split JoyCon mode, disable L/R/ZL/ZR in menu

Expand Down Expand Up @@ -224,8 +225,9 @@ Mouse + keyboard tested working with the "Jelly Comb Mini Bluetooth Keyboard Wit

CHANGELOG
=====
1.77 (Switch only)
1.77

- increase max files per dir from 3072 to 10240
- on Switch, in split JoyCon mode, make SL/SR act as L/R also in menu
- on Switch, in split JoyCon mode, disable L/R/ZL/ZR in menu

Expand Down
7 changes: 4 additions & 3 deletions src/gp2x/menu/menu_load.cpp
Expand Up @@ -52,6 +52,7 @@ static const char *text_str_load_title=" Filemanager -";
int text_dir_num_files=0, text_dir_num_files_index=0;

#define SHOW_MAX_FILES 13
#define MAX_FILES_PER_DIR 10240

extern int run_menuFileinfo(char* fileName);
static int min_in_dir=0, max_in_dir=SHOW_MAX_FILES;
Expand Down Expand Up @@ -262,7 +263,7 @@ static int menuLoadLoop(char *curr_path)
{
struct dirent *ent = NULL;
n = 0;
namelist = (struct dirent **)malloc(3*1024 * sizeof(struct dirent *)); // < 3*1024 files
namelist = (struct dirent **)malloc(MAX_FILES_PER_DIR * sizeof(struct dirent *));
namelist[0] = (struct dirent *)malloc(sizeof(struct dirent));
strcpy(namelist[0]->d_name, ".");
namelist[0]->d_type = DT_DIR; n++;
Expand Down Expand Up @@ -295,7 +296,7 @@ static int menuLoadLoop(char *curr_path)

struct dirent *ent = NULL;
n = 0;
namelist = (struct dirent **)malloc(3*1024 * sizeof(struct dirent *)); // < 3*1024 files
namelist = (struct dirent **)malloc(MAX_FILES_PER_DIR * sizeof(struct dirent *));
namelist[0] = (struct dirent *)malloc(sizeof(struct dirent));
strcpy(namelist[0]->d_name, ".");
namelist[0]->d_type = DT_DIR; n++;
Expand All @@ -304,7 +305,7 @@ static int menuLoadLoop(char *curr_path)
namelist[1]->d_type = DT_DIR; n++;

while ((ent = readdir (dir)) != NULL) {
if(n >= 3*1024-1)
if(n >= MAX_FILES_PER_DIR-1)
break;
namelist[n] = (struct dirent *)malloc(sizeof(struct dirent));
memcpy(namelist[n], ent, sizeof(struct dirent));
Expand Down

0 comments on commit 4606071

Please sign in to comment.