|
@@ -83,28 +83,32 @@ ResultVal<VirtualDir> SaveDataFactory::Open(SaveDataSpaceId space, SaveDataDescr
|
|
|
return MakeResult<VirtualDir>(std::move(out));
|
|
return MakeResult<VirtualDir>(std::move(out));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-std::string SaveDataFactory::GetFullPath(SaveDataSpaceId space, SaveDataType type, u64 title_id,
|
|
|
|
|
- u128 user_id, u64 save_id) {
|
|
|
|
|
- // According to switchbrew, if a save is of type SaveData and the title id field is 0, it should
|
|
|
|
|
- // be interpreted as the title id of the current process.
|
|
|
|
|
- if (type == SaveDataType::SaveData && title_id == 0)
|
|
|
|
|
- title_id = Core::CurrentProcess()->GetTitleID();
|
|
|
|
|
-
|
|
|
|
|
- std::string out;
|
|
|
|
|
|
|
+VirtualDir SaveDataFactory::GetSaveDataSpaceDirectory(SaveDataSpaceId space) {
|
|
|
|
|
+ return dir->GetDirectoryRelative(GetSaveDataSpaceIdPath(space));
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
+std::string SaveDataFactory::GetSaveDataSpaceIdPath(SaveDataSpaceId space) {
|
|
|
switch (space) {
|
|
switch (space) {
|
|
|
case SaveDataSpaceId::NandSystem:
|
|
case SaveDataSpaceId::NandSystem:
|
|
|
- out = "/system/";
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ return "/system/";
|
|
|
case SaveDataSpaceId::NandUser:
|
|
case SaveDataSpaceId::NandUser:
|
|
|
- out = "/user/";
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ return "/user/";
|
|
|
case SaveDataSpaceId::TemporaryStorage:
|
|
case SaveDataSpaceId::TemporaryStorage:
|
|
|
- out = "/temp/";
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ return "/temp/";
|
|
|
default:
|
|
default:
|
|
|
ASSERT_MSG(false, "Unrecognized SaveDataSpaceId: {:02X}", static_cast<u8>(space));
|
|
ASSERT_MSG(false, "Unrecognized SaveDataSpaceId: {:02X}", static_cast<u8>(space));
|
|
|
|
|
+ return "/unrecognized/"; ///< To prevent corruption when ignoring asserts.
|
|
|
}
|
|
}
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+std::string SaveDataFactory::GetFullPath(SaveDataSpaceId space, SaveDataType type, u64 title_id,
|
|
|
|
|
+ u128 user_id, u64 save_id) {
|
|
|
|
|
+ // According to switchbrew, if a save is of type SaveData and the title id field is 0, it should
|
|
|
|
|
+ // be interpreted as the title id of the current process.
|
|
|
|
|
+ if (type == SaveDataType::SaveData && title_id == 0)
|
|
|
|
|
+ title_id = Core::CurrentProcess()->GetTitleID();
|
|
|
|
|
+
|
|
|
|
|
+ std::string out = GetSaveDataSpaceIdPath(space);
|
|
|
|
|
|
|
|
switch (type) {
|
|
switch (type) {
|
|
|
case SaveDataType::SystemSaveData:
|
|
case SaveDataType::SystemSaveData:
|