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.
This commit is contained in:
17
sphaira/include/threaded_file_transfer.hpp
Normal file
17
sphaira/include/threaded_file_transfer.hpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user