Starting work on (Shared)ExtSaveData archive

This commit is contained in:
wheremyfoodat 2023-01-07 03:30:32 +02:00
parent bbb62a83d0
commit 79c89f1f63
8 changed files with 48 additions and 7 deletions

View file

@ -0,0 +1,16 @@
#pragma once
#include "archive_base.hpp"
class ExtSaveDataArchive : public ArchiveBase {
public:
ExtSaveDataArchive(Memory& mem) : ArchiveBase(mem) {}
u64 getFreeBytes() override { Helpers::panic("ExtSaveData::GetFreeBytes unimplemented"); return 0; }
std::string name() override { return "ExtSaveData"; }
bool openFile(const FSPath& path) override;
ArchiveBase* openArchive(const FSPath& path) override;
std::optional<u32> readFile(FileSession* file, u64 offset, u32 size, u32 dataPointer) override;
bool isShared = false;
};

View file

@ -2,7 +2,6 @@
#include "archive_base.hpp"
class SelfNCCHArchive : public ArchiveBase {
public:
SelfNCCHArchive(Memory& mem) : ArchiveBase(mem) {}

View file

@ -2,11 +2,10 @@
#include "archive_base.hpp"
class SaveDataArchive : public ArchiveBase {
public:
SaveDataArchive(Memory& mem) : ArchiveBase(mem) {}
u64 getFreeBytes() override { return 0; }
u64 getFreeBytes() override { Helpers::panic("SaveData::GetFreeBytes unimplemented"); return 0; }
std::string name() override { return "SaveData"; }
bool openFile(const FSPath& path) override;

View file

@ -2,11 +2,10 @@
#include "archive_base.hpp"
class SDMCArchive : public ArchiveBase {
public:
SDMCArchive(Memory& mem) : ArchiveBase(mem) {}
u64 getFreeBytes() override { return 0; }
u64 getFreeBytes() override { Helpers::panic("SDMC::GetFreeBytes unimplemented"); return 0; }
std::string name() override { return "SDMC"; }
bool openFile(const FSPath& path) override;

View file

@ -1,4 +1,5 @@
#pragma once
#include "fs/archive_ext_save_data.hpp"
#include "fs/archive_ncch.hpp"
#include "fs/archive_save_data.hpp"
#include "fs/archive_sdmc.hpp"
@ -20,6 +21,7 @@ class FSService {
// The different filesystem archives (Save data, RomFS+ExeFS, etc)
SelfNCCHArchive selfNcch;
SaveDataArchive saveData;
ExtSaveDataArchive sharedExtSaveData;
SDMCArchive sdmc;
ArchiveBase* getArchiveFromID(u32 id);
@ -41,7 +43,12 @@ class FSService {
u32 priority;
public:
FSService(Memory& mem, Kernel& kernel) : mem(mem), saveData(mem), sdmc(mem), selfNcch(mem), kernel(kernel) {}
FSService(Memory& mem, Kernel& kernel) : mem(mem), saveData(mem), sharedExtSaveData(mem), sdmc(mem), selfNcch(mem),
kernel(kernel)
{
sharedExtSaveData.isShared = true; // Need to do this here because templates and virtual classes do not mix well
}
void reset();
void handleSyncRequest(u32 messagePointer);
};