mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Rename StorageType to StorageLayoutType
This commit is contained in:
parent
d28c38a9d0
commit
c765ab999e
7 changed files with 60 additions and 60 deletions
|
@ -112,7 +112,7 @@ public readonly struct BaseFileSystemService
|
||||||
if (!accessibility.CanRead || !accessibility.CanWrite)
|
if (!accessibility.CanRead || !accessibility.CanWrite)
|
||||||
return ResultFs.PermissionDenied.Log();
|
return ResultFs.PermissionDenied.Log();
|
||||||
|
|
||||||
const StorageType storageFlag = StorageType.Bis;
|
const StorageLayoutType storageFlag = StorageLayoutType.Bis;
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||||
|
|
||||||
// Normalize the path
|
// Normalize the path
|
||||||
|
@ -218,7 +218,7 @@ public readonly struct BaseFileSystemService
|
||||||
if (!accessibility.CanRead || !accessibility.CanWrite)
|
if (!accessibility.CanRead || !accessibility.CanWrite)
|
||||||
return ResultFs.PermissionDenied.Log();
|
return ResultFs.PermissionDenied.Log();
|
||||||
|
|
||||||
const StorageType storageFlag = StorageType.Bis;
|
const StorageLayoutType storageFlag = StorageLayoutType.Bis;
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||||
|
|
||||||
using var fileSystem = new SharedRef<IFileSystem>();
|
using var fileSystem = new SharedRef<IFileSystem>();
|
||||||
|
|
|
@ -61,7 +61,7 @@ public readonly struct BaseStorageService
|
||||||
|
|
||||||
public Result OpenBisStorage(ref SharedRef<IStorageSf> outStorage, BisPartitionId id)
|
public Result OpenBisStorage(ref SharedRef<IStorageSf> outStorage, BisPartitionId id)
|
||||||
{
|
{
|
||||||
var storageFlag = StorageType.Bis;
|
var storageFlag = StorageLayoutType.Bis;
|
||||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(storageFlag);
|
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
|
|
|
@ -803,7 +803,7 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||||
public Result OpenCloudBackupWorkStorageFileSystem(ref SharedRef<IFileSystemSf> outFileSystem,
|
public Result OpenCloudBackupWorkStorageFileSystem(ref SharedRef<IFileSystemSf> outFileSystem,
|
||||||
CloudBackupWorkStorageId storageId)
|
CloudBackupWorkStorageId storageId)
|
||||||
{
|
{
|
||||||
var storageFlag = StorageType.NonGameCard;
|
var storageFlag = StorageLayoutType.NonGameCard;
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
|
@ -836,7 +836,7 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||||
|
|
||||||
public Result OpenCustomStorageFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, CustomStorageId storageId)
|
public Result OpenCustomStorageFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, CustomStorageId storageId)
|
||||||
{
|
{
|
||||||
var storageFlag = StorageType.NonGameCard;
|
var storageFlag = StorageLayoutType.NonGameCard;
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
|
|
|
@ -73,7 +73,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||||
public Result OpenFileSystemWithPatch(ref SharedRef<IFileSystemSf> outFileSystem, ProgramId programId,
|
public Result OpenFileSystemWithPatch(ref SharedRef<IFileSystemSf> outFileSystem, ProgramId programId,
|
||||||
FileSystemProxyType fsType)
|
FileSystemProxyType fsType)
|
||||||
{
|
{
|
||||||
const StorageType storageFlag = StorageType.All;
|
const StorageLayoutType storageFlag = StorageLayoutType.All;
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||||
|
|
||||||
// Get the program info for the caller and verify permissions
|
// Get the program info for the caller and verify permissions
|
||||||
|
@ -228,7 +228,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||||
public Result OpenFileSystemWithId(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath path,
|
public Result OpenFileSystemWithId(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath path,
|
||||||
ulong id, FileSystemProxyType fsType)
|
ulong id, FileSystemProxyType fsType)
|
||||||
{
|
{
|
||||||
const StorageType storageFlag = StorageType.All;
|
const StorageLayoutType storageFlag = StorageLayoutType.All;
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
|
@ -361,7 +361,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out outRightsId);
|
UnsafeHelpers.SkipParamInit(out outRightsId);
|
||||||
|
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.All);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.All);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
if (rc.IsFailure()) return rc;
|
if (rc.IsFailure()) return rc;
|
||||||
|
@ -389,7 +389,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||||
const ulong checkThroughProgramId = ulong.MaxValue;
|
const ulong checkThroughProgramId = ulong.MaxValue;
|
||||||
UnsafeHelpers.SkipParamInit(out outRightsId, out outKeyGeneration);
|
UnsafeHelpers.SkipParamInit(out outRightsId, out outKeyGeneration);
|
||||||
|
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.All);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.All);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
if (rc.IsFailure()) return rc;
|
if (rc.IsFailure()) return rc;
|
||||||
|
@ -426,7 +426,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out isHostFs);
|
UnsafeHelpers.SkipParamInit(out isHostFs);
|
||||||
|
|
||||||
StorageType storageFlag = _serviceImpl.GetStorageFlag(programId);
|
StorageLayoutType storageFlag = _serviceImpl.GetStorageFlag(programId);
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||||
|
|
||||||
using var programPath = new Path();
|
using var programPath = new Path();
|
||||||
|
@ -452,7 +452,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||||
public Result OpenContentStorageFileSystem(ref SharedRef<IFileSystemSf> outFileSystem,
|
public Result OpenContentStorageFileSystem(ref SharedRef<IFileSystemSf> outFileSystem,
|
||||||
ContentStorageId contentStorageId)
|
ContentStorageId contentStorageId)
|
||||||
{
|
{
|
||||||
StorageType storageFlag = contentStorageId == ContentStorageId.System ? StorageType.Bis : StorageType.All;
|
StorageLayoutType storageFlag = contentStorageId == ContentStorageId.System ? StorageLayoutType.Bis : StorageLayoutType.All;
|
||||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(storageFlag);
|
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
|
@ -535,7 +535,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||||
|
|
||||||
public Result OpenRegisteredUpdatePartition(ref SharedRef<IFileSystemSf> outFileSystem)
|
public Result OpenRegisteredUpdatePartition(ref SharedRef<IFileSystemSf> outFileSystem)
|
||||||
{
|
{
|
||||||
var storageFlag = StorageType.All;
|
var storageFlag = StorageLayoutType.All;
|
||||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(storageFlag);
|
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
|
|
|
@ -815,13 +815,13 @@ public class NcaFileSystemServiceImpl
|
||||||
return _locationResolverSet.ResolveRegisteredHtmlDocumentPath(ref path, id);
|
return _locationResolverSet.ResolveRegisteredHtmlDocumentPath(ref path, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal StorageType GetStorageFlag(ulong programId)
|
internal StorageLayoutType GetStorageFlag(ulong programId)
|
||||||
{
|
{
|
||||||
if (programId >= _config.SpeedEmulationRange.ProgramIdMin &&
|
if (programId >= _config.SpeedEmulationRange.ProgramIdMin &&
|
||||||
programId <= _config.SpeedEmulationRange.ProgramIdMax)
|
programId <= _config.SpeedEmulationRange.ProgramIdMax)
|
||||||
return StorageType.Bis;
|
return StorageLayoutType.Bis;
|
||||||
else
|
else
|
||||||
return StorageType.All;
|
return StorageLayoutType.All;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result HandleResolubleAccessFailure(out bool wasDeferred, Result resultForNoFailureDetected,
|
public Result HandleResolubleAccessFailure(out bool wasDeferred, Result resultForNoFailureDetected,
|
||||||
|
|
|
@ -450,7 +450,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
|
|
||||||
public Result DeleteSaveDataFileSystem(ulong saveDataId)
|
public Result DeleteSaveDataFileSystem(ulong saveDataId)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.Bis);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.Bis);
|
||||||
|
|
||||||
return DeleteSaveDataFileSystemCommon(SaveDataSpaceId.System, saveDataId);
|
return DeleteSaveDataFileSystemCommon(SaveDataSpaceId.System, saveDataId);
|
||||||
}
|
}
|
||||||
|
@ -473,7 +473,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
|
|
||||||
public Result DeleteSaveDataFileSystemBySaveDataSpaceId(SaveDataSpaceId spaceId, ulong saveDataId)
|
public Result DeleteSaveDataFileSystemBySaveDataSpaceId(SaveDataSpaceId spaceId, ulong saveDataId)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.NonGameCard);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||||
|
|
||||||
return DeleteSaveDataFileSystemBySaveDataSpaceIdCore(spaceId, saveDataId);
|
return DeleteSaveDataFileSystemBySaveDataSpaceIdCore(spaceId, saveDataId);
|
||||||
}
|
}
|
||||||
|
@ -499,7 +499,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
public Result DeleteSaveDataFileSystemBySaveDataAttribute(SaveDataSpaceId spaceId,
|
public Result DeleteSaveDataFileSystemBySaveDataAttribute(SaveDataSpaceId spaceId,
|
||||||
in SaveDataAttribute attribute)
|
in SaveDataAttribute attribute)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.NonGameCard);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||||
|
|
||||||
Result rs = GetSaveDataInfo(out SaveDataInfo info, spaceId, in attribute);
|
Result rs = GetSaveDataInfo(out SaveDataInfo info, spaceId, in attribute);
|
||||||
if (rs.IsFailure()) return rs;
|
if (rs.IsFailure()) return rs;
|
||||||
|
@ -691,7 +691,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
bool accessorInitialized = false;
|
bool accessorInitialized = false;
|
||||||
Result rc;
|
Result rc;
|
||||||
|
|
||||||
StorageType storageFlag = DecidePossibleStorageFlag(attribute.Type, creationInfo.SpaceId);
|
StorageLayoutType storageFlag = DecidePossibleStorageFlag(attribute.Type, creationInfo.SpaceId);
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||||
|
|
||||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||||
|
@ -863,7 +863,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out info);
|
UnsafeHelpers.SkipParamInit(out info);
|
||||||
|
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.NonGameCard);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||||
|
|
||||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||||
Result rc = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
Result rc = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||||
|
@ -906,7 +906,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
private Result CreateSaveDataFileSystemWithHashSaltImpl(in SaveDataAttribute attribute,
|
private Result CreateSaveDataFileSystemWithHashSaltImpl(in SaveDataAttribute attribute,
|
||||||
in SaveDataCreationInfo creationInfo, in SaveDataMetaInfo metaInfo, in Optional<HashSalt> hashSalt)
|
in SaveDataCreationInfo creationInfo, in SaveDataMetaInfo metaInfo, in Optional<HashSalt> hashSalt)
|
||||||
{
|
{
|
||||||
StorageType storageFlag = DecidePossibleStorageFlag(attribute.Type, creationInfo.SpaceId);
|
StorageLayoutType storageFlag = DecidePossibleStorageFlag(attribute.Type, creationInfo.SpaceId);
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
|
@ -943,7 +943,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
public Result CreateSaveDataFileSystemBySystemSaveDataId(in SaveDataAttribute attribute,
|
public Result CreateSaveDataFileSystemBySystemSaveDataId(in SaveDataAttribute attribute,
|
||||||
in SaveDataCreationInfo creationInfo)
|
in SaveDataCreationInfo creationInfo)
|
||||||
{
|
{
|
||||||
StorageType storageFlag = DecidePossibleStorageFlag(attribute.Type, creationInfo.SpaceId);
|
StorageLayoutType storageFlag = DecidePossibleStorageFlag(attribute.Type, creationInfo.SpaceId);
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
|
@ -1083,7 +1083,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
private Result OpenUserSaveDataFileSystemCore(ref SharedRef<IFileSystemSf> outFileSystem,
|
private Result OpenUserSaveDataFileSystemCore(ref SharedRef<IFileSystemSf> outFileSystem,
|
||||||
SaveDataSpaceId spaceId, in SaveDataAttribute attribute, ProgramInfo programInfo, bool openReadOnly)
|
SaveDataSpaceId spaceId, in SaveDataAttribute attribute, ProgramInfo programInfo, bool openReadOnly)
|
||||||
{
|
{
|
||||||
StorageType storageFlag = DecidePossibleStorageFlag(attribute.Type, spaceId);
|
StorageLayoutType storageFlag = DecidePossibleStorageFlag(attribute.Type, spaceId);
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||||
|
|
||||||
// Try grabbing the mount count semaphore
|
// Try grabbing the mount count semaphore
|
||||||
|
@ -1199,7 +1199,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
if (rc.IsFailure()) return rc;
|
if (rc.IsFailure()) return rc;
|
||||||
|
|
||||||
StorageType storageFlag = DecidePossibleStorageFlag(attribute.Type, spaceId);
|
StorageLayoutType storageFlag = DecidePossibleStorageFlag(attribute.Type, spaceId);
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||||
|
|
||||||
Accessibility accessibility =
|
Accessibility accessibility =
|
||||||
|
@ -1272,7 +1272,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out extraData);
|
UnsafeHelpers.SkipParamInit(out extraData);
|
||||||
|
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.NonGameCard);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||||
|
|
||||||
Result rc = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
Result rc = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||||
|
@ -1291,7 +1291,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out extraData);
|
UnsafeHelpers.SkipParamInit(out extraData);
|
||||||
|
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.NonGameCard);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
if (rc.IsFailure()) return rc;
|
if (rc.IsFailure()) return rc;
|
||||||
|
@ -1445,7 +1445,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
private Result WriteSaveDataFileSystemExtraDataCore(SaveDataSpaceId spaceId, ulong saveDataId,
|
private Result WriteSaveDataFileSystemExtraDataCore(SaveDataSpaceId spaceId, ulong saveDataId,
|
||||||
in SaveDataExtraData extraData, SaveDataType saveType, bool updateTimeStamp)
|
in SaveDataExtraData extraData, SaveDataType saveType, bool updateTimeStamp)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.NonGameCard);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||||
|
|
||||||
using Path saveDataRootPath = _saveDataRootPath.DangerousGetPath();
|
using Path saveDataRootPath = _saveDataRootPath.DangerousGetPath();
|
||||||
return _serviceImpl.WriteSaveDataFileSystemExtraData(spaceId, saveDataId, in extraData, in saveDataRootPath,
|
return _serviceImpl.WriteSaveDataFileSystemExtraData(spaceId, saveDataId, in extraData, in saveDataRootPath,
|
||||||
|
@ -1455,7 +1455,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
private Result WriteSaveDataFileSystemExtraDataWithMaskCore(ulong saveDataId, SaveDataSpaceId spaceId,
|
private Result WriteSaveDataFileSystemExtraDataWithMaskCore(ulong saveDataId, SaveDataSpaceId spaceId,
|
||||||
in SaveDataExtraData extraData, in SaveDataExtraData extraDataMask)
|
in SaveDataExtraData extraData, in SaveDataExtraData extraDataMask)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.NonGameCard);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
if (rc.IsFailure()) return rc;
|
if (rc.IsFailure()) return rc;
|
||||||
|
@ -1539,7 +1539,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
|
|
||||||
public Result OpenSaveDataInfoReader(ref SharedRef<ISaveDataInfoReader> outInfoReader)
|
public Result OpenSaveDataInfoReader(ref SharedRef<ISaveDataInfoReader> outInfoReader)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.Bis);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.Bis);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
if (rc.IsFailure()) return rc;
|
if (rc.IsFailure()) return rc;
|
||||||
|
@ -1569,7 +1569,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
public Result OpenSaveDataInfoReaderBySaveDataSpaceId(
|
public Result OpenSaveDataInfoReaderBySaveDataSpaceId(
|
||||||
ref SharedRef<ISaveDataInfoReader> outInfoReader, SaveDataSpaceId spaceId)
|
ref SharedRef<ISaveDataInfoReader> outInfoReader, SaveDataSpaceId spaceId)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.NonGameCard);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
if (rc.IsFailure()) return rc;
|
if (rc.IsFailure()) return rc;
|
||||||
|
@ -1603,7 +1603,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
public Result OpenSaveDataInfoReaderWithFilter(ref SharedRef<ISaveDataInfoReader> outInfoReader,
|
public Result OpenSaveDataInfoReaderWithFilter(ref SharedRef<ISaveDataInfoReader> outInfoReader,
|
||||||
SaveDataSpaceId spaceId, in SaveDataFilter filter)
|
SaveDataSpaceId spaceId, in SaveDataFilter filter)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.NonGameCard);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
if (rc.IsFailure()) return rc;
|
if (rc.IsFailure()) return rc;
|
||||||
|
@ -1664,7 +1664,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
if (saveDataInfoBuffer.Size != Unsafe.SizeOf<SaveDataInfo>())
|
if (saveDataInfoBuffer.Size != Unsafe.SizeOf<SaveDataInfo>())
|
||||||
return ResultFs.InvalidArgument.Log();
|
return ResultFs.InvalidArgument.Log();
|
||||||
|
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.NonGameCard);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
if (rc.IsFailure()) return rc;
|
if (rc.IsFailure()) return rc;
|
||||||
|
@ -1730,7 +1730,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
|
|
||||||
public Result OpenSaveDataInfoReaderOnlyCacheStorage(ref SharedRef<ISaveDataInfoReader> outInfoReader)
|
public Result OpenSaveDataInfoReaderOnlyCacheStorage(ref SharedRef<ISaveDataInfoReader> outInfoReader)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.NonGameCard);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||||
|
|
||||||
// Find where the current program's cache storage is located
|
// Find where the current program's cache storage is located
|
||||||
Result rc = GetCacheStorageSpaceId(out SaveDataSpaceId spaceId);
|
Result rc = GetCacheStorageSpaceId(out SaveDataSpaceId spaceId);
|
||||||
|
@ -1749,7 +1749,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
private Result OpenSaveDataInfoReaderOnlyCacheStorage(ref SharedRef<ISaveDataInfoReader> outInfoReader,
|
private Result OpenSaveDataInfoReaderOnlyCacheStorage(ref SharedRef<ISaveDataInfoReader> outInfoReader,
|
||||||
SaveDataSpaceId spaceId)
|
SaveDataSpaceId spaceId)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.NonGameCard);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||||
|
|
||||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
if (rc.IsFailure()) return rc;
|
if (rc.IsFailure()) return rc;
|
||||||
|
@ -1876,7 +1876,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
|
|
||||||
public Result DeleteCacheStorage(ushort index)
|
public Result DeleteCacheStorage(ushort index)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.NonGameCard);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||||
|
|
||||||
Result rc = FindCacheStorage(out SaveDataInfo saveInfo, out SaveDataSpaceId spaceId, index);
|
Result rc = FindCacheStorage(out SaveDataInfo saveInfo, out SaveDataSpaceId spaceId, index);
|
||||||
if (rc.IsFailure()) return rc;
|
if (rc.IsFailure()) return rc;
|
||||||
|
@ -1891,7 +1891,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out usableDataSize, out journalSize);
|
UnsafeHelpers.SkipParamInit(out usableDataSize, out journalSize);
|
||||||
|
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.NonGameCard);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||||
|
|
||||||
Result rc = FindCacheStorage(out SaveDataInfo saveInfo, out SaveDataSpaceId spaceId, index);
|
Result rc = FindCacheStorage(out SaveDataInfo saveInfo, out SaveDataSpaceId spaceId, index);
|
||||||
if (rc.IsFailure()) return rc;
|
if (rc.IsFailure()) return rc;
|
||||||
|
@ -1972,7 +1972,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
|
|
||||||
public Result CleanUpSaveData()
|
public Result CleanUpSaveData()
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.Bis);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.Bis);
|
||||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||||
|
|
||||||
Result rc = OpenSaveDataIndexerAccessor(ref accessor.Ref(), SaveDataSpaceId.System);
|
Result rc = OpenSaveDataIndexerAccessor(ref accessor.Ref(), SaveDataSpaceId.System);
|
||||||
|
@ -1989,7 +1989,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
|
|
||||||
public Result CompleteSaveDataExtension()
|
public Result CompleteSaveDataExtension()
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.Bis);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.Bis);
|
||||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||||
|
|
||||||
Result rc = OpenSaveDataIndexerAccessor(ref accessor.Ref(), SaveDataSpaceId.System);
|
Result rc = OpenSaveDataIndexerAccessor(ref accessor.Ref(), SaveDataSpaceId.System);
|
||||||
|
@ -2006,7 +2006,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
|
|
||||||
public Result CleanUpTemporaryStorage()
|
public Result CleanUpTemporaryStorage()
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageType.Bis);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.Bis);
|
||||||
using var fileSystem = new SharedRef<IFileSystem>();
|
using var fileSystem = new SharedRef<IFileSystem>();
|
||||||
|
|
||||||
Result rc = _serviceImpl.OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), SaveDataSpaceId.Temporary);
|
Result rc = _serviceImpl.OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), SaveDataSpaceId.Temporary);
|
||||||
|
@ -2197,16 +2197,16 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private StorageType DecidePossibleStorageFlag(SaveDataType type, SaveDataSpaceId spaceId)
|
private StorageLayoutType DecidePossibleStorageFlag(SaveDataType type, SaveDataSpaceId spaceId)
|
||||||
{
|
{
|
||||||
if (type == SaveDataType.Cache || type == SaveDataType.Bcat)
|
if (type == SaveDataType.Cache || type == SaveDataType.Bcat)
|
||||||
return StorageType.Bis | StorageType.SdCard | StorageType.Usb;
|
return StorageLayoutType.Bis | StorageLayoutType.SdCard | StorageLayoutType.Usb;
|
||||||
|
|
||||||
if (type == SaveDataType.System ||
|
if (type == SaveDataType.System ||
|
||||||
spaceId != SaveDataSpaceId.SdSystem && spaceId != SaveDataSpaceId.SdUser)
|
spaceId != SaveDataSpaceId.SdSystem && spaceId != SaveDataSpaceId.SdUser)
|
||||||
return StorageType.Bis;
|
return StorageLayoutType.Bis;
|
||||||
|
|
||||||
return StorageType.SdCard | StorageType.Usb;
|
return StorageLayoutType.SdCard | StorageLayoutType.Usb;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ISaveDataTransferCoreInterface.CreateSaveDataFileSystemCore(in SaveDataAttribute attribute,
|
Result ISaveDataTransferCoreInterface.CreateSaveDataFileSystemCore(in SaveDataAttribute attribute,
|
||||||
|
|
|
@ -7,7 +7,7 @@ using LibHac.Fs.Fsa;
|
||||||
namespace LibHac.FsSystem;
|
namespace LibHac.FsSystem;
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
internal enum StorageType
|
internal enum StorageLayoutType
|
||||||
{
|
{
|
||||||
Bis = 1 << 0,
|
Bis = 1 << 0,
|
||||||
SdCard = 1 << 1,
|
SdCard = 1 << 1,
|
||||||
|
@ -22,9 +22,9 @@ internal enum StorageType
|
||||||
/// Contains functions for validating the storage layout type flag.
|
/// Contains functions for validating the storage layout type flag.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>Based on FS 13.1.0 (nnSdk 13.4.0)</remarks>
|
/// <remarks>Based on FS 13.1.0 (nnSdk 13.4.0)</remarks>
|
||||||
internal static class StorageLayoutType
|
internal static class StorageLayoutTypeFunctions
|
||||||
{
|
{
|
||||||
public static bool IsStorageFlagValid(StorageType storageFlag)
|
public static bool IsStorageFlagValid(StorageLayoutType storageFlag)
|
||||||
{
|
{
|
||||||
return storageFlag != 0;
|
return storageFlag != 0;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ internal static class StorageLayoutType
|
||||||
internal struct ScopedStorageLayoutTypeSetter : IDisposable
|
internal struct ScopedStorageLayoutTypeSetter : IDisposable
|
||||||
{
|
{
|
||||||
// ReSharper disable once UnusedParameter.Local
|
// ReSharper disable once UnusedParameter.Local
|
||||||
public ScopedStorageLayoutTypeSetter(StorageType storageFlag)
|
public ScopedStorageLayoutTypeSetter(StorageLayoutType storageFlag)
|
||||||
{
|
{
|
||||||
// Todo: Implement
|
// Todo: Implement
|
||||||
}
|
}
|
||||||
|
@ -52,14 +52,14 @@ internal struct ScopedStorageLayoutTypeSetter : IDisposable
|
||||||
internal class StorageLayoutTypeSetStorage : IStorage
|
internal class StorageLayoutTypeSetStorage : IStorage
|
||||||
{
|
{
|
||||||
private SharedRef<IStorage> _baseStorage;
|
private SharedRef<IStorage> _baseStorage;
|
||||||
private StorageType _storageFlag;
|
private StorageLayoutType _storageFlag;
|
||||||
|
|
||||||
public StorageLayoutTypeSetStorage(ref SharedRef<IStorage> baseStorage, StorageType storageFlag)
|
public StorageLayoutTypeSetStorage(ref SharedRef<IStorage> baseStorage, StorageLayoutType storageFlag)
|
||||||
{
|
{
|
||||||
_baseStorage = SharedRef<IStorage>.CreateMove(ref baseStorage);
|
_baseStorage = SharedRef<IStorage>.CreateMove(ref baseStorage);
|
||||||
_storageFlag = storageFlag;
|
_storageFlag = storageFlag;
|
||||||
|
|
||||||
Assert.SdkAssert(StorageLayoutType.IsStorageFlagValid(storageFlag));
|
Assert.SdkAssert(StorageLayoutTypeFunctions.IsStorageFlagValid(storageFlag));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
|
@ -120,24 +120,24 @@ internal class StorageLayoutTypeSetFile : IFile
|
||||||
private IFile _baseFile;
|
private IFile _baseFile;
|
||||||
private UniqueRef<IFile> _baseFileUnique;
|
private UniqueRef<IFile> _baseFileUnique;
|
||||||
private SharedRef<IFile> _baseFileShared;
|
private SharedRef<IFile> _baseFileShared;
|
||||||
private StorageType _storageFlag;
|
private StorageLayoutType _storageFlag;
|
||||||
|
|
||||||
public StorageLayoutTypeSetFile(ref UniqueRef<IFile> baseFile, StorageType storageFlag)
|
public StorageLayoutTypeSetFile(ref UniqueRef<IFile> baseFile, StorageLayoutType storageFlag)
|
||||||
{
|
{
|
||||||
_baseFile = baseFile.Get;
|
_baseFile = baseFile.Get;
|
||||||
_baseFileUnique = new UniqueRef<IFile>(ref baseFile);
|
_baseFileUnique = new UniqueRef<IFile>(ref baseFile);
|
||||||
_storageFlag = storageFlag;
|
_storageFlag = storageFlag;
|
||||||
|
|
||||||
Assert.SdkAssert(StorageLayoutType.IsStorageFlagValid(storageFlag));
|
Assert.SdkAssert(StorageLayoutTypeFunctions.IsStorageFlagValid(storageFlag));
|
||||||
}
|
}
|
||||||
|
|
||||||
public StorageLayoutTypeSetFile(ref SharedRef<IFile> baseFile, StorageType storageFlag)
|
public StorageLayoutTypeSetFile(ref SharedRef<IFile> baseFile, StorageLayoutType storageFlag)
|
||||||
{
|
{
|
||||||
_baseFile = baseFile.Get;
|
_baseFile = baseFile.Get;
|
||||||
_baseFileShared = SharedRef<IFile>.CreateMove(ref baseFile);
|
_baseFileShared = SharedRef<IFile>.CreateMove(ref baseFile);
|
||||||
_storageFlag = storageFlag;
|
_storageFlag = storageFlag;
|
||||||
|
|
||||||
Assert.SdkAssert(StorageLayoutType.IsStorageFlagValid(storageFlag));
|
Assert.SdkAssert(StorageLayoutTypeFunctions.IsStorageFlagValid(storageFlag));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
|
@ -198,9 +198,9 @@ internal class StorageLayoutTypeSetFile : IFile
|
||||||
internal class StorageLayoutTypeSetDirectory : IDirectory
|
internal class StorageLayoutTypeSetDirectory : IDirectory
|
||||||
{
|
{
|
||||||
private UniqueRef<IDirectory> _baseDirectory;
|
private UniqueRef<IDirectory> _baseDirectory;
|
||||||
private StorageType _storageFlag;
|
private StorageLayoutType _storageFlag;
|
||||||
|
|
||||||
public StorageLayoutTypeSetDirectory(ref UniqueRef<IDirectory> baseDirectory, StorageType storageFlag)
|
public StorageLayoutTypeSetDirectory(ref UniqueRef<IDirectory> baseDirectory, StorageLayoutType storageFlag)
|
||||||
{
|
{
|
||||||
_baseDirectory = new UniqueRef<IDirectory>(ref baseDirectory);
|
_baseDirectory = new UniqueRef<IDirectory>(ref baseDirectory);
|
||||||
_storageFlag = storageFlag;
|
_storageFlag = storageFlag;
|
||||||
|
@ -236,14 +236,14 @@ internal class StorageLayoutTypeSetDirectory : IDirectory
|
||||||
internal class StorageLayoutTypeSetFileSystem : IFileSystem
|
internal class StorageLayoutTypeSetFileSystem : IFileSystem
|
||||||
{
|
{
|
||||||
private SharedRef<IFileSystem> _baseFileSystem;
|
private SharedRef<IFileSystem> _baseFileSystem;
|
||||||
private StorageType _storageFlag;
|
private StorageLayoutType _storageFlag;
|
||||||
|
|
||||||
public StorageLayoutTypeSetFileSystem(ref SharedRef<IFileSystem> baseFileSystem, StorageType storageFlag)
|
public StorageLayoutTypeSetFileSystem(ref SharedRef<IFileSystem> baseFileSystem, StorageLayoutType storageFlag)
|
||||||
{
|
{
|
||||||
_baseFileSystem = SharedRef<IFileSystem>.CreateMove(ref baseFileSystem);
|
_baseFileSystem = SharedRef<IFileSystem>.CreateMove(ref baseFileSystem);
|
||||||
_storageFlag = storageFlag;
|
_storageFlag = storageFlag;
|
||||||
|
|
||||||
Assert.SdkAssert(StorageLayoutType.IsStorageFlagValid(storageFlag));
|
Assert.SdkAssert(StorageLayoutTypeFunctions.IsStorageFlagValid(storageFlag));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
|
|
Loading…
Reference in a new issue