mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-01-06 03:29:55 -06:00
Implement installer with support for ISO, STFS and SVOD. Also implement XEX Patcher. (#5)
This commit is contained in:
24
UnleashedRecomp/install/virtual_file_system.h
Normal file
24
UnleashedRecomp/install/virtual_file_system.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
struct VirtualFileSystem {
|
||||
virtual ~VirtualFileSystem() { };
|
||||
virtual bool load(const std::string &path, uint8_t *fileData, size_t fileDataMaxByteCount) const = 0;
|
||||
virtual size_t getSize(const std::string &path) const = 0;
|
||||
virtual bool exists(const std::string &path) const = 0;
|
||||
|
||||
// Concrete implementation shortcut.
|
||||
bool load(const std::string &path, std::vector<uint8_t> &fileData)
|
||||
{
|
||||
size_t fileDataSize = getSize(path);
|
||||
if (fileDataSize == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
fileData.resize(fileDataSize);
|
||||
return load(path, fileData.data(), fileDataSize);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user