From 0bfd336796ea6d6bce25396927df91d0dc066e9e Mon Sep 17 00:00:00 2001 From: ITotalJustice <47043333+ITotalJustice@users.noreply.github.com> Date: Wed, 25 Jun 2025 19:28:23 +0100 Subject: [PATCH] always set `FsCreateOption_BigFile` in fs.cpp when creating 4GiB+ file. --- sphaira/source/dumper.cpp | 4 +--- sphaira/source/fs.cpp | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sphaira/source/dumper.cpp b/sphaira/source/dumper.cpp index ccdcad8..c9849cc 100644 --- a/sphaira/source/dumper.cpp +++ b/sphaira/source/dumper.cpp @@ -99,7 +99,6 @@ private: }; Result DumpToFile(ui::ProgressBox* pbox, fs::Fs* fs, const fs::FsPath& root, BaseSource* source, std::span paths) { - constexpr s64 BIG_FILE_SIZE = 1024ULL*1024ULL*1024ULL*4ULL; const auto is_file_based_emummc = App::IsFileBaseEmummc(); for (const auto& path : paths) { @@ -113,8 +112,7 @@ Result DumpToFile(ui::ProgressBox* pbox, fs::Fs* fs, const fs::FsPath& root, Bas fs->CreateDirectoryRecursivelyWithPath(temp_path); fs->DeleteFile(temp_path); - const auto flags = file_size >= BIG_FILE_SIZE ? FsCreateOption_BigFile : 0; - R_TRY(fs->CreateFile(temp_path, file_size, flags)); + R_TRY(fs->CreateFile(temp_path, file_size)); ON_SCOPE_EXIT(fs->DeleteFile(temp_path)); { diff --git a/sphaira/source/fs.cpp b/sphaira/source/fs.cpp index 6b67109..041238d 100644 --- a/sphaira/source/fs.cpp +++ b/sphaira/source/fs.cpp @@ -112,6 +112,10 @@ FsPath AppendPath(const FsPath& root_path, const FsPath& _file_path) { Result CreateFile(FsFileSystem* fs, const FsPath& path, u64 size, u32 option, bool ignore_read_only) { R_UNLESS(ignore_read_only || !is_read_only_root(path), Result_FsReadOnly); + if (size >= 1024ULL*1024ULL*1024ULL*4ULL) { + option |= FsCreateOption_BigFile; + } + R_TRY(fsFsCreateFile(fs, path, size, option)); fsFsCommit(fs); R_SUCCEED();