mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
[FS] Done with CreateFile
This commit is contained in:
parent
93d2d300b9
commit
49dcc25795
15 changed files with 85 additions and 3 deletions
|
@ -105,6 +105,12 @@ struct ArchiveSession {
|
|||
// Otherwise the fd of the opened file is returned (or nullptr if the opened file doesn't require one)
|
||||
using FileDescriptor = std::optional<FILE*>;
|
||||
|
||||
enum class CreateFileResult : u32 {
|
||||
Success = 0,
|
||||
AlreadyExists = 0x82044BE,
|
||||
FileTooLarge = 0x86044D2
|
||||
};
|
||||
|
||||
class ArchiveBase {
|
||||
protected:
|
||||
using Handle = u32;
|
||||
|
@ -161,6 +167,7 @@ protected:
|
|||
public:
|
||||
virtual std::string name() = 0;
|
||||
virtual u64 getFreeBytes() = 0;
|
||||
virtual CreateFileResult createFile(const FSPath& path, u64 size) = 0;
|
||||
// Returns nullopt if opening the file failed, otherwise returns a file descriptor to it (nullptr if none is needed)
|
||||
virtual FileDescriptor openFile(const FSPath& path, const FilePerms& perms) = 0;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ public:
|
|||
std::string name() override { return "ExtSaveData"; }
|
||||
|
||||
ArchiveBase* openArchive(const FSPath& path) override;
|
||||
CreateFileResult createFile(const FSPath& path, u64 size) override;
|
||||
FileDescriptor openFile(const FSPath& path, const FilePerms& perms) override;
|
||||
std::optional<u32> readFile(FileSession* file, u64 offset, u32 size, u32 dataPointer) override;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ public:
|
|||
std::string name() override { return "SelfNCCH"; }
|
||||
|
||||
ArchiveBase* openArchive(const FSPath& path) override;
|
||||
CreateFileResult createFile(const FSPath& path, u64 size) override;
|
||||
FileDescriptor openFile(const FSPath& path, const FilePerms& perms) override;
|
||||
std::optional<u32> readFile(FileSession* file, u64 offset, u32 size, u32 dataPointer) override;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ public:
|
|||
std::string name() override { return "SaveData"; }
|
||||
|
||||
ArchiveBase* openArchive(const FSPath& path) override;
|
||||
CreateFileResult createFile(const FSPath& path, u64 size) override;
|
||||
FileDescriptor openFile(const FSPath& path, const FilePerms& perms) override;
|
||||
std::optional<u32> readFile(FileSession* file, u64 offset, u32 size, u32 dataPointer) override;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ public:
|
|||
std::string name() override { return "SDMC"; }
|
||||
|
||||
ArchiveBase* openArchive(const FSPath& path) override;
|
||||
CreateFileResult createFile(const FSPath& path, u64 size) override;
|
||||
FileDescriptor openFile(const FSPath& path, const FilePerms& perms) override;
|
||||
std::optional<u32> readFile(FileSession* file, u64 offset, u32 size, u32 dataPointer) override;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue