2014-06-28 01:48:56 +05:30
|
|
|
// Copyright 2014 Citra Emulator Project
|
2014-12-17 11:08:14 +05:30
|
|
|
// Licensed under GPLv2 or any later version
|
2014-06-28 01:48:56 +05:30
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "common/common_types.h"
|
|
|
|
|
2014-12-15 10:21:38 +05:30
|
|
|
#include "core/file_sys/archive_backend.h"
|
2014-06-28 01:48:56 +05:30
|
|
|
#include "core/loader/loader.h"
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// FileSys namespace
|
|
|
|
|
|
|
|
namespace FileSys {
|
|
|
|
|
|
|
|
/// File system interface to the RomFS archive
|
2014-12-15 10:21:38 +05:30
|
|
|
class Archive_RomFS final : public ArchiveBackend {
|
2014-06-28 01:48:56 +05:30
|
|
|
public:
|
2014-07-04 22:41:09 +05:30
|
|
|
Archive_RomFS(const Loader::AppLoader& app_loader);
|
2014-06-28 01:48:56 +05:30
|
|
|
|
2014-12-15 10:14:04 +05:30
|
|
|
std::string GetName() const override { return "RomFS"; }
|
2014-06-28 01:48:56 +05:30
|
|
|
|
2014-09-12 04:12:59 +05:30
|
|
|
/**
|
|
|
|
* Open a file specified by its path, using the specified mode
|
|
|
|
* @param path Path relative to the archive
|
|
|
|
* @param mode Mode to open the file with
|
|
|
|
* @return Opened file, or nullptr
|
|
|
|
*/
|
2014-12-15 12:33:17 +05:30
|
|
|
std::unique_ptr<FileBackend> OpenFile(const Path& path, const Mode mode) const override;
|
2014-09-12 04:12:59 +05:30
|
|
|
|
2014-11-12 00:07:26 +05:30
|
|
|
/**
|
|
|
|
* Delete a file specified by its path
|
|
|
|
* @param path Path relative to the archive
|
|
|
|
* @return Whether the file could be deleted
|
|
|
|
*/
|
|
|
|
bool DeleteFile(const FileSys::Path& path) const override;
|
|
|
|
|
2014-11-24 12:50:04 +05:30
|
|
|
/**
|
|
|
|
* Rename a File specified by its path
|
|
|
|
* @param src_path Source path relative to the archive
|
|
|
|
* @param dest_path Destination path relative to the archive
|
|
|
|
* @return Whether rename succeeded
|
|
|
|
*/
|
|
|
|
bool RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const override;
|
|
|
|
|
2014-11-12 00:07:26 +05:30
|
|
|
/**
|
|
|
|
* Delete a directory specified by its path
|
|
|
|
* @param path Path relative to the archive
|
|
|
|
* @return Whether the directory could be deleted
|
|
|
|
*/
|
|
|
|
bool DeleteDirectory(const FileSys::Path& path) const override;
|
|
|
|
|
2014-10-29 11:22:56 +05:30
|
|
|
/**
|
|
|
|
* Create a directory specified by its path
|
|
|
|
* @param path Path relative to the archive
|
|
|
|
* @return Whether the directory could be created
|
|
|
|
*/
|
2014-11-12 05:57:35 +05:30
|
|
|
bool CreateDirectory(const Path& path) const override;
|
2014-10-29 11:22:56 +05:30
|
|
|
|
2014-11-24 14:42:58 +05:30
|
|
|
/**
|
|
|
|
* Rename a Directory specified by its path
|
|
|
|
* @param src_path Source path relative to the archive
|
|
|
|
* @param dest_path Destination path relative to the archive
|
|
|
|
* @return Whether rename succeeded
|
|
|
|
*/
|
|
|
|
bool RenameDirectory(const FileSys::Path& src_path, const FileSys::Path& dest_path) const override;
|
|
|
|
|
2014-09-12 04:17:05 +05:30
|
|
|
/**
|
|
|
|
* Open a directory specified by its path
|
|
|
|
* @param path Path relative to the archive
|
|
|
|
* @return Opened directory, or nullptr
|
|
|
|
*/
|
2014-12-15 12:29:29 +05:30
|
|
|
std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const override;
|
2014-09-12 04:17:05 +05:30
|
|
|
|
2014-06-28 01:48:56 +05:30
|
|
|
private:
|
2014-12-15 14:11:02 +05:30
|
|
|
friend class File_RomFS;
|
|
|
|
|
2014-06-28 01:48:56 +05:30
|
|
|
std::vector<u8> raw_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace FileSys
|