Files
sphaira/sphaira/include/threaded_file_transfer.hpp
ITotalJustice ef25c3edc7 multi thread game dumps and file uploads.
previous uploads were all single threaded, which meant that it only uploaded as fast as the slowest source.
usb transfer is still single threaded due it being random access for both files and data, making it
hard for the read thread to run freely.
2025-05-20 22:50:05 +01:00

18 lines
729 B
C++

#pragma once
#include "ui/progress_box.hpp"
#include <functional>
#include <switch.h>
namespace sphaira::thread {
using ReadFunctionCallback = std::function<Result(void* data, s64 off, s64 size, u64* bytes_read)>;
using WriteFunctionCallback = std::function<Result(const void* data, s64 off, s64 size)>;
using PullFunctionCallback = std::function<Result(void* data, s64 size, u64* bytes_read)>;
using StartFunctionCallback = std::function<Result(PullFunctionCallback pull)>;
Result Transfer(ui::ProgressBox* pbox, s64 size, ReadFunctionCallback rfunc, WriteFunctionCallback wfunc);
Result TransferPull(ui::ProgressBox* pbox, s64 size, ReadFunctionCallback rfunc, StartFunctionCallback sfunc);
} // namespace sphaira::thread