summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-06-12 05:53:23 +0200
committerLiam <byteslice@airmail.cc>2023-06-13 16:37:34 +0200
commit0e7eaaba5a170a935ca23e791f7b127646ff9464 (patch)
tree4594b30cadac1b7d5f9e60b226bee6a93fb02959 /src
parentvfs_real: add file LRU cache for open file limits (diff)
downloadyuzu-0e7eaaba5a170a935ca23e791f7b127646ff9464.tar
yuzu-0e7eaaba5a170a935ca23e791f7b127646ff9464.tar.gz
yuzu-0e7eaaba5a170a935ca23e791f7b127646ff9464.tar.bz2
yuzu-0e7eaaba5a170a935ca23e791f7b127646ff9464.tar.lz
yuzu-0e7eaaba5a170a935ca23e791f7b127646ff9464.tar.xz
yuzu-0e7eaaba5a170a935ca23e791f7b127646ff9464.tar.zst
yuzu-0e7eaaba5a170a935ca23e791f7b127646ff9464.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/file_sys/vfs_real.cpp11
-rw-r--r--src/core/file_sys/vfs_real.h3
2 files changed, 3 insertions, 11 deletions
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp
index a63629b80..d16790b55 100644
--- a/src/core/file_sys/vfs_real.cpp
+++ b/src/core/file_sys/vfs_real.cpp
@@ -75,16 +75,9 @@ VfsEntryType RealVfsFilesystem::GetEntryType(std::string_view path_) const {
VirtualFile RealVfsFilesystem::OpenFile(std::string_view path_, Mode perms) {
const auto path = FS::SanitizePath(path_, FS::DirectorySeparator::PlatformDefault);
- this->EvictSingleReference();
-
- auto backing = FS::FileOpen(path, ModeFlagsToFileAccessMode(perms), FS::FileType::BinaryFile);
- if (!backing) {
- return nullptr;
- }
-
- num_open_files++;
- auto reference = std::make_unique<FileReference>(std::move(backing));
+ auto reference = std::make_unique<FileReference>();
this->InsertReferenceIntoList(*reference);
+
return std::shared_ptr<RealVfsFile>(new RealVfsFile(*this, std::move(reference), path, perms));
}
diff --git a/src/core/file_sys/vfs_real.h b/src/core/file_sys/vfs_real.h
index f29c69fbd..48dc2698a 100644
--- a/src/core/file_sys/vfs_real.h
+++ b/src/core/file_sys/vfs_real.h
@@ -15,8 +15,7 @@ class IOFile;
namespace FileSys {
struct FileReference : public Common::IntrusiveListBaseNode<FileReference> {
- FileReference(std::shared_ptr<Common::FS::IOFile>&& f) : file(f) {}
- std::shared_ptr<Common::FS::IOFile> file;
+ std::shared_ptr<Common::FS::IOFile> file{};
};
class RealVfsFile;