Dynamically allocate memory for the file selector to store the name pointers into. Also dramatically simplify the file selector's name management code. This has many effects:

* It allows the file selector to handle directories of more than 511 files and a parent directory entry. (Fixes GitHub issue #37).
* It allows the file selector to sort directories along with files, which is a more common use case (game folders that contain ROM hacks, plus single game files, are sorted by name as the user expects).
* The file selector now reports progress while loading a large directory.
* The screenshot slideshow function now shows an existing dedicated message, "No screenshots found", instead of crashing when the screenshot directory contains no screenshots.

Add Quicksort code from GameYob. See <https://github.com/Nebuleon/GameYob/commit/afbeeba>.

* Faster sorting in the common case where a directory's natural order is already sorted, using the isSorted function.
* Use the median-of-three algorithm first described by Robert Sedgewick to select the pivot. Causes less recursion in many cases.
* Associates file names with their is-directory flag, keeping both in sync.
This commit is contained in:
Nebuleon Fumika 2013-06-15 23:40:29 -04:00
parent 4252250fe7
commit a1d1e01e11
3 changed files with 695 additions and 770 deletions

View file

@ -48,6 +48,10 @@ Tools
Options
#MSG_MAIN_MENU_EXIT
Exit
#MSG_FILE_MENU_LOADING_LIST
Loading...
#MSG_FILE_MENU_SORTING_LIST
Sorting...
#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
Fluidity %s
#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO
@ -265,6 +269,10 @@ STARTCHINESESIM
综合设置
#MSG_MAIN_MENU_EXIT
退出模拟器
#MSG_FILE_MENU_LOADING_LIST
装载...
#MSG_FILE_MENU_SORTING_LIST
列表进行排序...
#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
流畅度 %s
#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO
@ -482,6 +490,10 @@ Outils
Options
#MSG_MAIN_MENU_EXIT
Quitter
#MSG_FILE_MENU_LOADING_LIST
Chargement...
#MSG_FILE_MENU_SORTING_LIST
Tri...
#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
Fluidité %s
#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO
@ -700,6 +712,10 @@ Tools
Optionen
#MSG_MAIN_MENU_EXIT
Beenden
#MSG_FILE_MENU_LOADING_LIST
Laden...
#MSG_FILE_MENU_SORTING_LIST
Sortieren...
#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
Flüssigkeit %s
#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO
@ -918,6 +934,10 @@ Hulpmiddelen
Opties
#MSG_MAIN_MENU_EXIT
Afsluiten
#MSG_FILE_MENU_LOADING_LIST
Laden...
#MSG_FILE_MENU_SORTING_LIST
Sorteren...
#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
Fluïditeit %s
#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO
@ -1136,6 +1156,10 @@ Herramientas
Opciones
#MSG_MAIN_MENU_EXIT
Salir
#MSG_FILE_MENU_LOADING_LIST
Cargando...
#MSG_FILE_MENU_SORTING_LIST
Ordenando...
#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
Fluidez %s
#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO
@ -1353,6 +1377,10 @@ Strumenti
Opzioni
#MSG_MAIN_MENU_EXIT
Uscita
#MSG_FILE_MENU_LOADING_LIST
Caricando...
#MSG_FILE_MENU_SORTING_LIST
Ordinamento...
#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
Fluidità %s
#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO
@ -1570,6 +1598,10 @@ Ferramentas
Opções
#MSG_MAIN_MENU_EXIT
Sair
#MSG_FILE_MENU_LOADING_LIST
Carregando...
#MSG_FILE_MENU_SORTING_LIST
Classificando...
#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
Fluidez %s
#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO

File diff suppressed because it is too large Load diff

View file

@ -31,6 +31,10 @@ enum MSG
MSG_MAIN_MENU_TOOLS,
MSG_MAIN_MENU_OPTIONS,
MSG_MAIN_MENU_EXIT,
MSG_FILE_MENU_LOADING_LIST,
MSG_FILE_MENU_SORTING_LIST,
FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE,
MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO,
MSG_VIDEO_AUDIO_FLUIDITY_PREFER_AUDIO,