many more optimisations. cleaned up fs code. bug fixes etc (see below).

- fix usb using the wrong year when polling the timestamp.
- fs file/dir has been re-written to allow for simplified calling and remove the need of manually closing.
- add SetSize for stdio by using ftruncate.
- don't truncate the file when opened in stdio.
- add getcount api for stdio.
- display file/dir count in filebrowser for non-native fs.
- allow hash to be used on non-native fs.
- slightly optimise nro parsing by manually calculating nro size rather than doing an os call.
- slightly optimise nro parsing by keeping the fs struct alive between calls, rather than creating a new one on the stack.
- fix filebrowser peeking into zip files that are stored on non-sd fs.
- set the timestamp of a file moved to a stdio location (cut/paste).
- slightly optimise daybreak update folder detection by skipping opening/polling the dir size.
- set the fullpath of the file thats being hashed in progress box.
This commit is contained in:
ITotalJustice
2025-05-26 17:06:04 +01:00
parent 3e3ec71329
commit a9931a975d
23 changed files with 390 additions and 387 deletions

View File

@@ -162,11 +162,9 @@ auto DownloadApp(ProgressBox* pbox, const GhApiAsset& gh_asset, const AssetEntry
R_THROW(rc);
}
FsFile f;
fs::File f;
R_TRY(fs.OpenFile(file_path, FsOpenMode_Write, &f));
ON_SCOPE_EXIT(fsFileClose(&f));
R_TRY(fsFileSetSize(&f, info.uncompressed_size));
R_TRY(f.SetSize(info.uncompressed_size));
std::vector<char> buf(chunk_size);
s64 offset{};
@@ -179,7 +177,7 @@ auto DownloadApp(ProgressBox* pbox, const GhApiAsset& gh_asset, const AssetEntry
R_THROW(0x1);
}
R_TRY(fsFileWrite(&f, offset, buf.data(), bytes_read, FsWriteOption_None));
R_TRY(f.Write(offset, buf.data(), bytes_read, FsWriteOption_None));
pbox->UpdateTransfer(offset, info.uncompressed_size);
offset += bytes_read;