From 159abfa246e440943a38a63e28fc0db1dadb4108 Mon Sep 17 00:00:00 2001 From: ITotalJustice <47043333+ITotalJustice@users.noreply.github.com> Date: Sat, 19 Jul 2025 17:45:39 +0100 Subject: [PATCH] bump libhaze version, multithread mtp transfers to maximise sd throughput (77MiB/s read, 40MiB/s write) --- sphaira/CMakeLists.txt | 2 +- sphaira/source/haze_helper.cpp | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sphaira/CMakeLists.txt b/sphaira/CMakeLists.txt index 9f85f55..9528332 100644 --- a/sphaira/CMakeLists.txt +++ b/sphaira/CMakeLists.txt @@ -165,7 +165,7 @@ FetchContent_Declare(ftpsrv FetchContent_Declare(libhaze GIT_REPOSITORY https://github.com/ITotalJustice/libhaze.git - GIT_TAG af69c0a + GIT_TAG 1f11184 ) FetchContent_Declare(libpulsar diff --git a/sphaira/source/haze_helper.cpp b/sphaira/source/haze_helper.cpp index 3775c7d..edc8db1 100644 --- a/sphaira/source/haze_helper.cpp +++ b/sphaira/source/haze_helper.cpp @@ -153,19 +153,19 @@ struct FsProxy final : FsProxyBase { return f->GetSize(out_size); } Result SetFileSize(FsFile *file, s64 size) override { - log_write("[HAZE] SetFileSize()\n"); + log_write("[HAZE] SetFileSize(%zd)\n", size); fs::File* f; std::memcpy(&f, &file->s, sizeof(f)); return f->SetSize(size); } Result ReadFile(FsFile *file, s64 off, void *buf, u64 read_size, u32 option, u64 *out_bytes_read) override { - log_write("[HAZE] ReadFile()\n"); + log_write("[HAZE] ReadFile(%zd, %zu)\n", off, read_size); fs::File* f; std::memcpy(&f, &file->s, sizeof(f)); return f->Read(off, buf, read_size, option, out_bytes_read); } Result WriteFile(FsFile *file, s64 off, const void *buf, u64 write_size, u32 option) override { - log_write("[HAZE] WriteFile()\n"); + log_write("[HAZE] WriteFile(%zd, %zu)\n", off, write_size); fs::File* f; std::memcpy(&f, &file->s, sizeof(f)); return f->Write(off, buf, write_size, option); @@ -228,6 +228,9 @@ struct FsProxy final : FsProxyBase { } std::memset(d, 0, sizeof(*d)); } + virtual bool MultiThreadTransfer(s64 size, bool read) override { + return !App::IsFileBaseEmummc(); + } private: std::unique_ptr m_fs{}; @@ -398,6 +401,9 @@ struct FsDevNullProxy final : FsProxyVfs { *out = 1024ULL * 1024ULL * 1024ULL * 256ULL; R_SUCCEED(); } + bool MultiThreadTransfer(s64 size, bool read) override { + return true; + } }; struct FsInstallProxy final : FsProxyVfs { @@ -518,6 +524,12 @@ struct FsInstallProxy final : FsProxyVfs { FsProxyVfs::CloseFile(file); } + + // installs are already multi-threaded via yati. + bool MultiThreadTransfer(s64 size, bool read) override { + App::IsFileBaseEmummc(); + return false; + } }; ::haze::FsEntries g_fs_entries{};