From 270e61a50144daebf185e5ad3ab9579d2950bda4 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Sun, 7 Feb 2021 00:32:17 -0700 Subject: [PATCH] Add properties to FileSystemServerImpl and StorageService --- .../FsSrv/AccessFailureManagementServiceImpl.cs | 2 +- src/LibHac/FsSrv/FileSystemServer.cs | 7 ++++++- src/LibHac/FsSrv/FileSystemServerInitializer.cs | 2 +- src/LibHac/FsSrv/Impl/IDeviceEventSimulator.cs | 12 ++++++------ src/LibHac/FsSrv/Impl/LocationResolverSet.cs | 2 +- src/LibHac/FsSrv/SaveDataFileSystemServiceImpl.cs | 2 +- .../FsSrv/Storage/StorageDeviceManagerFactory.cs | 4 ++-- src/LibHac/FsSrv/TimeService.cs | 2 +- 8 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/LibHac/FsSrv/AccessFailureManagementServiceImpl.cs b/src/LibHac/FsSrv/AccessFailureManagementServiceImpl.cs index eedebab9..29373d2d 100644 --- a/src/LibHac/FsSrv/AccessFailureManagementServiceImpl.cs +++ b/src/LibHac/FsSrv/AccessFailureManagementServiceImpl.cs @@ -10,7 +10,7 @@ namespace LibHac.FsSrv private Configuration _config; private AccessFailureDetectionEventManager _eventManager; - internal HorizonClient HorizonClient => _config.FsServer.Globals.Hos; + internal HorizonClient HorizonClient => _config.FsServer.Hos; public AccessFailureManagementServiceImpl(in Configuration configuration) { diff --git a/src/LibHac/FsSrv/FileSystemServer.cs b/src/LibHac/FsSrv/FileSystemServer.cs index 7074498d..c8b24177 100644 --- a/src/LibHac/FsSrv/FileSystemServer.cs +++ b/src/LibHac/FsSrv/FileSystemServer.cs @@ -9,6 +9,7 @@ namespace LibHac.FsSrv public FileSystemServerImpl Impl => new FileSystemServerImpl(this); public StorageService Storage => new StorageService(this); + internal HorizonClient Hos => Globals.Hos; /// /// Creates a new and registers its services using the provided HOS client. @@ -36,6 +37,8 @@ namespace LibHac.FsSrv public readonly struct StorageService { internal readonly FileSystemServer FsSrv; + internal HorizonClient Hos => FsSrv.Hos; + internal ref FileSystemServerGlobals Globals => ref FsSrv.Globals; internal StorageService(FileSystemServer parentServer) => FsSrv = parentServer; } @@ -44,7 +47,9 @@ namespace LibHac.FsSrv public readonly struct FileSystemServerImpl { internal readonly FileSystemServer FsSrv; + internal HorizonClient Hos => FsSrv.Hos; + internal ref FileSystemServerGlobals Globals => ref FsSrv.Globals; - public FileSystemServerImpl(FileSystemServer parentServer) => FsSrv = parentServer; + internal FileSystemServerImpl(FileSystemServer parentServer) => FsSrv = parentServer; } } diff --git a/src/LibHac/FsSrv/FileSystemServerInitializer.cs b/src/LibHac/FsSrv/FileSystemServerInitializer.cs index db7b3b72..1bfb2a86 100644 --- a/src/LibHac/FsSrv/FileSystemServerInitializer.cs +++ b/src/LibHac/FsSrv/FileSystemServerInitializer.cs @@ -57,7 +57,7 @@ namespace LibHac.FsSrv private static FileSystemProxyConfiguration InitializeFileSystemProxy(FileSystemServer server, FileSystemServerConfig config) { - var saveDataIndexerManager = new SaveDataIndexerManager(server.Globals.Hos.Fs, Fs.SaveData.SaveIndexerId, + var saveDataIndexerManager = new SaveDataIndexerManager(server.Hos.Fs, Fs.SaveData.SaveIndexerId, new ArrayPoolMemoryResource(), new SdHandleManager(), false); var programRegistryService = new ProgramRegistryServiceImpl(server); diff --git a/src/LibHac/FsSrv/Impl/IDeviceEventSimulator.cs b/src/LibHac/FsSrv/Impl/IDeviceEventSimulator.cs index 3863f262..8905bffc 100644 --- a/src/LibHac/FsSrv/Impl/IDeviceEventSimulator.cs +++ b/src/LibHac/FsSrv/Impl/IDeviceEventSimulator.cs @@ -16,25 +16,25 @@ namespace LibHac.FsSrv.Impl { public static SdCardEventSimulator GetSdCardEventSimulator(this FileSystemServerImpl fs) { - ref DeviceEventSimulatorGlobals g = ref fs.FsSrv.Globals.DeviceEventSimulator; - using var guard = new InitializationGuard(ref g.SdCardEventSimulatorInit, fs.FsSrv.Globals.InitMutex); + ref DeviceEventSimulatorGlobals g = ref fs.Globals.DeviceEventSimulator; + using var guard = new InitializationGuard(ref g.SdCardEventSimulatorInit, fs.Globals.InitMutex); if (guard.IsInitialized) return g.SdCardEventSimulator; - g.SdCardEventSimulator = new SdCardEventSimulator(fs.FsSrv.Globals.Hos.Os); + g.SdCardEventSimulator = new SdCardEventSimulator(fs.Hos.Os); return g.SdCardEventSimulator; } public static GameCardEventSimulator GetGameCardEventSimulator(this FileSystemServerImpl fs) { - ref DeviceEventSimulatorGlobals g = ref fs.FsSrv.Globals.DeviceEventSimulator; - using var guard = new InitializationGuard(ref g.GameCardEventSimulatorInit, fs.FsSrv.Globals.InitMutex); + ref DeviceEventSimulatorGlobals g = ref fs.Globals.DeviceEventSimulator; + using var guard = new InitializationGuard(ref g.GameCardEventSimulatorInit, fs.Globals.InitMutex); if (guard.IsInitialized) return g.GameCardEventSimulator; - g.GameCardEventSimulator = new GameCardEventSimulator(fs.FsSrv.Globals.Hos.Os); + g.GameCardEventSimulator = new GameCardEventSimulator(fs.Hos.Os); return g.GameCardEventSimulator; } } diff --git a/src/LibHac/FsSrv/Impl/LocationResolverSet.cs b/src/LibHac/FsSrv/Impl/LocationResolverSet.cs index df9015a6..9a454c33 100644 --- a/src/LibHac/FsSrv/Impl/LocationResolverSet.cs +++ b/src/LibHac/FsSrv/Impl/LocationResolverSet.cs @@ -16,7 +16,7 @@ namespace LibHac.FsSrv.Impl private SdkMutexType _mutex; private FileSystemServer _fsServer; - private HorizonClient Hos => _fsServer.Globals.Hos; + private HorizonClient Hos => _fsServer.Hos; public LocationResolverSet(FileSystemServer fsServer) { diff --git a/src/LibHac/FsSrv/SaveDataFileSystemServiceImpl.cs b/src/LibHac/FsSrv/SaveDataFileSystemServiceImpl.cs index d9547c29..3bfd45ae 100644 --- a/src/LibHac/FsSrv/SaveDataFileSystemServiceImpl.cs +++ b/src/LibHac/FsSrv/SaveDataFileSystemServiceImpl.cs @@ -24,7 +24,7 @@ namespace LibHac.FsSrv private bool _isSdCardAccessible; // Timestamp getter - internal HorizonClient Hos => _config.FsServer.Globals.Hos; + internal HorizonClient Hos => _config.FsServer.Hos; public SaveDataFileSystemServiceImpl(in Configuration configuration) { diff --git a/src/LibHac/FsSrv/Storage/StorageDeviceManagerFactory.cs b/src/LibHac/FsSrv/Storage/StorageDeviceManagerFactory.cs index 0a284f31..de016ef4 100644 --- a/src/LibHac/FsSrv/Storage/StorageDeviceManagerFactory.cs +++ b/src/LibHac/FsSrv/Storage/StorageDeviceManagerFactory.cs @@ -39,8 +39,8 @@ namespace LibHac.FsSrv.Storage public static IStorageDeviceManagerFactory GetStorageDeviceManagerFactory(this StorageService storage, IStorageDeviceManagerFactory factory) { - ref StorageDeviceManagerFactoryGlobals g = ref storage.FsSrv.Globals.StorageDeviceManagerFactory; - using var initGuard = new InitializationGuard(ref g.FactoryGuard, storage.FsSrv.Globals.InitMutex); + ref StorageDeviceManagerFactoryGlobals g = ref storage.Globals.StorageDeviceManagerFactory; + using var initGuard = new InitializationGuard(ref g.FactoryGuard, storage.Globals.InitMutex); if (initGuard.IsInitialized) return g.Factory; diff --git a/src/LibHac/FsSrv/TimeService.cs b/src/LibHac/FsSrv/TimeService.cs index 786f1111..cf057e24 100644 --- a/src/LibHac/FsSrv/TimeService.cs +++ b/src/LibHac/FsSrv/TimeService.cs @@ -52,7 +52,7 @@ namespace LibHac.FsSrv private long GetSystemSeconds() { - OsState os = _fsServer.Globals.Hos.Os; + OsState os = _fsServer.Hos.Os; Tick tick = os.GetSystemTick(); TimeSpan timeSpan = os.ConvertToTimeSpan(tick);