feat: filesystem and Files app support for >64 file entries, 64-bit sizes, async ops, GUI toolkit improvements to devexplorer app
This commit is contained in:
+10
-3
@@ -674,11 +674,12 @@ namespace Fs::Fat32 {
|
||||
|
||||
static int ReadDirectoryNames(int inst, uint32_t dirCluster,
|
||||
char outNames[MaxDirEntries][MaxNameLen],
|
||||
int maxEntries) {
|
||||
int maxEntries, int startOffset = 0) {
|
||||
auto& self = g_instances[inst];
|
||||
uint16_t lfnBuf[MaxNameLen];
|
||||
bool hasLfn = false;
|
||||
int count = 0;
|
||||
int skipped = 0; // valid entries skipped to reach startOffset
|
||||
|
||||
uint32_t cluster = dirCluster;
|
||||
while (!IsEndOfChain(cluster) && count < maxEntries) {
|
||||
@@ -736,6 +737,10 @@ namespace Fs::Fat32 {
|
||||
outNames[count][len] = '\0';
|
||||
}
|
||||
|
||||
// Skip entries before the requested page. The name above was
|
||||
// written into outNames[count] as scratch and will be reused.
|
||||
if (skipped < startOffset) { skipped++; continue; }
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
@@ -997,7 +1002,7 @@ namespace Fs::Fat32 {
|
||||
}
|
||||
|
||||
static int ReadDirImpl(int inst, const char* path,
|
||||
const char** outNames, int maxEntries) {
|
||||
const char** outNames, int maxEntries, int startIndex = 0) {
|
||||
if (inst < 0 || inst >= g_instanceCount) return -1;
|
||||
auto& self = g_instances[inst];
|
||||
|
||||
@@ -1006,7 +1011,7 @@ namespace Fs::Fat32 {
|
||||
if (!(dirEntry.attributes & ATTR_DIRECTORY)) return -1;
|
||||
|
||||
int limit = maxEntries < MaxDirEntries ? maxEntries : MaxDirEntries;
|
||||
int count = ReadDirectoryNames(inst, dirEntry.firstCluster, self.dirNames, limit);
|
||||
int count = ReadDirectoryNames(inst, dirEntry.firstCluster, self.dirNames, limit, startIndex);
|
||||
|
||||
self.dirNameCount = count;
|
||||
for (int i = 0; i < count; i++) {
|
||||
@@ -1762,6 +1767,7 @@ namespace Fs::Fat32 {
|
||||
static uint64_t GetSize(int h) { return GetSizeImpl(N, h); }
|
||||
static void Close(int h) { CloseImpl(N, h); }
|
||||
static int ReadDir(const char* p, const char** o, int m) { return ReadDirImpl(N, p, o, m); }
|
||||
static int ReadDirAt(const char* p, const char** o, int m, int s) { return ReadDirImpl(N, p, o, m, s); }
|
||||
static int Write(int h, const uint8_t* b, uint64_t o, uint64_t s) { return WriteImpl(N, h, b, o, s); }
|
||||
static int Create(const char* p) { return CreateImpl(N, p); }
|
||||
static int Delete(const char* p) { return DeleteImpl(N, p); }
|
||||
@@ -1784,6 +1790,7 @@ namespace Fs::Fat32 {
|
||||
Thunks<N>::Mkdir,
|
||||
Thunks<N>::Rename,
|
||||
Thunks<N>::GetLabel,
|
||||
Thunks<N>::ReadDirAt,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user