From 04a2e51cfa075dbd1509f6493f1213dee84ded1c Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Wed, 12 Jan 2022 01:32:47 -0700 Subject: [PATCH] Ensure LocationResolverSet is updated for 13.1.0 --- src/LibHac/FsSrv/Impl/LocationResolverSet.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/LibHac/FsSrv/Impl/LocationResolverSet.cs b/src/LibHac/FsSrv/Impl/LocationResolverSet.cs index bf7ac043..69ea4ee6 100644 --- a/src/LibHac/FsSrv/Impl/LocationResolverSet.cs +++ b/src/LibHac/FsSrv/Impl/LocationResolverSet.cs @@ -39,7 +39,7 @@ internal struct LocationResolverSetGlobals /// /// Manages resolving the location of NCAs via the lr service. /// -/// Based on FS 12.1.0 (nnSdk 12.3.1) +/// Based on FS 13.1.0 (nnSdk 13.4.0) internal class LocationResolverSet : IDisposable { private Array5> _resolvers; @@ -52,7 +52,7 @@ internal class LocationResolverSet : IDisposable public LocationResolverSet(FileSystemServer fsServer) { - _mutex.Initialize(); + _mutex = new SdkMutexType(); _fsServer = fsServer; } @@ -129,6 +129,8 @@ internal class LocationResolverSet : IDisposable private Result GetAddOnContentLocationResolver(out AddOnContentLocationResolver resolver) { + UnsafeHelpers.SkipParamInit(out resolver); + _fsServer.InitializeLocationResolverSet(); using ScopedLock scopedLock = ScopedLock.Lock(ref _mutex); @@ -136,13 +138,9 @@ internal class LocationResolverSet : IDisposable if (!_aocResolver.HasValue) { Result rc = Hos.Lr.OpenAddOnContentLocationResolver(out AddOnContentLocationResolver lr); - if (rc.IsFailure()) - { - UnsafeHelpers.SkipParamInit(out resolver); - return rc; - } + if (rc.IsFailure()) return rc.Miss(); - _aocResolver = lr; + _aocResolver.Set(in lr); } resolver = _aocResolver.Value; @@ -283,11 +281,11 @@ internal class LocationResolverSet : IDisposable return id switch { - StorageId.Host => 2, - StorageId.GameCard => 4, StorageId.BuiltInSystem => 0, StorageId.BuiltInUser => 1, + StorageId.Host => 2, StorageId.SdCard => 3, + StorageId.GameCard => 4, _ => -1 }; }