summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/disk_archive.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-01-20 04:18:01 +0100
committerbunnei <bunneidev@gmail.com>2018-01-21 21:39:23 +0100
commit1c06c918af30e4f431920c6197128524b2caee14 (patch)
treebaf2150ffeef402b8ba59e71096b96326b69d556 /src/core/file_sys/disk_archive.cpp
parentarchive_backend: Minor changes to match Switch IFileSystem. (diff)
downloadyuzu-1c06c918af30e4f431920c6197128524b2caee14.tar
yuzu-1c06c918af30e4f431920c6197128524b2caee14.tar.gz
yuzu-1c06c918af30e4f431920c6197128524b2caee14.tar.bz2
yuzu-1c06c918af30e4f431920c6197128524b2caee14.tar.lz
yuzu-1c06c918af30e4f431920c6197128524b2caee14.tar.xz
yuzu-1c06c918af30e4f431920c6197128524b2caee14.tar.zst
yuzu-1c06c918af30e4f431920c6197128524b2caee14.zip
Diffstat (limited to 'src/core/file_sys/disk_archive.cpp')
-rw-r--r--src/core/file_sys/disk_archive.cpp99
1 files changed, 0 insertions, 99 deletions
diff --git a/src/core/file_sys/disk_archive.cpp b/src/core/file_sys/disk_archive.cpp
deleted file mode 100644
index 98d80aabc..000000000
--- a/src/core/file_sys/disk_archive.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include <algorithm>
-#include <cstdio>
-#include <memory>
-#include "common/common_types.h"
-#include "common/file_util.h"
-#include "common/logging/log.h"
-#include "core/file_sys/disk_archive.h"
-#include "core/file_sys/errors.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// FileSys namespace
-
-namespace FileSys {
-
-ResultVal<size_t> DiskFile::Read(const u64 offset, const size_t length, u8* buffer) const {
- if (!mode.read_flag)
- return ERROR_INVALID_OPEN_FLAGS;
-
- file->Seek(offset, SEEK_SET);
- return MakeResult<size_t>(file->ReadBytes(buffer, length));
-}
-
-ResultVal<size_t> DiskFile::Write(const u64 offset, const size_t length, const bool flush,
- const u8* buffer) const {
- if (!mode.write_flag)
- return ERROR_INVALID_OPEN_FLAGS;
-
- file->Seek(offset, SEEK_SET);
- size_t written = file->WriteBytes(buffer, length);
- if (flush)
- file->Flush();
- return MakeResult<size_t>(written);
-}
-
-u64 DiskFile::GetSize() const {
- return file->GetSize();
-}
-
-bool DiskFile::SetSize(const u64 size) const {
- file->Resize(size);
- file->Flush();
- return true;
-}
-
-bool DiskFile::Close() const {
- return file->Close();
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-DiskDirectory::DiskDirectory(const std::string& path) : directory() {
- unsigned size = FileUtil::ScanDirectoryTree(path, directory);
- directory.size = size;
- directory.isDirectory = true;
- children_iterator = directory.children.begin();
-}
-
-u32 DiskDirectory::Read(const u32 count, Entry* entries) {
- u32 entries_read = 0;
-
- while (entries_read < count && children_iterator != directory.children.cend()) {
- const FileUtil::FSTEntry& file = *children_iterator;
- const std::string& filename = file.virtualName;
- Entry& entry = entries[entries_read];
-
- LOG_TRACE(Service_FS, "File %s: size=%llu dir=%d", filename.c_str(), file.size,
- file.isDirectory);
-
- // TODO(Link Mauve): use a proper conversion to UTF-16.
- for (size_t j = 0; j < FILENAME_LENGTH; ++j) {
- entry.filename[j] = filename[j];
- if (!filename[j])
- break;
- }
-
- FileUtil::SplitFilename83(filename, entry.short_name, entry.extension);
-
- entry.is_directory = file.isDirectory;
- entry.is_hidden = (filename[0] == '.');
- entry.is_read_only = 0;
- entry.file_size = file.size;
-
- // We emulate a SD card where the archive bit has never been cleared, as it would be on
- // most user SD cards.
- // Some homebrews (blargSNES for instance) are known to mistakenly use the archive bit as a
- // file bit.
- entry.is_archive = !file.isDirectory;
-
- ++entries_read;
- ++children_iterator;
- }
- return entries_read;
-}
-
-} // namespace FileSys