diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/settings_list.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/apps/settings_list.c b/apps/settings_list.c index 1bf8b4202f..0ea6026346 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -354,6 +354,31 @@ static const char graphic_numeric[] = "graphic,numeric"; | |||
354 | # endif | 354 | # endif |
355 | #endif | 355 | #endif |
356 | 356 | ||
357 | /* | ||
358 | * Total buffer size due to this setting = max files in dir * 52 bytes | ||
359 | * Keep this in mind when selecting the maximum - if the maximum is too | ||
360 | * high it's possible rockbox could hit OOM and become unusable until | ||
361 | * the config file is deleted manually. | ||
362 | * | ||
363 | * Note the FAT32 limit is 65534 files per directory, but this limit | ||
364 | * also applies to the database browser so it makes sense to support | ||
365 | * larger maximums. | ||
366 | */ | ||
367 | #if MEMORYSIZE >= 16 | ||
368 | # define MAX_FILES_IN_DIR_DEFAULT 5000 | ||
369 | # define MAX_FILES_IN_DIR_MAX 100000 | ||
370 | # define MAX_FILES_IN_DIR_STEP 1000 | ||
371 | #elif MEMORYSIZE >= 8 | ||
372 | # define MAX_FILES_IN_DIR_DEFAULT 5000 | ||
373 | # define MAX_FILES_IN_DIR_MAX 40000 | ||
374 | # define MAX_FILES_IN_DIR_STEP 500 | ||
375 | #else | ||
376 | /* historical defaults, only for 2 MiB targets these days */ | ||
377 | # define MAX_FILES_IN_DIR_DEFAULT 1000 | ||
378 | # define MAX_FILES_IN_DIR_MAX 10000 | ||
379 | # define MAX_FILES_IN_DIR_STEP 50 | ||
380 | #endif | ||
381 | |||
357 | #if LCD_DEPTH > 1 | 382 | #if LCD_DEPTH > 1 |
358 | static const char* list_pad_formatter(char *buffer, size_t buffer_size, | 383 | static const char* list_pad_formatter(char *buffer, size_t buffer_size, |
359 | int val, const char *unit) | 384 | int val, const char *unit) |
@@ -1028,13 +1053,10 @@ const struct settings_list settings[] = { | |||
1028 | "max files in playlist", UNIT_INT, 1000, 32000, 1000, | 1053 | "max files in playlist", UNIT_INT, 1000, 32000, 1000, |
1029 | NULL, NULL, NULL), | 1054 | NULL, NULL, NULL), |
1030 | INT_SETTING(F_BANFROMQS, max_files_in_dir, LANG_MAX_FILES_IN_DIR, | 1055 | INT_SETTING(F_BANFROMQS, max_files_in_dir, LANG_MAX_FILES_IN_DIR, |
1031 | #if MEMORYSIZE > 1 | 1056 | MAX_FILES_IN_DIR_DEFAULT, "max files in dir", UNIT_INT, |
1032 | 1000, | 1057 | MAX_FILES_IN_DIR_STEP /* min */, MAX_FILES_IN_DIR_MAX, |
1033 | #else | 1058 | MAX_FILES_IN_DIR_STEP, |
1034 | 200, | 1059 | NULL, NULL, NULL), |
1035 | #endif | ||
1036 | "max files in dir", UNIT_INT, 50, 10000, 50, | ||
1037 | NULL, NULL, NULL), | ||
1038 | /* use this setting for user code even if there's no exchangable battery | 1060 | /* use this setting for user code even if there's no exchangable battery |
1039 | * support enabled */ | 1061 | * support enabled */ |
1040 | #if BATTERY_CAPACITY_INC > 0 | 1062 | #if BATTERY_CAPACITY_INC > 0 |