mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-28 14:23:18 +00:00
draft fs design
This commit is contained in:
parent
90d24c3a3c
commit
eb307b9cd9
4 changed files with 81 additions and 1 deletions
|
@ -0,0 +1,25 @@
|
|||
#pragma once
|
||||
#include <types.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Emulator::Host::GenericFS {
|
||||
|
||||
enum FileAccess {
|
||||
FILEACCESS_READ = 0,
|
||||
FILEACCESS_WRITE = 1,
|
||||
FILEACCESS_READWRITE = 2
|
||||
|
||||
};
|
||||
|
||||
class GenericHandleAllocator {
|
||||
public:
|
||||
virtual u32 requestHandle() = 0;
|
||||
virtual void releaseHandle(u32 handle) = 0;
|
||||
};
|
||||
|
||||
class AbstractFileSystem {
|
||||
virtual u32 openFile(std::string filename, FileAccess access) = 0;
|
||||
virtual void closeFile(u32 handle) = 0;
|
||||
};
|
||||
} // namespace Emulator::Host::GenericFS
|
|
@ -0,0 +1,20 @@
|
|||
#include "meta_file_system.h"
|
||||
|
||||
namespace Emulator::Host::GenericFS {
|
||||
|
||||
void MetaFileSystem::mount(std::string prefix, AbstractFileSystem* system) {}
|
||||
|
||||
void MetaFileSystem::unMount(AbstractFileSystem* system) {}
|
||||
|
||||
void MetaFileSystem::unMountAll() {}
|
||||
|
||||
bool MetaFileSystem::mapFilePath(std::string inpath, std::string* outpath, AbstractFileSystem** system) { return false; }
|
||||
|
||||
void MetaFileSystem::releaseHandle(u32 handle) {}
|
||||
|
||||
u32 MetaFileSystem::openFile(std::string filename, FileAccess access) { return u32(); }
|
||||
|
||||
void MetaFileSystem::closeFile(u32 handle) {}
|
||||
|
||||
|
||||
} // namespace Emulator::Host::GenericFS
|
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
#include <types.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "generic_file_system.h"
|
||||
|
||||
namespace Emulator::Host::GenericFS {
|
||||
|
||||
class MetaFileSystem : public GenericHandleAllocator, AbstractFileSystem {
|
||||
struct System {
|
||||
std::string prefix;
|
||||
AbstractFileSystem *system;
|
||||
};
|
||||
|
||||
u32 current;
|
||||
std::vector<System> fileSystems;
|
||||
std::string currentDirectory;
|
||||
|
||||
public:
|
||||
MetaFileSystem() : current(0) {}
|
||||
|
||||
void mount(std::string prefix, AbstractFileSystem *system);
|
||||
void unMount(AbstractFileSystem *system);
|
||||
void unMountAll();
|
||||
AbstractFileSystem *getHandleOwner(u32 handle);
|
||||
bool mapFilePath(std::string inpath, std::string *outpath, AbstractFileSystem **system);
|
||||
u32 requestHandle() { return ++current; }
|
||||
void releaseHandle(u32 handle);
|
||||
u32 openFile(std::string filename, FileAccess access);
|
||||
void closeFile(u32 handle);
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue