diff --git a/build/CodeGen/results.csv b/build/CodeGen/results.csv
index 4107e391..5fc635ef 100644
--- a/build/CodeGen/results.csv
+++ b/build/CodeGen/results.csv
@@ -905,9 +905,9 @@ Module,DescriptionStart,DescriptionEnd,Flags,Namespace,Name,Summary
2,6065,,,,InvalidMountName,
2,6066,,,,ExtensionSizeTooLarge,
2,6067,,,,ExtensionSizeInvalid,
-2,6068,,,,InvalidSaveDataInfoReader,
-2,6069,,,,InvalidCacheStorageSize,
-2,6070,,,,InvalidCacheStorageIndex,
+2,6068,,,,InvalidHandle,
+2,6069,,,,CacheStorageSizeTooLarge,
+2,6070,,,,CacheStorageIndexTooLarge,
2,6071,,,,InvalidCommitNameCount,Up to 10 file systems can be committed at the same time.
2,6072,,,,InvalidOpenMode,
2,6073,,,,InvalidFileSize,
diff --git a/src/LibHac/Fs/ApplicationSaveDataManagement.cs b/src/LibHac/Fs/ApplicationSaveDataManagement.cs
index 6387dbb6..4c62cfae 100644
--- a/src/LibHac/Fs/ApplicationSaveDataManagement.cs
+++ b/src/LibHac/Fs/ApplicationSaveDataManagement.cs
@@ -325,6 +325,26 @@ namespace LibHac.Fs
return EnsureApplicationCacheStorageImpl(fs, out requiredSize, out target, applicationId,
nacp.SaveDataOwnerId.Value, 0, nacp.CacheStorageSize, nacp.CacheStorageJournalSize, true);
+
+ }
+
+ public static Result CreateApplicationCacheStorage(this FileSystemClient fs, out long requiredSize,
+ out CacheStorageTargetMedia target, Ncm.ApplicationId applicationId, ref ApplicationControlProperty nacp,
+ ushort index, long dataSize, long journalSize)
+ {
+ UnsafeHelpers.SkipParamInit(out requiredSize, out target);
+
+ if (index > nacp.CacheStorageMaxIndex)
+ return ResultFs.CacheStorageIndexTooLarge.Log();
+
+ if (dataSize + journalSize > nacp.CacheStorageMaxSizeAndMaxJournalSize)
+ return ResultFs.CacheStorageSizeTooLarge.Log();
+
+ Result rc = fs.EnsureApplicationCacheStorage(out requiredSize, out target, applicationId,
+ nacp.SaveDataOwnerId.Value, index, dataSize, journalSize, false);
+
+ fs.Impl.AbortIfNeeded(rc);
+ return rc;
}
public static Result EnsureApplicationBcatDeliveryCacheStorage(this FileSystemClient fs, out long requiredSize,
diff --git a/src/LibHac/Fs/ResultFs.cs b/src/LibHac/Fs/ResultFs.cs
index 9692f072..fa1e3c3a 100644
--- a/src/LibHac/Fs/ResultFs.cs
+++ b/src/LibHac/Fs/ResultFs.cs
@@ -1622,11 +1622,11 @@ namespace LibHac.Fs
/// Error code: 2002-6067; Inner value: 0x2f6602
public static Result.Base ExtensionSizeInvalid => new Result.Base(ModuleFs, 6067);
/// Error code: 2002-6068; Inner value: 0x2f6802
- public static Result.Base InvalidSaveDataInfoReader => new Result.Base(ModuleFs, 6068);
+ public static Result.Base InvalidHandle => new Result.Base(ModuleFs, 6068);
/// Error code: 2002-6069; Inner value: 0x2f6a02
- public static Result.Base InvalidCacheStorageSize => new Result.Base(ModuleFs, 6069);
+ public static Result.Base CacheStorageSizeTooLarge => new Result.Base(ModuleFs, 6069);
/// Error code: 2002-6070; Inner value: 0x2f6c02
- public static Result.Base InvalidCacheStorageIndex => new Result.Base(ModuleFs, 6070);
+ public static Result.Base CacheStorageIndexTooLarge => new Result.Base(ModuleFs, 6070);
/// Up to 10 file systems can be committed at the same time.
Error code: 2002-6071; Inner value: 0x2f6e02
public static Result.Base InvalidCommitNameCount => new Result.Base(ModuleFs, 6071);
/// Error code: 2002-6072; Inner value: 0x2f7002
diff --git a/src/LibHac/FsSrv/SaveDataIndexer.cs b/src/LibHac/FsSrv/SaveDataIndexer.cs
index 4b23e3af..4aefe92d 100644
--- a/src/LibHac/FsSrv/SaveDataIndexer.cs
+++ b/src/LibHac/FsSrv/SaveDataIndexer.cs
@@ -828,7 +828,7 @@ namespace LibHac.FsSrv
// Indexer has been reloaded since this info reader was created
if (_handle != _indexer.Handle)
{
- return ResultFs.InvalidSaveDataInfoReader.Log();
+ return ResultFs.InvalidHandle.Log();
}
Span outInfo = MemoryMarshal.Cast(saveDataInfoBuffer.Buffer);