diff --git a/src/LibHac/Bcat/Impl/Ipc/IDeliveryCacheStorageService.cs b/src/LibHac/Bcat/Impl/Ipc/IDeliveryCacheStorageService.cs index 1a492801..003692c8 100644 --- a/src/LibHac/Bcat/Impl/Ipc/IDeliveryCacheStorageService.cs +++ b/src/LibHac/Bcat/Impl/Ipc/IDeliveryCacheStorageService.cs @@ -1,11 +1,12 @@ using System; +using LibHac.Common; namespace LibHac.Bcat.Impl.Ipc { public interface IDeliveryCacheStorageService : IDisposable { - Result CreateFileService(out IDeliveryCacheFileService fileService); - Result CreateDirectoryService(out IDeliveryCacheDirectoryService directoryService); + Result CreateFileService(ref SharedRef outFileService); + Result CreateDirectoryService(ref SharedRef outDirectoryService); Result EnumerateDeliveryCacheDirectory(out int namesRead, Span nameBuffer); } } diff --git a/src/LibHac/Bcat/Impl/Service/DeliveryCacheStorageService.cs b/src/LibHac/Bcat/Impl/Service/DeliveryCacheStorageService.cs index aefec5ee..c4111ca3 100644 --- a/src/LibHac/Bcat/Impl/Service/DeliveryCacheStorageService.cs +++ b/src/LibHac/Bcat/Impl/Service/DeliveryCacheStorageService.cs @@ -25,32 +25,28 @@ namespace LibHac.Bcat.Impl.Service Access = accessControl; } - public Result CreateFileService(out IDeliveryCacheFileService service) + public Result CreateFileService(ref SharedRef service) { lock (Locker) { - UnsafeHelpers.SkipParamInit(out service); - if (FileServiceOpenCount >= MaxOpenCount) return ResultBcat.ServiceOpenLimitReached.Log(); - service = new DeliveryCacheFileService(Server, this, ApplicationId, Access); + service.Reset(new DeliveryCacheFileService(Server, this, ApplicationId, Access)); FileServiceOpenCount++; return Result.Success; } } - public Result CreateDirectoryService(out IDeliveryCacheDirectoryService service) + public Result CreateDirectoryService(ref SharedRef service) { lock (Locker) { - UnsafeHelpers.SkipParamInit(out service); - if (DirectoryServiceOpenCount >= MaxOpenCount) return ResultBcat.ServiceOpenLimitReached.Log(); - service = new DeliveryCacheDirectoryService(Server, this, ApplicationId, Access); + service.Reset(new DeliveryCacheDirectoryService(Server, this, ApplicationId, Access)); DirectoryServiceOpenCount++; return Result.Success; diff --git a/src/LibHac/Common/NonCopyableAttribute.cs b/src/LibHac/Common/NonCopyableAttribute.cs index 967409ff..095568e9 100644 --- a/src/LibHac/Common/NonCopyableAttribute.cs +++ b/src/LibHac/Common/NonCopyableAttribute.cs @@ -3,8 +3,8 @@ namespace LibHac.Common { [AttributeUsage(AttributeTargets.Struct)] - public sealed class NonCopyableAttribute : System.Attribute { } + public sealed class NonCopyableAttribute : Attribute { } [AttributeUsage(AttributeTargets.Struct)] - public sealed class NonCopyableDisposableAttribute : System.Attribute { } + public sealed class NonCopyableDisposableAttribute : Attribute { } } diff --git a/src/LibHac/FsSrv/FileSystemServerInitializer.cs b/src/LibHac/FsSrv/FileSystemServerInitializer.cs index 5155648d..64b8cc5d 100644 --- a/src/LibHac/FsSrv/FileSystemServerInitializer.cs +++ b/src/LibHac/FsSrv/FileSystemServerInitializer.cs @@ -204,6 +204,8 @@ namespace LibHac.FsSrv serviceObject.SetByMove(ref derivedObject.Ref()); return Result.Success; } + + public void Dispose() { } } private class FileSystemProxyForLoaderService : IServiceObject @@ -221,6 +223,8 @@ namespace LibHac.FsSrv serviceObject.SetByMove(ref derivedObject.Ref()); return Result.Success; } + + public void Dispose() { } } private class ProgramRegistryService : IServiceObject @@ -238,6 +242,8 @@ namespace LibHac.FsSrv serviceObject.SetByMove(ref derivedObject.Ref()); return Result.Success; } + + public void Dispose() { } } private class DummyStackUsageReporter : IStackUsageReporter diff --git a/src/LibHac/Sm/IServiceObject.cs b/src/LibHac/Sm/IServiceObject.cs index 653e2169..860946c7 100644 --- a/src/LibHac/Sm/IServiceObject.cs +++ b/src/LibHac/Sm/IServiceObject.cs @@ -5,7 +5,7 @@ namespace LibHac.Sm { // This interface is being used as a stop-gap solution so we can // have at least some sort of service system for now - public interface IServiceObject + public interface IServiceObject : IDisposable { Result GetServiceObject(ref SharedRef serviceObject); }