mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
[FS] Rehaul to implement all the different things ExtSaveData can target
This commit is contained in:
parent
0f9d94a7d0
commit
f90a266bb4
4 changed files with 71 additions and 24 deletions
|
@ -3,17 +3,20 @@
|
|||
|
||||
class ExtSaveDataArchive : public ArchiveBase {
|
||||
public:
|
||||
ExtSaveDataArchive(Memory& mem) : ArchiveBase(mem) {}
|
||||
ExtSaveDataArchive(Memory& mem, const std::string& folder, bool isShared = false) : ArchiveBase(mem),
|
||||
isShared(isShared), backingFolder(folder) {}
|
||||
|
||||
u64 getFreeBytes() override { Helpers::panic("ExtSaveData::GetFreeBytes unimplemented"); return 0; }
|
||||
std::string name() override { return "ExtSaveData"; }
|
||||
std::string name() override { return "ExtSaveData::" + backingFolder; }
|
||||
|
||||
FSResult createFile(const FSPath& path, u64 size) override;
|
||||
FSResult deleteFile(const FSPath& path) override;
|
||||
|
||||
ArchiveBase* 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;
|
||||
|
||||
bool isShared = false;
|
||||
std::string backingFolder; // Backing folder for the archive. Can be NAND, Gamecard or SD depending on the archive path.
|
||||
};
|
|
@ -22,12 +22,15 @@ class FSService {
|
|||
// The different filesystem archives (Save data, SelfNCCH, SDMC, NCCH, ExtData, etc)
|
||||
SelfNCCHArchive selfNcch;
|
||||
SaveDataArchive saveData;
|
||||
ExtSaveDataArchive extSaveData;
|
||||
ExtSaveDataArchive sharedExtSaveData;
|
||||
SDMCArchive sdmc;
|
||||
NCCHArchive ncch;
|
||||
|
||||
ArchiveBase* getArchiveFromID(u32 id);
|
||||
ExtSaveDataArchive extSaveData_nand;
|
||||
ExtSaveDataArchive extSaveData_cart;
|
||||
ExtSaveDataArchive sharedExtSaveData_nand;
|
||||
ExtSaveDataArchive sharedExtSaveData_cart;
|
||||
|
||||
ArchiveBase* getArchiveFromID(u32 id, const FSPath& archivePath);
|
||||
std::optional<Handle> openArchiveHandle(u32 archiveID, const FSPath& path);
|
||||
Rust::Result<Handle, FSResult> openDirectoryHandle(ArchiveBase* archive, const FSPath& path);
|
||||
std::optional<Handle> openFileHandle(ArchiveBase* archive, const FSPath& path, const FSPath& archivePath, const FilePerms& perms);
|
||||
|
@ -53,11 +56,10 @@ class FSService {
|
|||
u32 priority;
|
||||
|
||||
public:
|
||||
FSService(Memory& mem, Kernel& kernel) : mem(mem), saveData(mem), extSaveData(mem), sharedExtSaveData(mem), sdmc(mem),
|
||||
selfNcch(mem), ncch(mem), kernel(kernel)
|
||||
{
|
||||
sharedExtSaveData.isShared = true; // Need to do this here because templates and virtual classes do not mix well
|
||||
}
|
||||
FSService(Memory& mem, Kernel& kernel) : mem(mem), saveData(mem), extSaveData_nand(mem, "NAND"),
|
||||
sharedExtSaveData_nand(mem, "NAND", true), extSaveData_cart(mem, "CartSave"), sharedExtSaveData_cart(mem, "CartSave", true),
|
||||
sdmc(mem), selfNcch(mem), ncch(mem), kernel(kernel)
|
||||
{}
|
||||
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue