Add CreateApplicationCacheStorage

This commit is contained in:
Alex Barney 2021-06-02 16:22:51 -07:00
parent 3018eeb8e8
commit c59e72606f
4 changed files with 27 additions and 7 deletions

View file

@ -905,9 +905,9 @@ Module,DescriptionStart,DescriptionEnd,Flags,Namespace,Name,Summary
2,6065,,,,InvalidMountName, 2,6065,,,,InvalidMountName,
2,6066,,,,ExtensionSizeTooLarge, 2,6066,,,,ExtensionSizeTooLarge,
2,6067,,,,ExtensionSizeInvalid, 2,6067,,,,ExtensionSizeInvalid,
2,6068,,,,InvalidSaveDataInfoReader, 2,6068,,,,InvalidHandle,
2,6069,,,,InvalidCacheStorageSize, 2,6069,,,,CacheStorageSizeTooLarge,
2,6070,,,,InvalidCacheStorageIndex, 2,6070,,,,CacheStorageIndexTooLarge,
2,6071,,,,InvalidCommitNameCount,Up to 10 file systems can be committed at the same time. 2,6071,,,,InvalidCommitNameCount,Up to 10 file systems can be committed at the same time.
2,6072,,,,InvalidOpenMode, 2,6072,,,,InvalidOpenMode,
2,6073,,,,InvalidFileSize, 2,6073,,,,InvalidFileSize,

1 Module DescriptionStart DescriptionEnd Flags Namespace Name Summary
905 2 6383 UnsupportedCommitProvisionallyForSaveDataFileSystem
906 2 6384 UnsupportedCommitProvisionallyForDirectorySaveDataFileSystem Called DirectorySaveDataFileSystem::CommitProvisionally on a non-user savedata.
907 2 6385 UnsupportedWriteForZeroBitmapHashStorageFile
908 2 6386 UnsupportedSetSizeForZeroBitmapHashStorageFile
909 2 6400 6449 PermissionDenied
910 2 6403 PermissionDeniedForCreateHostFileSystem Returned when opening a host FS on a retail device.
911 2 6450 PortAcceptableCountLimited
912 2 6452 ExternalKeyAlreadyRegistered
913 2 6454 NeedFlush

View file

@ -325,6 +325,26 @@ namespace LibHac.Fs
return EnsureApplicationCacheStorageImpl(fs, out requiredSize, out target, applicationId, return EnsureApplicationCacheStorageImpl(fs, out requiredSize, out target, applicationId,
nacp.SaveDataOwnerId.Value, 0, nacp.CacheStorageSize, nacp.CacheStorageJournalSize, true); 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, public static Result EnsureApplicationBcatDeliveryCacheStorage(this FileSystemClient fs, out long requiredSize,

View file

@ -1622,11 +1622,11 @@ namespace LibHac.Fs
/// <summary>Error code: 2002-6067; Inner value: 0x2f6602</summary> /// <summary>Error code: 2002-6067; Inner value: 0x2f6602</summary>
public static Result.Base ExtensionSizeInvalid => new Result.Base(ModuleFs, 6067); public static Result.Base ExtensionSizeInvalid => new Result.Base(ModuleFs, 6067);
/// <summary>Error code: 2002-6068; Inner value: 0x2f6802</summary> /// <summary>Error code: 2002-6068; Inner value: 0x2f6802</summary>
public static Result.Base InvalidSaveDataInfoReader => new Result.Base(ModuleFs, 6068); public static Result.Base InvalidHandle => new Result.Base(ModuleFs, 6068);
/// <summary>Error code: 2002-6069; Inner value: 0x2f6a02</summary> /// <summary>Error code: 2002-6069; Inner value: 0x2f6a02</summary>
public static Result.Base InvalidCacheStorageSize => new Result.Base(ModuleFs, 6069); public static Result.Base CacheStorageSizeTooLarge => new Result.Base(ModuleFs, 6069);
/// <summary>Error code: 2002-6070; Inner value: 0x2f6c02</summary> /// <summary>Error code: 2002-6070; Inner value: 0x2f6c02</summary>
public static Result.Base InvalidCacheStorageIndex => new Result.Base(ModuleFs, 6070); public static Result.Base CacheStorageIndexTooLarge => new Result.Base(ModuleFs, 6070);
/// <summary>Up to 10 file systems can be committed at the same time.<br/>Error code: 2002-6071; Inner value: 0x2f6e02</summary> /// <summary>Up to 10 file systems can be committed at the same time.<br/>Error code: 2002-6071; Inner value: 0x2f6e02</summary>
public static Result.Base InvalidCommitNameCount => new Result.Base(ModuleFs, 6071); public static Result.Base InvalidCommitNameCount => new Result.Base(ModuleFs, 6071);
/// <summary>Error code: 2002-6072; Inner value: 0x2f7002</summary> /// <summary>Error code: 2002-6072; Inner value: 0x2f7002</summary>

View file

@ -828,7 +828,7 @@ namespace LibHac.FsSrv
// Indexer has been reloaded since this info reader was created // Indexer has been reloaded since this info reader was created
if (_handle != _indexer.Handle) if (_handle != _indexer.Handle)
{ {
return ResultFs.InvalidSaveDataInfoReader.Log(); return ResultFs.InvalidHandle.Log();
} }
Span<SaveDataInfo> outInfo = MemoryMarshal.Cast<byte, SaveDataInfo>(saveDataInfoBuffer.Buffer); Span<SaveDataInfo> outInfo = MemoryMarshal.Cast<byte, SaveDataInfo>(saveDataInfoBuffer.Buffer);