mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 12:39:13 +12:00
fix shared ext data
also actually use title id for this one.
This commit is contained in:
parent
6c78a5ea9e
commit
bc0708cd10
1 changed files with 15 additions and 6 deletions
|
@ -204,14 +204,12 @@ void ExtSaveDataArchive::format(const FSPath& path, const FormatInfo& info) {
|
||||||
const fs::path saveDataPath = IOFile::getAppData() / getExtSaveDataPath();
|
const fs::path saveDataPath = IOFile::getAppData() / getExtSaveDataPath();
|
||||||
const fs::path formatInfoPath = getFormatInfoPath(path);
|
const fs::path formatInfoPath = getFormatInfoPath(path);
|
||||||
|
|
||||||
|
if (!isShared) {
|
||||||
// Delete all contents by deleting the directory then recreating it
|
// Delete all contents by deleting the directory then recreating it
|
||||||
fs::remove_all(saveDataPath);
|
fs::remove_all(saveDataPath);
|
||||||
fs::create_directories(saveDataPath);
|
fs::create_directories(saveDataPath);
|
||||||
|
|
||||||
if (!isShared) {
|
|
||||||
fs::create_directories(saveDataPath / "user");
|
fs::create_directories(saveDataPath / "user");
|
||||||
fs::create_directories(saveDataPath / "boss");
|
fs::create_directories(saveDataPath / "boss");
|
||||||
// todo: save icon.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write format info on disk
|
// Write format info on disk
|
||||||
|
@ -275,6 +273,10 @@ std::string ExtSaveDataArchive::getExtSaveDataPathFromBinary(const FSPath& path)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ExtSaveDataArchive::getExtSaveDataPath() const {
|
std::string ExtSaveDataArchive::getExtSaveDataPath() const {
|
||||||
|
if (isShared) {
|
||||||
|
return backingFolder + "/" + std::to_string(mem.getProgramID().value_or(0)) + "/" + std::to_string(archiveSaveId);
|
||||||
|
}
|
||||||
|
|
||||||
return backingFolder + "/" + std::to_string(archiveSaveId);
|
return backingFolder + "/" + std::to_string(archiveSaveId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,11 +285,18 @@ Rust::Result<ArchiveBase*, HorizonResult> ExtSaveDataArchive::openArchive(const
|
||||||
Helpers::panic("ExtSaveData accessed with an invalid path in OpenArchive");
|
Helpers::panic("ExtSaveData accessed with an invalid path in OpenArchive");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isShared) {
|
||||||
|
const fs::path saveDataPath = IOFile::getAppData() / getExtSaveDataPath();
|
||||||
|
if (!fs::exists(saveDataPath))
|
||||||
|
fs::create_directories(saveDataPath);
|
||||||
|
return Ok((ArchiveBase*) this);
|
||||||
|
}
|
||||||
|
|
||||||
// Create a format info path in the style of AppData/FormatInfo/Cartridge10390390194.format
|
// Create a format info path in the style of AppData/FormatInfo/Cartridge10390390194.format
|
||||||
const fs::path formatInfoPath = getFormatInfoPath(path);
|
const fs::path formatInfoPath = getFormatInfoPath(path);
|
||||||
// Format info not found so the archive is not formatted
|
// Format info not found so the archive is not formatted
|
||||||
if (!fs::is_regular_file(formatInfoPath)) {
|
if (!fs::is_regular_file(formatInfoPath)) {
|
||||||
return isShared ? Err(Result::FS::NotFormatted) : Err(Result::FS::NotFoundInvalid);
|
return Err(Result::FS::NotFoundInvalid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok((ArchiveBase*)this);
|
return Ok((ArchiveBase*)this);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue