mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-12 04:11:56 +00:00
Reduce load delay with many recent http files.
If we have data for them, we can start up fairly quickly.
This commit is contained in:
parent
9d6684a776
commit
eb674b4699
@ -54,6 +54,11 @@ DiskCachingFileLoader::~DiskCachingFileLoader() {
|
||||
}
|
||||
|
||||
bool DiskCachingFileLoader::Exists() {
|
||||
if (cache_->HasData()) {
|
||||
// It may require a slow operation to check - if we have data, let's say yes.
|
||||
// This helps initial load, since we check each recent file for existence.
|
||||
return true;
|
||||
}
|
||||
return backend_->Exists();
|
||||
}
|
||||
|
||||
@ -718,6 +723,19 @@ void DiskCachingFileLoaderCache::CloseFileHandle() {
|
||||
fd_ = 0;
|
||||
}
|
||||
|
||||
bool DiskCachingFileLoaderCache::HasData() const {
|
||||
if (!f_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < blockIndexLookup_.size(); ++i) {
|
||||
if (blockIndexLookup_[i] != INVALID_INDEX) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
u64 DiskCachingFileLoaderCache::FreeDiskSpace() {
|
||||
std::string dir = cacheDir_;
|
||||
if (dir.empty()) {
|
||||
|
@ -89,6 +89,8 @@ public:
|
||||
// Guaranteed to read at least one block into the cache.
|
||||
size_t SaveIntoCache(FileLoader *backend, s64 pos, size_t bytes, void *data);
|
||||
|
||||
bool HasData() const;
|
||||
|
||||
private:
|
||||
void InitCache(const std::string &path);
|
||||
void ShutdownCache();
|
||||
|
Loading…
x
Reference in New Issue
Block a user