|
@@ -689,11 +689,11 @@ void CardReader::getfilename(uint16_t nr, const char * const match/*=NULL*/)
|
|
|
|
|
|
}
|
|
|
|
|
|
-void CardReader::getfilename_simple(uint32_t position, const char * const match/*=NULL*/)
|
|
|
+void CardReader::getfilename_simple(uint16_t entry, const char * const match/*=NULL*/)
|
|
|
{
|
|
|
curDir = &workDir;
|
|
|
nrFiles = 0;
|
|
|
- curDir->seekSet(position);
|
|
|
+ curDir->seekSet((uint32_t)entry << 5);
|
|
|
lsDive("", *curDir, match, LS_GetFilename);
|
|
|
}
|
|
|
|
|
@@ -775,7 +775,7 @@ void CardReader::updir()
|
|
|
*/
|
|
|
void CardReader::getfilename_sorted(const uint16_t nr, uint8_t sdSort) {
|
|
|
if (nr < sort_count)
|
|
|
- getfilename_simple(sort_positions[(sdSort == SD_SORT_ALPHA) ? (sort_count - nr - 1) : nr]);
|
|
|
+ getfilename_simple(sort_entries[(sdSort == SD_SORT_ALPHA) ? (sort_count - nr - 1) : nr]);
|
|
|
else
|
|
|
getfilename(nr);
|
|
|
}
|
|
@@ -832,7 +832,7 @@ void CardReader::presort() {
|
|
|
else
|
|
|
getfilename_next(position);
|
|
|
sort_order[i] = i;
|
|
|
- sort_positions[i] = position;
|
|
|
+ sort_entries[i] = position >> 5;
|
|
|
#if HAS_FOLDER_SORTING
|
|
|
if (filenameIsDir) dirCnt++;
|
|
|
#endif
|
|
@@ -882,7 +882,7 @@ void CardReader::presort() {
|
|
|
|
|
|
manage_heater();
|
|
|
uint8_t orderBckp = sort_order[i];
|
|
|
- getfilename_simple(sort_positions[orderBckp]);
|
|
|
+ getfilename_simple(sort_entries[orderBckp]);
|
|
|
strcpy(name1, LONGEST_FILENAME); // save (or getfilename below will trounce it)
|
|
|
crmod_date_bckp = crmodDate;
|
|
|
crmod_time_bckp = crmodTime;
|
|
@@ -891,7 +891,7 @@ void CardReader::presort() {
|
|
|
#endif
|
|
|
|
|
|
uint16_t j = i;
|
|
|
- getfilename_simple(sort_positions[sort_order[j - gap]]);
|
|
|
+ getfilename_simple(sort_entries[sort_order[j - gap]]);
|
|
|
char *name2 = LONGEST_FILENAME; // use the string in-place
|
|
|
#if HAS_FOLDER_SORTING
|
|
|
while (j >= gap && ((sdSort == SD_SORT_TIME)?_SORT_CMP_TIME_DIR(FOLDER_SORTING):_SORT_CMP_DIR(FOLDER_SORTING)))
|
|
@@ -909,7 +909,7 @@ void CardReader::presort() {
|
|
|
printf_P(PSTR("i%2d j%2d gap%2d orderBckp%2d\n"), i, j, gap, orderBckp);
|
|
|
#endif
|
|
|
if (j < gap) break;
|
|
|
- getfilename_simple(sort_positions[sort_order[j - gap]]);
|
|
|
+ getfilename_simple(sort_entries[sort_order[j - gap]]);
|
|
|
name2 = LONGEST_FILENAME; // use the string in-place
|
|
|
}
|
|
|
sort_order[j] = orderBckp;
|
|
@@ -950,14 +950,14 @@ void CardReader::presort() {
|
|
|
const uint16_t o1 = sort_order[j], o2 = sort_order[j + 1];
|
|
|
|
|
|
counter++;
|
|
|
- getfilename_simple(sort_positions[o1]);
|
|
|
+ getfilename_simple(sort_entries[o1]);
|
|
|
strcpy(name1, LONGEST_FILENAME); // save (or getfilename below will trounce it)
|
|
|
crmod_date_bckp = crmodDate;
|
|
|
crmod_time_bckp = crmodTime;
|
|
|
#if HAS_FOLDER_SORTING
|
|
|
bool dir1 = filenameIsDir;
|
|
|
#endif
|
|
|
- getfilename_simple(sort_positions[o2]);
|
|
|
+ getfilename_simple(sort_entries[o2]);
|
|
|
char *name2 = LONGEST_FILENAME; // use the string in-place
|
|
|
|
|
|
// Sort the current pair according to settings.
|
|
@@ -995,26 +995,26 @@ void CardReader::presort() {
|
|
|
{
|
|
|
if (sort_order_reverse_index[i] != i)
|
|
|
{
|
|
|
- uint32_t el = sort_positions[i];
|
|
|
+ uint32_t el = sort_entries[i];
|
|
|
uint8_t idx = sort_order_reverse_index[i];
|
|
|
while (idx != i)
|
|
|
{
|
|
|
- uint32_t el1 = sort_positions[idx];
|
|
|
+ uint32_t el1 = sort_entries[idx];
|
|
|
uint8_t idx1 = sort_order_reverse_index[idx];
|
|
|
sort_order_reverse_index[idx] = idx;
|
|
|
- sort_positions[idx] = el;
|
|
|
+ sort_entries[idx] = el;
|
|
|
idx = idx1;
|
|
|
el = el1;
|
|
|
}
|
|
|
sort_order_reverse_index[idx] = idx;
|
|
|
- sort_positions[idx] = el;
|
|
|
+ sort_entries[idx] = el;
|
|
|
}
|
|
|
}
|
|
|
menu_progressbar_finish();
|
|
|
}
|
|
|
else {
|
|
|
getfilename(0);
|
|
|
- sort_positions[0] = position;
|
|
|
+ sort_entries[0] = position >> 5;
|
|
|
}
|
|
|
|
|
|
sort_count = fileCnt;
|