File_Sys: Add a size dependend delay for each file read
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/result.h"
|
||||
@ -37,6 +38,24 @@ public:
|
||||
*/
|
||||
virtual ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) = 0;
|
||||
|
||||
/**
|
||||
* Get the amount of time a 3ds needs to read those data
|
||||
* @param length Length in bytes of data read from file
|
||||
* @return Nanoseconds for the delay
|
||||
*/
|
||||
virtual u64 GetReadDelayNs(size_t length) const {
|
||||
// Return the default delay for the case that the subclass backend didn't
|
||||
// implement one. We take the one measured for romfs reads
|
||||
// This should be removed as soon as every subclass backend
|
||||
// has one implemented
|
||||
LOG_WARNING(Service_FS, "Using default delay for read");
|
||||
static constexpr u64 slope(94);
|
||||
static constexpr u64 offset(582778);
|
||||
static constexpr u64 minimum(663124);
|
||||
u64 IPCDelayNanoseconds = std::max<u64>(static_cast<u64>(length) * slope + offset, minimum);
|
||||
return IPCDelayNanoseconds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size of the file in bytes
|
||||
* @return Size of the file in bytes
|
||||
|
Reference in New Issue
Block a user