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:
@@ -357,15 +357,14 @@ void loop(void* args) {
|
||||
ON_SCOPE_EXIT(fs.DeleteFile(temp_path));
|
||||
|
||||
{
|
||||
FsFile f;
|
||||
fs::File f;
|
||||
if (R_FAILED(rc = fs.OpenFile(temp_path, FsOpenMode_Write, &f))) {
|
||||
sendall(connfd, &ERR_FILE, sizeof(ERR_FILE));
|
||||
log_write("failed to open file %X\n", rc);
|
||||
continue;
|
||||
}
|
||||
ON_SCOPE_EXIT(fsFileClose(&f));
|
||||
|
||||
if (R_FAILED(rc = fsFileSetSize(&f, file_data.size()))) {
|
||||
if (R_FAILED(rc = f.SetSize(file_data.size()))) {
|
||||
sendall(connfd, &ERR_FILE, sizeof(ERR_FILE));
|
||||
log_write("failed to set file size: 0x%X\n", socketGetLastResult());
|
||||
continue;
|
||||
@@ -379,7 +378,7 @@ void loop(void* args) {
|
||||
if (offset + chunk_size > file_data.size()) {
|
||||
chunk_size = file_data.size() - offset;
|
||||
}
|
||||
if (R_FAILED(rc = fsFileWrite(&f, offset, file_data.data() + offset, chunk_size, FsWriteOption_None))) {
|
||||
if (R_FAILED(rc = f.Write(offset, file_data.data() + offset, chunk_size, FsWriteOption_None))) {
|
||||
break;
|
||||
}
|
||||
offset += chunk_size;
|
||||
|
||||
Reference in New Issue
Block a user