mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Fix a bug when ensuring bcat saves exist
This commit is contained in:
parent
fe2549cb2a
commit
903942b2f4
2 changed files with 87 additions and 1 deletions
|
@ -210,7 +210,7 @@ public static class ApplicationSaveDataManagement
|
||||||
|
|
||||||
if (bcatDeliveryCacheStorageSize > 0)
|
if (bcatDeliveryCacheStorageSize > 0)
|
||||||
{
|
{
|
||||||
Result res = SaveDataFilter.Make(out SaveDataFilter filter, programId: default, SaveDataType.Bcat,
|
Result res = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, SaveDataType.Bcat,
|
||||||
userId: default, saveDataId: default, index: default);
|
userId: default, saveDataId: default, index: default);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,35 @@ public class ApplicationSaveDataManagementTests
|
||||||
Assert.Equal(SaveDataType.Account, info[0].Type);
|
Assert.Equal(SaveDataType.Account, info[0].Type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public static void EnsureApplicationSaveData_CreatesMultipleAccountSaveData_AllSavesExist()
|
||||||
|
{
|
||||||
|
FileSystemClient fs = FileSystemServerFactory.CreateClient(true);
|
||||||
|
|
||||||
|
var userId = new Uid(2, 3);
|
||||||
|
|
||||||
|
var controlProperty = new ApplicationControlProperty
|
||||||
|
{
|
||||||
|
UserAccountSaveDataSize = 0x1000,
|
||||||
|
UserAccountSaveDataJournalSize = 0x1000
|
||||||
|
};
|
||||||
|
|
||||||
|
Assert.Success(fs.EnsureApplicationSaveData(out _, new Ncm.ApplicationId(11), in controlProperty, in userId));
|
||||||
|
Assert.Success(fs.EnsureApplicationSaveData(out _, new Ncm.ApplicationId(12), in controlProperty, in userId));
|
||||||
|
AssertSaveExists();
|
||||||
|
|
||||||
|
void AssertSaveExists()
|
||||||
|
{
|
||||||
|
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||||
|
fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User);
|
||||||
|
|
||||||
|
var info = new SaveDataInfo[3];
|
||||||
|
Assert.Success(iterator.Get.ReadSaveDataInfo(out long entriesRead, info));
|
||||||
|
|
||||||
|
Assert.Equal(2, entriesRead);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public static void EnsureApplicationSaveData_CreatesDeviceSaveData()
|
public static void EnsureApplicationSaveData_CreatesDeviceSaveData()
|
||||||
|
@ -81,6 +110,35 @@ public class ApplicationSaveDataManagementTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public static void EnsureApplicationSaveData_CreatesMultipleDeviceSaveData_AllSavesExist()
|
||||||
|
{
|
||||||
|
FileSystemClient fs = FileSystemServerFactory.CreateClient(true);
|
||||||
|
|
||||||
|
var userId = new Uid(2, 3);
|
||||||
|
|
||||||
|
var controlProperty = new ApplicationControlProperty
|
||||||
|
{
|
||||||
|
DeviceSaveDataSize = 0x1000,
|
||||||
|
DeviceSaveDataJournalSize = 0x1000
|
||||||
|
};
|
||||||
|
|
||||||
|
Assert.Success(fs.EnsureApplicationSaveData(out _, new Ncm.ApplicationId(11), in controlProperty, in userId));
|
||||||
|
Assert.Success(fs.EnsureApplicationSaveData(out _, new Ncm.ApplicationId(12), in controlProperty, in userId));
|
||||||
|
AssertSaveExists();
|
||||||
|
|
||||||
|
void AssertSaveExists()
|
||||||
|
{
|
||||||
|
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||||
|
fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User);
|
||||||
|
|
||||||
|
var info = new SaveDataInfo[3];
|
||||||
|
Assert.Success(iterator.Get.ReadSaveDataInfo(out long entriesRead, info));
|
||||||
|
|
||||||
|
Assert.Equal(2, entriesRead);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public static void EnsureApplicationSaveData_CreatesBcatCacheStorage()
|
public static void EnsureApplicationSaveData_CreatesBcatCacheStorage()
|
||||||
{
|
{
|
||||||
|
@ -115,6 +173,34 @@ public class ApplicationSaveDataManagementTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public static void EnsureApplicationSaveData_CreatesMultipleBcatCacheStorages_AllSavesExist()
|
||||||
|
{
|
||||||
|
FileSystemClient fs = FileSystemServerFactory.CreateClient(true);
|
||||||
|
|
||||||
|
var userId = new Uid(2, 3);
|
||||||
|
|
||||||
|
var controlProperty = new ApplicationControlProperty
|
||||||
|
{
|
||||||
|
BcatDeliveryCacheStorageSize = 0x1000
|
||||||
|
};
|
||||||
|
|
||||||
|
Assert.Success(fs.EnsureApplicationSaveData(out _, new Ncm.ApplicationId(11), in controlProperty, in userId));
|
||||||
|
Assert.Success(fs.EnsureApplicationSaveData(out _, new Ncm.ApplicationId(12), in controlProperty, in userId));
|
||||||
|
AssertSaveExists();
|
||||||
|
|
||||||
|
void AssertSaveExists()
|
||||||
|
{
|
||||||
|
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||||
|
fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User);
|
||||||
|
|
||||||
|
var info = new SaveDataInfo[3];
|
||||||
|
Assert.Success(iterator.Get.ReadSaveDataInfo(out long entriesRead, info));
|
||||||
|
|
||||||
|
Assert.Equal(2, entriesRead);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public static void EnsureApplicationSaveData_CreatesTemporaryStorage()
|
public static void EnsureApplicationSaveData_CreatesTemporaryStorage()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue