2013-01-31 21:27:00 +00:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
* Xenia : Xbox 360 Emulator Research Project *
|
|
|
|
******************************************************************************
|
|
|
|
* Copyright 2013 Ben Vanik. All rights reserved. *
|
|
|
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
|
|
|
******************************************************************************
|
|
|
|
*/
|
|
|
|
|
2015-06-27 20:31:21 +00:00
|
|
|
#ifndef XENIA_VFS_VIRTUAL_FILE_SYSTEM_H_
|
|
|
|
#define XENIA_VFS_VIRTUAL_FILE_SYSTEM_H_
|
2013-01-31 21:27:00 +00:00
|
|
|
|
2014-08-21 06:26:46 +00:00
|
|
|
#include <memory>
|
2014-08-15 17:19:59 +00:00
|
|
|
#include <string>
|
2014-07-12 01:03:35 +00:00
|
|
|
#include <unordered_map>
|
|
|
|
#include <vector>
|
|
|
|
|
2015-06-27 20:31:21 +00:00
|
|
|
#include "xenia/vfs/entry.h"
|
2013-01-31 21:27:00 +00:00
|
|
|
|
|
|
|
namespace xe {
|
2015-06-27 20:31:21 +00:00
|
|
|
namespace vfs {
|
2013-01-31 21:27:00 +00:00
|
|
|
|
|
|
|
class Device;
|
|
|
|
|
2014-08-15 17:19:59 +00:00
|
|
|
enum class FileSystemType {
|
|
|
|
STFS_TITLE,
|
|
|
|
DISC_IMAGE,
|
|
|
|
XEX_FILE,
|
|
|
|
};
|
2013-01-31 21:27:00 +00:00
|
|
|
|
2015-06-27 20:31:21 +00:00
|
|
|
class VirtualFileSystem {
|
2014-08-15 17:19:59 +00:00
|
|
|
public:
|
2015-06-27 20:31:21 +00:00
|
|
|
VirtualFileSystem();
|
|
|
|
~VirtualFileSystem();
|
2013-01-31 21:27:00 +00:00
|
|
|
|
2014-08-15 17:19:59 +00:00
|
|
|
FileSystemType InferType(const std::wstring& local_path);
|
|
|
|
int InitializeFromPath(FileSystemType type, const std::wstring& local_path);
|
|
|
|
|
|
|
|
int RegisterDevice(const std::string& path, Device* device);
|
|
|
|
int RegisterHostPathDevice(const std::string& path,
|
2015-05-03 17:27:50 +00:00
|
|
|
const std::wstring& local_path, bool read_only);
|
2014-08-15 17:19:59 +00:00
|
|
|
int RegisterDiscImageDevice(const std::string& path,
|
|
|
|
const std::wstring& local_path);
|
|
|
|
int RegisterSTFSContainerDevice(const std::string& path,
|
|
|
|
const std::wstring& local_path);
|
2013-01-31 21:27:00 +00:00
|
|
|
|
2014-08-16 09:30:23 +00:00
|
|
|
int CreateSymbolicLink(const std::string& path, const std::string& target);
|
|
|
|
int DeleteSymbolicLink(const std::string& path);
|
2013-01-31 21:27:00 +00:00
|
|
|
|
2014-08-21 06:26:46 +00:00
|
|
|
std::unique_ptr<Entry> ResolvePath(const std::string& path);
|
2014-08-21 14:54:19 +00:00
|
|
|
X_STATUS Open(std::unique_ptr<Entry> entry, KernelState* kernel_state,
|
|
|
|
Mode mode, bool async, XFile** out_file);
|
2013-01-31 21:27:00 +00:00
|
|
|
|
2014-08-15 17:19:59 +00:00
|
|
|
private:
|
|
|
|
std::vector<Device*> devices_;
|
2014-05-14 05:20:42 +00:00
|
|
|
std::unordered_map<std::string, std::string> symlinks_;
|
2013-01-31 21:27:00 +00:00
|
|
|
};
|
|
|
|
|
2015-06-27 20:31:21 +00:00
|
|
|
} // namespace vfs
|
2013-01-31 21:27:00 +00:00
|
|
|
} // namespace xe
|
|
|
|
|
2015-06-27 20:31:21 +00:00
|
|
|
#endif // XENIA_VFS_VIRTUAL_FILE_SYSTEM_H_
|