mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-05-03 02:34:48 +12:00
[FS] Formatting archives v1
This commit is contained in:
parent
2f5bb45d58
commit
4dc04be350
6 changed files with 67 additions and 4 deletions
|
@ -224,6 +224,10 @@ public:
|
|||
return Err(FSResult::FileNotFound);
|
||||
}
|
||||
|
||||
virtual void format(const FSPath& path, const FormatInfo& info) {
|
||||
Helpers::panic("Unimplemented Format for %s archive", name().c_str());
|
||||
}
|
||||
|
||||
// Read size bytes from a file starting at offset "offset" into a certain buffer in memory
|
||||
// Returns the number of bytes read, or nullopt if the read failed
|
||||
virtual std::optional<u32> readFile(FileSession* file, u64 offset, u32 size, u32 dataPointer) = 0;
|
||||
|
|
|
@ -17,6 +17,10 @@ public:
|
|||
FileDescriptor openFile(const FSPath& path, const FilePerms& perms) override;
|
||||
std::optional<u32> readFile(FileSession* file, u64 offset, u32 size, u32 dataPointer) override;
|
||||
|
||||
// Takes in a binary ExtSaveData path, outputs a combination of the backing folder with the low and high save entries of the path
|
||||
// Used for identifying the archive format info files
|
||||
std::string getExtSaveDataPathFromBinary(const FSPath& path);
|
||||
|
||||
bool isShared = false;
|
||||
std::string backingFolder; // Backing folder for the archive. Can be NAND, Gamecard or SD depending on the archive path.
|
||||
};
|
|
@ -11,13 +11,19 @@ public:
|
|||
FSResult createDirectory(const FSPath& path) override;
|
||||
FSResult createFile(const FSPath& path, u64 size) override;
|
||||
FSResult deleteFile(const FSPath& path) override;
|
||||
FormatInfo getFormatInfo(const FSPath& path) override;
|
||||
|
||||
Rust::Result<ArchiveBase*, FSResult> openArchive(const FSPath& path) override;
|
||||
Rust::Result<DirectorySession, FSResult> openDirectory(const FSPath& path) override;
|
||||
FileDescriptor openFile(const FSPath& path, const FilePerms& perms) override;
|
||||
std::optional<u32> readFile(FileSession* file, u64 offset, u32 size, u32 dataPointer) override;
|
||||
|
||||
void format(const FSPath& path, const FormatInfo& info) override;
|
||||
FormatInfo getFormatInfo(const FSPath& path) override;
|
||||
|
||||
std::filesystem::path getFormatInfoPath() {
|
||||
return IOFile::getAppData() / "FormatInfo" / "SaveData.format";
|
||||
}
|
||||
|
||||
// Returns whether the cart has save data or not
|
||||
bool cartHasSaveData() {
|
||||
auto cxi = mem.getCXI();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue