mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2025-02-09 13:14:46 +01:00
Change the Ref() extension methods for UniqueRef/SharedRef to properties
This commit is contained in:
parent
f8766b3cc5
commit
d47e0ebedc
@ -61,14 +61,14 @@ public class ArpClient : IDisposable
|
||||
return;
|
||||
|
||||
using var reader = new SharedRef<IReader>();
|
||||
Result res = _hosClient.Sm.GetService(ref reader.Ref(), "arp:r");
|
||||
Result res = _hosClient.Sm.GetService(ref reader.Ref, "arp:r");
|
||||
|
||||
if (res.IsFailure())
|
||||
{
|
||||
throw new HorizonResultException(res, "Failed to initialize arp reader.");
|
||||
}
|
||||
|
||||
_reader.SetByMove(ref reader.Ref());
|
||||
_reader.SetByMove(ref reader.Ref);
|
||||
}
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ public class BcatServer
|
||||
|
||||
using SharedRef<IServiceCreator> service = GetServiceCreator(type);
|
||||
|
||||
Result res = Hos.Sm.RegisterService(new BcatServiceObject(ref service.Ref()), name);
|
||||
Result res = Hos.Sm.RegisterService(new BcatServiceObject(ref service.Ref), name);
|
||||
if (res.IsFailure())
|
||||
{
|
||||
throw new HorizonResultException(res, "Abort");
|
||||
|
@ -105,7 +105,7 @@ public class Package2StorageReader : IDisposable
|
||||
|
||||
// Ini is embedded in the kernel
|
||||
using var kernelStorage = new UniqueRef<IStorage>();
|
||||
Result res = OpenKernel(ref kernelStorage.Ref());
|
||||
Result res = OpenKernel(ref kernelStorage.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!IniExtract.TryGetIni1Offset(out int offset, out int size, kernelStorage.Get))
|
||||
@ -243,7 +243,7 @@ public class Package2StorageReader : IDisposable
|
||||
continue;
|
||||
|
||||
using var payloadStorage = new UniqueRef<IStorage>();
|
||||
Result res = OpenPayload(ref payloadStorage.Ref(), i);
|
||||
Result res = OpenPayload(ref payloadStorage.Ref, i);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
storages.Add(payloadStorage.Release());
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using LibHac.Diag;
|
||||
@ -7,21 +8,6 @@ using LibHac.Diag;
|
||||
|
||||
namespace LibHac.Common;
|
||||
|
||||
public static class SharedRefExtensions
|
||||
{
|
||||
// ReSharper disable once EntityNameCapturedOnly.Global
|
||||
public static ref SharedRef<T> Ref<T>(this in SharedRef<T> value) where T : class, IDisposable
|
||||
{
|
||||
return ref Unsafe.AsRef(in value);
|
||||
}
|
||||
|
||||
// ReSharper disable once EntityNameCapturedOnly.Global
|
||||
public static ref WeakRef<T> Ref<T>(this in WeakRef<T> value) where T : class, IDisposable
|
||||
{
|
||||
return ref Unsafe.AsRef(in value);
|
||||
}
|
||||
}
|
||||
|
||||
internal class RefCount
|
||||
{
|
||||
private int _count;
|
||||
@ -135,6 +121,10 @@ public struct SharedRef<T> : IDisposable where T : class, IDisposable
|
||||
}
|
||||
|
||||
public readonly T Get => _value;
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ref SharedRef<T> Ref => ref Unsafe.AsRef(in this);
|
||||
|
||||
public readonly bool HasValue => Get is not null;
|
||||
public readonly int UseCount => _refCount?.UseCount() ?? 0;
|
||||
|
||||
@ -155,7 +145,7 @@ public struct SharedRef<T> : IDisposable where T : class, IDisposable
|
||||
{
|
||||
var sharedRef = new SharedRef<T>();
|
||||
|
||||
sharedRef._value = Unsafe.As<TFrom, T>(ref other.Ref()._value);
|
||||
sharedRef._value = Unsafe.As<TFrom, T>(ref Unsafe.AsRef(in other._value));
|
||||
sharedRef._refCount = other._refCount;
|
||||
|
||||
sharedRef._refCount?.Increment();
|
||||
@ -165,7 +155,7 @@ public struct SharedRef<T> : IDisposable where T : class, IDisposable
|
||||
|
||||
public static SharedRef<T> Create<TFrom>(in WeakRef<TFrom> other) where TFrom : class, T
|
||||
{
|
||||
ref SharedRef<TFrom> otherShared = ref Unsafe.As<WeakRef<TFrom>, SharedRef<TFrom>>(ref other.Ref());
|
||||
ref SharedRef<TFrom> otherShared = ref Unsafe.As<WeakRef<TFrom>, SharedRef<TFrom>>(ref Unsafe.AsRef(in other));
|
||||
|
||||
var sharedRef = new SharedRef<T>();
|
||||
|
||||
@ -185,13 +175,12 @@ public struct SharedRef<T> : IDisposable where T : class, IDisposable
|
||||
public static SharedRef<T> Create<TFrom>(ref UniqueRef<TFrom> other) where TFrom : class, T
|
||||
{
|
||||
var sharedRef = new SharedRef<T>();
|
||||
TFrom value = other.Get;
|
||||
TFrom otherValue = other.Release();
|
||||
|
||||
if (value is not null)
|
||||
if (otherValue is not null)
|
||||
{
|
||||
sharedRef._value = value;
|
||||
sharedRef._refCount = new RefCount(value);
|
||||
other.Release();
|
||||
sharedRef._value = otherValue;
|
||||
sharedRef._refCount = new RefCount(otherValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -246,7 +235,7 @@ public struct SharedRef<T> : IDisposable where T : class, IDisposable
|
||||
|
||||
otherRef?.Increment();
|
||||
|
||||
_value = Unsafe.As<TFrom, T>(ref other.Ref()._value);
|
||||
_value = Unsafe.As<TFrom, T>(ref Unsafe.AsRef(in other._value));
|
||||
_refCount = otherRef;
|
||||
|
||||
oldRefCount?.Decrement();
|
||||
@ -329,6 +318,9 @@ public struct WeakRef<T> : IDisposable where T : class, IDisposable
|
||||
Reset();
|
||||
}
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ref WeakRef<T> Ref => ref Unsafe.AsRef(in this);
|
||||
|
||||
public readonly int UseCount => _refCount?.UseCount() ?? 0;
|
||||
public readonly bool Expired => UseCount == 0;
|
||||
|
||||
@ -356,7 +348,7 @@ public struct WeakRef<T> : IDisposable where T : class, IDisposable
|
||||
|
||||
if (weakRef._refCount.IncrementIfNotZero())
|
||||
{
|
||||
weakRef._value = Unsafe.As<TFrom, T>(ref other.Ref()._value);
|
||||
weakRef._value = Unsafe.As<TFrom, T>(ref Unsafe.AsRef(in other._value));
|
||||
weakRef._refCount.Decrement();
|
||||
}
|
||||
}
|
||||
@ -366,13 +358,13 @@ public struct WeakRef<T> : IDisposable where T : class, IDisposable
|
||||
|
||||
public static WeakRef<T> Create<TFrom>(in SharedRef<TFrom> other) where TFrom : class, T
|
||||
{
|
||||
ref WeakRef<TFrom> otherWeak = ref Unsafe.As<SharedRef<TFrom>, WeakRef<TFrom>>(ref other.Ref());
|
||||
ref readonly WeakRef<TFrom> otherWeak = ref Unsafe.As<SharedRef<TFrom>, WeakRef<TFrom>>(ref Unsafe.AsRef(in other));
|
||||
|
||||
var weakRef = new WeakRef<T>();
|
||||
|
||||
if (otherWeak._refCount is not null)
|
||||
{
|
||||
weakRef._value = Unsafe.As<TFrom, T>(ref otherWeak._value);
|
||||
weakRef._value = Unsafe.As<TFrom, T>(ref Unsafe.AsRef(in otherWeak._value));
|
||||
weakRef._refCount = otherWeak._refCount;
|
||||
|
||||
weakRef._refCount.IncrementWeak();
|
||||
|
@ -4,15 +4,6 @@ using System.Runtime.CompilerServices;
|
||||
|
||||
namespace LibHac.Common;
|
||||
|
||||
public static class UniqueRefExtensions
|
||||
{
|
||||
// ReSharper disable once EntityNameCapturedOnly.Global
|
||||
public static ref UniqueRef<T> Ref<T>(this in UniqueRef<T> value) where T : class, IDisposable
|
||||
{
|
||||
return ref Unsafe.AsRef(in value);
|
||||
}
|
||||
}
|
||||
|
||||
[NonCopyableDisposable]
|
||||
public struct UniqueRef<T> : IDisposable where T : class, IDisposable
|
||||
{
|
||||
@ -21,6 +12,9 @@ public struct UniqueRef<T> : IDisposable where T : class, IDisposable
|
||||
[UnscopedRef]
|
||||
public readonly ref readonly T Get => ref _value;
|
||||
|
||||
[UnscopedRef]
|
||||
public readonly ref UniqueRef<T> Ref => ref Unsafe.AsRef(in this);
|
||||
|
||||
public readonly bool HasValue => Get is not null;
|
||||
|
||||
public UniqueRef(T value)
|
||||
|
@ -604,7 +604,7 @@ public static class ApplicationSaveDataManagement
|
||||
UnsafeHelpers.SkipParamInit(out outRequiredSize);
|
||||
|
||||
using var prohibiter = new UniqueRef<SaveDataTransferProhibiterForCloudBackUp>();
|
||||
Result res = fs.Impl.OpenSaveDataTransferProhibiterForCloudBackUp(ref prohibiter.Ref(), applicationId);
|
||||
Result res = fs.Impl.OpenSaveDataTransferProhibiterForCloudBackUp(ref prohibiter.Ref, applicationId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -183,12 +183,12 @@ public class FileStorageBasedFileSystem : FileStorage
|
||||
{
|
||||
using var baseFile = new UniqueRef<IFile>();
|
||||
|
||||
Result res = baseFileSystem.Get.OpenFile(ref baseFile.Ref(), in path, mode);
|
||||
Result res = baseFileSystem.Get.OpenFile(ref baseFile.Ref, in path, mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
SetFile(baseFile.Get);
|
||||
_baseFileSystem.SetByMove(ref baseFileSystem);
|
||||
_baseFile.Set(ref baseFile.Ref());
|
||||
_baseFile.Set(ref baseFile.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -364,10 +364,10 @@ internal class FileSystemAccessor : IDisposable
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
res = _fileSystem.Get.OpenFile(ref file.Ref(), in pathNormalized, mode);
|
||||
res = _fileSystem.Get.OpenFile(ref file.Ref, in pathNormalized, mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var accessor = new FileAccessor(Hos, ref file.Ref(), this, mode);
|
||||
var accessor = new FileAccessor(Hos, ref file.Ref, this, mode);
|
||||
|
||||
using (ScopedLock.Lock(ref _openListLock))
|
||||
{
|
||||
@ -403,10 +403,10 @@ internal class FileSystemAccessor : IDisposable
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var directory = new UniqueRef<IDirectory>();
|
||||
res = _fileSystem.Get.OpenDirectory(ref directory.Ref(), in pathNormalized, mode);
|
||||
res = _fileSystem.Get.OpenDirectory(ref directory.Ref, in pathNormalized, mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var accessor = new DirectoryAccessor(ref directory.Ref(), this);
|
||||
var accessor = new DirectoryAccessor(ref directory.Ref, this);
|
||||
|
||||
using (ScopedLock.Lock(ref _openListLock))
|
||||
{
|
||||
|
@ -108,9 +108,9 @@ public static class Registrar
|
||||
using var mountNameGenerator = new UniqueRef<ICommonMountNameGenerator>();
|
||||
|
||||
using var accessor = new UniqueRef<FileSystemAccessor>(new FileSystemAccessor(fs.Hos, name, null,
|
||||
ref fileSystem, ref mountNameGenerator.Ref(), ref attributeGetter.Ref()));
|
||||
ref fileSystem, ref mountNameGenerator.Ref, ref attributeGetter.Ref));
|
||||
|
||||
Result res = fs.Impl.Register(ref accessor.Ref());
|
||||
Result res = fs.Impl.Register(ref accessor.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
@ -122,9 +122,9 @@ public static class Registrar
|
||||
using var attributeGetter = new UniqueRef<ISaveDataAttributeGetter>();
|
||||
|
||||
using var accessor = new UniqueRef<FileSystemAccessor>(new FileSystemAccessor(fs.Hos, name, null,
|
||||
ref fileSystem, ref mountNameGenerator, ref attributeGetter.Ref()));
|
||||
ref fileSystem, ref mountNameGenerator, ref attributeGetter.Ref));
|
||||
|
||||
Result res = fs.Impl.Register(ref accessor.Ref());
|
||||
Result res = fs.Impl.Register(ref accessor.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
@ -138,8 +138,8 @@ public static class Registrar
|
||||
using var attributeGetter = new UniqueRef<ISaveDataAttributeGetter>();
|
||||
|
||||
Result res = Register(fs, name, multiCommitTarget, ref fileSystem, ref mountNameGenerator,
|
||||
ref attributeGetter.Ref(), useDataCache, storageForPurgeFileDataCache, usePathCache,
|
||||
ref unmountHookInvoker.Ref());
|
||||
ref attributeGetter.Ref, useDataCache, storageForPurgeFileDataCache, usePathCache,
|
||||
ref unmountHookInvoker.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
@ -153,7 +153,7 @@ public static class Registrar
|
||||
using var attributeGetter = new UniqueRef<ISaveDataAttributeGetter>();
|
||||
|
||||
Result res = Register(fs, name, multiCommitTarget, ref fileSystem, ref mountNameGenerator,
|
||||
ref attributeGetter.Ref(), useDataCache, storageForPurgeFileDataCache, usePathCache, ref unmountHook);
|
||||
ref attributeGetter.Ref, useDataCache, storageForPurgeFileDataCache, usePathCache, ref unmountHook);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
@ -168,7 +168,7 @@ public static class Registrar
|
||||
|
||||
Result res = Register(fs, name, multiCommitTarget, ref fileSystem, ref mountNameGenerator,
|
||||
ref saveAttributeGetter, useDataCache, storageForPurgeFileDataCache, usePathCache,
|
||||
ref unmountHookInvoker.Ref());
|
||||
ref unmountHookInvoker.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
@ -185,7 +185,7 @@ public static class Registrar
|
||||
using (var unmountHookFileSystem =
|
||||
new UniqueRef<UnmountHookFileSystem>(new UnmountHookFileSystem(ref fileSystem, ref unmountHook)))
|
||||
{
|
||||
fileSystem.Set(ref unmountHookFileSystem.Ref());
|
||||
fileSystem.Set(ref unmountHookFileSystem.Ref);
|
||||
}
|
||||
|
||||
if (!fileSystem.HasValue)
|
||||
@ -200,7 +200,7 @@ public static class Registrar
|
||||
accessor.Get.SetFileDataCacheAttachable(useDataCache, storageForPurgeFileDataCache);
|
||||
accessor.Get.SetPathBasedFileDataCacheAttachable(usePathCache);
|
||||
|
||||
Result res = fs.Impl.Register(ref accessor.Ref());
|
||||
Result res = fs.Impl.Register(ref accessor.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
@ -517,14 +517,14 @@ public static class UserFileSystem
|
||||
if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = fileSystem.OpenFile(ref file.Ref(), subPath, mode);
|
||||
res = fileSystem.OpenFile(ref file.Ref, subPath, mode);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(res, start, end, file.Get, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = fileSystem.OpenFile(ref file.Ref(), subPath, mode);
|
||||
res = fileSystem.OpenFile(ref file.Ref, subPath, mode);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
@ -575,14 +575,14 @@ public static class UserFileSystem
|
||||
if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = fileSystem.OpenDirectory(ref accessor.Ref(), subPath, mode);
|
||||
res = fileSystem.OpenDirectory(ref accessor.Ref, subPath, mode);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(res, start, end, accessor.Get, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = fileSystem.OpenDirectory(ref accessor.Ref(), subPath, mode);
|
||||
res = fileSystem.OpenDirectory(ref accessor.Ref, subPath, mode);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
@ -649,7 +649,7 @@ public static class UserFileSystem
|
||||
using var commitManager = new SharedRef<IMultiCommitManager>();
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenMultiCommitManager(ref commitManager.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenMultiCommitManager(ref commitManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
for (int i = 0; i < mountNames.Length; i++)
|
||||
@ -661,7 +661,7 @@ public static class UserFileSystem
|
||||
if (!fileSystem.HasValue)
|
||||
return ResultFs.UnsupportedCommitTarget.Log();
|
||||
|
||||
res = commitManager.Get.Add(ref fileSystem.Ref());
|
||||
res = commitManager.Get.Add(ref fileSystem.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
|
@ -97,10 +97,10 @@ public class ReadOnlyFileSystem : IFileSystem
|
||||
return ResultFs.InvalidModeForFileOpen.Log();
|
||||
|
||||
using var baseFile = new UniqueRef<IFile>();
|
||||
Result res = _baseFileSystem.Get.OpenFile(ref baseFile.Ref(), in path, mode);
|
||||
Result res = _baseFileSystem.Get.OpenFile(ref baseFile.Ref, in path, mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFile.Reset(new ReadOnlyFile(ref baseFile.Ref()));
|
||||
outFile.Reset(new ReadOnlyFile(ref baseFile.Ref));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -60,17 +60,17 @@ public static class Application
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
res = fileSystemProxy.Get.OpenFileSystemWithId(ref fileSystem.Ref(), in sfPath,
|
||||
res = fileSystemProxy.Get.OpenFileSystemWithId(ref fileSystem.Ref, in sfPath,
|
||||
Ncm.ProgramId.InvalidId.Value, FileSystemProxyType.Package);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref));
|
||||
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInApplicationA.Log();
|
||||
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
@ -28,9 +28,9 @@ public static class BaseFileSystem
|
||||
ref SharedRef<IFileSystemSf> fileSystem)
|
||||
{
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref));
|
||||
|
||||
Result res = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
Result res = fs.Register(mountName, ref fileSystemAdapter.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
@ -43,11 +43,11 @@ public static class BaseFileSystem
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
res = OpenBaseFileSystem(fs, ref fileSystem.Ref(), fileSystemId);
|
||||
res = OpenBaseFileSystem(fs, ref fileSystem.Ref, fileSystemId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = RegisterFileSystem(fs, mountName, ref fileSystem.Ref());
|
||||
res = RegisterFileSystem(fs, mountName, ref fileSystem.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -64,16 +64,16 @@ public static class BcatSaveData
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
res = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref(), SaveDataSpaceId.User, in attribute);
|
||||
res = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref, SaveDataSpaceId.User, in attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref));
|
||||
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInBcatSaveDataA.Log();
|
||||
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
@ -98,7 +98,7 @@ public static class Bis
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
res = fileSystemProxy.Get.OpenBisFileSystem(ref fileSystem.Ref(), in sfPath, partitionId);
|
||||
res = fileSystemProxy.Get.OpenBisFileSystem(ref fileSystem.Ref, in sfPath, partitionId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var mountNameGenerator =
|
||||
@ -108,12 +108,12 @@ public static class Bis
|
||||
return ResultFs.AllocationMemoryFailedInBisA.Log();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref));
|
||||
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInBisB.Log();
|
||||
|
||||
res = fs.Fs.Register(mountName, ref fileSystemAdapter.Ref(), ref mountNameGenerator.Ref());
|
||||
res = fs.Fs.Register(mountName, ref fileSystemAdapter.Ref, ref mountNameGenerator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
@ -170,11 +170,11 @@ public static class Bis
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var storage = new SharedRef<IStorageSf>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenBisStorage(ref storage.Ref(), partitionId);
|
||||
Result res = fileSystemProxy.Get.OpenBisStorage(ref storage.Ref, partitionId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var storageAdapter = new UniqueRef<IStorage>(new StorageServiceObjectAdapter(ref storage.Ref()));
|
||||
using var storageAdapter = new UniqueRef<IStorage>(new StorageServiceObjectAdapter(ref storage.Ref));
|
||||
|
||||
if (!storageAdapter.HasValue)
|
||||
{
|
||||
@ -183,7 +183,7 @@ public static class Bis
|
||||
if (res.IsFailure()) return res.Log();
|
||||
}
|
||||
|
||||
outPartitionStorage.Set(ref storageAdapter.Ref());
|
||||
outPartitionStorage.Set(ref storageAdapter.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -71,17 +71,17 @@ public static class Code
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
res = fileSystemProxy.Get.OpenCodeFileSystem(ref fileSystem.Ref(), out verificationData, in sfPath,
|
||||
res = fileSystemProxy.Get.OpenCodeFileSystem(ref fileSystem.Ref, out verificationData, in sfPath,
|
||||
programId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref));
|
||||
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInCodeA.Log();
|
||||
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
@ -48,16 +48,16 @@ public static class Content
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
res = fileSystemProxy.Get.OpenFileSystemWithId(ref fileSystem.Ref(), in sfPath, id, fsType);
|
||||
res = fileSystemProxy.Get.OpenFileSystemWithId(ref fileSystem.Ref, in sfPath, id, fsType);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref));
|
||||
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInContentA.Log();
|
||||
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
@ -249,16 +249,16 @@ public static class Content
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
res = fileSystemProxy.Get.OpenFileSystemWithPatch(ref fileSystem.Ref(), programId, fsType);
|
||||
res = fileSystemProxy.Get.OpenFileSystemWithPatch(ref fileSystem.Ref, programId, fsType);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref));
|
||||
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInContentA.Log();
|
||||
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
@ -101,7 +101,7 @@ public static class ContentStorage
|
||||
|
||||
for (int i = 0; i < maxRetries; i++)
|
||||
{
|
||||
res = fileSystemProxy.Get.OpenContentStorageFileSystem(ref fileSystem.Ref(), storageId);
|
||||
res = fileSystemProxy.Get.OpenContentStorageFileSystem(ref fileSystem.Ref, storageId);
|
||||
|
||||
if (res.IsSuccess())
|
||||
break;
|
||||
@ -118,7 +118,7 @@ public static class ContentStorage
|
||||
}
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref));
|
||||
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInContentStorageA.Log();
|
||||
@ -129,7 +129,7 @@ public static class ContentStorage
|
||||
if (!mountNameGenerator.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInContentStorageB.Log();
|
||||
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref(), ref mountNameGenerator.Ref());
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref, ref mountNameGenerator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
@ -47,13 +47,13 @@ public static class CustomStorage
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
res = fileSystemProxy.Get.OpenCustomStorageFileSystem(ref fileSystem.Ref(), storageId);
|
||||
res = fileSystemProxy.Get.OpenCustomStorageFileSystem(ref fileSystem.Ref, storageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref));
|
||||
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
@ -47,10 +47,10 @@ public static class DeviceSaveData
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
res = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref(), DeviceSaveDataSpaceId, in attribute);
|
||||
res = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref, DeviceSaveDataSpaceId, in attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var fileSystemAdapterRaw = new FileSystemServiceObjectAdapter(ref fileSystem.Ref());
|
||||
var fileSystemAdapterRaw = new FileSystemServiceObjectAdapter(ref fileSystem.Ref);
|
||||
using var fileSystemAdapter = new UniqueRef<IFileSystem>(fileSystemAdapterRaw);
|
||||
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
@ -61,8 +61,8 @@ public static class DeviceSaveData
|
||||
|
||||
using var mountNameGenerator = new UniqueRef<ICommonMountNameGenerator>();
|
||||
|
||||
res = fs.Fs.Register(mountName, fileSystemAdapterRaw, ref fileSystemAdapter.Ref(), ref mountNameGenerator.Ref(),
|
||||
ref saveDataAttributeGetter.Ref(), useDataCache: false, storageForPurgeFileDataCache: null,
|
||||
res = fs.Fs.Register(mountName, fileSystemAdapterRaw, ref fileSystemAdapter.Ref, ref mountNameGenerator.Ref,
|
||||
ref saveDataAttributeGetter.Ref, useDataCache: false, storageForPurgeFileDataCache: null,
|
||||
usePathCache: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -44,7 +44,7 @@ public static class FileSystemProxyServiceObject
|
||||
if (!guard.IsInitialized)
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> createdObject = GetFileSystemProxyServiceObjectImpl(fs);
|
||||
g.FileSystemProxyServiceObject.SetByMove(ref createdObject.Ref());
|
||||
g.FileSystemProxyServiceObject.SetByMove(ref createdObject.Ref);
|
||||
}
|
||||
|
||||
return SharedRef<IFileSystemProxy>.CreateCopy(in g.FileSystemProxyServiceObject);
|
||||
@ -61,7 +61,7 @@ public static class FileSystemProxyServiceObject
|
||||
}
|
||||
|
||||
using var fileSystemProxy = new SharedRef<IFileSystemProxy>();
|
||||
Result res = fs.Hos.Sm.GetService(ref fileSystemProxy.Ref(), "fsp-srv");
|
||||
Result res = fs.Hos.Sm.GetService(ref fileSystemProxy.Ref, "fsp-srv");
|
||||
|
||||
if (res.IsFailure())
|
||||
{
|
||||
@ -69,7 +69,7 @@ public static class FileSystemProxyServiceObject
|
||||
}
|
||||
|
||||
fileSystemProxy.Get.SetCurrentProcess(fs.Hos.Os.GetCurrentProcessId().Value).IgnoreResult();
|
||||
return SharedRef<IFileSystemProxy>.CreateMove(ref fileSystemProxy.Ref());
|
||||
return SharedRef<IFileSystemProxy>.CreateMove(ref fileSystemProxy.Ref);
|
||||
}
|
||||
|
||||
public static SharedRef<IFileSystemProxyForLoader> GetFileSystemProxyForLoaderServiceObject(
|
||||
@ -82,7 +82,7 @@ public static class FileSystemProxyServiceObject
|
||||
if (!guard.IsInitialized)
|
||||
{
|
||||
using SharedRef<IFileSystemProxyForLoader> createdObject = GetFileSystemProxyForLoaderServiceObjectImpl(fs);
|
||||
g.FileSystemProxyForLoaderServiceObject.SetByMove(ref createdObject.Ref());
|
||||
g.FileSystemProxyForLoaderServiceObject.SetByMove(ref createdObject.Ref);
|
||||
}
|
||||
|
||||
return SharedRef<IFileSystemProxyForLoader>.CreateCopy(in g.FileSystemProxyForLoaderServiceObject);
|
||||
@ -92,7 +92,7 @@ public static class FileSystemProxyServiceObject
|
||||
FileSystemClientImpl fs)
|
||||
{
|
||||
using var fileSystemProxy = new SharedRef<IFileSystemProxyForLoader>();
|
||||
Result res = fs.Hos.Sm.GetService(ref fileSystemProxy.Ref(), "fsp-ldr");
|
||||
Result res = fs.Hos.Sm.GetService(ref fileSystemProxy.Ref, "fsp-ldr");
|
||||
|
||||
if (res.IsFailure())
|
||||
{
|
||||
@ -100,7 +100,7 @@ public static class FileSystemProxyServiceObject
|
||||
}
|
||||
|
||||
fileSystemProxy.Get.SetCurrentProcess(fs.Hos.Os.GetCurrentProcessId().Value).IgnoreResult();
|
||||
return SharedRef<IFileSystemProxyForLoader>.CreateMove(ref fileSystemProxy.Ref());
|
||||
return SharedRef<IFileSystemProxyForLoader>.CreateMove(ref fileSystemProxy.Ref);
|
||||
}
|
||||
|
||||
public static SharedRef<IProgramRegistry> GetProgramRegistryServiceObject(this FileSystemClientImpl fs)
|
||||
@ -112,7 +112,7 @@ public static class FileSystemProxyServiceObject
|
||||
if (!guard.IsInitialized)
|
||||
{
|
||||
using SharedRef<IProgramRegistry> createdObject = GetProgramRegistryServiceObjectImpl(fs);
|
||||
g.ProgramRegistryServiceObject.SetByMove(ref createdObject.Ref());
|
||||
g.ProgramRegistryServiceObject.SetByMove(ref createdObject.Ref);
|
||||
}
|
||||
|
||||
return SharedRef<IProgramRegistry>.CreateCopy(in g.ProgramRegistryServiceObject);
|
||||
@ -121,7 +121,7 @@ public static class FileSystemProxyServiceObject
|
||||
private static SharedRef<IProgramRegistry> GetProgramRegistryServiceObjectImpl(FileSystemClientImpl fs)
|
||||
{
|
||||
using var registry = new SharedRef<IProgramRegistry>();
|
||||
Result res = fs.Hos.Sm.GetService(ref registry.Ref(), "fsp-pr");
|
||||
Result res = fs.Hos.Sm.GetService(ref registry.Ref, "fsp-pr");
|
||||
|
||||
if (res.IsFailure())
|
||||
{
|
||||
@ -129,7 +129,7 @@ public static class FileSystemProxyServiceObject
|
||||
}
|
||||
|
||||
registry.Get.SetCurrentProcess(fs.Hos.Os.GetCurrentProcessId().Value).IgnoreResult();
|
||||
return SharedRef<IProgramRegistry>.CreateMove(ref registry.Ref());
|
||||
return SharedRef<IProgramRegistry>.CreateMove(ref registry.Ref);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -256,10 +256,10 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
||||
|
||||
using var fileServiceObject = new SharedRef<IFileSf>();
|
||||
|
||||
res = _baseFs.Get.OpenFile(ref fileServiceObject.Ref(), in sfPath, (uint)mode);
|
||||
res = _baseFs.Get.OpenFile(ref fileServiceObject.Ref, in sfPath, (uint)mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFile.Reset(new FileServiceObjectAdapter(ref fileServiceObject.Ref()));
|
||||
outFile.Reset(new FileServiceObjectAdapter(ref fileServiceObject.Ref));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -271,10 +271,10 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
||||
|
||||
using var directoryServiceObject = new SharedRef<IDirectorySf>();
|
||||
|
||||
res = _baseFs.Get.OpenDirectory(ref directoryServiceObject.Ref(), in sfPath, (uint)mode);
|
||||
res = _baseFs.Get.OpenDirectory(ref directoryServiceObject.Ref, in sfPath, (uint)mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outDirectory.Reset(new DirectoryServiceObjectAdapter(ref directoryServiceObject.Ref()));
|
||||
outDirectory.Reset(new DirectoryServiceObjectAdapter(ref directoryServiceObject.Ref));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -136,11 +136,11 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
res = fileSystemProxy.Get.OpenGameCardFileSystem(ref fileSystem.Ref(), handle, partitionId);
|
||||
res = fileSystemProxy.Get.OpenGameCardFileSystem(ref fileSystem.Ref, handle, partitionId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref));
|
||||
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInGameCardC.Log();
|
||||
@ -151,7 +151,7 @@ public static class GameCard
|
||||
if (!mountNameGenerator.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInGameCardD.Log();
|
||||
|
||||
return fs.Register(mountName, ref fileSystemAdapter.Ref(), ref mountNameGenerator.Ref()).Ret();
|
||||
return fs.Register(mountName, ref fileSystemAdapter.Ref, ref mountNameGenerator.Ref).Ret();
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
@ -177,16 +177,16 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var storage = new SharedRef<IStorageSf>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenGameCardStorage(ref storage.Ref(), handle, partitionType);
|
||||
Result res = fileSystemProxy.Get.OpenGameCardStorage(ref storage.Ref, handle, partitionType);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var storageAdapter = new UniqueRef<IStorage>(new StorageServiceObjectAdapter(ref storage.Ref()));
|
||||
using var storageAdapter = new UniqueRef<IStorage>(new StorageServiceObjectAdapter(ref storage.Ref));
|
||||
|
||||
if (!storageAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInGameCardB.Log();
|
||||
|
||||
outStorage.Set(ref storageAdapter.Ref());
|
||||
outStorage.Set(ref storageAdapter.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -214,7 +214,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -233,7 +233,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
@ -250,7 +250,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -271,7 +271,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -290,7 +290,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -307,7 +307,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -327,7 +327,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -350,7 +350,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -379,7 +379,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -399,7 +399,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -415,7 +415,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -431,7 +431,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -448,7 +448,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -465,7 +465,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -481,7 +481,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -497,7 +497,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -515,7 +515,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -535,7 +535,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -554,7 +554,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenGameCardFileSystem(ref fileSystem.Ref(), handle, partitionId);
|
||||
Result res = fileSystemProxy.Get.OpenGameCardFileSystem(ref fileSystem.Ref, handle, partitionId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -576,7 +576,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -598,7 +598,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = deviceOperator.Get.SetDeviceSimulationEvent((uint)SdmmcPort.GcAsic, (uint)simulatedOperationType,
|
||||
@ -660,7 +660,7 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -44,22 +44,22 @@ public static class Host
|
||||
|
||||
if (option.Flags != MountHostOptionFlag.None)
|
||||
{
|
||||
Result res = fileSystemProxy.Get.OpenHostFileSystemWithOption(ref fileSystem.Ref(), in path, option);
|
||||
Result res = fileSystemProxy.Get.OpenHostFileSystemWithOption(ref fileSystem.Ref, in path, option);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
Result res = fileSystemProxy.Get.OpenHostFileSystem(ref fileSystem.Ref(), in path);
|
||||
Result res = fileSystemProxy.Get.OpenHostFileSystem(ref fileSystem.Ref, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref));
|
||||
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInHostA.Log();
|
||||
|
||||
outFileSystem.Set(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.Set(ref fileSystemAdapter.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -139,10 +139,10 @@ public static class Host
|
||||
|
||||
using var fileSystem = new UniqueRef<IFileSystem>();
|
||||
|
||||
res = OpenHostFileSystemImpl(fs, ref fileSystem.Ref(), in sfPath, option);
|
||||
res = OpenHostFileSystemImpl(fs, ref fileSystem.Ref, in sfPath, option);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFileSystem.Set(ref fileSystem.Ref());
|
||||
outFileSystem.Set(ref fileSystem.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ public static class Host
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = PreMountHost(fs, ref mountNameGenerator.Ref(), mountName, path);
|
||||
res = PreMountHost(fs, ref mountNameGenerator.Ref, mountName, path);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
@ -199,7 +199,7 @@ public static class Host
|
||||
}
|
||||
else
|
||||
{
|
||||
res = PreMountHost(fs, ref mountNameGenerator.Ref(), mountName, path);
|
||||
res = PreMountHost(fs, ref mountNameGenerator.Ref, mountName, path);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
@ -210,14 +210,14 @@ public static class Host
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = OpenHostFileSystem(fs, ref fileSystem.Ref(), mountName, path, MountHostOption.None);
|
||||
res = OpenHostFileSystem(fs, ref fileSystem.Ref, mountName, path, MountHostOption.None);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = OpenHostFileSystem(fs, ref fileSystem.Ref(), mountName, path, MountHostOption.None);
|
||||
res = OpenHostFileSystem(fs, ref fileSystem.Ref, mountName, path, MountHostOption.None);
|
||||
}
|
||||
|
||||
// No AbortIfNeeded here
|
||||
@ -226,14 +226,14 @@ public static class Host
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = PostMount(fs, mountName, ref fileSystem.Ref(), ref mountNameGenerator.Ref());
|
||||
res = PostMount(fs, mountName, ref fileSystem.Ref, ref mountNameGenerator.Ref);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = PostMount(fs, mountName, ref fileSystem.Ref(), ref mountNameGenerator.Ref());
|
||||
res = PostMount(fs, mountName, ref fileSystem.Ref, ref mountNameGenerator.Ref);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
@ -250,7 +250,7 @@ public static class Host
|
||||
using UniqueRef<ICommonMountNameGenerator> baseMountNameGenerator =
|
||||
UniqueRef<ICommonMountNameGenerator>.Create(ref mountNameGenerator);
|
||||
|
||||
Result res = fs.Register(mountName, ref fileSystem, ref baseMountNameGenerator.Ref());
|
||||
Result res = fs.Register(mountName, ref fileSystem, ref baseMountNameGenerator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
@ -275,7 +275,7 @@ public static class Host
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = PreMountHost(fs, ref mountNameGenerator.Ref(), mountName, path);
|
||||
res = PreMountHost(fs, ref mountNameGenerator.Ref, mountName, path);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var idString = new IdString();
|
||||
@ -291,7 +291,7 @@ public static class Host
|
||||
}
|
||||
else
|
||||
{
|
||||
res = PreMountHost(fs, ref mountNameGenerator.Ref(), mountName, path);
|
||||
res = PreMountHost(fs, ref mountNameGenerator.Ref, mountName, path);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
@ -302,14 +302,14 @@ public static class Host
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = OpenHostFileSystem(fs, ref fileSystem.Ref(), mountName, path, option);
|
||||
res = OpenHostFileSystem(fs, ref fileSystem.Ref, mountName, path, option);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = OpenHostFileSystem(fs, ref fileSystem.Ref(), mountName, path, option);
|
||||
res = OpenHostFileSystem(fs, ref fileSystem.Ref, mountName, path, option);
|
||||
}
|
||||
|
||||
// No AbortIfNeeded here
|
||||
@ -318,14 +318,14 @@ public static class Host
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = PostMount(fs, mountName, ref fileSystem.Ref(), ref mountNameGenerator.Ref());
|
||||
res = PostMount(fs, mountName, ref fileSystem.Ref, ref mountNameGenerator.Ref);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = PostMount(fs, mountName, ref fileSystem.Ref(), ref mountNameGenerator.Ref());
|
||||
res = PostMount(fs, mountName, ref fileSystem.Ref, ref mountNameGenerator.Ref);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
@ -342,7 +342,7 @@ public static class Host
|
||||
using UniqueRef<ICommonMountNameGenerator> baseMountNameGenerator =
|
||||
UniqueRef<ICommonMountNameGenerator>.Create(ref mountNameGenerator);
|
||||
|
||||
Result res = fs.Register(mountName, ref fileSystem, ref baseMountNameGenerator.Ref());
|
||||
Result res = fs.Register(mountName, ref fileSystem, ref baseMountNameGenerator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
@ -365,7 +365,7 @@ public static class Host
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = OpenHostFileSystemImpl(fs, ref fileSystem.Ref(), in sfPath, MountHostOption.None);
|
||||
res = OpenHostFileSystemImpl(fs, ref fileSystem.Ref, in sfPath, MountHostOption.None);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
@ -376,7 +376,7 @@ public static class Host
|
||||
}
|
||||
else
|
||||
{
|
||||
res = OpenHostFileSystemImpl(fs, ref fileSystem.Ref(), in sfPath, MountHostOption.None);
|
||||
res = OpenHostFileSystemImpl(fs, ref fileSystem.Ref, in sfPath, MountHostOption.None);
|
||||
}
|
||||
|
||||
// No AbortIfNeeded here
|
||||
@ -385,14 +385,14 @@ public static class Host
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = PostMount(fs, ref fileSystem.Ref());
|
||||
res = PostMount(fs, ref fileSystem.Ref);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = PostMount(fs, ref fileSystem.Ref());
|
||||
res = PostMount(fs, ref fileSystem.Ref);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
@ -412,7 +412,7 @@ public static class Host
|
||||
return ResultFs.AllocationMemoryFailedInHostC.Log();
|
||||
|
||||
Result res = fs.Register(new U8Span(HostRootFileSystemMountName), ref fileSystem,
|
||||
ref mountNameGenerator.Ref());
|
||||
ref mountNameGenerator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
@ -436,7 +436,7 @@ public static class Host
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = OpenHostFileSystemImpl(fs, ref fileSystem.Ref(), in sfPath, option);
|
||||
res = OpenHostFileSystemImpl(fs, ref fileSystem.Ref, in sfPath, option);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var idString = new IdString();
|
||||
@ -451,7 +451,7 @@ public static class Host
|
||||
}
|
||||
else
|
||||
{
|
||||
res = OpenHostFileSystemImpl(fs, ref fileSystem.Ref(), in sfPath, option);
|
||||
res = OpenHostFileSystemImpl(fs, ref fileSystem.Ref, in sfPath, option);
|
||||
}
|
||||
|
||||
// No AbortIfNeeded here
|
||||
@ -460,14 +460,14 @@ public static class Host
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = PostMount(fs, ref fileSystem.Ref());
|
||||
res = PostMount(fs, ref fileSystem.Ref);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = PostMount(fs, ref fileSystem.Ref());
|
||||
res = PostMount(fs, ref fileSystem.Ref);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
@ -487,7 +487,7 @@ public static class Host
|
||||
return ResultFs.AllocationMemoryFailedInHostC.Log();
|
||||
|
||||
Result res = fs.Register(new U8Span(HostRootFileSystemMountName), ref fileSystem,
|
||||
ref mountNameGenerator.Ref());
|
||||
ref mountNameGenerator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
@ -56,16 +56,16 @@ public static class ImageDirectory
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
res = fileSystemProxy.Get.OpenImageDirectoryFileSystem(ref fileSystem.Ref(), directoryId);
|
||||
res = fileSystemProxy.Get.OpenImageDirectoryFileSystem(ref fileSystem.Ref, directoryId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref));
|
||||
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInImageDirectoryA.Log();
|
||||
|
||||
res = fs.Impl.Fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
res = fs.Impl.Fs.Register(mountName, ref fileSystemAdapter.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
@ -60,17 +60,17 @@ public static class Logo
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
res = fileSystemProxy.Get.OpenFileSystemWithId(ref fileSystem.Ref(), in sfPath, programId.Value,
|
||||
res = fileSystemProxy.Get.OpenFileSystemWithId(ref fileSystem.Ref, in sfPath, programId.Value,
|
||||
FileSystemProxyType.Logo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref));
|
||||
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInLogoA.Log();
|
||||
|
||||
res = fs.Impl.Fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
res = fs.Impl.Fs.Register(mountName, ref fileSystemAdapter.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
@ -18,7 +18,7 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -35,7 +35,7 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -51,7 +51,7 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -70,7 +70,7 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -88,7 +88,7 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -107,7 +107,7 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -126,7 +126,7 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -142,7 +142,7 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -158,7 +158,7 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -30,14 +30,14 @@ public static class SaveData
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenSaveDataInternalStorageFileSystem(ref fileSystem.Ref(), spaceId,
|
||||
Result res = fileSystemProxy.Get.OpenSaveDataInternalStorageFileSystem(ref fileSystem.Ref, spaceId,
|
||||
saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref));
|
||||
|
||||
outFileSystem.Set(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.Set(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -91,18 +91,18 @@ public static class SaveData
|
||||
|
||||
if (openReadOnly)
|
||||
{
|
||||
res = fileSystemProxy.Get.OpenReadOnlySaveDataFileSystem(ref fileSystem.Ref(), spaceId, in attribute);
|
||||
res = fileSystemProxy.Get.OpenReadOnlySaveDataFileSystem(ref fileSystem.Ref, spaceId, in attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
res = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref(), spaceId, in attribute);
|
||||
res = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref, spaceId, in attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
// Note: Nintendo does pass in the same object both as a unique_ptr and as a raw pointer.
|
||||
// Both of these are tied to the lifetime of the created FileSystemServiceObjectAdapter so it shouldn't be an issue.
|
||||
var fileSystemAdapterRaw = new FileSystemServiceObjectAdapter(ref fileSystem.Ref());
|
||||
var fileSystemAdapterRaw = new FileSystemServiceObjectAdapter(ref fileSystem.Ref);
|
||||
using var fileSystemAdapter = new UniqueRef<IFileSystem>(fileSystemAdapterRaw);
|
||||
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
@ -110,7 +110,7 @@ public static class SaveData
|
||||
|
||||
using var mountNameGenerator = new UniqueRef<ICommonMountNameGenerator>();
|
||||
|
||||
res = fs.Fs.Register(mountName, fileSystemAdapterRaw, ref fileSystemAdapter.Ref(), ref mountNameGenerator.Ref(),
|
||||
res = fs.Fs.Register(mountName, fileSystemAdapterRaw, ref fileSystemAdapter.Ref, ref mountNameGenerator.Ref,
|
||||
false, null, true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -297,7 +297,7 @@ public static class SaveData
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
res = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref(), SaveDataSpaceId.User, in attribute);
|
||||
res = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref, SaveDataSpaceId.User, in attribute);
|
||||
|
||||
if (res.IsSuccess() || ResultFs.TargetLocked.Includes(res) || ResultFs.SaveDataExtending.Includes(res))
|
||||
{
|
||||
@ -506,10 +506,10 @@ public static class SaveData
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystem = new UniqueRef<IFileSystem>();
|
||||
res = OpenSaveDataInternalStorageFileSystemImpl(fs, ref fileSystem.Ref(), spaceId, saveDataId);
|
||||
res = OpenSaveDataInternalStorageFileSystemImpl(fs, ref fileSystem.Ref, spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return fs.Register(mountName, ref fileSystem.Ref());
|
||||
return fs.Register(mountName, ref fileSystem.Ref);
|
||||
}
|
||||
}
|
||||
}
|
@ -557,15 +557,15 @@ namespace LibHac.Fs.Shim
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.GetFileSystemProxyServiceObject();
|
||||
using var reader = new SharedRef<ISaveDataInfoReader>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenSaveDataInfoReaderBySaveDataSpaceId(ref reader.Ref(), spaceId);
|
||||
Result res = fileSystemProxy.Get.OpenSaveDataInfoReaderBySaveDataSpaceId(ref reader.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var iterator = new UniqueRef<SaveDataIterator>(new SaveDataIterator(fs.Fs, ref reader.Ref()));
|
||||
using var iterator = new UniqueRef<SaveDataIterator>(new SaveDataIterator(fs.Fs, ref reader.Ref));
|
||||
|
||||
if (!iterator.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInSaveDataManagementA.Log();
|
||||
|
||||
outIterator.Set(ref iterator.Ref());
|
||||
outIterator.Set(ref iterator.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -576,15 +576,15 @@ namespace LibHac.Fs.Shim
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.GetFileSystemProxyServiceObject();
|
||||
using var reader = new SharedRef<ISaveDataInfoReader>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenSaveDataInfoReaderWithFilter(ref reader.Ref(), spaceId, in filter);
|
||||
Result res = fileSystemProxy.Get.OpenSaveDataInfoReaderWithFilter(ref reader.Ref, spaceId, in filter);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var iterator = new UniqueRef<SaveDataIterator>(new SaveDataIterator(fs.Fs, ref reader.Ref()));
|
||||
using var iterator = new UniqueRef<SaveDataIterator>(new SaveDataIterator(fs.Fs, ref reader.Ref));
|
||||
|
||||
if (!iterator.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInSaveDataManagementA.Log();
|
||||
|
||||
outIterator.Set(ref iterator.Ref());
|
||||
outIterator.Set(ref iterator.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -2049,7 +2049,7 @@ namespace LibHac.Fs.Shim
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var reader = new SharedRef<ISaveDataInfoReader>();
|
||||
|
||||
Result result = fileSystemProxy.Get.OpenSaveDataInfoReaderOnlyCacheStorage(ref reader.Ref());
|
||||
Result result = fileSystemProxy.Get.OpenSaveDataInfoReaderOnlyCacheStorage(ref reader.Ref);
|
||||
if (result.IsFailure()) return result.Miss();
|
||||
|
||||
while (true)
|
||||
|
@ -174,11 +174,11 @@ public class SaveDataExporterVersion2 : ISaveDataDivisionExporter
|
||||
{
|
||||
using var iteratorObject = new SharedRef<FsSrv.Sf.ISaveDataChunkIterator>();
|
||||
|
||||
Result res = _baseInterface.Get.OpenSaveDataDiffChunkIterator(ref iteratorObject.Ref());
|
||||
Result res = _baseInterface.Get.OpenSaveDataDiffChunkIterator(ref iteratorObject.Ref);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outIterator.Reset(new SaveDataChunkIterator(_fsClient, ref iteratorObject.Ref()));
|
||||
outIterator.Reset(new SaveDataChunkIterator(_fsClient, ref iteratorObject.Ref));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -186,11 +186,11 @@ public class SaveDataExporterVersion2 : ISaveDataDivisionExporter
|
||||
{
|
||||
using var exporterObject = new SharedRef<FsSrv.Sf.ISaveDataChunkExporter>();
|
||||
|
||||
Result res = _baseInterface.Get.OpenSaveDataChunkExporter(ref exporterObject.Ref(), chunkId);
|
||||
Result res = _baseInterface.Get.OpenSaveDataChunkExporter(ref exporterObject.Ref, chunkId);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outExporter.Reset(new SaveDataChunkExporter(_fsClient, ref exporterObject.Ref()));
|
||||
outExporter.Reset(new SaveDataChunkExporter(_fsClient, ref exporterObject.Ref));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -400,11 +400,11 @@ public class SaveDataImporterVersion2 : ISaveDataDivisionImporter
|
||||
{
|
||||
using var iteratorObject = new SharedRef<FsSrv.Sf.ISaveDataChunkIterator>();
|
||||
|
||||
Result res = _baseInterface.Get.OpenSaveDataDiffChunkIterator(ref iteratorObject.Ref());
|
||||
Result res = _baseInterface.Get.OpenSaveDataDiffChunkIterator(ref iteratorObject.Ref);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outIterator.Reset(new SaveDataChunkIterator(_fsClient, ref iteratorObject.Ref()));
|
||||
outIterator.Reset(new SaveDataChunkIterator(_fsClient, ref iteratorObject.Ref));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -412,11 +412,11 @@ public class SaveDataImporterVersion2 : ISaveDataDivisionImporter
|
||||
{
|
||||
using var importerObject = new SharedRef<FsSrv.Sf.ISaveDataChunkImporter>();
|
||||
|
||||
Result res = _baseInterface.Get.OpenSaveDataChunkImporter(ref importerObject.Ref(), chunkId);
|
||||
Result res = _baseInterface.Get.OpenSaveDataChunkImporter(ref importerObject.Ref, chunkId);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outImporter.Reset(new SaveDataChunkImporter(_fsClient, ref importerObject.Ref()));
|
||||
outImporter.Reset(new SaveDataChunkImporter(_fsClient, ref importerObject.Ref));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -81,11 +81,11 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var exporterInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionExporter>();
|
||||
|
||||
Result res = _baseInterface.Get.OpenSaveDataExporter(ref exporterInterface.Ref(), spaceId, saveDataId);
|
||||
Result res = _baseInterface.Get.OpenSaveDataExporter(ref exporterInterface.Ref, spaceId, saveDataId);
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outExporter.Reset(new SaveDataExporterVersion2(_fsClient, ref exporterInterface.Ref()));
|
||||
outExporter.Reset(new SaveDataExporterVersion2(_fsClient, ref exporterInterface.Ref));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -94,13 +94,13 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var exporterInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionExporter>();
|
||||
|
||||
Result res = _baseInterface.Get.OpenSaveDataExporterForDiffExport(ref exporterInterface.Ref(),
|
||||
Result res = _baseInterface.Get.OpenSaveDataExporterForDiffExport(ref exporterInterface.Ref,
|
||||
InBuffer.FromStruct(in initialData), spaceId, saveDataId);
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outExporter.Reset(new SaveDataExporterVersion2(_fsClient, ref exporterInterface.Ref()));
|
||||
outExporter.Reset(new SaveDataExporterVersion2(_fsClient, ref exporterInterface.Ref));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -109,13 +109,13 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var exporterInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionExporter>();
|
||||
|
||||
Result res = _baseInterface.Get.OpenSaveDataExporterByContext(ref exporterInterface.Ref(),
|
||||
Result res = _baseInterface.Get.OpenSaveDataExporterByContext(ref exporterInterface.Ref,
|
||||
InBuffer.FromStruct(in exportContext));
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outExporter.Reset(new SaveDataExporterVersion2(_fsClient, ref exporterInterface.Ref()));
|
||||
outExporter.Reset(new SaveDataExporterVersion2(_fsClient, ref exporterInterface.Ref));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -124,13 +124,13 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var importerInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionImporter>();
|
||||
|
||||
Result res = _baseInterface.Get.OpenSaveDataImporterDeprecated(ref importerInterface.Ref(),
|
||||
Result res = _baseInterface.Get.OpenSaveDataImporterDeprecated(ref importerInterface.Ref,
|
||||
InBuffer.FromStruct(in initialData), in userId, spaceId);
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outImporter.Reset(new SaveDataImporterVersion2(_fsClient, ref importerInterface.Ref()));
|
||||
outImporter.Reset(new SaveDataImporterVersion2(_fsClient, ref importerInterface.Ref));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -139,13 +139,13 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var importerInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionImporter>();
|
||||
|
||||
Result res = _baseInterface.Get.OpenSaveDataImporterForDiffImport(ref importerInterface.Ref(),
|
||||
Result res = _baseInterface.Get.OpenSaveDataImporterForDiffImport(ref importerInterface.Ref,
|
||||
InBuffer.FromStruct(in initialData), spaceId, saveDataId);
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outImporter.Reset(new SaveDataImporterVersion2(_fsClient, ref importerInterface.Ref()));
|
||||
outImporter.Reset(new SaveDataImporterVersion2(_fsClient, ref importerInterface.Ref));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -154,13 +154,13 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var importerInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionImporter>();
|
||||
|
||||
Result res = _baseInterface.Get.OpenSaveDataImporterForDuplicateDiffImport(ref importerInterface.Ref(),
|
||||
Result res = _baseInterface.Get.OpenSaveDataImporterForDuplicateDiffImport(ref importerInterface.Ref,
|
||||
InBuffer.FromStruct(in initialData), spaceId, saveDataId);
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outImporter.Reset(new SaveDataImporterVersion2(_fsClient, ref importerInterface.Ref()));
|
||||
outImporter.Reset(new SaveDataImporterVersion2(_fsClient, ref importerInterface.Ref));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -169,13 +169,13 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var importerInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionImporter>();
|
||||
|
||||
Result res = _baseInterface.Get.OpenSaveDataImporter(ref importerInterface.Ref(),
|
||||
Result res = _baseInterface.Get.OpenSaveDataImporter(ref importerInterface.Ref,
|
||||
InBuffer.FromStruct(in initialData), in userId, spaceId, useSwap);
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outImporter.Reset(new SaveDataImporterVersion2(_fsClient, ref importerInterface.Ref()));
|
||||
outImporter.Reset(new SaveDataImporterVersion2(_fsClient, ref importerInterface.Ref));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -190,13 +190,13 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var importerInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionImporter>();
|
||||
|
||||
Result res = _baseInterface.Get.OpenSaveDataImporterByContext(ref importerInterface.Ref(),
|
||||
Result res = _baseInterface.Get.OpenSaveDataImporterByContext(ref importerInterface.Ref,
|
||||
InBuffer.FromStruct(in importContext));
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outImporter.Reset(new SaveDataImporterVersion2(_fsClient, ref importerInterface.Ref()));
|
||||
outImporter.Reset(new SaveDataImporterVersion2(_fsClient, ref importerInterface.Ref));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -293,10 +293,10 @@ namespace LibHac.Fs.Shim
|
||||
using var prohibiter = new SharedRef<ISaveDataTransferProhibiter>();
|
||||
|
||||
// Todo: Uncomment once opening transfer prohibiters is implemented
|
||||
// Result res = fileSystemProxy.Get.OpenSaveDataTransferProhibiter(ref prohibiter.Ref(), applicationId);
|
||||
// Result res = fileSystemProxy.Get.OpenSaveDataTransferProhibiter(ref prohibiter.Ref, applicationId);
|
||||
// if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outProhibiter.Reset(new SaveDataTransferProhibiterForCloudBackUp(ref prohibiter.Ref()));
|
||||
outProhibiter.Reset(new SaveDataTransferProhibiterForCloudBackUp(ref prohibiter.Ref));
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -356,7 +356,7 @@ namespace LibHac.Fs.Shim
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = fs.Impl.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User, in filter);
|
||||
res = fs.Impl.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User, in filter);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -62,7 +62,7 @@ public static class SdCard
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInSdCardA.Log();
|
||||
|
||||
return fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
return fs.Register(mountName, ref fileSystemAdapter.Ref);
|
||||
}
|
||||
|
||||
public static Result MountSdCard(this FileSystemClient fs, U8Span mountName)
|
||||
@ -97,14 +97,14 @@ public static class SdCard
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = OpenSdCardFileSystem(fs, ref fileSystem.Ref());
|
||||
res = OpenSdCardFileSystem(fs, ref fileSystem.Ref);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = OpenSdCardFileSystem(fs, ref fileSystem.Ref());
|
||||
res = OpenSdCardFileSystem(fs, ref fileSystem.Ref);
|
||||
}
|
||||
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
@ -113,14 +113,14 @@ public static class SdCard
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = RegisterFileSystem(fs, mountName, ref fileSystem.Ref());
|
||||
res = RegisterFileSystem(fs, mountName, ref fileSystem.Ref);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = RegisterFileSystem(fs, mountName, ref fileSystem.Ref());
|
||||
res = RegisterFileSystem(fs, mountName, ref fileSystem.Ref);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
@ -164,14 +164,14 @@ public static class SdCard
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = OpenSdCardFileSystem(fs, ref fileSystem.Ref());
|
||||
res = OpenSdCardFileSystem(fs, ref fileSystem.Ref);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = OpenSdCardFileSystem(fs, ref fileSystem.Ref());
|
||||
res = OpenSdCardFileSystem(fs, ref fileSystem.Ref);
|
||||
}
|
||||
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
@ -180,14 +180,14 @@ public static class SdCard
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
res = RegisterFileSystem(fs, mountName, ref fileSystem.Ref());
|
||||
res = RegisterFileSystem(fs, mountName, ref fileSystem.Ref);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = RegisterFileSystem(fs, mountName, ref fileSystem.Ref());
|
||||
res = RegisterFileSystem(fs, mountName, ref fileSystem.Ref);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
@ -204,11 +204,11 @@ public static class SdCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
res = CheckIfInserted(fs, ref deviceOperator.Ref(), out bool isInserted);
|
||||
res = CheckIfInserted(fs, ref deviceOperator.Ref, out bool isInserted);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
@ -250,7 +250,7 @@ public static class SdCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -295,7 +295,7 @@ public static class SdCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -338,7 +338,7 @@ public static class SdCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -384,7 +384,7 @@ public static class SdCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -431,7 +431,7 @@ public static class SdCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -616,7 +616,7 @@ public static class SdCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -17,7 +17,7 @@ public static class SdmmcControl
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -35,7 +35,7 @@ public static class SdmmcControl
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -51,7 +51,7 @@ public static class SdmmcControl
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace LibHac.Fs.Shim
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -39,7 +39,7 @@ namespace LibHac.Fs.Shim
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -84,10 +84,10 @@ public static class SystemSaveData
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
res = fileSystemProxy.Get.OpenSaveDataFileSystemBySystemSaveDataId(ref fileSystem.Ref(), spaceId, in attribute);
|
||||
res = fileSystemProxy.Get.OpenSaveDataFileSystemBySystemSaveDataId(ref fileSystem.Ref, spaceId, in attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var fileSystemAdapterRaw = new FileSystemServiceObjectAdapter(ref fileSystem.Ref());
|
||||
var fileSystemAdapterRaw = new FileSystemServiceObjectAdapter(ref fileSystem.Ref);
|
||||
using var fileSystemAdapter = new UniqueRef<IFileSystem>(fileSystemAdapterRaw);
|
||||
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
@ -96,13 +96,13 @@ public static class SystemSaveData
|
||||
if (spaceId == SaveDataSpaceId.System)
|
||||
{
|
||||
using var mountNameGenerator = new UniqueRef<ICommonMountNameGenerator>();
|
||||
return fs.Register(mountName, multiCommitTarget: fileSystemAdapterRaw, ref fileSystemAdapter.Ref(),
|
||||
ref mountNameGenerator.Ref(), useDataCache: false, storageForPurgeFileDataCache: null,
|
||||
return fs.Register(mountName, multiCommitTarget: fileSystemAdapterRaw, ref fileSystemAdapter.Ref,
|
||||
ref mountNameGenerator.Ref, useDataCache: false, storageForPurgeFileDataCache: null,
|
||||
usePathCache: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
return fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
return fs.Register(mountName, ref fileSystemAdapter.Ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,10 +33,10 @@ public readonly struct AccessFailureManagementService
|
||||
|
||||
using var notifier = new UniqueRef<IEventNotifier>();
|
||||
|
||||
res = _serviceImpl.CreateNotifier(ref notifier.Ref(), processId, notifyOnDeepRetry);
|
||||
res = _serviceImpl.CreateNotifier(ref notifier.Ref, processId, notifyOnDeepRetry);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outNotifier.Set(ref notifier.Ref());
|
||||
outNotifier.Set(ref notifier.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -65,14 +65,14 @@ public readonly struct BaseFileSystemService
|
||||
|
||||
// Open the file system
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
res = _serviceImpl.OpenBaseFileSystem(ref fileSystem.Ref(), fileSystemId);
|
||||
res = _serviceImpl.OpenBaseFileSystem(ref fileSystem.Ref, fileSystemId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Create an SF adapter for the file system
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref fileSystem.Ref(), false);
|
||||
FileSystemInterfaceAdapter.CreateShared(ref fileSystem.Ref, false);
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -127,25 +127,25 @@ public readonly struct BaseFileSystemService
|
||||
|
||||
// Open the file system
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
res = _serviceImpl.OpenBisFileSystem(ref fileSystem.Ref(), partitionId, false);
|
||||
res = _serviceImpl.OpenBisFileSystem(ref fileSystem.Ref, partitionId, false);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var subDirFileSystem = new SharedRef<IFileSystem>();
|
||||
res = Utility.CreateSubDirectoryFileSystem(ref subDirFileSystem.Ref(), ref fileSystem.Ref(),
|
||||
res = Utility.CreateSubDirectoryFileSystem(ref subDirFileSystem.Ref, ref fileSystem.Ref,
|
||||
in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the file system wrappers
|
||||
using var typeSetFileSystem =
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref subDirFileSystem.Ref(), storageFlag));
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref subDirFileSystem.Ref, storageFlag));
|
||||
|
||||
using var asyncFileSystem =
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref()));
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref));
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref(), false);
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref, false);
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -194,16 +194,16 @@ public readonly struct BaseFileSystemService
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
res = _serviceImpl.OpenGameCardFileSystem(ref fileSystem.Ref(), handle, partitionId);
|
||||
res = _serviceImpl.OpenGameCardFileSystem(ref fileSystem.Ref, handle, partitionId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var asyncFileSystem =
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref fileSystem.Ref()));
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref fileSystem.Ref));
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref(), false);
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref, false);
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -222,20 +222,20 @@ public readonly struct BaseFileSystemService
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
res = _serviceImpl.OpenSdCardProxyFileSystem(ref fileSystem.Ref());
|
||||
res = _serviceImpl.OpenSdCardProxyFileSystem(ref fileSystem.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the file system wrappers
|
||||
using var typeSetFileSystem =
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref(), storageFlag));
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref, storageFlag));
|
||||
|
||||
using var asyncFileSystem =
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref()));
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref));
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref(), false);
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref, false);
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -295,13 +295,13 @@ public readonly struct BaseFileSystemService
|
||||
}
|
||||
|
||||
using var baseFileSystem = new SharedRef<IFileSystem>();
|
||||
res = _serviceImpl.OpenBaseFileSystem(ref baseFileSystem.Ref(), fileSystemId);
|
||||
res = _serviceImpl.OpenBaseFileSystem(ref baseFileSystem.Ref, fileSystemId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref baseFileSystem.Ref(), false);
|
||||
FileSystemInterfaceAdapter.CreateShared(ref baseFileSystem.Ref, false);
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -317,10 +317,10 @@ public readonly struct BaseFileSystemService
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var bisWiper = new UniqueRef<IWiper>();
|
||||
res = _serviceImpl.OpenBisWiper(ref bisWiper.Ref(), transferMemoryHandle, transferMemorySize);
|
||||
res = _serviceImpl.OpenBisWiper(ref bisWiper.Ref, transferMemoryHandle, transferMemorySize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outBisWiper.Set(ref bisWiper.Ref());
|
||||
outBisWiper.Set(ref bisWiper.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -76,18 +76,18 @@ public readonly struct BaseStorageService
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var storage = new SharedRef<IStorage>();
|
||||
res = _serviceImpl.OpenBisStorage(ref storage.Ref(), id);
|
||||
res = _serviceImpl.OpenBisStorage(ref storage.Ref, id);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var typeSetStorage =
|
||||
new SharedRef<IStorage>(new StorageLayoutTypeSetStorage(ref storage.Ref(), storageFlag));
|
||||
new SharedRef<IStorage>(new StorageLayoutTypeSetStorage(ref storage.Ref, storageFlag));
|
||||
|
||||
// Todo: Async storage
|
||||
|
||||
using var storageAdapter =
|
||||
new SharedRef<IStorageSf>(new StorageInterfaceAdapter(ref typeSetStorage.Ref()));
|
||||
new SharedRef<IStorageSf>(new StorageInterfaceAdapter(ref typeSetStorage.Ref));
|
||||
|
||||
outStorage.SetByMove(ref storageAdapter.Ref());
|
||||
outStorage.SetByMove(ref storageAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -118,15 +118,15 @@ public readonly struct BaseStorageService
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var storage = new SharedRef<IStorage>();
|
||||
res = _serviceImpl.OpenGameCardPartition(ref storage.Ref(), handle, partitionId);
|
||||
res = _serviceImpl.OpenGameCardPartition(ref storage.Ref, handle, partitionId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Todo: Async storage
|
||||
|
||||
using var storageAdapter =
|
||||
new SharedRef<IStorageSf>(new StorageInterfaceAdapter(ref storage.Ref()));
|
||||
new SharedRef<IStorageSf>(new StorageInterfaceAdapter(ref storage.Ref));
|
||||
|
||||
outStorage.SetByMove(ref storageAdapter.Ref());
|
||||
outStorage.SetByMove(ref storageAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -36,8 +36,8 @@ public class DefaultFsServerObjects
|
||||
creators.GameCardStorageCreator = gcStorageCreator;
|
||||
creators.GameCardFileSystemCreator = new EmulatedGameCardFsCreator(gcStorageCreator, gameCard);
|
||||
creators.EncryptedFileSystemCreator = new EncryptedFileSystemCreator(keySet);
|
||||
creators.BuiltInStorageFileSystemCreator = new EmulatedBisFileSystemCreator(ref sharedRootFileSystem.Ref());
|
||||
creators.SdCardFileSystemCreator = new EmulatedSdCardFileSystemCreator(sdCard, ref sharedRootFileSystemCopy.Ref());
|
||||
creators.BuiltInStorageFileSystemCreator = new EmulatedBisFileSystemCreator(ref sharedRootFileSystem.Ref);
|
||||
creators.SdCardFileSystemCreator = new EmulatedSdCardFileSystemCreator(sdCard, ref sharedRootFileSystemCopy.Ref);
|
||||
|
||||
var deviceOperator = new EmulatedDeviceOperator(gameCard, sdCard);
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class FileSystemProxyCoreImpl
|
||||
|
||||
if (storageId == CustomStorageId.System)
|
||||
{
|
||||
Result res = _baseFileSystemService.OpenBisFileSystem(ref fileSystem.Ref(), BisPartitionId.User);
|
||||
Result res = _baseFileSystemService.OpenBisFileSystem(ref fileSystem.Ref, BisPartitionId.User);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using scoped var path = new Path();
|
||||
@ -45,13 +45,13 @@ public class FileSystemProxyCoreImpl
|
||||
CustomStorage.GetCustomStorageDirectoryName(CustomStorageId.System));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystem> tempFs = SharedRef<IFileSystem>.CreateMove(ref fileSystem.Ref());
|
||||
res = Utility.WrapSubDirectory(ref fileSystem.Ref(), ref tempFs.Ref(), in path, createIfMissing: true);
|
||||
using SharedRef<IFileSystem> tempFs = SharedRef<IFileSystem>.CreateMove(ref fileSystem.Ref);
|
||||
res = Utility.WrapSubDirectory(ref fileSystem.Ref, ref tempFs.Ref, in path, createIfMissing: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else if (storageId == CustomStorageId.SdCard)
|
||||
{
|
||||
Result res = _baseFileSystemService.OpenSdCardProxyFileSystem(ref fileSystem.Ref());
|
||||
Result res = _baseFileSystemService.OpenSdCardProxyFileSystem(ref fileSystem.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using scoped var path = new Path();
|
||||
@ -60,12 +60,12 @@ public class FileSystemProxyCoreImpl
|
||||
CustomStorage.GetCustomStorageDirectoryName(CustomStorageId.System));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystem> tempFs = SharedRef<IFileSystem>.CreateMove(ref fileSystem.Ref());
|
||||
res = Utility.WrapSubDirectory(ref fileSystem.Ref(), ref tempFs.Ref(), in path, createIfMissing: true);
|
||||
using SharedRef<IFileSystem> tempFs = SharedRef<IFileSystem>.CreateMove(ref fileSystem.Ref);
|
||||
res = Utility.WrapSubDirectory(ref fileSystem.Ref, ref tempFs.Ref, in path, createIfMissing: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
tempFs.SetByMove(ref fileSystem.Ref());
|
||||
res = _fsCreators.EncryptedFileSystemCreator.Create(ref fileSystem.Ref(), ref tempFs.Ref(),
|
||||
tempFs.SetByMove(ref fileSystem.Ref);
|
||||
res = _fsCreators.EncryptedFileSystemCreator.Create(ref fileSystem.Ref, ref tempFs.Ref,
|
||||
IEncryptedFileSystemCreator.KeyId.CustomStorage, in _sdEncryptionSeed);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
@ -74,7 +74,7 @@ public class FileSystemProxyCoreImpl
|
||||
return ResultFs.InvalidArgument.Log();
|
||||
}
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystem.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystem.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -189,11 +189,11 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
// Initialize the NCA file system service
|
||||
using SharedRef<NcaFileSystemService> ncaFsService =
|
||||
NcaFileSystemService.CreateShared(Globals.NcaFileSystemServiceImpl, processId);
|
||||
_ncaFsService.SetByMove(ref ncaFsService.Ref());
|
||||
_ncaFsService.SetByMove(ref ncaFsService.Ref);
|
||||
|
||||
using SharedRef<SaveDataFileSystemService> saveFsService =
|
||||
SaveDataFileSystemService.CreateShared(Globals.SaveDataFileSystemServiceImpl, processId);
|
||||
_saveFsService.SetByMove(ref saveFsService.Ref());
|
||||
_saveFsService.SetByMove(ref saveFsService.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -534,7 +534,7 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
|
||||
bool isCaseSensitive = option.Flags.HasFlag(MountHostOptionFlag.PseudoCaseSensitive);
|
||||
|
||||
res = _fsProxyCore.OpenHostFileSystem(ref hostFileSystem.Ref(), in pathNormalized, isCaseSensitive);
|
||||
res = _fsProxyCore.OpenHostFileSystem(ref hostFileSystem.Ref, in pathNormalized, isCaseSensitive);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var adapterFlags = new PathFlags();
|
||||
@ -542,9 +542,9 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
adapterFlags.AllowWindowsPath();
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref hostFileSystem.Ref(), adapterFlags, false);
|
||||
FileSystemInterfaceAdapter.CreateShared(ref hostFileSystem.Ref, adapterFlags, false);
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -824,20 +824,20 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
res = _fsProxyCore.OpenCloudBackupWorkStorageFileSystem(ref fileSystem.Ref(), storageId);
|
||||
res = _fsProxyCore.OpenCloudBackupWorkStorageFileSystem(ref fileSystem.Ref, storageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the wrappers for the file system
|
||||
using var typeSetFileSystem =
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref(), storageFlag));
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref, storageFlag));
|
||||
|
||||
using var asyncFileSystem =
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref()));
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref));
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref(), false);
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref, false);
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -860,20 +860,20 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
res = _fsProxyCore.OpenCustomStorageFileSystem(ref fileSystem.Ref(), storageId);
|
||||
res = _fsProxyCore.OpenCustomStorageFileSystem(ref fileSystem.Ref, storageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the file system wrappers
|
||||
using var typeSetFileSystem =
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref(), storageFlag));
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref, storageFlag));
|
||||
|
||||
using var asyncFileSystem =
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref()));
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref));
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref(), false);
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref, false);
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public static class FileSystemServerInitializer
|
||||
ulong processId = client.Os.GetCurrentProcessId().Value;
|
||||
fileSystemProxy.Get.SetCurrentProcess(processId).IgnoreResult();
|
||||
|
||||
client.Fs.Impl.InitializeDfcFileSystemProxyServiceObject(ref fileSystemProxy.Ref());
|
||||
client.Fs.Impl.InitializeDfcFileSystemProxyServiceObject(ref fileSystemProxy.Ref);
|
||||
|
||||
InitializeFileSystemProxyServer(client, server);
|
||||
|
||||
@ -201,7 +201,7 @@ public static class FileSystemServerInitializer
|
||||
public Result GetServiceObject(ref SharedRef<IDisposable> serviceObject)
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> derivedObject = _server.Impl.GetFileSystemProxyServiceObject();
|
||||
serviceObject.SetByMove(ref derivedObject.Ref());
|
||||
serviceObject.SetByMove(ref derivedObject.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ public static class FileSystemServerInitializer
|
||||
public Result GetServiceObject(ref SharedRef<IDisposable> serviceObject)
|
||||
{
|
||||
using SharedRef<IFileSystemProxyForLoader> derivedObject = _server.Impl.GetFileSystemProxyForLoaderServiceObject();
|
||||
serviceObject.SetByMove(ref derivedObject.Ref());
|
||||
serviceObject.SetByMove(ref derivedObject.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -239,7 +239,7 @@ public static class FileSystemServerInitializer
|
||||
public Result GetServiceObject(ref SharedRef<IDisposable> serviceObject)
|
||||
{
|
||||
using SharedRef<IProgramRegistry> derivedObject = _server.Impl.GetProgramRegistryServiceObject();
|
||||
serviceObject.SetByMove(ref derivedObject.Ref());
|
||||
serviceObject.SetByMove(ref derivedObject.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -60,15 +60,15 @@ public class EmulatedBisFileSystemCreator : IBuiltInStorageFileSystemCreator
|
||||
if (!IsValidPartitionId(partitionId)) return ResultFs.InvalidArgument.Log();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
if (Config.TryGetFileSystem(ref fileSystem.Ref(), partitionId))
|
||||
if (Config.TryGetFileSystem(ref fileSystem.Ref, partitionId))
|
||||
{
|
||||
outFileSystem.SetByMove(ref fileSystem.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystem.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
using var rootFileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
if (!Config.TryGetRootFileSystem(ref rootFileSystem.Ref()))
|
||||
if (!Config.TryGetRootFileSystem(ref rootFileSystem.Ref))
|
||||
{
|
||||
return ResultFs.PreconditionViolation.Log();
|
||||
}
|
||||
@ -83,10 +83,10 @@ public class EmulatedBisFileSystemCreator : IBuiltInStorageFileSystemCreator
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var partitionFileSystem = new SharedRef<IFileSystem>();
|
||||
res = Utility.WrapSubDirectory(ref partitionFileSystem.Ref(), ref rootFileSystem.Ref(), in bisRootPath, true);
|
||||
res = Utility.WrapSubDirectory(ref partitionFileSystem.Ref, ref rootFileSystem.Ref, in bisRootPath, true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFileSystem.SetByMove(ref partitionFileSystem.Ref());
|
||||
outFileSystem.SetByMove(ref partitionFileSystem.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class EmulatedSdCardFileSystemCreator : ISdCardProxyFileSystemCreator, ID
|
||||
// Todo: Add ProxyFileSystem?
|
||||
|
||||
using SharedRef<IFileSystem> fileSystem = SharedRef<IFileSystem>.CreateCopy(in _rootFileSystem);
|
||||
res = Utility.WrapSubDirectory(ref _sdCardFileSystem, ref fileSystem.Ref(), in sdCardPath, true);
|
||||
res = Utility.WrapSubDirectory(ref _sdCardFileSystem, ref fileSystem.Ref, in sdCardPath, true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFileSystem.SetByCopy(in _sdCardFileSystem);
|
||||
|
@ -29,7 +29,7 @@ public class EncryptedFileSystemCreator : IEncryptedFileSystemCreator
|
||||
using var encryptedFileSystem = new SharedRef<AesXtsFileSystem>(new AesXtsFileSystem(ref baseFileSystem,
|
||||
KeySet.SdCardEncryptionKeys[(int)idIndex].DataRo.ToArray(), 0x4000));
|
||||
|
||||
outEncryptedFileSystem.SetByMove(ref encryptedFileSystem.Ref());
|
||||
outEncryptedFileSystem.SetByMove(ref encryptedFileSystem.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class PartitionFileSystemCreator : IPartitionFileSystemCreator
|
||||
Result res = partitionFs.Get.Initialize(ref baseStorage);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFileSystem.SetByMove(ref partitionFs.Ref());
|
||||
outFileSystem.SetByMove(ref partitionFs.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
}
|
@ -77,9 +77,9 @@ public class SaveDataFileSystemCreator : ISaveDataFileSystemCreator
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Create and initialize the directory save data FS
|
||||
using UniqueRef<IFileSystem> tempFs = UniqueRef<IFileSystem>.Create(ref baseFs.Ref());
|
||||
using UniqueRef<IFileSystem> tempFs = UniqueRef<IFileSystem>.Create(ref baseFs.Ref);
|
||||
using var saveDirFs = new SharedRef<DirectorySaveDataFileSystem>(
|
||||
new DirectorySaveDataFileSystem(ref tempFs.Ref(), _fsServer.Hos.Fs));
|
||||
new DirectorySaveDataFileSystem(ref tempFs.Ref, _fsServer.Hos.Fs));
|
||||
|
||||
if (!saveDirFs.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInSaveDataFileSystemCreatorB.Log();
|
||||
@ -88,7 +88,7 @@ public class SaveDataFileSystemCreator : ISaveDataFileSystemCreator
|
||||
timeStampGetter, _randomGenerator);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
saveDataFs.SetByMove(ref saveDirFs.Ref());
|
||||
saveDataFs.SetByMove(ref saveDirFs.Ref);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -97,7 +97,7 @@ public class SaveDataFileSystemCreator : ISaveDataFileSystemCreator
|
||||
Optional<OpenType> openType =
|
||||
openShared ? new Optional<OpenType>(OpenType.Normal) : new Optional<OpenType>();
|
||||
|
||||
res = _fsServer.OpenSaveDataStorage(ref fileStorage.Ref(), ref baseFileSystem, spaceId, saveDataId,
|
||||
res = _fsServer.OpenSaveDataStorage(ref fileStorage.Ref, ref baseFileSystem, spaceId, saveDataId,
|
||||
OpenMode.ReadWrite, openType);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -106,9 +106,9 @@ public class SaveDataFileSystemCreator : ISaveDataFileSystemCreator
|
||||
|
||||
// Wrap the save FS in a result convert FS and set it as the output FS
|
||||
using var resultConvertFs = new SharedRef<SaveDataResultConvertFileSystem>(
|
||||
new SaveDataResultConvertFileSystem(ref saveDataFs.Ref(), isReconstructible));
|
||||
new SaveDataResultConvertFileSystem(ref saveDataFs.Ref, isReconstructible));
|
||||
|
||||
outFileSystem.SetByMove(ref resultConvertFs.Ref());
|
||||
outFileSystem.SetByMove(ref resultConvertFs.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -85,13 +85,13 @@ public class SaveDataResultConvertFileSystem : IResultConvertFileSystem<ISaveDat
|
||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
||||
{
|
||||
using var file = new UniqueRef<IFile>();
|
||||
Result res = ConvertResult(GetFileSystem().OpenFile(ref file.Ref(), in path, mode));
|
||||
Result res = ConvertResult(GetFileSystem().OpenFile(ref file.Ref, in path, mode));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using UniqueRef<SaveDataResultConvertFile> resultConvertFile =
|
||||
new(new SaveDataResultConvertFile(ref file.Ref(), _isReconstructible));
|
||||
new(new SaveDataResultConvertFile(ref file.Ref, _isReconstructible));
|
||||
|
||||
outFile.Set(ref resultConvertFile.Ref());
|
||||
outFile.Set(ref resultConvertFile.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -99,13 +99,13 @@ public class SaveDataResultConvertFileSystem : IResultConvertFileSystem<ISaveDat
|
||||
OpenDirectoryMode mode)
|
||||
{
|
||||
using var directory = new UniqueRef<IDirectory>();
|
||||
Result res = ConvertResult(GetFileSystem().OpenDirectory(ref directory.Ref(), in path, mode));
|
||||
Result res = ConvertResult(GetFileSystem().OpenDirectory(ref directory.Ref, in path, mode));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using UniqueRef<SaveDataResultConvertDirectory> resultConvertDirectory =
|
||||
new(new SaveDataResultConvertDirectory(ref directory.Ref(), _isReconstructible));
|
||||
new(new SaveDataResultConvertDirectory(ref directory.Ref, _isReconstructible));
|
||||
|
||||
outDirectory.Set(ref resultConvertDirectory.Ref());
|
||||
outDirectory.Set(ref resultConvertDirectory.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ public class SubDirectoryFileSystemCreator : ISubDirectoryFileSystemCreator
|
||||
{
|
||||
using var directory = new UniqueRef<IDirectory>();
|
||||
|
||||
Result res = baseFileSystem.Get.OpenDirectory(ref directory.Ref(), in path, OpenDirectoryMode.Directory);
|
||||
Result res = baseFileSystem.Get.OpenDirectory(ref directory.Ref, in path, OpenDirectoryMode.Directory);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
directory.Reset();
|
||||
@ -25,7 +25,7 @@ public class SubDirectoryFileSystemCreator : ISubDirectoryFileSystemCreator
|
||||
res = subFs.Get.Initialize(in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outSubDirFileSystem.SetByMove(ref subFs.Ref());
|
||||
outSubDirFileSystem.SetByMove(ref subFs.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
}
|
@ -23,9 +23,9 @@ public class DeepRetryFileSystem : ForwardingFileSystem
|
||||
using var retryFileSystem = new SharedRef<DeepRetryFileSystem>(
|
||||
new DeepRetryFileSystem(ref baseFileSystem, ref accessFailureManager));
|
||||
|
||||
retryFileSystem.Get._selfReference.Set(in retryFileSystem.Ref());
|
||||
retryFileSystem.Get._selfReference.Set(in retryFileSystem.Ref);
|
||||
|
||||
return SharedRef<IFileSystem>.CreateMove(ref retryFileSystem.Ref());
|
||||
return SharedRef<IFileSystem>.CreateMove(ref retryFileSystem.Ref);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
|
@ -273,7 +273,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
|
||||
adapter._selfReference.Set(in sharedAdapter);
|
||||
|
||||
return SharedRef<IFileSystemSf>.CreateMove(ref sharedAdapter.Ref());
|
||||
return SharedRef<IFileSystemSf>.CreateMove(ref sharedAdapter.Ref);
|
||||
}
|
||||
|
||||
public static SharedRef<IFileSystemSf> CreateShared(
|
||||
@ -284,7 +284,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
|
||||
adapter._selfReference.Set(in sharedAdapter);
|
||||
|
||||
return SharedRef<IFileSystemSf>.CreateMove(ref sharedAdapter.Ref());
|
||||
return SharedRef<IFileSystemSf>.CreateMove(ref sharedAdapter.Ref);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@ -491,7 +491,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
|
||||
for (int tryNum = 0; tryNum < maxTryCount; tryNum++)
|
||||
{
|
||||
res = _baseFileSystem.Get.OpenFile(ref file.Ref(), in pathNormalized, (OpenMode)mode);
|
||||
res = _baseFileSystem.Get.OpenFile(ref file.Ref, in pathNormalized, (OpenMode)mode);
|
||||
|
||||
// Retry on ResultDataCorrupted
|
||||
if (!ResultFs.DataCorrupted.Includes(res))
|
||||
@ -503,7 +503,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
using SharedRef<FileSystemInterfaceAdapter> selfReference =
|
||||
SharedRef<FileSystemInterfaceAdapter>.Create(in _selfReference);
|
||||
|
||||
var adapter = new FileInterfaceAdapter(ref file.Ref(), ref selfReference.Ref(), _allowAllOperations);
|
||||
var adapter = new FileInterfaceAdapter(ref file.Ref, ref selfReference.Ref, _allowAllOperations);
|
||||
outFile.Reset(adapter);
|
||||
|
||||
return Result.Success;
|
||||
@ -521,7 +521,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
|
||||
for (int tryNum = 0; tryNum < maxTryCount; tryNum++)
|
||||
{
|
||||
res = _baseFileSystem.Get.OpenDirectory(ref directory.Ref(), in pathNormalized,
|
||||
res = _baseFileSystem.Get.OpenDirectory(ref directory.Ref, in pathNormalized,
|
||||
(OpenDirectoryMode)mode);
|
||||
|
||||
// Retry on ResultDataCorrupted
|
||||
@ -534,7 +534,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
using SharedRef<FileSystemInterfaceAdapter> selfReference =
|
||||
SharedRef<FileSystemInterfaceAdapter>.Create(in _selfReference);
|
||||
|
||||
var adapter = new DirectoryInterfaceAdapter(ref directory.Ref(), ref selfReference.Ref());
|
||||
var adapter = new DirectoryInterfaceAdapter(ref directory.Ref, ref selfReference.Ref);
|
||||
outDirectory.Reset(adapter);
|
||||
|
||||
return Result.Success;
|
||||
|
@ -99,7 +99,7 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
private Result EnsureSaveDataForContext()
|
||||
{
|
||||
using var contextFileSystem = new SharedRef<IFileSystem>();
|
||||
Result res = _multiCommitInterface.Get.OpenMultiCommitContext(ref contextFileSystem.Ref());
|
||||
Result res = _multiCommitInterface.Get.OpenMultiCommitContext(ref contextFileSystem.Ref);
|
||||
|
||||
if (res.IsFailure())
|
||||
{
|
||||
@ -127,7 +127,7 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
return ResultFs.MultiCommitFileSystemLimit.Log();
|
||||
|
||||
using var fsaFileSystem = new SharedRef<IFileSystem>();
|
||||
Result res = fileSystem.Get.GetImpl(ref fsaFileSystem.Ref());
|
||||
Result res = fileSystem.Get.GetImpl(ref fsaFileSystem.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Check that the file system hasn't already been added
|
||||
@ -137,7 +137,7 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
return ResultFs.MultiCommitHasOverlappingTargets.Log();
|
||||
}
|
||||
|
||||
_fileSystems[_fileSystemCount].SetByMove(ref fsaFileSystem.Ref());
|
||||
_fileSystems[_fileSystemCount].SetByMove(ref fsaFileSystem.Ref);
|
||||
_fileSystemCount++;
|
||||
|
||||
return Result.Success;
|
||||
@ -184,7 +184,7 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
Result res = EnsureSaveDataForContext();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = _multiCommitInterface.Get.OpenMultiCommitContext(ref contextFileSystem.Ref());
|
||||
res = _multiCommitInterface.Get.OpenMultiCommitContext(ref contextFileSystem.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Commit(contextFileSystem.Get);
|
||||
@ -273,7 +273,7 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
|
||||
// Read the multi-commit context
|
||||
using var contextFile = new UniqueRef<IFile>();
|
||||
res = contextFs.OpenFile(ref contextFile.Ref(), in contextFilePath, OpenMode.ReadWrite);
|
||||
res = contextFs.OpenFile(ref contextFile.Ref, in contextFilePath, OpenMode.ReadWrite);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Unsafe.SkipInit(out Context context);
|
||||
@ -300,10 +300,10 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
using var reader = new SharedRef<SaveDataInfoReaderImpl>();
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
|
||||
res = saveService.OpenSaveDataIndexerAccessor(ref accessor.Ref(), out _, SaveDataSpaceId.User);
|
||||
res = saveService.OpenSaveDataIndexerAccessor(ref accessor.Ref, out _, SaveDataSpaceId.User);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref());
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Iterate through all the saves to find any provisionally committed save data
|
||||
@ -381,10 +381,10 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
using var reader = new SharedRef<SaveDataInfoReaderImpl>();
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
|
||||
res = saveService.OpenSaveDataIndexerAccessor(ref accessor.Ref(), out _, SaveDataSpaceId.User);
|
||||
res = saveService.OpenSaveDataIndexerAccessor(ref accessor.Ref, out _, SaveDataSpaceId.User);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref());
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Iterate through all the saves to find any provisionally committed save data
|
||||
@ -461,7 +461,7 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
// Check if a multi-commit was interrupted by checking if there's a commit context file.
|
||||
Result res = multiCommitInterface.OpenMultiCommitContext(ref fileSystem.Ref());
|
||||
Result res = multiCommitInterface.OpenMultiCommitContext(ref fileSystem.Ref);
|
||||
|
||||
if (res.IsFailure())
|
||||
{
|
||||
@ -479,7 +479,7 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
res = fileSystem.Get.OpenFile(ref file.Ref(), in contextFilePath, OpenMode.Read);
|
||||
res = fileSystem.Get.OpenFile(ref file.Ref, in contextFilePath, OpenMode.Read);
|
||||
|
||||
if (res.IsFailure())
|
||||
{
|
||||
@ -552,7 +552,7 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
// Open context file and create if it doesn't exist
|
||||
using (var contextFile = new UniqueRef<IFile>())
|
||||
{
|
||||
res = _fileSystem.OpenFile(ref contextFile.Ref(), in contextFilePath, OpenMode.Read);
|
||||
res = _fileSystem.OpenFile(ref contextFile.Ref, in contextFilePath, OpenMode.Read);
|
||||
|
||||
if (res.IsFailure())
|
||||
{
|
||||
@ -562,14 +562,14 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
res = _fileSystem.CreateFile(in contextFilePath, CommitContextFileSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = _fileSystem.OpenFile(ref contextFile.Ref(), in contextFilePath, OpenMode.Read);
|
||||
res = _fileSystem.OpenFile(ref contextFile.Ref, in contextFilePath, OpenMode.Read);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
}
|
||||
|
||||
using (var contextFile = new UniqueRef<IFile>())
|
||||
{
|
||||
res = _fileSystem.OpenFile(ref contextFile.Ref(), in contextFilePath, OpenMode.ReadWrite);
|
||||
res = _fileSystem.OpenFile(ref contextFile.Ref, in contextFilePath, OpenMode.ReadWrite);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_context.Version = CurrentCommitContextVersion;
|
||||
@ -604,7 +604,7 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var contextFile = new UniqueRef<IFile>();
|
||||
res = _fileSystem.OpenFile(ref contextFile.Ref(), in contextFilePath, OpenMode.ReadWrite);
|
||||
res = _fileSystem.OpenFile(ref contextFile.Ref, in contextFilePath, OpenMode.ReadWrite);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_context.State = CommitState.ProvisionallyCommitted;
|
||||
|
@ -135,7 +135,7 @@ public class SaveDataExtraDataAccessorCacheManager : ISaveDataExtraDataAccessorO
|
||||
if (!accessor.HasValue)
|
||||
return ResultFs.TargetNotFound.Log();
|
||||
|
||||
outAccessor.SetByMove(ref accessor.Ref());
|
||||
outAccessor.SetByMove(ref accessor.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ public class SaveDataFileSystemCacheManager : IDisposable
|
||||
if (_cachedFileSystems[i].IsCached(spaceId, saveDataId))
|
||||
{
|
||||
using SharedRef<ISaveDataFileSystem> cachedFs = _cachedFileSystems[i].Move();
|
||||
outFileSystem.SetByMove(ref cachedFs.Ref());
|
||||
outFileSystem.SetByMove(ref cachedFs.Ref);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ internal static class Utility
|
||||
|
||||
// Check if the directory exists
|
||||
using var dir = new UniqueRef<IDirectory>();
|
||||
Result res = baseFileSystem.Get.OpenDirectory(ref dir.Ref(), rootPath, OpenDirectoryMode.Directory);
|
||||
Result res = baseFileSystem.Get.OpenDirectory(ref dir.Ref, rootPath, OpenDirectoryMode.Directory);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
dir.Reset();
|
||||
@ -38,7 +38,7 @@ internal static class Utility
|
||||
res = fs.Get.Initialize(in rootPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outSubDirFileSystem.SetByMove(ref fs.Ref());
|
||||
outSubDirFileSystem.SetByMove(ref fs.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
using var sharedService = new SharedRef<NcaFileSystemService>(ncaService);
|
||||
ncaService._selfReference.Set(in sharedService);
|
||||
|
||||
return SharedRef<NcaFileSystemService>.CreateMove(ref sharedService.Ref());
|
||||
return SharedRef<NcaFileSystemService>.CreateMove(ref sharedService.Ref);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@ -127,7 +127,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
return originalResult;
|
||||
|
||||
// There is an original version and no patch version. Open the original directly
|
||||
res = _serviceImpl.OpenFileSystem(ref fileSystem.Ref(), in originalPath, fsType, programId.Value,
|
||||
res = _serviceImpl.OpenFileSystem(ref fileSystem.Ref, in originalPath, fsType, programId.Value,
|
||||
isDirectory);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
@ -141,28 +141,28 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
: ref PathExtensions.GetNullRef();
|
||||
|
||||
// Open the file system using both the original and patch versions
|
||||
res = _serviceImpl.OpenFileSystemWithPatch(ref fileSystem.Ref(), in originalNcaPath, in patchPath,
|
||||
res = _serviceImpl.OpenFileSystemWithPatch(ref fileSystem.Ref, in originalNcaPath, in patchPath,
|
||||
fsType, programId.Value);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
// Add all the file system wrappers
|
||||
using var typeSetFileSystem =
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref(), storageFlag));
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref, storageFlag));
|
||||
|
||||
using var asyncFileSystem =
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref()));
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref));
|
||||
|
||||
using SharedRef<IRomFileSystemAccessFailureManager> accessFailureManager =
|
||||
SharedRef<IRomFileSystemAccessFailureManager>.Create(in _selfReference);
|
||||
|
||||
using SharedRef<IFileSystem> retryFileSystem =
|
||||
DeepRetryFileSystem.CreateShared(ref asyncFileSystem.Ref(), ref accessFailureManager.Ref());
|
||||
DeepRetryFileSystem.CreateShared(ref asyncFileSystem.Ref, ref accessFailureManager.Ref);
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref retryFileSystem.Ref(), false);
|
||||
FileSystemInterfaceAdapter.CreateShared(ref retryFileSystem.Ref, false);
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -290,21 +290,21 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
bool isDirectory = PathUtility.IsDirectoryPath(in path);
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
res = _serviceImpl.OpenFileSystem(ref fileSystem.Ref(), in pathNormalized, fsType, canMountSystemDataPrivate,
|
||||
res = _serviceImpl.OpenFileSystem(ref fileSystem.Ref, in pathNormalized, fsType, canMountSystemDataPrivate,
|
||||
id, isDirectory);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the wrappers for the file system
|
||||
using var typeSetFileSystem =
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref(), storageFlag));
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref, storageFlag));
|
||||
|
||||
using var asyncFileSystem =
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref fileSystem.Ref()));
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref fileSystem.Ref));
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref(), false);
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref, false);
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -330,7 +330,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
res = OpenDataFileSystemCore(ref fileSystem.Ref(), out _, targetProgramId.Value, programInfo.StorageId);
|
||||
res = OpenDataFileSystemCore(ref fileSystem.Ref, out _, targetProgramId.Value, programInfo.StorageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Verify the caller has access to the file system
|
||||
@ -342,12 +342,12 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
|
||||
// Add all the file system wrappers
|
||||
using var asyncFileSystem =
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref fileSystem.Ref()));
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref fileSystem.Ref));
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref(), false);
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref, false);
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -436,15 +436,15 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
isHostFs = Utility.IsHostFsMountName(programPath.GetString());
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
res = _serviceImpl.OpenDataFileSystem(ref fileSystem.Ref(), in programPath, FileSystemProxyType.Rom,
|
||||
res = _serviceImpl.OpenDataFileSystem(ref fileSystem.Ref, in programPath, FileSystemProxyType.Rom,
|
||||
programId, isDirectory);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the file system wrappers
|
||||
using var typeSetFileSystem =
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref(), storageFlag));
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref, storageFlag));
|
||||
|
||||
outFileSystem.SetByMove(ref typeSetFileSystem.Ref());
|
||||
outFileSystem.SetByMove(ref typeSetFileSystem.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -465,20 +465,20 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
res = _serviceImpl.OpenContentStorageFileSystem(ref fileSystem.Ref(), contentStorageId);
|
||||
res = _serviceImpl.OpenContentStorageFileSystem(ref fileSystem.Ref, contentStorageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the file system wrappers
|
||||
using var typeSetFileSystem =
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref(), storageFlag));
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref, storageFlag));
|
||||
|
||||
using var asyncFileSystem =
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref()));
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref));
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref(), false);
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref, false);
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -547,20 +547,20 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
res = _serviceImpl.OpenRegisteredUpdatePartition(ref fileSystem.Ref());
|
||||
res = _serviceImpl.OpenRegisteredUpdatePartition(ref fileSystem.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the file system wrappers
|
||||
using var typeSetFileSystem =
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref(), storageFlag));
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref, storageFlag));
|
||||
|
||||
using var asyncFileSystem =
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref()));
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref));
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref(), false);
|
||||
FileSystemInterfaceAdapter.CreateShared(ref asyncFileSystem.Ref, false);
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class NcaFileSystemServiceImpl
|
||||
|
||||
// Open the root filesystem based on the path's mount name
|
||||
using var baseFileSystem = new SharedRef<IFileSystem>();
|
||||
Result res = ParseMountName(ref currentPath, ref baseFileSystem.Ref(), out bool shouldContinue,
|
||||
Result res = ParseMountName(ref currentPath, ref baseFileSystem.Ref, out bool shouldContinue,
|
||||
out MountInfo mountNameInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -132,22 +132,22 @@ public class NcaFileSystemServiceImpl
|
||||
using var hostFileSystem = new SharedRef<IFileSystem>();
|
||||
using var readOnlyFileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
res = ParseDirWithPathCaseNormalizationOnCaseSensitiveHostFs(ref hostFileSystem.Ref(),
|
||||
res = ParseDirWithPathCaseNormalizationOnCaseSensitiveHostFs(ref hostFileSystem.Ref,
|
||||
in directoryPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
readOnlyFileSystem.Reset(new ReadOnlyFileSystem(ref hostFileSystem.Ref()));
|
||||
outFileSystem.SetByMove(ref readOnlyFileSystem.Ref());
|
||||
readOnlyFileSystem.Reset(new ReadOnlyFileSystem(ref hostFileSystem.Ref));
|
||||
outFileSystem.SetByMove(ref readOnlyFileSystem.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
return ParseDir(in directoryPath, ref outFileSystem, ref baseFileSystem.Ref(), type, true);
|
||||
return ParseDir(in directoryPath, ref outFileSystem, ref baseFileSystem.Ref, type, true);
|
||||
}
|
||||
|
||||
using var nspFileSystem = new SharedRef<IFileSystem>();
|
||||
using SharedRef<IFileSystem> tempFileSystem = SharedRef<IFileSystem>.CreateCopy(in baseFileSystem);
|
||||
res = ParseNsp(ref currentPath, ref nspFileSystem.Ref(), ref baseFileSystem.Ref());
|
||||
res = ParseNsp(ref currentPath, ref nspFileSystem.Ref, ref baseFileSystem.Ref);
|
||||
|
||||
if (res.IsSuccess())
|
||||
{
|
||||
@ -156,14 +156,14 @@ public class NcaFileSystemServiceImpl
|
||||
{
|
||||
if (type == FileSystemProxyType.Package)
|
||||
{
|
||||
outFileSystem.SetByMove(ref nspFileSystem.Ref());
|
||||
outFileSystem.SetByMove(ref nspFileSystem.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
return ResultFs.InvalidArgument.Log();
|
||||
}
|
||||
|
||||
baseFileSystem.SetByMove(ref nspFileSystem.Ref());
|
||||
baseFileSystem.SetByMove(ref nspFileSystem.Ref);
|
||||
}
|
||||
|
||||
if (!mountNameInfo.CanMountNca)
|
||||
@ -173,20 +173,20 @@ public class NcaFileSystemServiceImpl
|
||||
|
||||
ulong openProgramId = mountNameInfo.IsHostFs ? ulong.MaxValue : id;
|
||||
|
||||
res = ParseNca(ref currentPath, out Nca nca, ref baseFileSystem.Ref(), openProgramId);
|
||||
res = ParseNca(ref currentPath, out Nca nca, ref baseFileSystem.Ref, openProgramId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var ncaSectionStorage = new SharedRef<IStorage>();
|
||||
res = OpenStorageByContentType(ref ncaSectionStorage.Ref(), nca, out NcaFormatType fsType, type,
|
||||
res = OpenStorageByContentType(ref ncaSectionStorage.Ref, nca, out NcaFormatType fsType, type,
|
||||
mountNameInfo.IsGameCard, canMountSystemDataPrivate);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
switch (fsType)
|
||||
{
|
||||
case NcaFormatType.Romfs:
|
||||
return _config.RomFsCreator.Create(ref outFileSystem, ref ncaSectionStorage.Ref());
|
||||
return _config.RomFsCreator.Create(ref outFileSystem, ref ncaSectionStorage.Ref);
|
||||
case NcaFormatType.Pfs0:
|
||||
return _config.PartitionFsCreator.Create(ref outFileSystem, ref ncaSectionStorage.Ref());
|
||||
return _config.PartitionFsCreator.Create(ref outFileSystem, ref ncaSectionStorage.Ref);
|
||||
default:
|
||||
return ResultFs.InvalidNcaFileSystemType.Log();
|
||||
}
|
||||
@ -208,11 +208,11 @@ public class NcaFileSystemServiceImpl
|
||||
in Path originalNcaPath, in Path currentNcaPath, FileSystemProxyType fsType, ulong id)
|
||||
{
|
||||
using var romFsStorage = new SharedRef<IStorage>();
|
||||
Result res = OpenStorageWithPatch(ref romFsStorage.Ref(), out Unsafe.NullRef<Hash>(), in originalNcaPath,
|
||||
Result res = OpenStorageWithPatch(ref romFsStorage.Ref, out Unsafe.NullRef<Hash>(), in originalNcaPath,
|
||||
in currentNcaPath, fsType, id);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _config.RomFsCreator.Create(ref outFileSystem, ref romFsStorage.Ref());
|
||||
return _config.RomFsCreator.Create(ref outFileSystem, ref romFsStorage.Ref);
|
||||
}
|
||||
|
||||
public Result OpenContentStorageFileSystem(ref SharedRef<IFileSystem> outFileSystem,
|
||||
@ -225,15 +225,15 @@ public class NcaFileSystemServiceImpl
|
||||
switch (contentStorageId)
|
||||
{
|
||||
case ContentStorageId.System:
|
||||
res = _config.BaseFsService.OpenBisFileSystem(ref fileSystem.Ref(), BisPartitionId.System);
|
||||
res = _config.BaseFsService.OpenBisFileSystem(ref fileSystem.Ref, BisPartitionId.System);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
break;
|
||||
case ContentStorageId.User:
|
||||
res = _config.BaseFsService.OpenBisFileSystem(ref fileSystem.Ref(), BisPartitionId.User);
|
||||
res = _config.BaseFsService.OpenBisFileSystem(ref fileSystem.Ref, BisPartitionId.User);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
break;
|
||||
case ContentStorageId.SdCard:
|
||||
res = _config.BaseFsService.OpenSdCardProxyFileSystem(ref fileSystem.Ref());
|
||||
res = _config.BaseFsService.OpenSdCardProxyFileSystem(ref fileSystem.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
break;
|
||||
default:
|
||||
@ -264,18 +264,18 @@ public class NcaFileSystemServiceImpl
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var subDirFs = new SharedRef<IFileSystem>();
|
||||
res = _config.SubDirectoryFsCreator.Create(ref subDirFs.Ref(), ref fileSystem.Ref(), in contentStoragePath);
|
||||
res = _config.SubDirectoryFsCreator.Create(ref subDirFs.Ref, ref fileSystem.Ref, in contentStoragePath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Only content on the SD card is encrypted
|
||||
if (contentStorageId == ContentStorageId.SdCard)
|
||||
{
|
||||
using SharedRef<IFileSystem> tempFileSystem = SharedRef<IFileSystem>.CreateMove(ref subDirFs.Ref());
|
||||
res = _config.EncryptedFsCreator.Create(ref subDirFs.Ref(), ref tempFileSystem.Ref(),
|
||||
using SharedRef<IFileSystem> tempFileSystem = SharedRef<IFileSystem>.CreateMove(ref subDirFs.Ref);
|
||||
res = _config.EncryptedFsCreator.Create(ref subDirFs.Ref, ref tempFileSystem.Ref,
|
||||
IEncryptedFileSystemCreator.KeyId.Content, in _encryptionSeed);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
outFileSystem.SetByMove(ref subDirFs.Ref());
|
||||
outFileSystem.SetByMove(ref subDirFs.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -514,10 +514,10 @@ public class NcaFileSystemServiceImpl
|
||||
ref SharedRef<IFileSystem> baseFileSystem, FileSystemProxyType fsType, bool preserveUnc)
|
||||
{
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
Result res = _config.SubDirectoryFsCreator.Create(ref fileSystem.Ref(), ref baseFileSystem, in path);
|
||||
Result res = _config.SubDirectoryFsCreator.Create(ref fileSystem.Ref, ref baseFileSystem, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ParseContentTypeForDirectory(ref outContentFileSystem, ref fileSystem.Ref(), fsType);
|
||||
return ParseContentTypeForDirectory(ref outContentFileSystem, ref fileSystem.Ref, fsType);
|
||||
}
|
||||
|
||||
private Result ParseDirWithPathCaseNormalizationOnCaseSensitiveHostFs(ref SharedRef<IFileSystem> outFileSystem,
|
||||
@ -586,8 +586,8 @@ public class NcaFileSystemServiceImpl
|
||||
res = nspFileStorage.Get.Initialize(ref baseFileSystem, in pathNsp, OpenMode.Read);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IStorage> tempStorage = SharedRef<IStorage>.CreateMove(ref nspFileStorage.Ref());
|
||||
res = _config.PartitionFsCreator.Create(ref outFileSystem, ref tempStorage.Ref());
|
||||
using SharedRef<IStorage> tempStorage = SharedRef<IStorage>.CreateMove(ref nspFileStorage.Ref);
|
||||
res = _config.PartitionFsCreator.Create(ref outFileSystem, ref tempStorage.Ref);
|
||||
|
||||
if (res.IsSuccess())
|
||||
{
|
||||
@ -669,10 +669,10 @@ public class NcaFileSystemServiceImpl
|
||||
return ResultFs.InvalidArgument.Log();
|
||||
|
||||
// Open the subdirectory filesystem
|
||||
res = _config.SubDirectoryFsCreator.Create(ref subDirFs.Ref(), ref baseFileSystem, in directoryPath);
|
||||
res = _config.SubDirectoryFsCreator.Create(ref subDirFs.Ref, ref baseFileSystem, in directoryPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFileSystem.SetByMove(ref subDirFs.Ref());
|
||||
outFileSystem.SetByMove(ref subDirFs.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
using var sharedService = new SharedRef<SaveDataFileSystemService>(saveService);
|
||||
saveService._selfReference.Set(in sharedService);
|
||||
|
||||
return SharedRef<SaveDataFileSystemService>.CreateMove(ref sharedService.Ref());
|
||||
return SharedRef<SaveDataFileSystemService>.CreateMove(ref sharedService.Ref);
|
||||
}
|
||||
|
||||
private class SaveDataOpenCountAdapter : IEntryOpenCountSemaphoreManager
|
||||
@ -617,7 +617,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
Result res = _serviceImpl.OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), spaceId);
|
||||
Result res = _serviceImpl.OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var pathRoot = new Path();
|
||||
@ -651,7 +651,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
bool success = false;
|
||||
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), SaveDataSpaceId.System);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, SaveDataSpaceId.System);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
ReadOnlySpan<ulong> ids = MemoryMarshal.Cast<byte, ulong>(saveDataIds.Buffer);
|
||||
@ -721,7 +721,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
if (saveDataId != SaveIndexerId)
|
||||
{
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().GetValue(out SaveDataIndexerValue value, saveDataId);
|
||||
@ -756,7 +756,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
|
||||
if (saveDataId != SaveIndexerId)
|
||||
{
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Get the actual space ID of this save.
|
||||
@ -909,12 +909,12 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||
|
||||
using var file = new SharedRef<IFile>();
|
||||
Result res = _serviceImpl.OpenSaveDataFile(ref file.Ref(), spaceId, saveDataId, openMode);
|
||||
Result res = _serviceImpl.OpenSaveDataFile(ref file.Ref, spaceId, saveDataId, openMode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var typeSetFile = new SharedRef<IFile>(new StorageLayoutTypeSetFile(ref file.Ref(), storageFlag));
|
||||
using var typeSetFile = new SharedRef<IFile>(new StorageLayoutTypeSetFile(ref file.Ref, storageFlag));
|
||||
|
||||
outFile.SetByMove(ref typeSetFile.Ref());
|
||||
outFile.SetByMove(ref typeSetFile.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -953,7 +953,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
}
|
||||
else
|
||||
{
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), creationInfo.SpaceId);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, creationInfo.SpaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
accessorInitialized = true;
|
||||
@ -1068,7 +1068,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
if (creationInfo.MetaType == SaveDataMetaType.Thumbnail)
|
||||
{
|
||||
using var metaFile = new UniqueRef<IFile>();
|
||||
res = _serviceImpl.OpenSaveDataMeta(ref metaFile.Ref(), saveDataId, creationInfo.SpaceId,
|
||||
res = _serviceImpl.OpenSaveDataMeta(ref metaFile.Ref, saveDataId, creationInfo.SpaceId,
|
||||
creationInfo.MetaType);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -1172,7 +1172,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().Get(out SaveDataIndexerValue value, in attribute);
|
||||
@ -1325,7 +1325,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
|
||||
using (var accessor = new UniqueRef<SaveDataIndexerAccessor>())
|
||||
{
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().GetKey(out key, saveDataId);
|
||||
@ -1370,7 +1370,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
// Get the indexer key for the save data.
|
||||
using (var accessor = new UniqueRef<SaveDataIndexerAccessor>())
|
||||
{
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().GetKey(out key, saveDataId);
|
||||
@ -1386,7 +1386,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
{
|
||||
// Try to return the save data to its original state if something went wrong.
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().GetValue(out SaveDataIndexerValue value, saveDataId);
|
||||
@ -1407,7 +1407,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
// Update the save data's size in the indexer.
|
||||
using (var accessor = new UniqueRef<SaveDataIndexerAccessor>())
|
||||
{
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
accessor.Get.GetInterface().SetSize(saveDataId, extendedTotalSize).IgnoreResult();
|
||||
@ -1423,7 +1423,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
// Set the save data's state back to normal.
|
||||
using (var accessor = new UniqueRef<SaveDataIndexerAccessor>())
|
||||
{
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().SetState(saveDataId, SaveDataState.Normal);
|
||||
@ -1466,7 +1466,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
}
|
||||
else
|
||||
{
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().Get(out SaveDataIndexerValue indexerValue, in attribute);
|
||||
@ -1520,7 +1520,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
if (isStaticSaveDataId)
|
||||
{
|
||||
// The accessor won't be open yet if the save has a static ID
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Check the space ID of the save data
|
||||
@ -1547,7 +1547,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
|
||||
// Try grabbing the mount count semaphore
|
||||
using var mountCountSemaphore = new UniqueRef<IUniqueLock>();
|
||||
Result res = TryAcquireSaveDataMountCountSemaphore(ref mountCountSemaphore.Ref());
|
||||
Result res = TryAcquireSaveDataMountCountSemaphore(ref mountCountSemaphore.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using Path saveDataRootPath = _saveDataRootPath.DangerousGetPath();
|
||||
@ -1556,7 +1556,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
// Open the file system
|
||||
res = OpenSaveDataFileSystemCore(ref fileSystem.Ref(), out ulong saveDataId, spaceId, in attribute,
|
||||
res = OpenSaveDataFileSystemCore(ref fileSystem.Ref, out ulong saveDataId, spaceId, in attribute,
|
||||
openReadOnly, cacheExtraData: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -1575,34 +1575,34 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
|
||||
// Add all the wrappers for the file system
|
||||
using var typeSetFileSystem =
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref(), storageFlag));
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref, storageFlag));
|
||||
|
||||
using var asyncFileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
if (useAsyncFileSystem)
|
||||
{
|
||||
asyncFileSystem.Reset(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref()));
|
||||
asyncFileSystem.Reset(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref));
|
||||
}
|
||||
else
|
||||
{
|
||||
asyncFileSystem.SetByMove(ref typeSetFileSystem.Ref());
|
||||
asyncFileSystem.SetByMove(ref typeSetFileSystem.Ref);
|
||||
}
|
||||
|
||||
using SharedRef<SaveDataFileSystemService> saveService = GetSharedFromThis();
|
||||
using var openEntryCountAdapter =
|
||||
new SharedRef<IEntryOpenCountSemaphoreManager>(new SaveDataOpenCountAdapter(ref saveService.Ref()));
|
||||
new SharedRef<IEntryOpenCountSemaphoreManager>(new SaveDataOpenCountAdapter(ref saveService.Ref));
|
||||
|
||||
using var openCountFileSystem = new SharedRef<IFileSystem>(new OpenCountFileSystem(ref asyncFileSystem.Ref(),
|
||||
ref openEntryCountAdapter.Ref(), ref mountCountSemaphore.Ref()));
|
||||
using var openCountFileSystem = new SharedRef<IFileSystem>(new OpenCountFileSystem(ref asyncFileSystem.Ref,
|
||||
ref openEntryCountAdapter.Ref, ref mountCountSemaphore.Ref));
|
||||
|
||||
var pathFlags = new PathFlags();
|
||||
pathFlags.AllowBackslash();
|
||||
pathFlags.AllowAllCharacters();
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref openCountFileSystem.Ref(), pathFlags, false);
|
||||
FileSystemInterfaceAdapter.CreateShared(ref openCountFileSystem.Ref, pathFlags, false);
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -1672,7 +1672,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
// Open the file system
|
||||
res = OpenSaveDataFileSystemCore(ref fileSystem.Ref(), out ulong saveDataId, spaceId, in attribute,
|
||||
res = OpenSaveDataFileSystemCore(ref fileSystem.Ref, out ulong saveDataId, spaceId, in attribute,
|
||||
openReadOnly: false, cacheExtraData: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -1691,35 +1691,35 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
|
||||
// Add all the wrappers for the file system
|
||||
using var typeSetFileSystem =
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref(), storageFlag));
|
||||
new SharedRef<IFileSystem>(new StorageLayoutTypeSetFileSystem(ref fileSystem.Ref, storageFlag));
|
||||
|
||||
using var asyncFileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
if (useAsyncFileSystem)
|
||||
{
|
||||
asyncFileSystem.Reset(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref()));
|
||||
asyncFileSystem.Reset(new AsynchronousAccessFileSystem(ref typeSetFileSystem.Ref));
|
||||
}
|
||||
else
|
||||
{
|
||||
asyncFileSystem.SetByMove(ref typeSetFileSystem.Ref());
|
||||
asyncFileSystem.SetByMove(ref typeSetFileSystem.Ref);
|
||||
}
|
||||
|
||||
using SharedRef<SaveDataFileSystemService> saveService = GetSharedFromThis();
|
||||
using var openEntryCountAdapter =
|
||||
new SharedRef<IEntryOpenCountSemaphoreManager>(new SaveDataOpenCountAdapter(ref saveService.Ref()));
|
||||
new SharedRef<IEntryOpenCountSemaphoreManager>(new SaveDataOpenCountAdapter(ref saveService.Ref));
|
||||
|
||||
using var openCountFileSystem = new SharedRef<IFileSystem>(
|
||||
new OpenCountFileSystem(ref asyncFileSystem.Ref(), ref openEntryCountAdapter.Ref()));
|
||||
new OpenCountFileSystem(ref asyncFileSystem.Ref, ref openEntryCountAdapter.Ref));
|
||||
|
||||
var pathFlags = new PathFlags();
|
||||
pathFlags.AllowBackslash();
|
||||
pathFlags.AllowAllCharacters();
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref openCountFileSystem.Ref(), pathFlags,
|
||||
FileSystemInterfaceAdapter.CreateShared(ref openCountFileSystem.Ref, pathFlags,
|
||||
allowAllOperations: false);
|
||||
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref());
|
||||
outFileSystem.SetByMove(ref fileSystemAdapter.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -1734,7 +1734,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().GetKey(out SaveDataAttribute key, saveDataId);
|
||||
@ -1764,12 +1764,12 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
|
||||
if (IsStaticSaveDataIdValueRange(saveDataId))
|
||||
{
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), SaveDataSpaceId.System);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, SaveDataSpaceId.System);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), SaveDataSpaceId.User);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, SaveDataSpaceId.User);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
@ -1785,7 +1785,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
{
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId.ValueRo);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId.ValueRo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().GetValue(out SaveDataIndexerValue _, saveDataId);
|
||||
@ -1924,7 +1924,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().GetKey(out SaveDataAttribute key, saveDataId);
|
||||
@ -2019,14 +2019,14 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
|
||||
using (var accessor = new UniqueRef<SaveDataIndexerAccessor>())
|
||||
{
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), SaveDataSpaceId.System);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, SaveDataSpaceId.System);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref());
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
outInfoReader.SetByMove(ref reader.Ref());
|
||||
outInfoReader.SetByMove(ref reader.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -2046,21 +2046,21 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
|
||||
using (var accessor = new UniqueRef<SaveDataIndexerAccessor>())
|
||||
{
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var reader = new SharedRef<SaveDataInfoReaderImpl>();
|
||||
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref());
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var filter = new SaveDataInfoFilter(ConvertToRealSpaceId(spaceId), programId: default,
|
||||
saveDataType: default, userId: default, saveDataId: default, index: default, (int)SaveDataRank.Primary);
|
||||
|
||||
filterReader.Reset(new SaveDataInfoFilterReader(ref reader.Ref(), in filter));
|
||||
filterReader.Reset(new SaveDataInfoFilterReader(ref reader.Ref, in filter));
|
||||
}
|
||||
|
||||
outInfoReader.Set(ref filterReader.Ref());
|
||||
outInfoReader.Set(ref filterReader.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -2083,20 +2083,20 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
|
||||
using (var accessor = new UniqueRef<SaveDataIndexerAccessor>())
|
||||
{
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var reader = new SharedRef<SaveDataInfoReaderImpl>();
|
||||
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref());
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var infoFilter = new SaveDataInfoFilter(ConvertToRealSpaceId(spaceId), in filter);
|
||||
|
||||
filterReader.Reset(new SaveDataInfoFilterReader(ref reader.Ref(), in infoFilter));
|
||||
filterReader.Reset(new SaveDataInfoFilterReader(ref reader.Ref, in infoFilter));
|
||||
}
|
||||
|
||||
outInfoReader.Set(ref filterReader.Ref());
|
||||
outInfoReader.Set(ref filterReader.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -2109,14 +2109,14 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
using var reader = new SharedRef<SaveDataInfoReaderImpl>();
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref());
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var filterReader =
|
||||
new UniqueRef<SaveDataInfoFilterReader>(new SaveDataInfoFilterReader(ref reader.Ref(), in infoFilter));
|
||||
new UniqueRef<SaveDataInfoFilterReader>(new SaveDataInfoFilterReader(ref reader.Ref, in infoFilter));
|
||||
|
||||
return filterReader.Get.Read(out count, new OutBuffer(SpanHelpers.AsByteSpan(ref info))).Ret();
|
||||
}
|
||||
@ -2165,7 +2165,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
res = _serviceImpl.OpenSaveDataMeta(ref file.Ref(), saveDataId, spaceId, SaveDataMetaType.Thumbnail);
|
||||
res = _serviceImpl.OpenSaveDataMeta(ref file.Ref, saveDataId, spaceId, SaveDataMetaType.Thumbnail);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Hash hash = default;
|
||||
@ -2244,10 +2244,10 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
using (var reader = new SharedRef<SaveDataInfoReaderImpl>())
|
||||
using (var accessor = new UniqueRef<SaveDataIndexerAccessor>())
|
||||
{
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref());
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
ProgramId resolvedProgramId = ResolveDefaultSaveDataReferenceProgramId(programInfo.ProgramId);
|
||||
@ -2255,10 +2255,10 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
var filter = new SaveDataInfoFilter(ConvertToRealSpaceId(spaceId), resolvedProgramId, SaveDataType.Cache,
|
||||
userId: default, saveDataId: default, index: default, (int)SaveDataRank.Primary);
|
||||
|
||||
filterReader.Reset(new SaveDataInfoFilterReader(ref reader.Ref(), in filter));
|
||||
filterReader.Reset(new SaveDataInfoFilterReader(ref reader.Ref, in filter));
|
||||
}
|
||||
|
||||
outInfoReader.Set(ref filterReader.Ref());
|
||||
outInfoReader.Set(ref filterReader.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -2501,7 +2501,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
|
||||
using (var accessor = new UniqueRef<SaveDataIndexerAccessor>())
|
||||
{
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), spaceId);
|
||||
res = OpenSaveDataIndexerAccessor(ref accessor.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = accessor.Get.GetInterface().GetValue(out value, saveDataId);
|
||||
@ -2517,7 +2517,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
using Path saveDataRootPath = _saveDataRootPath.DangerousGetPath();
|
||||
res = _serviceImpl.OpenSaveDataFileSystem(ref fileSystem.Ref(), value.SpaceId, saveDataId,
|
||||
res = _serviceImpl.OpenSaveDataFileSystem(ref fileSystem.Ref, value.SpaceId, saveDataId,
|
||||
in saveDataRootPath,
|
||||
openReadOnly: false, saveDataType, cacheExtraData: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
@ -2545,7 +2545,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.Bis);
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), SaveDataSpaceId.System);
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref, SaveDataSpaceId.System);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return CleanUpSaveData(accessor.Get).Ret();
|
||||
@ -2562,7 +2562,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.Bis);
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), SaveDataSpaceId.System);
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref, SaveDataSpaceId.System);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return CompleteSaveDataExtension(accessor.Get).Ret();
|
||||
@ -2579,7 +2579,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.Bis);
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
Result res = _serviceImpl.OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), SaveDataSpaceId.Temporary);
|
||||
Result res = _serviceImpl.OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref, SaveDataSpaceId.Temporary);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var pathRoot = new Path();
|
||||
@ -2603,7 +2603,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
{
|
||||
using SharedRef<ISaveDataMultiCommitCoreInterface> commitInterface = GetSharedMultiCommitInterfaceFromThis();
|
||||
|
||||
outCommitManager.Reset(new MultiCommitManager(_serviceImpl.FsServer, ref commitInterface.Ref()));
|
||||
outCommitManager.Reset(new MultiCommitManager(_serviceImpl.FsServer, ref commitInterface.Ref));
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -2616,11 +2616,11 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
res = OpenSaveDataFileSystemCore(ref fileSystem.Ref(), out _, SaveDataSpaceId.System, in attribute,
|
||||
res = OpenSaveDataFileSystemCore(ref fileSystem.Ref, out _, SaveDataSpaceId.System, in attribute,
|
||||
openReadOnly: false, cacheExtraData: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
contextFileSystem.SetByMove(ref fileSystem.Ref());
|
||||
contextFileSystem.SetByMove(ref fileSystem.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -2642,7 +2642,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
res = OpenSaveDataFileSystemCore(ref fileSystem.Ref(), out _, saveInfo.SpaceId, in attribute,
|
||||
res = OpenSaveDataFileSystemCore(ref fileSystem.Ref, out _, saveInfo.SpaceId, in attribute,
|
||||
openReadOnly: false, cacheExtraData: false);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -2665,7 +2665,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
using SharedRef<SaveDataFileSystemService> saveService = GetSharedFromThis();
|
||||
|
||||
Result res = Utility.MakeUniqueLockWithPin(ref outSemaphoreLock, _openEntryCountSemaphore,
|
||||
ref saveService.Ref());
|
||||
ref saveService.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
@ -2676,7 +2676,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
using SharedRef<SaveDataFileSystemService> saveService = GetSharedFromThis();
|
||||
|
||||
Result res = Utility.MakeUniqueLockWithPin(ref outSemaphoreLock, _saveDataMountCountSemaphore,
|
||||
ref saveService.Ref());
|
||||
ref saveService.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
@ -2709,7 +2709,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
SaveDataSpaceId spaceId)
|
||||
{
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
Result res = _serviceImpl.OpenSaveDataIndexerAccessor(ref accessor.Ref(), out bool isInitialOpen, spaceId);
|
||||
Result res = _serviceImpl.OpenSaveDataIndexerAccessor(ref accessor.Ref, out bool isInitialOpen, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (isInitialOpen)
|
||||
@ -2718,7 +2718,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
||||
CompleteSaveDataExtension(accessor.Get).IgnoreResult();
|
||||
}
|
||||
|
||||
outAccessor.Set(ref accessor.Ref());
|
||||
outAccessor.Set(ref accessor.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
Result res = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), spaceId);
|
||||
Result res = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref, spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Get the path of the save data
|
||||
@ -160,7 +160,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
{
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
Result res = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), spaceId, in saveDataRootPath, true);
|
||||
Result res = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref, spaceId, in saveDataRootPath, true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
bool isEmulatedOnHost = IsAllowedDirectorySaveData(spaceId, in saveDataRootPath);
|
||||
@ -182,7 +182,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
using (_saveFileSystemCacheManager.GetScopedLock())
|
||||
using (_saveExtraDataCacheManager.GetScopedLock())
|
||||
{
|
||||
if (isEmulatedOnHost || !_saveFileSystemCacheManager.GetCache(ref saveDataFs.Ref(), spaceId, saveDataId))
|
||||
if (isEmulatedOnHost || !_saveFileSystemCacheManager.GetCache(ref saveDataFs.Ref, spaceId, saveDataId))
|
||||
{
|
||||
bool isDeviceUniqueMac = IsDeviceUniqueMac(spaceId);
|
||||
bool isJournalingSupported = SaveDataProperties.IsJournalingSupported(type);
|
||||
@ -190,7 +190,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
bool openShared = SaveDataProperties.IsSharedOpenNeeded(type);
|
||||
bool isReconstructible = SaveDataProperties.IsReconstructible(type, spaceId);
|
||||
|
||||
res = _config.SaveFsCreator.Create(ref saveDataFs.Ref(), ref fileSystem.Ref(), spaceId, saveDataId,
|
||||
res = _config.SaveFsCreator.Create(ref saveDataFs.Ref, ref fileSystem.Ref, spaceId, saveDataId,
|
||||
isEmulatedOnHost, isDeviceUniqueMac, isJournalingSupported, isMultiCommitSupported,
|
||||
openReadOnly, openShared, _timeStampGetter, isReconstructible);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
@ -207,21 +207,21 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
}
|
||||
|
||||
using var registerFs = new SharedRef<SaveDataFileSystemCacheRegister>(
|
||||
new SaveDataFileSystemCacheRegister(ref saveDataFs.Ref(), _saveFileSystemCacheManager, spaceId, saveDataId));
|
||||
new SaveDataFileSystemCacheRegister(ref saveDataFs.Ref, _saveFileSystemCacheManager, spaceId, saveDataId));
|
||||
|
||||
if (openReadOnly)
|
||||
{
|
||||
using SharedRef<IFileSystem> tempFs = SharedRef<IFileSystem>.CreateMove(ref registerFs.Ref());
|
||||
using var readOnlyFileSystem = new SharedRef<ReadOnlyFileSystem>(new ReadOnlyFileSystem(ref tempFs.Ref()));
|
||||
using SharedRef<IFileSystem> tempFs = SharedRef<IFileSystem>.CreateMove(ref registerFs.Ref);
|
||||
using var readOnlyFileSystem = new SharedRef<ReadOnlyFileSystem>(new ReadOnlyFileSystem(ref tempFs.Ref));
|
||||
|
||||
if (!readOnlyFileSystem.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInSaveDataFileSystemServiceImplB.Log();
|
||||
|
||||
outFileSystem.SetByMove(ref readOnlyFileSystem.Ref());
|
||||
outFileSystem.SetByMove(ref readOnlyFileSystem.Ref);
|
||||
}
|
||||
else
|
||||
{
|
||||
outFileSystem.SetByMove(ref registerFs.Ref());
|
||||
outFileSystem.SetByMove(ref registerFs.Ref);
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
@ -286,7 +286,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
in Path saveDataRootPath)
|
||||
{
|
||||
using var saveDataFile = new UniqueRef<IFile>();
|
||||
Result res = OpenSaveDataImageFile(ref saveDataFile.Ref(), spaceId, saveDataId, in saveDataRootPath);
|
||||
Result res = OpenSaveDataImageFile(ref saveDataFile.Ref, spaceId, saveDataId, in saveDataRootPath);
|
||||
|
||||
if (res.IsSuccess())
|
||||
{
|
||||
@ -308,7 +308,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
{
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
Result res = OpenSaveDataMetaDirectoryFileSystem(ref fileSystem.Ref(), spaceId, saveDataId);
|
||||
Result res = OpenSaveDataMetaDirectoryFileSystem(ref fileSystem.Ref, spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Unsafe.SkipInit(out Array15<byte> saveDataMetaNameBuffer);
|
||||
@ -328,7 +328,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
{
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
Result res = OpenSaveDataMetaDirectoryFileSystem(ref fileSystem.Ref(), spaceId, saveDataId);
|
||||
Result res = OpenSaveDataMetaDirectoryFileSystem(ref fileSystem.Ref, spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Unsafe.SkipInit(out Array15<byte> saveDataMetaNameBuffer);
|
||||
@ -356,7 +356,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
Result res = PathFunctions.SetUpFixedPath(ref saveDataMetaDirectoryName.Ref(), metaDirName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = OpenSaveDataDirectoryFileSystemImpl(ref fileSystem.Ref(), spaceId, in saveDataMetaDirectoryName,
|
||||
res = OpenSaveDataDirectoryFileSystemImpl(ref fileSystem.Ref, spaceId, in saveDataMetaDirectoryName,
|
||||
createIfMissing: false);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -384,7 +384,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
{
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
Result res = OpenSaveDataMetaDirectoryFileSystem(ref fileSystem.Ref(), spaceId, saveDataId);
|
||||
Result res = OpenSaveDataMetaDirectoryFileSystem(ref fileSystem.Ref, spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Unsafe.SkipInit(out Array15<byte> saveDataMetaNameBuffer);
|
||||
@ -413,7 +413,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
Result res = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), creationInfo.SpaceId, in saveDataRootPath,
|
||||
Result res = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref, creationInfo.SpaceId, in saveDataRootPath,
|
||||
allowEmulatedSave: false);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -486,7 +486,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
_saveFileSystemCacheManager.Unregister(spaceId, saveDataId);
|
||||
|
||||
// Open the directory containing the save data
|
||||
Result res = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), spaceId, in saveDataRootPath, false);
|
||||
Result res = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref, spaceId, in saveDataRootPath, false);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using scoped var saveImageName = new Path();
|
||||
@ -513,7 +513,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
if (GetDebugConfigurationService().Get(DebugOptionKey.SaveDataEncryption, 0) != 0)
|
||||
{
|
||||
using SharedRef<IFileSystem> tempFileSystem = SharedRef<IFileSystem>.CreateCopy(in fileSystem);
|
||||
res = _config.SaveFsCreator.IsDataEncrypted(out isDataEncrypted, ref tempFileSystem.Ref(),
|
||||
res = _config.SaveFsCreator.IsDataEncrypted(out isDataEncrypted, ref tempFileSystem.Ref,
|
||||
saveDataId, _config.BufferManager, IsDeviceUniqueMac(spaceId), isReconstructible: false);
|
||||
|
||||
if (res.IsFailure())
|
||||
@ -556,7 +556,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
using var extraDataAccessor = new SharedRef<ISaveDataExtraDataAccessor>();
|
||||
|
||||
// Try to grab an extra data accessor for the requested save from the cache.
|
||||
Result res = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref(), spaceId, saveDataId);
|
||||
Result res = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref, spaceId, saveDataId);
|
||||
|
||||
if (res.IsFailure())
|
||||
{
|
||||
@ -564,12 +564,12 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
|
||||
// We won't actually use the returned save data FS.
|
||||
// Opening the FS should cache an extra data accessor for it.
|
||||
res = OpenSaveDataFileSystem(ref unusedSaveDataFs.Ref(), spaceId, saveDataId, saveDataRootPath,
|
||||
res = OpenSaveDataFileSystem(ref unusedSaveDataFs.Ref, spaceId, saveDataId, saveDataRootPath,
|
||||
openReadOnly: true, type, cacheExtraData: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Try to grab an accessor from the cache again.
|
||||
res = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref(), spaceId, saveDataId);
|
||||
res = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref, spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
@ -596,7 +596,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
using var extraDataAccessor = new SharedRef<ISaveDataExtraDataAccessor>();
|
||||
|
||||
// Try to grab an extra data accessor for the requested save from the cache.
|
||||
Result res = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref(), spaceId, saveDataId);
|
||||
Result res = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref, spaceId, saveDataId);
|
||||
|
||||
if (res.IsFailure())
|
||||
{
|
||||
@ -604,12 +604,12 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
|
||||
// We won't actually use the returned save data FS.
|
||||
// Opening the FS should cache an extra data accessor for it.
|
||||
res = OpenSaveDataFileSystem(ref unusedSaveDataFs.Ref(), spaceId, saveDataId, saveDataRootPath,
|
||||
res = OpenSaveDataFileSystem(ref unusedSaveDataFs.Ref, spaceId, saveDataId, saveDataRootPath,
|
||||
openReadOnly: false, type, cacheExtraData: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Try to grab an accessor from the cache again.
|
||||
res = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref(), spaceId, saveDataId);
|
||||
res = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref, spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
@ -660,7 +660,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
using (var tmFileSystem = new SharedRef<IFileSystem>())
|
||||
{
|
||||
// Ensure the target save data directory exists
|
||||
res = _config.TargetManagerFsCreator.Create(ref tmFileSystem.Ref(), in saveDataRootPath,
|
||||
res = _config.TargetManagerFsCreator.Create(ref tmFileSystem.Ref, in saveDataRootPath,
|
||||
openCaseSensitive: false, ensureRootPathExists: true,
|
||||
ResultFs.SaveDataRootPathUnavailable.Value);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
@ -723,11 +723,11 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
{
|
||||
case SaveDataSpaceId.System:
|
||||
{
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref(), BisPartitionId.System,
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref, BisPartitionId.System,
|
||||
caseSensitive: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref(), in directoryPath,
|
||||
res = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref, in directoryPath,
|
||||
createIfMissing);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -737,11 +737,11 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
case SaveDataSpaceId.User:
|
||||
case SaveDataSpaceId.Temporary:
|
||||
{
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref(), BisPartitionId.User,
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref, BisPartitionId.User,
|
||||
caseSensitive: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref(), in directoryPath,
|
||||
res = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref, in directoryPath,
|
||||
createIfMissing);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -751,7 +751,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
case SaveDataSpaceId.SdSystem:
|
||||
case SaveDataSpaceId.SdUser:
|
||||
{
|
||||
Result res = _config.BaseFsService.OpenSdCardProxyFileSystem(ref baseFileSystem.Ref(),
|
||||
Result res = _config.BaseFsService.OpenSdCardProxyFileSystem(ref baseFileSystem.Ref,
|
||||
openCaseSensitive: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -766,12 +766,12 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
res = pathSdRoot.Combine(in pathParent, in directoryPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystem> tempFileSystem = SharedRef<IFileSystem>.CreateMove(ref baseFileSystem.Ref());
|
||||
using SharedRef<IFileSystem> tempFileSystem = SharedRef<IFileSystem>.CreateMove(ref baseFileSystem.Ref);
|
||||
|
||||
res = Utility.WrapSubDirectory(ref baseFileSystem.Ref(), ref tempFileSystem.Ref(), in pathSdRoot, createIfMissing);
|
||||
res = Utility.WrapSubDirectory(ref baseFileSystem.Ref, ref tempFileSystem.Ref, in pathSdRoot, createIfMissing);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = _config.EncryptedFsCreator.Create(ref outFileSystem, ref baseFileSystem.Ref(),
|
||||
res = _config.EncryptedFsCreator.Create(ref outFileSystem, ref baseFileSystem.Ref,
|
||||
IEncryptedFileSystemCreator.KeyId.Save, in _encryptionSeed);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -780,11 +780,11 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
|
||||
case SaveDataSpaceId.ProperSystem:
|
||||
{
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref(),
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref,
|
||||
BisPartitionId.SystemProperPartition, caseSensitive: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref(), in directoryPath,
|
||||
res = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref, in directoryPath,
|
||||
createIfMissing);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -793,11 +793,11 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
|
||||
case SaveDataSpaceId.SafeMode:
|
||||
{
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref(), BisPartitionId.SafeMode,
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref, BisPartitionId.SafeMode,
|
||||
caseSensitive: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref(), in directoryPath,
|
||||
res = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref, in directoryPath,
|
||||
createIfMissing);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -885,7 +885,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
UnsafeHelpers.SkipParamInit(out count);
|
||||
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), out bool _, SaveDataSpaceId.User);
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref, out bool _, SaveDataSpaceId.User);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
count = accessor.Get.GetInterface().GetIndexCount();
|
||||
|
@ -840,7 +840,7 @@ public class SaveDataIndexer : ISaveDataIndexer
|
||||
res = RegisterReader(in reader);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outInfoReader.SetByMove(ref reader.Ref());
|
||||
outInfoReader.SetByMove(ref reader.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ public class SaveDataFileStorageHolder
|
||||
res = fileStorage.Get.Initialize(ref baseFileSystem, in saveImageName, mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outSaveDataStorage.SetByMove(ref fileStorage.Ref());
|
||||
outSaveDataStorage.SetByMove(ref fileStorage.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -369,11 +369,11 @@ public class SaveDataFileStorageHolder
|
||||
using SharedRef<SaveDataOpenTypeSetFileStorage> baseFileStorageCopy =
|
||||
SharedRef<SaveDataOpenTypeSetFileStorage>.CreateCopy(in baseFileStorage);
|
||||
|
||||
res = Register(ref baseFileStorageCopy.Ref(), spaceId, saveDataId);
|
||||
res = Register(ref baseFileStorageCopy.Ref, spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
outSaveDataStorage.Reset(new SaveDataSharedFileStorage(ref baseFileStorage.Ref(), type.ValueRo));
|
||||
outSaveDataStorage.Reset(new SaveDataSharedFileStorage(ref baseFileStorage.Ref, type.ValueRo));
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ internal static class GameCardService
|
||||
ref SharedRef<IStorageDevice> outStorageDevice, OpenGameCardAttribute attribute)
|
||||
{
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetGameCardManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetGameCardManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
ref GameCardServiceGlobals g = ref service.Globals.GameCardService;
|
||||
@ -61,7 +61,7 @@ internal static class GameCardService
|
||||
using var gameCardStorageDevice = new SharedRef<IStorageDevice>();
|
||||
using ScopedLock<SdkMutexType> scopedLock = ScopedLock.Lock(ref g.StorageDeviceMutex);
|
||||
|
||||
res = storageDeviceManager.Get.OpenDevice(ref gameCardStorageDevice.Ref(), MakeAttributeId(attribute));
|
||||
res = storageDeviceManager.Get.OpenDevice(ref gameCardStorageDevice.Ref, MakeAttributeId(attribute));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
g.CachedStorageDevice.SetByCopy(in gameCardStorageDevice);
|
||||
@ -74,7 +74,7 @@ internal static class GameCardService
|
||||
ref SharedRef<IStorageDeviceOperator> outDeviceOperator)
|
||||
{
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetGameCardManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetGameCardManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return storageDeviceManager.Get.OpenOperator(ref outDeviceOperator);
|
||||
@ -84,10 +84,10 @@ internal static class GameCardService
|
||||
ref SharedRef<IStorageDeviceOperator> outDeviceOperator, OpenGameCardAttribute attribute)
|
||||
{
|
||||
using var storageDevice = new SharedRef<IStorageDevice>();
|
||||
Result res = service.OpenAndCacheGameCardDevice(ref storageDevice.Ref(), attribute);
|
||||
Result res = service.OpenAndCacheGameCardDevice(ref storageDevice.Ref, attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return storageDevice.Get.OpenOperator(ref outDeviceOperator.Ref());
|
||||
return storageDevice.Get.OpenOperator(ref outDeviceOperator.Ref);
|
||||
}
|
||||
|
||||
private static Result GetGameCardOperator(this StorageService service,
|
||||
@ -111,7 +111,7 @@ internal static class GameCardService
|
||||
{
|
||||
using var gameCardStorageDevice = new SharedRef<IStorageDevice>();
|
||||
|
||||
Result res = service.OpenAndCacheGameCardDevice(ref gameCardStorageDevice.Ref(), attribute);
|
||||
Result res = service.OpenAndCacheGameCardDevice(ref gameCardStorageDevice.Ref, attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Verify that the game card handle hasn't changed.
|
||||
@ -134,12 +134,12 @@ internal static class GameCardService
|
||||
}
|
||||
|
||||
// Open the storage and add IPC and event simulation wrappers.
|
||||
using var storage = new SharedRef<IStorage>(new StorageServiceObjectAdapter(ref gameCardStorageDevice.Ref()));
|
||||
using var storage = new SharedRef<IStorage>(new StorageServiceObjectAdapter(ref gameCardStorageDevice.Ref));
|
||||
|
||||
using var deviceEventSimulationStorage = new SharedRef<DeviceEventSimulationStorage>(
|
||||
new DeviceEventSimulationStorage(ref storage.Ref(), service.FsSrv.Impl.GetGameCardEventSimulator()));
|
||||
new DeviceEventSimulationStorage(ref storage.Ref, service.FsSrv.Impl.GetGameCardEventSimulator()));
|
||||
|
||||
outStorage.SetByMove(ref deviceEventSimulationStorage.Ref());
|
||||
outStorage.SetByMove(ref deviceEventSimulationStorage.Ref);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -164,7 +164,7 @@ internal static class GameCardService
|
||||
|
||||
{
|
||||
using var gameCardStorageDevice = new SharedRef<IStorageDevice>();
|
||||
Result res = service.OpenAndCacheGameCardDevice(ref gameCardStorageDevice.Ref(),
|
||||
Result res = service.OpenAndCacheGameCardDevice(ref gameCardStorageDevice.Ref,
|
||||
OpenGameCardAttribute.ReadOnly);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -182,7 +182,7 @@ internal static class GameCardService
|
||||
UnsafeHelpers.SkipParamInit(out isValid);
|
||||
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetGameCardManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetGameCardManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return storageDeviceManager.Get.IsHandleValid(out isValid, handle.Value);
|
||||
@ -193,7 +193,7 @@ internal static class GameCardService
|
||||
UnsafeHelpers.SkipParamInit(out outIsInserted);
|
||||
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetGameCardManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetGameCardManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Get the actual state of the game card.
|
||||
@ -208,7 +208,7 @@ internal static class GameCardService
|
||||
public static Result EraseGameCard(this StorageService service, uint gameCardSize, ulong romAreaStartPageAddress)
|
||||
{
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
InBuffer inBuffer = InBuffer.FromStruct(in romAreaStartPageAddress);
|
||||
@ -220,7 +220,7 @@ internal static class GameCardService
|
||||
public static Result GetInitializationResult(this StorageService service)
|
||||
{
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int operationId = MakeOperationId(GameCardManagerOperationIdValue.GetInitializationResult);
|
||||
@ -234,7 +234,7 @@ internal static class GameCardService
|
||||
UnsafeHelpers.SkipParamInit(out outGameCardStatus);
|
||||
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Verify that the game card handle hasn't changed.
|
||||
@ -260,7 +260,7 @@ internal static class GameCardService
|
||||
public static Result FinalizeGameCardLibrary(this StorageService service)
|
||||
{
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int operationId = MakeOperationId(GameCardManagerOperationIdValue.Finalize);
|
||||
@ -272,7 +272,7 @@ internal static class GameCardService
|
||||
GameCardHandle handle)
|
||||
{
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Verify that the game card handle hasn't changed.
|
||||
@ -299,7 +299,7 @@ internal static class GameCardService
|
||||
ReadOnlySpan<byte> challengeSeed, ReadOnlySpan<byte> challengeValue, GameCardHandle handle)
|
||||
{
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Verify that the game card handle hasn't changed.
|
||||
@ -330,7 +330,7 @@ internal static class GameCardService
|
||||
UnsafeHelpers.SkipParamInit(out outHandle);
|
||||
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Get the current handle.
|
||||
@ -368,7 +368,7 @@ internal static class GameCardService
|
||||
UnsafeHelpers.SkipParamInit(out rmaInfo);
|
||||
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var inFirmwareBuffer = new InBuffer(firmwareBuffer);
|
||||
@ -389,7 +389,7 @@ internal static class GameCardService
|
||||
UnsafeHelpers.SkipParamInit(out outIdSet);
|
||||
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
OutBuffer outIdSetBuffer = OutBuffer.FromStruct(ref outIdSet);
|
||||
@ -406,7 +406,7 @@ internal static class GameCardService
|
||||
public static Result WriteToGameCardDirectly(this StorageService service, long offset, Span<byte> buffer)
|
||||
{
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var outBuffer = new OutBuffer(buffer);
|
||||
@ -425,7 +425,7 @@ internal static class GameCardService
|
||||
public static Result SetVerifyWriteEnableFlag(this StorageService service, bool isEnabled)
|
||||
{
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
InBuffer inIsEnabledBuffer = InBuffer.FromStruct(in isEnabled);
|
||||
@ -437,7 +437,7 @@ internal static class GameCardService
|
||||
public static Result GetGameCardImageHash(this StorageService service, Span<byte> outBuffer, GameCardHandle handle)
|
||||
{
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Verify that the game card handle hasn't changed.
|
||||
@ -464,7 +464,7 @@ internal static class GameCardService
|
||||
ReadOnlySpan<byte> devHeaderBuffer)
|
||||
{
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var inDevHeaderBuffer = new InBuffer(devHeaderBuffer);
|
||||
@ -483,7 +483,7 @@ internal static class GameCardService
|
||||
public static Result EraseAndWriteParamDirectly(this StorageService service, ReadOnlySpan<byte> devParamBuffer)
|
||||
{
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var inDevParamBuffer = new InBuffer(devParamBuffer);
|
||||
@ -495,7 +495,7 @@ internal static class GameCardService
|
||||
public static Result ReadParamDirectly(this StorageService service, Span<byte> outDevParamBuffer)
|
||||
{
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int operationId = MakeOperationId(GameCardManagerOperationIdValue.ReadParamDirectly);
|
||||
@ -511,7 +511,7 @@ internal static class GameCardService
|
||||
public static Result ForceEraseGameCard(this StorageService service)
|
||||
{
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int operationId = MakeOperationId(GameCardManagerOperationIdValue.ForceErase);
|
||||
@ -524,7 +524,7 @@ internal static class GameCardService
|
||||
UnsafeHelpers.SkipParamInit(out errorInfo);
|
||||
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
OutBuffer outErrorInfoBuffer = OutBuffer.FromStruct(ref errorInfo);
|
||||
@ -544,7 +544,7 @@ internal static class GameCardService
|
||||
UnsafeHelpers.SkipParamInit(out errorReportInfo);
|
||||
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
OutBuffer outErrorReportInfoBuffer = OutBuffer.FromStruct(ref errorReportInfo);
|
||||
@ -561,7 +561,7 @@ internal static class GameCardService
|
||||
public static Result GetGameCardDeviceId(this StorageService service, Span<byte> outBuffer)
|
||||
{
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var outDeviceIdBuffer = new OutBuffer(outBuffer);
|
||||
@ -578,7 +578,7 @@ internal static class GameCardService
|
||||
public static bool IsGameCardActivationValid(this StorageService service, GameCardHandle handle)
|
||||
{
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return Result.ConvertResultToReturnType<bool>(res);
|
||||
|
||||
bool isValid = false;
|
||||
@ -599,7 +599,7 @@ internal static class GameCardService
|
||||
ref SharedRef<IEventNotifier> outEventNotifier)
|
||||
{
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetGameCardManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetGameCardManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return storageDeviceManager.Get.OpenDetectionEvent(ref outEventNotifier);
|
||||
@ -608,7 +608,7 @@ internal static class GameCardService
|
||||
public static Result SimulateGameCardDetectionEventSignaled(this StorageService service)
|
||||
{
|
||||
using var gcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref());
|
||||
Result res = service.GetGameCardManagerOperator(ref gcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int operationId = MakeOperationId(GameCardManagerOperationIdValue.SimulateDetectionEventSignaled);
|
||||
|
@ -42,7 +42,7 @@ internal static class MmcService
|
||||
ref SharedRef<IStorageDeviceOperator> outDeviceOperator)
|
||||
{
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetMmcManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetMmcManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return storageDeviceManager.Get.OpenOperator(ref outDeviceOperator);
|
||||
@ -77,14 +77,14 @@ internal static class MmcService
|
||||
ref SharedRef<IStorageDeviceOperator> outMmcOperator, MmcPartition partition)
|
||||
{
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetMmcManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetMmcManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = GetAttribute(out ulong attribute, partition);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var storageDevice = new SharedRef<IStorageDevice>();
|
||||
res = storageDeviceManager.Get.OpenDevice(ref storageDevice.Ref(), attribute);
|
||||
res = storageDeviceManager.Get.OpenDevice(ref storageDevice.Ref, attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return storageDevice.Get.OpenOperator(ref outMmcOperator);
|
||||
@ -94,28 +94,28 @@ internal static class MmcService
|
||||
MmcPartition partition)
|
||||
{
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetMmcManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetMmcManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = GetAttribute(out ulong attribute, partition);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var mmcStorage = new SharedRef<IStorageSf>();
|
||||
res = storageDeviceManager.Get.OpenStorage(ref mmcStorage.Ref(), attribute);
|
||||
res = storageDeviceManager.Get.OpenStorage(ref mmcStorage.Ref, attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var storage = new SharedRef<IStorage>(new StorageServiceObjectAdapter(ref mmcStorage.Ref()));
|
||||
using var storage = new SharedRef<IStorage>(new StorageServiceObjectAdapter(ref mmcStorage.Ref));
|
||||
|
||||
if (IsSpeedEmulationNeeded(partition))
|
||||
{
|
||||
using var emulationStorage =
|
||||
new SharedRef<IStorage>(new SpeedEmulationStorage(ref storage.Ref(), service.FsSrv));
|
||||
new SharedRef<IStorage>(new SpeedEmulationStorage(ref storage.Ref, service.FsSrv));
|
||||
|
||||
outStorage.SetByMove(ref emulationStorage.Ref());
|
||||
outStorage.SetByMove(ref emulationStorage.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
outStorage.SetByMove(ref storage.Ref());
|
||||
outStorage.SetByMove(ref storage.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ internal static class MmcService
|
||||
UnsafeHelpers.SkipParamInit(out speedMode);
|
||||
|
||||
using var mmcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetMmcOperator(ref mmcOperator.Ref(), MmcPartition.UserData);
|
||||
Result res = service.GetMmcOperator(ref mmcOperator.Ref, MmcPartition.UserData);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Unsafe.SkipInit(out SpeedMode sdmmcSpeedMode);
|
||||
@ -150,7 +150,7 @@ internal static class MmcService
|
||||
public static Result GetMmcCid(this StorageService service, Span<byte> cidBuffer)
|
||||
{
|
||||
using var mmcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetMmcOperator(ref mmcOperator.Ref(), MmcPartition.UserData);
|
||||
Result res = service.GetMmcOperator(ref mmcOperator.Ref, MmcPartition.UserData);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int operationId = MakeOperationId(MmcOperationIdValue.GetCid);
|
||||
@ -162,7 +162,7 @@ internal static class MmcService
|
||||
public static Result EraseMmc(this StorageService service, MmcPartition partition)
|
||||
{
|
||||
using var mmcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetMmcOperator(ref mmcOperator.Ref(), partition);
|
||||
Result res = service.GetMmcOperator(ref mmcOperator.Ref, partition);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return mmcOperator.Get.Operate(MakeOperationId(MmcOperationIdValue.Erase));
|
||||
@ -173,7 +173,7 @@ internal static class MmcService
|
||||
UnsafeHelpers.SkipParamInit(out size);
|
||||
|
||||
using var mmcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetMmcOperator(ref mmcOperator.Ref(), partition);
|
||||
Result res = service.GetMmcOperator(ref mmcOperator.Ref, partition);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int operationId = MakeOperationId(MmcOperationIdValue.GetPartitionSize);
|
||||
@ -187,7 +187,7 @@ internal static class MmcService
|
||||
UnsafeHelpers.SkipParamInit(out count);
|
||||
|
||||
using var mmcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetMmcManagerOperator(ref mmcOperator.Ref());
|
||||
Result res = service.GetMmcManagerOperator(ref mmcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int operationId = MakeOperationId(MmcManagerOperationIdValue.GetPatrolCount);
|
||||
@ -202,7 +202,7 @@ internal static class MmcService
|
||||
UnsafeHelpers.SkipParamInit(out errorInfo, out logSize);
|
||||
|
||||
using var mmcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetMmcManagerOperator(ref mmcOperator.Ref());
|
||||
Result res = service.GetMmcManagerOperator(ref mmcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
OutBuffer errorInfoOutBuffer = OutBuffer.FromStruct(ref errorInfo);
|
||||
@ -215,7 +215,7 @@ internal static class MmcService
|
||||
public static Result GetMmcExtendedCsd(this StorageService service, Span<byte> buffer)
|
||||
{
|
||||
using var mmcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetMmcOperator(ref mmcOperator.Ref(), MmcPartition.UserData);
|
||||
Result res = service.GetMmcOperator(ref mmcOperator.Ref, MmcPartition.UserData);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int operationId = MakeOperationId(MmcOperationIdValue.GetExtendedCsd);
|
||||
@ -227,7 +227,7 @@ internal static class MmcService
|
||||
public static Result SuspendMmcPatrol(this StorageService service)
|
||||
{
|
||||
using var mmcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetMmcManagerOperator(ref mmcOperator.Ref());
|
||||
Result res = service.GetMmcManagerOperator(ref mmcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return mmcOperator.Get.Operate(MakeOperationId(MmcManagerOperationIdValue.SuspendPatrol));
|
||||
@ -236,7 +236,7 @@ internal static class MmcService
|
||||
public static Result ResumeMmcPatrol(this StorageService service)
|
||||
{
|
||||
using var mmcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetMmcManagerOperator(ref mmcOperator.Ref());
|
||||
Result res = service.GetMmcManagerOperator(ref mmcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return mmcOperator.Get.Operate(MakeOperationId(MmcManagerOperationIdValue.ResumePatrol));
|
||||
@ -248,7 +248,7 @@ internal static class MmcService
|
||||
UnsafeHelpers.SkipParamInit(out successCount, out failureCount);
|
||||
|
||||
using var mmcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetMmcManagerOperator(ref mmcOperator.Ref());
|
||||
Result res = service.GetMmcManagerOperator(ref mmcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int operationId = MakeOperationId(MmcManagerOperationIdValue.GetAndClearPatrolReadAllocateBufferCount);
|
||||
@ -261,7 +261,7 @@ internal static class MmcService
|
||||
public static Result SuspendMmcControl(this StorageService service)
|
||||
{
|
||||
using var mmcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetMmcManagerOperator(ref mmcOperator.Ref());
|
||||
Result res = service.GetMmcManagerOperator(ref mmcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return mmcOperator.Get.Operate(MakeOperationId(MmcManagerOperationIdValue.SuspendControl));
|
||||
@ -270,7 +270,7 @@ internal static class MmcService
|
||||
public static Result ResumeMmcControl(this StorageService service)
|
||||
{
|
||||
using var mmcOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetMmcManagerOperator(ref mmcOperator.Ref());
|
||||
Result res = service.GetMmcManagerOperator(ref mmcOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return mmcOperator.Get.Operate(MakeOperationId(MmcManagerOperationIdValue.ResumeControl));
|
||||
|
@ -32,7 +32,7 @@ internal static class SdCardService
|
||||
ref SharedRef<IStorageDeviceOperator> outDeviceOperator)
|
||||
{
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return storageDeviceManager.Get.OpenOperator(ref outDeviceOperator);
|
||||
@ -42,11 +42,11 @@ internal static class SdCardService
|
||||
ref SharedRef<IStorageDeviceOperator> outSdCardOperator)
|
||||
{
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var storageDevice = new SharedRef<IStorageDevice>();
|
||||
res = storageDeviceManager.Get.OpenDevice(ref storageDevice.Ref(), 0);
|
||||
res = storageDeviceManager.Get.OpenDevice(ref storageDevice.Ref, 0);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return storageDevice.Get.OpenOperator(ref outSdCardOperator);
|
||||
@ -55,23 +55,23 @@ internal static class SdCardService
|
||||
public static Result OpenSdStorage(this StorageService service, ref SharedRef<IStorage> outStorage)
|
||||
{
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var sdCardStorage = new SharedRef<IStorageSf>();
|
||||
res = storageDeviceManager.Get.OpenStorage(ref sdCardStorage.Ref(), 0);
|
||||
res = storageDeviceManager.Get.OpenStorage(ref sdCardStorage.Ref, 0);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var storage = new SharedRef<IStorage>(new StorageServiceObjectAdapter(ref sdCardStorage.Ref()));
|
||||
using var storage = new SharedRef<IStorage>(new StorageServiceObjectAdapter(ref sdCardStorage.Ref));
|
||||
|
||||
SdCardEventSimulator eventSimulator = service.FsSrv.Impl.GetSdCardEventSimulator();
|
||||
using var deviceEventSimulationStorage =
|
||||
new SharedRef<IStorage>(new DeviceEventSimulationStorage(ref storage.Ref(), eventSimulator));
|
||||
new SharedRef<IStorage>(new DeviceEventSimulationStorage(ref storage.Ref, eventSimulator));
|
||||
|
||||
using var emulationStorage = new SharedRef<IStorage>(
|
||||
new SpeedEmulationStorage(ref deviceEventSimulationStorage.Ref(), service.FsSrv));
|
||||
new SpeedEmulationStorage(ref deviceEventSimulationStorage.Ref, service.FsSrv));
|
||||
|
||||
outStorage.SetByMove(ref emulationStorage.Ref());
|
||||
outStorage.SetByMove(ref emulationStorage.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -80,11 +80,11 @@ internal static class SdCardService
|
||||
UnsafeHelpers.SkipParamInit(out handle);
|
||||
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var sdCardStorageDevice = new SharedRef<IStorageDevice>();
|
||||
res = storageDeviceManager.Get.OpenDevice(ref sdCardStorageDevice.Ref(), 0);
|
||||
res = storageDeviceManager.Get.OpenDevice(ref sdCardStorageDevice.Ref, 0);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = sdCardStorageDevice.Get.GetHandle(out uint handleValue);
|
||||
@ -100,7 +100,7 @@ internal static class SdCardService
|
||||
UnsafeHelpers.SkipParamInit(out isValid);
|
||||
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Note: I don't know why the official code doesn't check the handle port
|
||||
@ -110,7 +110,7 @@ internal static class SdCardService
|
||||
public static Result InvalidateSdCard(this StorageService service)
|
||||
{
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return storageDeviceManager.Get.Invalidate();
|
||||
@ -121,7 +121,7 @@ internal static class SdCardService
|
||||
UnsafeHelpers.SkipParamInit(out isInserted);
|
||||
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = storageDeviceManager.Get.IsInserted(out bool actualState);
|
||||
@ -136,7 +136,7 @@ internal static class SdCardService
|
||||
UnsafeHelpers.SkipParamInit(out speedMode);
|
||||
|
||||
using var sdCardOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetSdCardOperator(ref sdCardOperator.Ref());
|
||||
Result res = service.GetSdCardOperator(ref sdCardOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Unsafe.SkipInit(out SpeedMode sdmmcSpeedMode);
|
||||
@ -165,7 +165,7 @@ internal static class SdCardService
|
||||
public static Result GetSdCardCid(this StorageService service, Span<byte> cidBuffer)
|
||||
{
|
||||
using var sdCardOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetSdCardOperator(ref sdCardOperator.Ref());
|
||||
Result res = service.GetSdCardOperator(ref sdCardOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int operationId = MakeOperationId(SdCardOperationIdValue.GetCid);
|
||||
@ -179,7 +179,7 @@ internal static class SdCardService
|
||||
UnsafeHelpers.SkipParamInit(out count);
|
||||
|
||||
using var sdCardOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetSdCardOperator(ref sdCardOperator.Ref());
|
||||
Result res = service.GetSdCardOperator(ref sdCardOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int operationId = MakeOperationId(SdCardOperationIdValue.GetUserAreaNumSectors);
|
||||
@ -193,7 +193,7 @@ internal static class SdCardService
|
||||
UnsafeHelpers.SkipParamInit(out size);
|
||||
|
||||
using var sdCardOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetSdCardOperator(ref sdCardOperator.Ref());
|
||||
Result res = service.GetSdCardOperator(ref sdCardOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int operationId = MakeOperationId(SdCardOperationIdValue.GetUserAreaSize);
|
||||
@ -207,7 +207,7 @@ internal static class SdCardService
|
||||
UnsafeHelpers.SkipParamInit(out count);
|
||||
|
||||
using var sdCardOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetSdCardOperator(ref sdCardOperator.Ref());
|
||||
Result res = service.GetSdCardOperator(ref sdCardOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int operationId = MakeOperationId(SdCardOperationIdValue.GetProtectedAreaNumSectors);
|
||||
@ -221,7 +221,7 @@ internal static class SdCardService
|
||||
UnsafeHelpers.SkipParamInit(out size);
|
||||
|
||||
using var sdCardOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetSdCardOperator(ref sdCardOperator.Ref());
|
||||
Result res = service.GetSdCardOperator(ref sdCardOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int operationId = MakeOperationId(SdCardOperationIdValue.GetProtectedAreaSize);
|
||||
@ -236,7 +236,7 @@ internal static class SdCardService
|
||||
UnsafeHelpers.SkipParamInit(out errorInfo, out logSize);
|
||||
|
||||
using var sdCardOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetSdCardManagerOperator(ref sdCardOperator.Ref());
|
||||
Result res = service.GetSdCardManagerOperator(ref sdCardOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
OutBuffer errorInfoOutBuffer = OutBuffer.FromStruct(ref errorInfo);
|
||||
@ -250,7 +250,7 @@ internal static class SdCardService
|
||||
ref SharedRef<IEventNotifier> outEventNotifier)
|
||||
{
|
||||
using var storageDeviceManager = new SharedRef<IStorageDeviceManager>();
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref());
|
||||
Result res = service.GetSdCardManager(ref storageDeviceManager.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return storageDeviceManager.Get.OpenDetectionEvent(ref outEventNotifier);
|
||||
@ -259,7 +259,7 @@ internal static class SdCardService
|
||||
public static Result SimulateSdCardDetectionEventSignaled(this StorageService service)
|
||||
{
|
||||
using var sdCardOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetSdCardManagerOperator(ref sdCardOperator.Ref());
|
||||
Result res = service.GetSdCardManagerOperator(ref sdCardOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return sdCardOperator.Get.Operate(
|
||||
@ -269,7 +269,7 @@ internal static class SdCardService
|
||||
public static Result SuspendSdCardControl(this StorageService service)
|
||||
{
|
||||
using var sdCardOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetSdCardManagerOperator(ref sdCardOperator.Ref());
|
||||
Result res = service.GetSdCardManagerOperator(ref sdCardOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return sdCardOperator.Get.Operate(MakeOperationId(SdCardManagerOperationIdValue.SuspendControl));
|
||||
@ -278,7 +278,7 @@ internal static class SdCardService
|
||||
public static Result ResumeSdCardControl(this StorageService service)
|
||||
{
|
||||
using var sdCardOperator = new SharedRef<IStorageDeviceOperator>();
|
||||
Result res = service.GetSdCardManagerOperator(ref sdCardOperator.Ref());
|
||||
Result res = service.GetSdCardManagerOperator(ref sdCardOperator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return sdCardOperator.Get.Operate(MakeOperationId(SdCardManagerOperationIdValue.ResumeControl));
|
||||
|
@ -88,7 +88,7 @@ public class AesCtrCounterExtendedStorage : IStorage
|
||||
if (!decryptor.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInAesCtrCounterExtendedStorageA.Log();
|
||||
|
||||
outDecryptor.Set(ref decryptor.Ref());
|
||||
outDecryptor.Set(ref decryptor.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ public class AesCtrCounterExtendedStorage : IStorage
|
||||
if (!decryptor.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInAesCtrCounterExtendedStorageA.Log();
|
||||
|
||||
outDecryptor.Set(ref decryptor.Ref());
|
||||
outDecryptor.Set(ref decryptor.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ public class AesCtrCounterExtendedStorage : IStorage
|
||||
long entryStorageOffset = nodeStorageOffset + nodeStorageSize;
|
||||
|
||||
using var decryptor = new UniqueRef<IDecryptor>();
|
||||
res = CreateSoftwareDecryptor(ref decryptor.Ref());
|
||||
res = CreateSoftwareDecryptor(ref decryptor.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = tableStorage.GetSize(out long storageSize);
|
||||
@ -155,7 +155,7 @@ public class AesCtrCounterExtendedStorage : IStorage
|
||||
using var nodeStorage = new ValueSubStorage(in tableStorage, nodeStorageOffset, nodeStorageSize);
|
||||
|
||||
return Initialize(allocator, key, secureValue, counterOffset: 0, in dataStorage, in nodeStorage,
|
||||
in entryStorage, header.EntryCount, ref decryptor.Ref());
|
||||
in entryStorage, header.EntryCount, ref decryptor.Ref);
|
||||
}
|
||||
|
||||
public Result Initialize(MemoryResource allocator, ReadOnlySpan<byte> key, uint secureValue, long counterOffset,
|
||||
|
@ -227,7 +227,7 @@ public class ConcatenationFileSystem : IFileSystem
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var newInternalFile = new UniqueRef<IFile>();
|
||||
res = _baseFileSystem.OpenFile(ref newInternalFile.Ref(), in internalFilePath, _mode);
|
||||
res = _baseFileSystem.OpenFile(ref newInternalFile.Ref, in internalFilePath, _mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_fileArray.Add(newInternalFile.Release());
|
||||
@ -459,7 +459,7 @@ public class ConcatenationFileSystem : IFileSystem
|
||||
|
||||
using Path path = _path.DangerousGetPath();
|
||||
|
||||
Result res = _baseFileSystem.OpenDirectory(ref directory.Ref(), in path,
|
||||
Result res = _baseFileSystem.OpenDirectory(ref directory.Ref, in path,
|
||||
OpenDirectoryMode.All | OpenDirectoryMode.NoFileSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
@ -679,7 +679,7 @@ public class ConcatenationFileSystem : IFileSystem
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var internalFile = new UniqueRef<IFile>();
|
||||
res = _baseFileSystem.Get.OpenFile(ref internalFile.Ref(), in filePath, mode);
|
||||
res = _baseFileSystem.Get.OpenFile(ref internalFile.Ref, in filePath, mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
internalFiles.Add(internalFile.Release());
|
||||
@ -694,7 +694,7 @@ public class ConcatenationFileSystem : IFileSystem
|
||||
res = concatFile.Get.Initialize(in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFile.Set(ref concatFile.Ref());
|
||||
outFile.Set(ref concatFile.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
finally
|
||||
@ -720,15 +720,15 @@ public class ConcatenationFileSystem : IFileSystem
|
||||
}
|
||||
|
||||
using var baseDirectory = new UniqueRef<IDirectory>();
|
||||
Result res = _baseFileSystem.Get.OpenDirectory(ref baseDirectory.Ref(), path, OpenDirectoryMode.All);
|
||||
Result res = _baseFileSystem.Get.OpenDirectory(ref baseDirectory.Ref, path, OpenDirectoryMode.All);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var concatDirectory = new UniqueRef<ConcatenationDirectory>(
|
||||
new ConcatenationDirectory(mode, ref baseDirectory.Ref(), this, _baseFileSystem.Get));
|
||||
new ConcatenationDirectory(mode, ref baseDirectory.Ref, this, _baseFileSystem.Get));
|
||||
res = concatDirectory.Get.Initialize(in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outDirectory.Set(ref concatDirectory.Ref());
|
||||
outDirectory.Set(ref concatDirectory.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -309,7 +309,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var lockFile = new UniqueRef<IFile>();
|
||||
res = _baseFs.OpenFile(ref lockFile.Ref(), in pathLockFile, OpenMode.ReadWrite);
|
||||
res = _baseFs.OpenFile(ref lockFile.Ref, in pathLockFile, OpenMode.ReadWrite);
|
||||
|
||||
if (res.IsFailure())
|
||||
{
|
||||
@ -318,7 +318,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
||||
res = _baseFs.CreateFile(in pathLockFile, 0);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = _baseFs.OpenFile(ref lockFile.Ref(), in pathLockFile, OpenMode.ReadWrite);
|
||||
res = _baseFs.OpenFile(ref lockFile.Ref, in pathLockFile, OpenMode.ReadWrite);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
@ -327,7 +327,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
||||
}
|
||||
}
|
||||
|
||||
_lockFile.Set(ref lockFile.Ref());
|
||||
_lockFile.Set(ref lockFile.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -496,17 +496,17 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
||||
using ScopedLock<SdkMutexType> scopedLock = ScopedLock.Lock(ref _mutex);
|
||||
|
||||
using var baseFile = new UniqueRef<IFile>();
|
||||
res = _baseFs.OpenFile(ref baseFile.Ref(), in fullPath, mode);
|
||||
res = _baseFs.OpenFile(ref baseFile.Ref, in fullPath, mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var file = new UniqueRef<IFile>(new DirectorySaveDataFile(ref baseFile.Ref(), this, mode));
|
||||
using var file = new UniqueRef<IFile>(new DirectorySaveDataFile(ref baseFile.Ref, this, mode));
|
||||
|
||||
if (mode.HasFlag(OpenMode.Write))
|
||||
{
|
||||
_openWritableFileCount++;
|
||||
}
|
||||
|
||||
outFile.Set(ref file.Ref());
|
||||
outFile.Set(ref file.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -886,7 +886,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
||||
private Result EnsureExtraDataSize(in Path path)
|
||||
{
|
||||
using var file = new UniqueRef<IFile>();
|
||||
Result res = _baseFs.OpenFile(ref file.Ref(), in path, OpenMode.ReadWrite);
|
||||
Result res = _baseFs.OpenFile(ref file.Ref, in path, OpenMode.ReadWrite);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = file.Get.GetSize(out long fileSize);
|
||||
@ -904,7 +904,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
||||
|
||||
using (var sourceFile = new UniqueRef<IFile>())
|
||||
{
|
||||
Result res = _baseFs.OpenFile(ref sourceFile.Ref(), in sourcePath, OpenMode.Read);
|
||||
Result res = _baseFs.OpenFile(ref sourceFile.Ref, in sourcePath, OpenMode.Read);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = sourceFile.Get.Read(out long bytesRead, 0, workBuffer);
|
||||
@ -915,7 +915,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
||||
|
||||
using (var destFile = new UniqueRef<IFile>())
|
||||
{
|
||||
Result res = _baseFs.OpenFile(ref destFile.Ref(), in destPath, OpenMode.Write);
|
||||
Result res = _baseFs.OpenFile(ref destFile.Ref, in destPath, OpenMode.Write);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = destFile.Get.Write(0, workBuffer, WriteOption.Flush);
|
||||
@ -958,7 +958,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
res = _baseFs.OpenFile(ref file.Ref(), in pathExtraData, OpenMode.Write);
|
||||
res = _baseFs.OpenFile(ref file.Ref, in pathExtraData, OpenMode.Write);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = file.Get.Write(0, SpanHelpers.AsReadOnlyByteSpan(in extraData), WriteOption.Flush);
|
||||
@ -1015,7 +1015,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
res = _baseFs.OpenFile(ref file.Ref(), in pathExtraData, OpenMode.Read);
|
||||
res = _baseFs.OpenFile(ref file.Ref, in pathExtraData, OpenMode.Read);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = file.Get.Read(out long bytesRead, 0, SpanHelpers.AsByteSpan(ref extraData));
|
||||
|
@ -203,7 +203,7 @@ public class IntegrityVerificationStorage : IStorage
|
||||
Result verifyHashResult = Result.Success;
|
||||
|
||||
using var hashGenerator = new UniqueRef<IHash256Generator>();
|
||||
res = _hashGeneratorFactory.Create(ref hashGenerator.Ref());
|
||||
res = _hashGeneratorFactory.Create(ref hashGenerator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int signatureCount = destination.Length >> _verificationBlockOrder;
|
||||
@ -304,7 +304,7 @@ public class IntegrityVerificationStorage : IStorage
|
||||
int bufferCount = Math.Min(signatureCount, signatureBuffer.GetSize() / Unsafe.SizeOf<BlockHash>());
|
||||
|
||||
using var hashGenerator = new UniqueRef<IHash256Generator>();
|
||||
res = _hashGeneratorFactory.Create(ref hashGenerator.Ref());
|
||||
res = _hashGeneratorFactory.Create(ref hashGenerator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
while (updatedSignatureCount < signatureCount)
|
||||
@ -520,7 +520,7 @@ public class IntegrityVerificationStorage : IStorage
|
||||
UnsafeHelpers.SkipParamInit(out outHash);
|
||||
|
||||
using var hashGenerator = new UniqueRef<IHash256Generator>();
|
||||
Result res = _hashGeneratorFactory.Create(ref hashGenerator.Ref());
|
||||
Result res = _hashGeneratorFactory.Create(ref hashGenerator.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
CalcBlockHash(out outHash, buffer, verificationBlockSize, in hashGenerator);
|
||||
|
@ -178,7 +178,7 @@ public class NcaReader : IDisposable
|
||||
_getDecompressorFunc = compressionConfig.GetDecompressorFunc;
|
||||
|
||||
_bodyStorage.SetByMove(ref baseStorage);
|
||||
_headerStorage.Set(ref headerStorage.Ref());
|
||||
_headerStorage.Set(ref headerStorage.Ref);
|
||||
|
||||
return Result.Success;
|
||||
|
||||
|
@ -327,10 +327,10 @@ internal class StorageLayoutTypeSetFileSystem : IFileSystem
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||
using var baseFile = new UniqueRef<IFile>();
|
||||
|
||||
Result res = _baseFileSystem.Get.OpenFile(ref baseFile.Ref(), in path, mode);
|
||||
Result res = _baseFileSystem.Get.OpenFile(ref baseFile.Ref, in path, mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFile.Reset(new StorageLayoutTypeSetFile(ref baseFile.Ref(), _storageFlag));
|
||||
outFile.Reset(new StorageLayoutTypeSetFile(ref baseFile.Ref, _storageFlag));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -340,10 +340,10 @@ internal class StorageLayoutTypeSetFileSystem : IFileSystem
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||
using var baseDirectory = new UniqueRef<IDirectory>();
|
||||
|
||||
Result res = _baseFileSystem.Get.OpenDirectory(ref baseDirectory.Ref(), in path, mode);
|
||||
Result res = _baseFileSystem.Get.OpenDirectory(ref baseDirectory.Ref, in path, mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outDirectory.Reset(new StorageLayoutTypeSetDirectory(ref baseDirectory.Ref(), _storageFlag));
|
||||
outDirectory.Reset(new StorageLayoutTypeSetDirectory(ref baseDirectory.Ref, _storageFlag));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ internal static class Utility
|
||||
{
|
||||
using var directory = new UniqueRef<IDirectory>();
|
||||
|
||||
Result res = fs.OpenDirectory(ref directory.Ref(), in workPath, OpenDirectoryMode.All);
|
||||
Result res = fs.OpenDirectory(ref directory.Ref, in workPath, OpenDirectoryMode.All);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
while (true)
|
||||
@ -88,7 +88,7 @@ internal static class Utility
|
||||
|
||||
while (true)
|
||||
{
|
||||
Result res = fs.OpenDirectory(ref directory.Ref(), in workPath, OpenDirectoryMode.All);
|
||||
Result res = fs.OpenDirectory(ref directory.Ref, in workPath, OpenDirectoryMode.All);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = directory.Get.Read(out long entriesRead, SpanHelpers.AsSpan(ref dirEntry));
|
||||
@ -159,7 +159,7 @@ internal static class Utility
|
||||
{
|
||||
// Open source file.
|
||||
using var sourceFile = new UniqueRef<IFile>();
|
||||
Result res = sourceFileSystem.OpenFile(ref sourceFile.Ref(), sourcePath, OpenMode.Read);
|
||||
Result res = sourceFileSystem.OpenFile(ref sourceFile.Ref, sourcePath, OpenMode.Read);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = sourceFile.Get.GetSize(out long fileSize);
|
||||
@ -169,7 +169,7 @@ internal static class Utility
|
||||
res = destFileSystem.CreateFile(in destPath, fileSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = destFileSystem.OpenFile(ref destFile.Ref(), in destPath, OpenMode.Write);
|
||||
res = destFileSystem.OpenFile(ref destFile.Ref, in destPath, OpenMode.Write);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Read/Write file in work-buffer-sized chunks.
|
||||
@ -285,7 +285,7 @@ internal static class Utility
|
||||
{
|
||||
using var file = new UniqueRef<IFile>();
|
||||
|
||||
Result res = closure.SourceFileSystem.OpenFile(ref file.Ref(), in path, OpenMode.Read);
|
||||
Result res = closure.SourceFileSystem.OpenFile(ref file.Ref, in path, OpenMode.Read);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
long offset = 0;
|
||||
@ -419,7 +419,7 @@ internal static class Utility
|
||||
var lockWithPin = new UniqueLockWithPin<T>(ref semaphoreAdapter.Ref(), ref objectToPin);
|
||||
using var uniqueLock = new UniqueRef<IUniqueLock>(lockWithPin);
|
||||
|
||||
outUniqueLock.Set(ref uniqueLock.Ref());
|
||||
outUniqueLock.Set(ref uniqueLock.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
}
|
@ -37,7 +37,7 @@ public static class LrService
|
||||
return;
|
||||
|
||||
using SharedRef<ILocationResolverManager> serviceObject = lr.GetLocationResolverManagerServiceObject();
|
||||
globals.LocationResolver.SetByMove(ref serviceObject.Ref());
|
||||
globals.LocationResolver.SetByMove(ref serviceObject.Ref);
|
||||
}
|
||||
|
||||
public static Result OpenLocationResolver(this LrClient lr, out LocationResolver outResolver, StorageId storageId)
|
||||
@ -45,10 +45,10 @@ public static class LrService
|
||||
UnsafeHelpers.SkipParamInit(out outResolver);
|
||||
|
||||
using var resolver = new SharedRef<ILocationResolver>();
|
||||
Result res = lr.Globals.LrService.LocationResolver.Get.OpenLocationResolver(ref resolver.Ref(), storageId);
|
||||
Result res = lr.Globals.LrService.LocationResolver.Get.OpenLocationResolver(ref resolver.Ref, storageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outResolver = new LocationResolver(ref resolver.Ref());
|
||||
outResolver = new LocationResolver(ref resolver.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -57,10 +57,10 @@ public static class LrService
|
||||
UnsafeHelpers.SkipParamInit(out outResolver);
|
||||
|
||||
using var resolver = new SharedRef<IRegisteredLocationResolver>();
|
||||
Result res = lr.Globals.LrService.LocationResolver.Get.OpenRegisteredLocationResolver(ref resolver.Ref());
|
||||
Result res = lr.Globals.LrService.LocationResolver.Get.OpenRegisteredLocationResolver(ref resolver.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outResolver = new RegisteredLocationResolver(ref resolver.Ref());
|
||||
outResolver = new RegisteredLocationResolver(ref resolver.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -69,10 +69,10 @@ public static class LrService
|
||||
UnsafeHelpers.SkipParamInit(out outResolver);
|
||||
|
||||
using var resolver = new SharedRef<IAddOnContentLocationResolver>();
|
||||
Result res = lr.Globals.LrService.LocationResolver.Get.OpenAddOnContentLocationResolver(ref resolver.Ref());
|
||||
Result res = lr.Globals.LrService.LocationResolver.Get.OpenAddOnContentLocationResolver(ref resolver.Ref);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outResolver = new AddOnContentLocationResolver(ref resolver.Ref());
|
||||
outResolver = new AddOnContentLocationResolver(ref resolver.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@ -89,13 +89,13 @@ public static class LrService
|
||||
private static SharedRef<ILocationResolverManager> GetLocationResolverManagerServiceObject(this LrClient lr)
|
||||
{
|
||||
using var manager = new SharedRef<ILocationResolverManager>();
|
||||
Result res = lr.Hos.Sm.GetService(ref manager.Ref(), "lr");
|
||||
Result res = lr.Hos.Sm.GetService(ref manager.Ref, "lr");
|
||||
|
||||
if (res.IsFailure())
|
||||
{
|
||||
throw new HorizonResultException(res, "Failed to get lr service object.");
|
||||
}
|
||||
|
||||
return SharedRef<ILocationResolverManager>.CreateMove(ref manager.Ref());
|
||||
return SharedRef<ILocationResolverManager>.CreateMove(ref manager.Ref);
|
||||
}
|
||||
}
|
@ -16,10 +16,10 @@ public class ServiceManagerClient
|
||||
{
|
||||
using var service = new SharedRef<IDisposable>();
|
||||
|
||||
Result res = Server.GetService(ref service.Ref(), ServiceName.Encode(name));
|
||||
Result res = Server.GetService(ref service.Ref, ServiceName.Encode(name));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (serviceObject.TryCastSet(ref service.Ref()))
|
||||
if (serviceObject.TryCastSet(ref service.Ref))
|
||||
{
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ public class SwitchFs : IDisposable
|
||||
try
|
||||
{
|
||||
using var ncaFile = new UniqueRef<IFile>();
|
||||
ContentFs.OpenFile(ref ncaFile.Ref(), fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
ContentFs.OpenFile(ref ncaFile.Ref, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
|
||||
nca = new SwitchFsNca(new Nca(KeySet, ncaFile.Release().AsStorage()));
|
||||
|
||||
@ -152,7 +152,7 @@ public class SwitchFs : IDisposable
|
||||
try
|
||||
{
|
||||
using var file = new UniqueRef<IFile>();
|
||||
SaveFs.OpenFile(ref file.Ref(), fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
SaveFs.OpenFile(ref file.Ref, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
|
||||
save = new SaveDataFileSystem(KeySet, file.Release().AsStorage(), IntegrityCheckLevel.None, true);
|
||||
}
|
||||
@ -180,7 +180,7 @@ public class SwitchFs : IDisposable
|
||||
string cnmtPath = fs.EnumerateEntries("/", "*.cnmt").Single().FullPath;
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), cnmtPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
fs.OpenFile(ref file.Ref, cnmtPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
|
||||
var metadata = new Cnmt(file.Release().AsStream());
|
||||
title.Id = metadata.TitleId;
|
||||
@ -227,7 +227,7 @@ public class SwitchFs : IDisposable
|
||||
|
||||
using (var control = new UniqueRef<IFile>())
|
||||
{
|
||||
romfs.OpenFile(ref control.Ref(), "/control.nacp"u8, OpenMode.Read).ThrowIfFailure();
|
||||
romfs.OpenFile(ref control.Ref, "/control.nacp"u8, OpenMode.Read).ThrowIfFailure();
|
||||
|
||||
control.Get.Read(out _, 0, title.Control.ByteSpan).ThrowIfFailure();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class Xci
|
||||
if (type == XciPartitionType.Root) return root;
|
||||
|
||||
using var partitionFile = new UniqueRef<IFile>();
|
||||
root.OpenFile(ref partitionFile.Ref(), type.GetFileName().ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
root.OpenFile(ref partitionFile.Ref, type.GetFileName().ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
return new XciPartition(partitionFile.Release().AsStorage());
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class AesXtsDirectory : IDirectory
|
||||
try
|
||||
{
|
||||
using var file = new UniqueRef<IFile>();
|
||||
Result res = _baseFileSystem.OpenFile(ref file.Ref(), path, OpenMode.Read);
|
||||
Result res = _baseFileSystem.OpenFile(ref file.Ref, path, OpenMode.Read);
|
||||
if (res.IsFailure()) return 0;
|
||||
|
||||
uint magic = 0;
|
||||
|
@ -68,7 +68,7 @@ public class AesXtsFileSystem : IFileSystem
|
||||
var header = new AesXtsFileHeader(key, size, path.ToString(), _kekSource, _validationKey);
|
||||
|
||||
using var baseFile = new UniqueRef<IFile>();
|
||||
res = _baseFileSystem.OpenFile(ref baseFile.Ref(), in path, OpenMode.Write);
|
||||
res = _baseFileSystem.OpenFile(ref baseFile.Ref, in path, OpenMode.Write);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = baseFile.Get.Write(0, header.ToBytes(false));
|
||||
@ -101,20 +101,20 @@ public class AesXtsFileSystem : IFileSystem
|
||||
OpenDirectoryMode mode)
|
||||
{
|
||||
using var baseDir = new UniqueRef<IDirectory>();
|
||||
Result res = _baseFileSystem.OpenDirectory(ref baseDir.Ref(), path, mode);
|
||||
Result res = _baseFileSystem.OpenDirectory(ref baseDir.Ref, path, mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outDirectory.Reset(new AesXtsDirectory(_baseFileSystem, ref baseDir.Ref(), new U8String(path.GetString().ToArray()), mode));
|
||||
outDirectory.Reset(new AesXtsDirectory(_baseFileSystem, ref baseDir.Ref, new U8String(path.GetString().ToArray()), mode));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
||||
{
|
||||
using var baseFile = new UniqueRef<IFile>();
|
||||
Result res = _baseFileSystem.OpenFile(ref baseFile.Ref(), path, mode | OpenMode.Read);
|
||||
Result res = _baseFileSystem.OpenFile(ref baseFile.Ref, path, mode | OpenMode.Read);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var xtsFile = new AesXtsFile(mode, ref baseFile.Ref(), new U8String(path.GetString().ToArray()), _kekSource,
|
||||
var xtsFile = new AesXtsFile(mode, ref baseFile.Ref, new U8String(path.GetString().ToArray()), _kekSource,
|
||||
_validationKey, BlockSize);
|
||||
|
||||
outFile.Reset(xtsFile);
|
||||
@ -264,7 +264,7 @@ public class AesXtsFileSystem : IFileSystem
|
||||
header = null;
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
Result res = _baseFileSystem.OpenFile(ref file.Ref(), filePath.ToU8Span(), OpenMode.Read);
|
||||
Result res = _baseFileSystem.OpenFile(ref file.Ref, filePath.ToU8Span(), OpenMode.Read);
|
||||
if (res.IsFailure()) return false;
|
||||
|
||||
header = new AesXtsFileHeader(file.Get);
|
||||
@ -280,7 +280,7 @@ public class AesXtsFileSystem : IFileSystem
|
||||
header.EncryptHeader(keyPath, _kekSource, _validationKey);
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
_baseFileSystem.OpenFile(ref file.Ref(), filePath.ToU8Span(), OpenMode.ReadWrite);
|
||||
_baseFileSystem.OpenFile(ref file.Ref, filePath.ToU8Span(), OpenMode.ReadWrite);
|
||||
|
||||
file.Get.Write(0, header.ToBytes(false), WriteOption.Flush).ThrowIfFailure();
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public static class FileSystemExtensions
|
||||
{
|
||||
// Open source file.
|
||||
using var sourceFile = new UniqueRef<IFile>();
|
||||
Result res = sourceFileSystem.OpenFile(ref sourceFile.Ref(), sourcePath, OpenMode.Read);
|
||||
Result res = sourceFileSystem.OpenFile(ref sourceFile.Ref, sourcePath, OpenMode.Read);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = sourceFile.Get.GetSize(out long fileSize);
|
||||
@ -110,7 +110,7 @@ public static class FileSystemExtensions
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var destFile = new UniqueRef<IFile>();
|
||||
res = destFileSystem.OpenFile(ref destFile.Ref(), in destPath, OpenMode.Write);
|
||||
res = destFileSystem.OpenFile(ref destFile.Ref, in destPath, OpenMode.Write);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Read/Write file in work buffer sized chunks.
|
||||
@ -169,7 +169,7 @@ public static class FileSystemExtensions
|
||||
{
|
||||
InitializeFromString(ref pathNormalized.Ref(), path).ThrowIfFailure();
|
||||
|
||||
fileSystem.OpenDirectory(ref directory.Ref(), in pathNormalized, OpenDirectoryMode.All)
|
||||
fileSystem.OpenDirectory(ref directory.Ref, in pathNormalized, OpenDirectoryMode.All)
|
||||
.ThrowIfFailure();
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class LayeredFileSystem : IFileSystem
|
||||
|
||||
if (res.IsSuccess())
|
||||
{
|
||||
outDirectory.Set(ref dir.Ref());
|
||||
outDirectory.Set(ref dir.Ref);
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -95,11 +95,11 @@ public class LayeredFileSystem : IFileSystem
|
||||
if (!(singleSource is null))
|
||||
{
|
||||
using var dir = new UniqueRef<IDirectory>();
|
||||
Result res = singleSource.OpenDirectory(ref dir.Ref(), in path, mode);
|
||||
Result res = singleSource.OpenDirectory(ref dir.Ref, in path, mode);
|
||||
|
||||
if (res.IsSuccess())
|
||||
{
|
||||
outDirectory.Set(ref dir.Ref());
|
||||
outDirectory.Set(ref dir.Ref);
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -227,7 +227,7 @@ public class LayeredFileSystem : IFileSystem
|
||||
|
||||
foreach (IFileSystem fs in SourceFileSystems)
|
||||
{
|
||||
res = fs.OpenDirectory(ref dir.Ref(), in path, Mode);
|
||||
res = fs.OpenDirectory(ref dir.Ref, in path, Mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
SourceDirs.Add(dir.Release());
|
||||
@ -276,7 +276,7 @@ public class LayeredFileSystem : IFileSystem
|
||||
// Open new directories for each source because we need to remove duplicate entries
|
||||
foreach (IFileSystem fs in SourceFileSystems)
|
||||
{
|
||||
Result res = fs.OpenDirectory(ref dir.Ref(), in path, Mode);
|
||||
Result res = fs.OpenDirectory(ref dir.Ref, in path, Mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
long entriesRead;
|
||||
|
@ -33,7 +33,7 @@ public class PartitionFileSystemBuilder
|
||||
foreach (DirectoryEntryEx entry in input.EnumerateEntries().Where(x => x.Type == DirectoryEntryType.File)
|
||||
.OrderBy(x => x.FullPath, StringComparer.Ordinal))
|
||||
{
|
||||
input.OpenFile(ref file.Ref(), entry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
input.OpenFile(ref file.Ref, entry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
|
||||
AddFile(entry.FullPath.TrimStart('/'), file.Release());
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class RomFsBuilder
|
||||
.OrderBy(x => x.FullPath, StringComparer.Ordinal))
|
||||
{
|
||||
using var file = new UniqueRef<IFile>();
|
||||
input.OpenFile(ref file.Ref(), entry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
input.OpenFile(ref file.Ref, entry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
|
||||
AddFile(entry.FullPath, file.Release());
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ internal static class ProcessAppFs
|
||||
foreach (DirectoryEntryEx entry in fileSystem.EnumerateEntries("*.tik", SearchOptions.Default))
|
||||
{
|
||||
using var tikFile = new UniqueRef<IFile>();
|
||||
fileSystem.OpenFile(ref tikFile.Ref(), entry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
fileSystem.OpenFile(ref tikFile.Ref, entry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
|
||||
var ticket = new Ticket(tikFile.Get.AsStream());
|
||||
|
||||
|
@ -38,7 +38,7 @@ internal static class ProcessDelta
|
||||
}
|
||||
|
||||
using var deltaFragmentFile = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref deltaFragmentFile.Ref(), FragmentFileName.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
fs.OpenFile(ref deltaFragmentFile.Ref, FragmentFileName.ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
|
||||
deltaStorage = deltaFragmentFile.Release().AsStorage();
|
||||
}
|
||||
|
@ -49,9 +49,9 @@ internal static class ProcessKip
|
||||
for (int i = 0; i < ini1.ProcessCount; i++)
|
||||
{
|
||||
using var kipStorage = new UniqueRef<IStorage>();
|
||||
ini1.OpenKipStorage(ref kipStorage.Ref(), i).ThrowIfFailure();
|
||||
ini1.OpenKipStorage(ref kipStorage.Ref, i).ThrowIfFailure();
|
||||
|
||||
using SharedRef<IStorage> sharedKipStorage = SharedRef<IStorage>.Create(ref kipStorage.Ref());
|
||||
using SharedRef<IStorage> sharedKipStorage = SharedRef<IStorage>.Create(ref kipStorage.Ref);
|
||||
kipReader.Initialize(in sharedKipStorage).ThrowIfFailure();
|
||||
|
||||
sharedKipStorage.Get.WriteAllBytes(System.IO.Path.Combine(outDir, $"{kipReader.Name.ToString()}.kip1"));
|
||||
|
@ -36,7 +36,7 @@ internal static class ProcessNax0
|
||||
|
||||
try
|
||||
{
|
||||
xtsFile = new AesXtsFile(OpenMode.Read, ref baseFile.Ref(), ctx.Options.SdPath.ToU8String(), kekSource, validationKey, 0x4000);
|
||||
xtsFile = new AesXtsFile(OpenMode.Read, ref baseFile.Ref, ctx.Options.SdPath.ToU8String(), kekSource, validationKey, 0x4000);
|
||||
contentType = i;
|
||||
|
||||
break;
|
||||
|
@ -76,8 +76,8 @@ internal static class ProcessNca
|
||||
using var inputFs = new UniqueRef<IFileSystem>(OpenFileSystem(i));
|
||||
using var outputFs = new UniqueRef<IFileSystem>(new LocalFileSystem(ctx.Options.SectionOutDir[i]));
|
||||
|
||||
fs.Register(mountName.ToU8Span(), ref inputFs.Ref());
|
||||
fs.Register("output"u8, ref outputFs.Ref());
|
||||
fs.Register(mountName.ToU8Span(), ref inputFs.Ref);
|
||||
fs.Register("output"u8, ref outputFs.Ref);
|
||||
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName.ToU8Span());
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog("output"u8);
|
||||
@ -131,8 +131,8 @@ internal static class ProcessNca
|
||||
using var inputFs = new UniqueRef<IFileSystem>(OpenFileSystemByType(NcaSectionType.Data));
|
||||
using var outputFs = new UniqueRef<IFileSystem>(new LocalFileSystem(ctx.Options.RomfsOutDir));
|
||||
|
||||
fs.Register("rom"u8, ref inputFs.Ref());
|
||||
fs.Register("output"u8, ref outputFs.Ref());
|
||||
fs.Register("rom"u8, ref inputFs.Ref);
|
||||
fs.Register("output"u8, ref outputFs.Ref);
|
||||
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog("rom"u8);
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog("output"u8);
|
||||
@ -194,8 +194,8 @@ internal static class ProcessNca
|
||||
using var inputFs = new UniqueRef<IFileSystem>(OpenFileSystemByType(NcaSectionType.Code));
|
||||
using var outputFs = new UniqueRef<IFileSystem>(new LocalFileSystem(ctx.Options.ExefsOutDir));
|
||||
|
||||
fs.Register("code"u8, ref inputFs.Ref());
|
||||
fs.Register("output"u8, ref outputFs.Ref());
|
||||
fs.Register("code"u8, ref inputFs.Ref);
|
||||
fs.Register("output"u8, ref outputFs.Ref);
|
||||
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog("code"u8);
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog("output"u8);
|
||||
@ -260,7 +260,7 @@ internal static class ProcessNca
|
||||
if (!pfs.FileExists("main.npdm")) return Validity.Unchecked;
|
||||
|
||||
using var npdmFile = new UniqueRef<IFile>();
|
||||
pfs.OpenFile(ref npdmFile.Ref(), "main.npdm"u8, OpenMode.Read).ThrowIfFailure();
|
||||
pfs.OpenFile(ref npdmFile.Ref, "main.npdm"u8, OpenMode.Read).ThrowIfFailure();
|
||||
var npdm = new NpdmBinary(npdmFile.Release().AsStream());
|
||||
|
||||
return nca.Header.VerifySignature2(npdm.AciD.Rsa2048Modulus);
|
||||
@ -293,7 +293,7 @@ internal static class ProcessNca
|
||||
IFileSystem fs = nca.OpenFileSystem(NcaSectionType.Code, IntegrityCheckLevel.None);
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
Result res = fs.OpenFile(ref file.Ref(), "/main.npdm"u8, OpenMode.Read);
|
||||
Result res = fs.OpenFile(ref file.Ref, "/main.npdm"u8, OpenMode.Read);
|
||||
if (res.IsSuccess())
|
||||
{
|
||||
var npdm = new NpdmBinary(file.Release().AsStream(), null);
|
||||
|
@ -125,15 +125,15 @@ internal static class ProcessPackage
|
||||
Directory.CreateDirectory(outDir);
|
||||
|
||||
using var kernelStorage = new UniqueRef<IStorage>();
|
||||
package2.OpenPayload(ref kernelStorage.Ref(), 0).ThrowIfFailure();
|
||||
package2.OpenPayload(ref kernelStorage.Ref, 0).ThrowIfFailure();
|
||||
kernelStorage.Get.WriteAllBytes(Path.Combine(outDir, "Kernel.bin"), ctx.Logger);
|
||||
|
||||
using var ini1Storage = new UniqueRef<IStorage>();
|
||||
package2.OpenIni(ref ini1Storage.Ref()).ThrowIfFailure();
|
||||
package2.OpenIni(ref ini1Storage.Ref).ThrowIfFailure();
|
||||
ini1Storage.Get.WriteAllBytes(Path.Combine(outDir, "INI1.bin"), ctx.Logger);
|
||||
|
||||
using var decPackageStorage = new UniqueRef<IStorage>();
|
||||
package2.OpenDecryptedPackage(ref decPackageStorage.Ref()).ThrowIfFailure();
|
||||
package2.OpenDecryptedPackage(ref decPackageStorage.Ref).ThrowIfFailure();
|
||||
decPackageStorage.Get.WriteAllBytes(Path.Combine(outDir, "Decrypted.bin"), ctx.Logger);
|
||||
}
|
||||
|
||||
@ -142,9 +142,9 @@ internal static class ProcessPackage
|
||||
Directory.CreateDirectory(iniDir);
|
||||
|
||||
using var ini1Storage = new UniqueRef<IStorage>();
|
||||
package2.OpenIni(ref ini1Storage.Ref()).ThrowIfFailure();
|
||||
package2.OpenIni(ref ini1Storage.Ref).ThrowIfFailure();
|
||||
|
||||
using SharedRef<IStorage> sharedIni1Storage = SharedRef<IStorage>.Create(ref ini1Storage.Ref());
|
||||
using SharedRef<IStorage> sharedIni1Storage = SharedRef<IStorage>.Create(ref ini1Storage.Ref);
|
||||
ProcessKip.ExtractIni1(in sharedIni1Storage, iniDir);
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ internal static class ProcessSave
|
||||
FileSystemClient fs = ctx.Horizon.Fs;
|
||||
|
||||
using var saveUnique = new UniqueRef<IFileSystem>(save);
|
||||
fs.Register("save"u8, ref saveUnique.Ref());
|
||||
fs.Register("save"u8, ref saveUnique.Ref);
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog("save"u8);
|
||||
|
||||
if (ctx.Options.Validate)
|
||||
@ -48,7 +48,7 @@ internal static class ProcessSave
|
||||
if (ctx.Options.OutDir != null)
|
||||
{
|
||||
using var outputFs = new UniqueRef<IFileSystem>(new LocalFileSystem(ctx.Options.OutDir));
|
||||
fs.Register("output"u8, ref outputFs.Ref());
|
||||
fs.Register("output"u8, ref outputFs.Ref);
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog("output"u8);
|
||||
|
||||
FsUtils.CopyDirectoryWithProgress(fs, "save:/"u8, "output:/"u8, logger: ctx.Logger).ThrowIfFailure();
|
||||
@ -73,7 +73,7 @@ internal static class ProcessSave
|
||||
using var inFile = new UniqueRef<IFile>(new LocalFile(ctx.Options.ReplaceFileSource, OpenMode.Read));
|
||||
|
||||
using var outFile = new UniqueRef<IFile>();
|
||||
save.OpenFile(ref outFile.Ref(), destFilename.ToU8Span(), OpenMode.ReadWrite).ThrowIfFailure();
|
||||
save.OpenFile(ref outFile.Ref, destFilename.ToU8Span(), OpenMode.ReadWrite).ThrowIfFailure();
|
||||
|
||||
inFile.Get.GetSize(out long inFileSize).ThrowIfFailure();
|
||||
outFile.Get.GetSize(out long outFileSize).ThrowIfFailure();
|
||||
@ -93,7 +93,7 @@ internal static class ProcessSave
|
||||
if (ctx.Options.RepackSource != null)
|
||||
{
|
||||
using var inputFs = new UniqueRef<IFileSystem>(new LocalFileSystem(ctx.Options.RepackSource));
|
||||
fs.Register("input"u8, ref inputFs.Ref());
|
||||
fs.Register("input"u8, ref inputFs.Ref);
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog("input"u8);
|
||||
|
||||
fs.CleanDirectoryRecursively("save:/"u8);
|
||||
|
@ -26,14 +26,14 @@ internal static class ProcessSwitchFs
|
||||
if (Directory.Exists(Path.Combine(ctx.Options.InFile, "Nintendo", "Contents", "registered")))
|
||||
{
|
||||
ctx.Logger.LogMessage("Treating path as SD card storage");
|
||||
switchFs = SwitchFs.OpenSdCard(ctx.KeySet, ref baseFs.Ref());
|
||||
switchFs = SwitchFs.OpenSdCard(ctx.KeySet, ref baseFs.Ref);
|
||||
|
||||
CheckForNcaFolders(ctx, switchFs);
|
||||
}
|
||||
else if (Directory.Exists(Path.Combine(ctx.Options.InFile, "Contents", "registered")))
|
||||
{
|
||||
ctx.Logger.LogMessage("Treating path as NAND storage");
|
||||
switchFs = SwitchFs.OpenNandPartition(ctx.KeySet, ref baseFs.Ref());
|
||||
switchFs = SwitchFs.OpenNandPartition(ctx.KeySet, ref baseFs.Ref);
|
||||
|
||||
CheckForNcaFolders(ctx, switchFs);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class ApplicationSaveDataManagementTests
|
||||
void AssertSaveExists()
|
||||
{
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User);
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User);
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
Assert.Success(iterator.Get.ReadSaveDataInfo(out long entriesRead, info));
|
||||
@ -69,7 +69,7 @@ public class ApplicationSaveDataManagementTests
|
||||
void AssertSaveExists()
|
||||
{
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User);
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User);
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
Assert.Success(iterator.Get.ReadSaveDataInfo(out long entriesRead, info));
|
||||
@ -103,7 +103,7 @@ public class ApplicationSaveDataManagementTests
|
||||
void AssertSaveExists()
|
||||
{
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User);
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User);
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
Assert.Success(iterator.Get.ReadSaveDataInfo(out long entriesRead, info));
|
||||
@ -137,7 +137,7 @@ public class ApplicationSaveDataManagementTests
|
||||
void AssertSaveExists()
|
||||
{
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.Temporary);
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.Temporary);
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
Assert.Success(iterator.Get.ReadSaveDataInfo(out long entriesRead, info));
|
||||
@ -174,7 +174,7 @@ public class ApplicationSaveDataManagementTests
|
||||
Assert.Success(fs.EnsureApplicationSaveData(out _, applicationId, in controlProperty, in userId));
|
||||
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User);
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User);
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
Assert.Success(iterator.Get.ReadSaveDataInfo(out long entriesRead, info));
|
||||
@ -219,7 +219,7 @@ public class ApplicationSaveDataManagementTests
|
||||
Assert.Equal(CacheStorageTargetMedia.SdCard, target);
|
||||
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.SdUser);
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.SdUser);
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
Assert.Success(iterator.Get.ReadSaveDataInfo(out long entriesRead, info));
|
||||
@ -249,7 +249,7 @@ public class ApplicationSaveDataManagementTests
|
||||
Assert.Equal(CacheStorageTargetMedia.Nand, target);
|
||||
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User);
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User);
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
Assert.Success(iterator.Get.ReadSaveDataInfo(out long entriesRead, info));
|
||||
|
@ -22,7 +22,7 @@ public class SaveDataManagement
|
||||
Assert.Success(fs.CreateCacheStorage(applicationId, SaveDataSpaceId.User, applicationId.Value, 0, 0, SaveDataFlags.None));
|
||||
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User);
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User);
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
iterator.Get.ReadSaveDataInfo(out long entriesRead, info);
|
||||
@ -40,7 +40,7 @@ public class SaveDataManagement
|
||||
Assert.Success(fs.CreateCacheStorage(applicationId, SaveDataSpaceId.SdUser, applicationId.Value, 0, 0, SaveDataFlags.None));
|
||||
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.SdUser);
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.SdUser);
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
iterator.Get.ReadSaveDataInfo(out long entriesRead, info);
|
||||
@ -78,7 +78,7 @@ public class SaveDataManagement
|
||||
Assert.Success(fs.CreateCacheStorage(applicationId, SaveDataSpaceId.User, applicationId.Value, 1, 0, 0, SaveDataFlags.None));
|
||||
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User);
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User);
|
||||
|
||||
var info = new SaveDataInfo[3];
|
||||
iterator.Get.ReadSaveDataInfo(out long entriesRead, info);
|
||||
@ -102,7 +102,7 @@ public class SaveDataManagement
|
||||
Assert.Success(fs.CreateBcatSaveData(applicationId, 0x400000));
|
||||
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User);
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User);
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
iterator.Get.ReadSaveDataInfo(out long entriesRead, info);
|
||||
@ -134,7 +134,7 @@ public class SaveDataManagement
|
||||
|
||||
// Make sure it was placed in the System save space with the right info.
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.System));
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.System));
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
Assert.Success(iterator.Get.ReadSaveDataInfo(out long entriesRead, info));
|
||||
@ -177,7 +177,7 @@ public class SaveDataManagement
|
||||
|
||||
// Make sure it was placed in the System save space with the right info.
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
Assert.Success(privilegedClient.Fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.System));
|
||||
Assert.Success(privilegedClient.Fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.System));
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
Assert.Success(iterator.Get.ReadSaveDataInfo(out long entriesRead, info));
|
||||
@ -201,7 +201,7 @@ public class SaveDataManagement
|
||||
Assert.Success(fs.CreateSaveData(applicationId, userId, 0, 0x1000, 0x1000, SaveDataFlags.None));
|
||||
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User));
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User));
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
iterator.Get.ReadSaveDataInfo(out long entriesRead, info);
|
||||
@ -227,7 +227,7 @@ public class SaveDataManagement
|
||||
|
||||
// Get the created save data's ID
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User));
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User));
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
iterator.Get.ReadSaveDataInfo(out long entriesRead, info);
|
||||
@ -255,7 +255,7 @@ public class SaveDataManagement
|
||||
|
||||
// Get the created save data's ID
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User));
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User));
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
iterator.Get.ReadSaveDataInfo(out long entriesRead, info);
|
||||
@ -284,7 +284,7 @@ public class SaveDataManagement
|
||||
|
||||
// Get the created save data's ID
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User));
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User));
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
iterator.Get.ReadSaveDataInfo(out long entriesRead, info);
|
||||
@ -328,7 +328,7 @@ public class SaveDataManagement
|
||||
|
||||
// Get the created save data's ID
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
Assert.Success(client.Fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User));
|
||||
Assert.Success(client.Fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User));
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
iterator.Get.ReadSaveDataInfo(out long entriesRead, info);
|
||||
@ -349,7 +349,7 @@ public class SaveDataManagement
|
||||
Assert.Success(fs.CreateTemporaryStorage(applicationId, 0, availableSize, SaveDataFlags.None));
|
||||
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.Temporary);
|
||||
fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.Temporary);
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
iterator.Get.ReadSaveDataInfo(out long entriesRead, info);
|
||||
@ -390,7 +390,7 @@ public class SaveDataManagement
|
||||
|
||||
// Get the ID of the save
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User));
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User));
|
||||
|
||||
var info = new SaveDataInfo[1];
|
||||
Assert.Success(iterator.Get.ReadSaveDataInfo(out _, info));
|
||||
@ -400,7 +400,7 @@ public class SaveDataManagement
|
||||
|
||||
// Iterate saves again
|
||||
using var iterator2 = new UniqueRef<SaveDataIterator>();
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator2.Ref(), SaveDataSpaceId.User));
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator2.Ref, SaveDataSpaceId.User));
|
||||
Assert.Success(iterator2.Get.ReadSaveDataInfo(out long entriesRead, info));
|
||||
|
||||
// Make sure no saves were returned
|
||||
@ -423,7 +423,7 @@ public class SaveDataManagement
|
||||
|
||||
// Open an iterator
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User));
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User));
|
||||
|
||||
// Skip ahead a few entries. Entries start counting at 1, so subtract 1
|
||||
var infos = new SaveDataInfo[nextEntryWhenRemoving - 1];
|
||||
@ -461,7 +461,7 @@ public class SaveDataManagement
|
||||
|
||||
// Open an iterator
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User));
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User));
|
||||
|
||||
// Skip ahead a few entries. We skipped 0 and added every other ID, so divide by 2 and subtract 1
|
||||
var infos = new SaveDataInfo[nextEntryWhenAdding / 2 - 1];
|
||||
@ -490,7 +490,7 @@ public class SaveDataManagement
|
||||
Assert.Success(PopulateSaveData(fs, count, rngSeed));
|
||||
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User));
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User));
|
||||
|
||||
var info = new SaveDataInfo();
|
||||
for (int i = 0; i < count; i++)
|
||||
@ -533,7 +533,7 @@ public class SaveDataManagement
|
||||
saveDataId: default, index: default));
|
||||
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User, in filter));
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User, in filter));
|
||||
|
||||
var info = new SaveDataInfo();
|
||||
for (int i = countUser1 + 1; i <= count; i++)
|
||||
@ -565,7 +565,7 @@ public class SaveDataManagement
|
||||
|
||||
// Get the created save data's ID
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User));
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User));
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
iterator.Get.ReadSaveDataInfo(out long entriesRead, info);
|
||||
@ -595,7 +595,7 @@ public class SaveDataManagement
|
||||
|
||||
// Get the created save data's ID
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User));
|
||||
Assert.Success(fs.OpenSaveDataIterator(ref iterator.Ref, SaveDataSpaceId.User));
|
||||
|
||||
var info = new SaveDataInfo[2];
|
||||
iterator.Get.ReadSaveDataInfo(out long entriesRead, info);
|
||||
|
@ -27,8 +27,8 @@ public abstract partial class CommittableIFileSystemTests
|
||||
using var file1 = new UniqueRef<IFile>();
|
||||
using var file2 = new UniqueRef<IFile>();
|
||||
|
||||
fs.OpenFile(ref file1.Ref(), "/dir1/file", OpenMode.Write).ThrowIfFailure();
|
||||
fs.OpenFile(ref file2.Ref(), "/dir2/file", OpenMode.Write).ThrowIfFailure();
|
||||
fs.OpenFile(ref file1.Ref, "/dir1/file", OpenMode.Write).ThrowIfFailure();
|
||||
fs.OpenFile(ref file2.Ref, "/dir2/file", OpenMode.Write).ThrowIfFailure();
|
||||
|
||||
file1.Get.Write(0, data1, WriteOption.Flush).ThrowIfFailure();
|
||||
file2.Get.Write(0, data2, WriteOption.Flush).ThrowIfFailure();
|
||||
@ -45,7 +45,7 @@ public abstract partial class CommittableIFileSystemTests
|
||||
byte[] readData1 = new byte[data1.Length];
|
||||
byte[] readData2 = new byte[data2.Length];
|
||||
|
||||
Assert.Success(fs.OpenFile(ref file1.Ref(), "/dir1/file", OpenMode.Read));
|
||||
Assert.Success(fs.OpenFile(ref file1.Ref, "/dir1/file", OpenMode.Read));
|
||||
|
||||
Assert.Success(file1.Get.Read(out long bytesReadFile1, 0, readData1, ReadOption.None));
|
||||
file1.Reset();
|
||||
@ -53,7 +53,7 @@ public abstract partial class CommittableIFileSystemTests
|
||||
|
||||
Assert.Equal(data1, readData1);
|
||||
|
||||
Assert.Success(fs.OpenFile(ref file2.Ref(), "/dir2/file", OpenMode.Read));
|
||||
Assert.Success(fs.OpenFile(ref file2.Ref, "/dir2/file", OpenMode.Read));
|
||||
|
||||
Assert.Success(file2.Get.Read(out long bytesReadFile2, 0, readData2, ReadOption.None));
|
||||
Assert.Equal(data2.Length, bytesReadFile2);
|
||||
@ -109,7 +109,7 @@ public abstract partial class CommittableIFileSystemTests
|
||||
fs.CreateFile("/dir/file", data1.Length, CreateFileOptions.None).ThrowIfFailure();
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/dir/file", OpenMode.Write).ThrowIfFailure();
|
||||
fs.OpenFile(ref file.Ref, "/dir/file", OpenMode.Write).ThrowIfFailure();
|
||||
file.Get.Write(0, data1, WriteOption.Flush).ThrowIfFailure();
|
||||
file.Reset();
|
||||
|
||||
@ -120,7 +120,7 @@ public abstract partial class CommittableIFileSystemTests
|
||||
fs = fsCreator.Create();
|
||||
|
||||
// Make changes to the file
|
||||
fs.OpenFile(ref file.Ref(), "/dir/file", OpenMode.Write).ThrowIfFailure();
|
||||
fs.OpenFile(ref file.Ref, "/dir/file", OpenMode.Write).ThrowIfFailure();
|
||||
file.Get.Write(0, data2, WriteOption.Flush).ThrowIfFailure();
|
||||
file.Reset();
|
||||
|
||||
@ -129,7 +129,7 @@ public abstract partial class CommittableIFileSystemTests
|
||||
// The file should contain the original data after the rollback
|
||||
byte[] readData = new byte[data1.Length];
|
||||
|
||||
Assert.Success(fs.OpenFile(ref file.Ref(), "/dir/file", OpenMode.Read));
|
||||
Assert.Success(fs.OpenFile(ref file.Ref, "/dir/file", OpenMode.Read));
|
||||
|
||||
Assert.Success(file.Get.Read(out long bytesRead, 0, readData, ReadOption.None));
|
||||
Assert.Equal(data1.Length, bytesRead);
|
||||
|
@ -74,7 +74,7 @@ public abstract partial class IFileSystemTests
|
||||
fs.CreateFile("/file", expectedSize, CreateFileOptions.None);
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Read);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Read);
|
||||
|
||||
Assert.Success(file.Get.GetSize(out long fileSize));
|
||||
Assert.Equal(expectedSize, fileSize);
|
||||
|
@ -16,7 +16,7 @@ public abstract partial class IFileSystemTests
|
||||
Span<DirectoryEntry> entries = stackalloc DirectoryEntry[1];
|
||||
|
||||
using var directory = new UniqueRef<IDirectory>();
|
||||
Assert.Success(fs.OpenDirectory(ref directory.Ref(), "/", OpenDirectoryMode.All));
|
||||
Assert.Success(fs.OpenDirectory(ref directory.Ref, "/", OpenDirectoryMode.All));
|
||||
|
||||
Assert.Success(directory.Get.Read(out long entriesRead, entries));
|
||||
Assert.Equal(0, entriesRead);
|
||||
@ -28,7 +28,7 @@ public abstract partial class IFileSystemTests
|
||||
IFileSystem fs = CreateFileSystem();
|
||||
|
||||
using var directory = new UniqueRef<IDirectory>();
|
||||
Assert.Success(fs.OpenDirectory(ref directory.Ref(), "/", OpenDirectoryMode.All));
|
||||
Assert.Success(fs.OpenDirectory(ref directory.Ref, "/", OpenDirectoryMode.All));
|
||||
|
||||
Assert.Success(directory.Get.GetEntryCount(out long entryCount));
|
||||
Assert.Equal(0, entryCount);
|
||||
@ -45,7 +45,7 @@ public abstract partial class IFileSystemTests
|
||||
fs.CreateFile("/dir/file2", 0, CreateFileOptions.None);
|
||||
|
||||
using var dir = new UniqueRef<IDirectory>();
|
||||
Assert.Success(fs.OpenDirectory(ref dir.Ref(), "/dir", OpenDirectoryMode.All));
|
||||
Assert.Success(fs.OpenDirectory(ref dir.Ref, "/dir", OpenDirectoryMode.All));
|
||||
|
||||
var entry1 = new DirectoryEntry();
|
||||
var entry2 = new DirectoryEntry();
|
||||
|
@ -17,7 +17,7 @@ public abstract partial class IFileSystemTests
|
||||
|
||||
byte[] buffer = new byte[20];
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Read);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Read);
|
||||
|
||||
Assert.Success(file.Get.Read(out long bytesRead, 50, buffer, ReadOption.None));
|
||||
Assert.Equal(20, bytesRead);
|
||||
@ -32,7 +32,7 @@ public abstract partial class IFileSystemTests
|
||||
|
||||
byte[] buffer = new byte[10];
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Read);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Read);
|
||||
|
||||
Result res = file.Get.Read(out _, 1, buffer, ReadOption.None);
|
||||
Assert.Result(ResultFs.OutOfRange, res);
|
||||
@ -47,7 +47,7 @@ public abstract partial class IFileSystemTests
|
||||
|
||||
byte[] buffer = new byte[10];
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Write);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Write);
|
||||
|
||||
Result res = file.Get.Read(out _, 0, buffer, ReadOption.None);
|
||||
Assert.Result(ResultFs.ReadUnpermitted, res);
|
||||
@ -62,7 +62,7 @@ public abstract partial class IFileSystemTests
|
||||
|
||||
byte[] buffer = new byte[10];
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Write);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Write);
|
||||
|
||||
Result res = file.Get.Read(out _, -5, buffer, ReadOption.None);
|
||||
Assert.Result(ResultFs.OutOfRange, res);
|
||||
@ -77,7 +77,7 @@ public abstract partial class IFileSystemTests
|
||||
|
||||
byte[] buffer = new byte[10];
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Write);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Write);
|
||||
|
||||
Result res = file.Get.Read(out _, long.MaxValue - 5, buffer, ReadOption.None);
|
||||
Assert.Result(ResultFs.OutOfRange, res);
|
||||
@ -92,7 +92,7 @@ public abstract partial class IFileSystemTests
|
||||
|
||||
byte[] buffer = new byte[200];
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Read);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Read);
|
||||
|
||||
Assert.Success(file.Get.Read(out long bytesRead, 90, buffer, ReadOption.None));
|
||||
Assert.Equal(10, bytesRead);
|
||||
@ -107,7 +107,7 @@ public abstract partial class IFileSystemTests
|
||||
|
||||
// The contents of a created file are undefined, so zero the file
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Write);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Write);
|
||||
file.Get.Write(0, new byte[100], WriteOption.None);
|
||||
file.Reset();
|
||||
|
||||
@ -117,7 +117,7 @@ public abstract partial class IFileSystemTests
|
||||
byte[] buffer = new byte[200];
|
||||
buffer.AsSpan().Fill(0xCC);
|
||||
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Read);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Read);
|
||||
|
||||
Assert.Success(file.Get.Read(out _, 90, buffer, ReadOption.None));
|
||||
Assert.Equal(bufferExpected, buffer);
|
||||
|
@ -14,11 +14,11 @@ public abstract partial class IFileSystemTests
|
||||
fs.CreateFile("/file", 0, CreateFileOptions.None);
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.All);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.All);
|
||||
Result res = file.Get.SetSize(54321);
|
||||
file.Reset();
|
||||
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.All);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.All);
|
||||
file.Get.GetSize(out long fileSize);
|
||||
|
||||
Assert.Success(res);
|
||||
|
@ -18,12 +18,12 @@ public abstract partial class IFileSystemTests
|
||||
fs.CreateFile("/file", data.Length, CreateFileOptions.None);
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Write);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Write);
|
||||
file.Get.Write(0, data, WriteOption.None);
|
||||
file.Reset();
|
||||
|
||||
byte[] readData = new byte[data.Length];
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Read);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Read);
|
||||
|
||||
Assert.Success(file.Get.Read(out long bytesRead, 0, readData, ReadOption.None));
|
||||
Assert.Equal(data.Length, bytesRead);
|
||||
@ -40,7 +40,7 @@ public abstract partial class IFileSystemTests
|
||||
|
||||
byte[] buffer = new byte[10];
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Write);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Write);
|
||||
|
||||
Result res = file.Get.Write(5, buffer, WriteOption.None);
|
||||
Assert.Result(ResultFs.FileExtensionWithoutOpenModeAllowAppend, res);
|
||||
@ -55,7 +55,7 @@ public abstract partial class IFileSystemTests
|
||||
|
||||
byte[] buffer = new byte[10];
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Read);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Read);
|
||||
|
||||
Result res = file.Get.Write(5, buffer, WriteOption.None);
|
||||
Assert.Result(ResultFs.WriteUnpermitted, res);
|
||||
@ -70,7 +70,7 @@ public abstract partial class IFileSystemTests
|
||||
|
||||
byte[] buffer = new byte[10];
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Read);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Read);
|
||||
|
||||
Result res = file.Get.Write(-5, buffer, WriteOption.None);
|
||||
Assert.Result(ResultFs.OutOfRange, res);
|
||||
@ -85,7 +85,7 @@ public abstract partial class IFileSystemTests
|
||||
|
||||
byte[] buffer = new byte[10];
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Read);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Read);
|
||||
|
||||
Result res = file.Get.Write(long.MaxValue - 5, buffer, WriteOption.None);
|
||||
Assert.Result(ResultFs.OutOfRange, res);
|
||||
@ -100,7 +100,7 @@ public abstract partial class IFileSystemTests
|
||||
|
||||
byte[] buffer = new byte[10];
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.All);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.All);
|
||||
|
||||
Assert.Success(file.Get.Write(5, buffer, WriteOption.None));
|
||||
|
||||
@ -117,7 +117,7 @@ public abstract partial class IFileSystemTests
|
||||
|
||||
byte[] buffer = new byte[10];
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.All);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.All);
|
||||
|
||||
Assert.Success(file.Get.Write(15, buffer, WriteOption.None));
|
||||
|
||||
@ -139,7 +139,7 @@ public abstract partial class IFileSystemTests
|
||||
writeBuffer.AsSpan().Fill(0xCC);
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.All);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.All);
|
||||
|
||||
Assert.Success(file.Get.Write(15, writeBuffer, WriteOption.None));
|
||||
|
||||
@ -149,7 +149,7 @@ public abstract partial class IFileSystemTests
|
||||
|
||||
byte[] readBuffer = new byte[25];
|
||||
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Read);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Read);
|
||||
|
||||
file.Get.Read(out _, 0, readBuffer, ReadOption.None);
|
||||
Assert.Equal(bufferExpected, readBuffer);
|
||||
|
@ -15,7 +15,7 @@ public abstract partial class IFileSystemTests
|
||||
fs.CreateFile("/file", 0, CreateFileOptions.None);
|
||||
|
||||
using var directory = new UniqueRef<IDirectory>();
|
||||
Result res = fs.OpenDirectory(ref directory.Ref(), "/file", OpenDirectoryMode.All);
|
||||
Result res = fs.OpenDirectory(ref directory.Ref, "/file", OpenDirectoryMode.All);
|
||||
|
||||
Assert.Result(ResultFs.PathNotFound, res);
|
||||
}
|
||||
@ -26,7 +26,7 @@ public abstract partial class IFileSystemTests
|
||||
IFileSystem fs = CreateFileSystem();
|
||||
|
||||
using var directory = new UniqueRef<IDirectory>();
|
||||
Result res = fs.OpenDirectory(ref directory.Ref(), "/dir", OpenDirectoryMode.All);
|
||||
Result res = fs.OpenDirectory(ref directory.Ref, "/dir", OpenDirectoryMode.All);
|
||||
|
||||
Assert.Result(ResultFs.PathNotFound, res);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public abstract partial class IFileSystemTests
|
||||
fs.CreateDirectory("/dir");
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
Result res = fs.OpenFile(ref file.Ref(), "/dir", OpenMode.All);
|
||||
Result res = fs.OpenFile(ref file.Ref, "/dir", OpenMode.All);
|
||||
|
||||
Assert.Result(ResultFs.PathNotFound, res);
|
||||
}
|
||||
@ -26,7 +26,7 @@ public abstract partial class IFileSystemTests
|
||||
IFileSystem fs = CreateFileSystem();
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
Result res = fs.OpenFile(ref file.Ref(), "/file", OpenMode.All);
|
||||
Result res = fs.OpenFile(ref file.Ref, "/file", OpenMode.All);
|
||||
|
||||
Assert.Result(ResultFs.PathNotFound, res);
|
||||
}
|
||||
|
@ -79,8 +79,8 @@ public abstract partial class IFileSystemTests
|
||||
using var file1 = new UniqueRef<IFile>();
|
||||
using var file2 = new UniqueRef<IFile>();
|
||||
|
||||
Assert.Success(fs.OpenFile(ref file1.Ref(), "/file1", OpenMode.Read));
|
||||
Assert.Success(fs.OpenFile(ref file2.Ref(), "/file2", OpenMode.Read));
|
||||
Assert.Success(fs.OpenFile(ref file1.Ref, "/file1", OpenMode.Read));
|
||||
Assert.Success(fs.OpenFile(ref file2.Ref, "/file2", OpenMode.Read));
|
||||
|
||||
Assert.Success(file1.Get.GetSize(out long file1Size));
|
||||
Assert.Success(file2.Get.GetSize(out long file2Size));
|
||||
@ -99,7 +99,7 @@ public abstract partial class IFileSystemTests
|
||||
fs.CreateFile("/file", data.Length, CreateFileOptions.None);
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
fs.OpenFile(ref file.Ref(), "/file", OpenMode.Write);
|
||||
fs.OpenFile(ref file.Ref, "/file", OpenMode.Write);
|
||||
file.Get.Write(0, data, WriteOption.None);
|
||||
file.Reset();
|
||||
|
||||
@ -107,7 +107,7 @@ public abstract partial class IFileSystemTests
|
||||
|
||||
byte[] readData = new byte[data.Length];
|
||||
|
||||
fs.OpenFile(ref file.Ref(), "/renamed", OpenMode.Read);
|
||||
fs.OpenFile(ref file.Ref, "/renamed", OpenMode.Read);
|
||||
Result res = file.Get.Read(out long bytesRead, 0, readData, ReadOption.None);
|
||||
|
||||
Assert.Success(res);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user