コード例 #1
0
        private static FileSystemProxyConfiguration InitializeFileSystemProxy(FileSystemServer server,
                                                                              FileSystemServerConfig config)
        {
            var random = new Random();
            RandomDataGenerator randomGenerator = buffer =>
            {
                random.NextBytes(buffer);
                return(Result.Success);
            };

            var           bufferManager = new FileSystemBufferManager();
            Memory <byte> heapBuffer    = GC.AllocateArray <byte>(BufferManagerHeapSize, true);

            bufferManager.Initialize(BufferManagerCacheSize, heapBuffer, BufferManagerBlockSize);

            var saveDataIndexerManager = new SaveDataIndexerManager(server.Hos.Fs, Fs.SaveData.SaveIndexerId,
                                                                    new ArrayPoolMemoryResource(), new SdHandleManager(), false);

            var programRegistryService = new ProgramRegistryServiceImpl(server);

            server.InitializeProgramRegistryImpl(programRegistryService);

            var baseStorageConfig = new BaseStorageServiceImpl.Configuration();

            baseStorageConfig.BisStorageCreator      = config.FsCreators.BuiltInStorageCreator;
            baseStorageConfig.GameCardStorageCreator = config.FsCreators.GameCardStorageCreator;
            baseStorageConfig.FsServer       = server;
            baseStorageConfig.DeviceOperator = new ReferenceCountedDisposable <IDeviceOperator>(config.DeviceOperator);
            var baseStorageService = new BaseStorageServiceImpl(in baseStorageConfig);

            var timeService = new TimeServiceImpl(server);

            var baseFsServiceConfig = new BaseFileSystemServiceImpl.Configuration();

            baseFsServiceConfig.BisFileSystemCreator      = config.FsCreators.BuiltInStorageFileSystemCreator;
            baseFsServiceConfig.GameCardFileSystemCreator = config.FsCreators.GameCardFileSystemCreator;
            baseFsServiceConfig.SdCardFileSystemCreator   = config.FsCreators.SdCardFileSystemCreator;
            baseFsServiceConfig.BisWiperCreator           = BisWiper.CreateWiper;
            baseFsServiceConfig.FsServer = server;
            var baseFsService = new BaseFileSystemServiceImpl(in baseFsServiceConfig);

            var accessFailureManagementServiceConfig = new AccessFailureManagementServiceImpl.Configuration();

            accessFailureManagementServiceConfig.FsServer = server;

            var accessFailureManagementService =
                new AccessFailureManagementServiceImpl(in accessFailureManagementServiceConfig);

            var speedEmulationRange =
                new InternalProgramIdRangeForSpeedEmulation(SpeedEmulationProgramIdMinimum,
                                                            SpeedEmulationProgramIdMaximum);

            var ncaFsServiceConfig = new NcaFileSystemServiceImpl.Configuration();

            ncaFsServiceConfig.BaseFsService                  = baseFsService;
            ncaFsServiceConfig.LocalFsCreator                 = config.FsCreators.LocalFileSystemCreator;
            ncaFsServiceConfig.TargetManagerFsCreator         = config.FsCreators.TargetManagerFileSystemCreator;
            ncaFsServiceConfig.PartitionFsCreator             = config.FsCreators.PartitionFileSystemCreator;
            ncaFsServiceConfig.RomFsCreator                   = config.FsCreators.RomFileSystemCreator;
            ncaFsServiceConfig.StorageOnNcaCreator            = config.FsCreators.StorageOnNcaCreator;
            ncaFsServiceConfig.SubDirectoryFsCreator          = config.FsCreators.SubDirectoryFileSystemCreator;
            ncaFsServiceConfig.EncryptedFsCreator             = config.FsCreators.EncryptedFileSystemCreator;
            ncaFsServiceConfig.ProgramRegistryService         = programRegistryService;
            ncaFsServiceConfig.AccessFailureManagementService = accessFailureManagementService;
            ncaFsServiceConfig.SpeedEmulationRange            = speedEmulationRange;
            ncaFsServiceConfig.FsServer = server;

            var ncaFsService = new NcaFileSystemServiceImpl(in ncaFsServiceConfig, config.ExternalKeySet);

            var saveFsServiceConfig = new SaveDataFileSystemServiceImpl.Configuration();

            saveFsServiceConfig.BaseFsService          = baseFsService;
            saveFsServiceConfig.TimeService            = timeService;
            saveFsServiceConfig.LocalFsCreator         = config.FsCreators.LocalFileSystemCreator;
            saveFsServiceConfig.TargetManagerFsCreator = config.FsCreators.TargetManagerFileSystemCreator;
            saveFsServiceConfig.SaveFsCreator          = config.FsCreators.SaveDataFileSystemCreator;
            saveFsServiceConfig.EncryptedFsCreator     = config.FsCreators.EncryptedFileSystemCreator;
            saveFsServiceConfig.ProgramRegistryService = programRegistryService;
            saveFsServiceConfig.BufferManager          = bufferManager;
            saveFsServiceConfig.GenerateRandomData     = randomGenerator;
            saveFsServiceConfig.IsPseudoSaveData       = () => true;
            saveFsServiceConfig.MaxSaveFsCacheCount    = 1;
            saveFsServiceConfig.SaveIndexerManager     = saveDataIndexerManager;
            saveFsServiceConfig.FsServer = server;

            var saveFsService = new SaveDataFileSystemServiceImpl(in saveFsServiceConfig);

            var statusReportServiceConfig = new StatusReportServiceImpl.Configuration();

            statusReportServiceConfig.NcaFsServiceImpl                       = ncaFsService;
            statusReportServiceConfig.SaveFsServiceImpl                      = saveFsService;
            statusReportServiceConfig.BufferManagerMemoryReport              = null;
            statusReportServiceConfig.ExpHeapMemoryReport                    = null;
            statusReportServiceConfig.BufferPoolMemoryReport                 = null;
            statusReportServiceConfig.GetPatrolAllocateCounts                = null;
            statusReportServiceConfig.MainThreadStackUsageReporter           = new DummyStackUsageReporter();
            statusReportServiceConfig.IpcWorkerThreadStackUsageReporter      = new DummyStackUsageReporter();
            statusReportServiceConfig.PipeLineWorkerThreadStackUsageReporter = new DummyStackUsageReporter();
            statusReportServiceConfig.FsServer = server;

            var statusReportService = new StatusReportServiceImpl(in statusReportServiceConfig);

            var accessLogServiceConfig = new AccessLogServiceImpl.Configuration();

            accessLogServiceConfig.MinimumProgramIdForSdCardLog = 0x0100000000003000;
            accessLogServiceConfig.FsServer = server;

            var accessLogService = new AccessLogServiceImpl(in accessLogServiceConfig);

            var fspConfig = new FileSystemProxyConfiguration
            {
                FsCreatorInterfaces            = config.FsCreators,
                BaseStorageService             = baseStorageService,
                BaseFileSystemService          = baseFsService,
                NcaFileSystemService           = ncaFsService,
                SaveDataFileSystemService      = saveFsService,
                AccessFailureManagementService = accessFailureManagementService,
                TimeService            = timeService,
                StatusReportService    = statusReportService,
                ProgramRegistryService = programRegistryService,
                AccessLogService       = accessLogService
            };

            server.InitializeFileSystemProxy(fspConfig);
            return(fspConfig);
        }
コード例 #2
0
 public TimeService(TimeServiceImpl serviceImpl, ulong processId)
 {
     _serviceImpl = serviceImpl;
     _processId   = processId;
 }