return NotFormatted on non-shared NAND archive (??)

This commit is contained in:
Ada 2024-03-08 22:05:26 +00:00
parent 0cd81c9ed6
commit fe9167ee66
No known key found for this signature in database
GPG key ID: 066E56D5C9F4E50D
3 changed files with 6 additions and 5 deletions

View file

@ -13,8 +13,8 @@ struct ExtSaveDataInfo {
class ExtSaveDataArchive : public ArchiveBase {
public:
ExtSaveDataArchive(Memory& mem, const std::string& folder, u64 saveId, bool isShared = false) : ArchiveBase(mem),
archiveSaveId(saveId), isShared(isShared), backingFolder(folder) {}
ExtSaveDataArchive(Memory& mem, const std::string& folder, u64 saveId, bool isShared = false, bool isNAND = false) : ArchiveBase(mem),
archiveSaveId(saveId), isShared(isShared), isNAND(isNAND), backingFolder(folder) {}
u64 getFreeBytes() override { Helpers::panic("ExtSaveData::GetFreeBytes unimplemented"); return 0; }
std::string name() override { return "ExtSaveData::" + backingFolder + "::" + std::to_string(archiveSaveId); }
@ -43,5 +43,6 @@ public:
u64 archiveSaveId = 0;
bool isShared = false;
bool isNAND = false;
std::string backingFolder; // Backing folder for the archive. Can be NAND, Gamecard or SD depending on the archive path.
};

View file

@ -296,7 +296,7 @@ Rust::Result<ArchiveBase*, HorizonResult> ExtSaveDataArchive::openArchive(const
const fs::path formatInfoPath = getFormatInfoPath(path);
// Format info not found so the archive is not formatted
if (!fs::is_regular_file(formatInfoPath)) {
return Err(Result::FS::NotFoundInvalid);
return isNAND ? Err(Result::FS::NotFormatted) : Err(Result::FS::NotFoundInvalid);
}
return Ok((ArchiveBase*)this);

View file

@ -96,14 +96,14 @@ void FSService::initializeFilesystem() {
ExtSaveDataArchive* FSService::getExtArchiveFromID(u64 saveId, bool isShared) {
if (const auto entry = extSaveData_sdmc.find(saveId); entry == extSaveData_sdmc.end()) {
extSaveData_sdmc.emplace(saveId, ExtSaveDataArchive(mem, isShared ? "../SharedFiles/SDMC" : "SDMC", saveId, isShared));
extSaveData_sdmc.emplace(saveId, ExtSaveDataArchive(mem, isShared ? "../SharedFiles/SDMC" : "SDMC", saveId, isShared, false));
}
return &extSaveData_sdmc.at(saveId);
}
ExtSaveDataArchive* FSService::getNANDExtArchiveFromID(u64 saveId, bool isShared) {
if (const auto entry = nandExtSaveData_nand.find(saveId); entry == nandExtSaveData_nand.end()) {
nandExtSaveData_nand.emplace(saveId, ExtSaveDataArchive(mem, isShared ? "../SharedFiles/NAND" : "NAND", saveId, isShared));
nandExtSaveData_nand.emplace(saveId, ExtSaveDataArchive(mem, isShared ? "../SharedFiles/NAND" : "NAND", saveId, isShared, true));
}
return &nandExtSaveData_nand.at(saveId);
}