From 46060713c5fc713d52f894c21f30004dc52479be Mon Sep 17 00:00:00 2001 From: rsn8887 Date: Thu, 15 Nov 2018 18:38:44 -0600 Subject: [PATCH] increase max files per dir from 3072 to 10240 --- README.MD | 6 ++++-- src/gp2x/menu/menu_load.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.MD b/README.MD index 83c0fb2..12e391b 100644 --- a/README.MD +++ b/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 @@ -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 diff --git a/src/gp2x/menu/menu_load.cpp b/src/gp2x/menu/menu_load.cpp index efdea54..01ec2f8 100755 --- a/src/gp2x/menu/menu_load.cpp +++ b/src/gp2x/menu/menu_load.cpp @@ -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; @@ -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++; @@ -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++; @@ -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));