diff --git a/src/LibHac/Fs/AccessLog.cs b/src/LibHac/Fs/AccessLog.cs new file mode 100644 index 00000000..39c54aeb --- /dev/null +++ b/src/LibHac/Fs/AccessLog.cs @@ -0,0 +1,13 @@ +using System.Runtime.InteropServices; + +namespace LibHac.Fs +{ + [StructLayout(LayoutKind.Sequential, Size = 0x20)] + public struct ApplicationInfo + { + public Ncm.ApplicationId ApplicationId; + public uint Version; + public byte LaunchType; + public bool IsMultiProgram; + } +} diff --git a/src/LibHac/Fs/FsEnums.cs b/src/LibHac/Fs/FsEnums.cs index 6939c687..c5e49294 100644 --- a/src/LibHac/Fs/FsEnums.cs +++ b/src/LibHac/Fs/FsEnums.cs @@ -115,6 +115,13 @@ namespace LibHac.Fs SdCard = 1 } + public enum BaseFileSystemId + { + ImageDirectoryNand = 0, + ImageDirectorySdCard = 1, + TemporaryDirectory = 2 + } + /// /// Specifies which operations are available on an . /// @@ -197,4 +204,11 @@ namespace LibHac.Fs Inserted = 1, NotInserted = 2 } + + public enum FsStackUsageThreadType + { + MainThread = 0, + IpcWorker = 1, + PipelineWorker = 2 + } } diff --git a/src/LibHac/Fs/MemoryReportInfo.cs b/src/LibHac/Fs/MemoryReportInfo.cs new file mode 100644 index 00000000..92d43c07 --- /dev/null +++ b/src/LibHac/Fs/MemoryReportInfo.cs @@ -0,0 +1,21 @@ +using System.Runtime.InteropServices; + +namespace LibHac.Fs +{ + [StructLayout(LayoutKind.Sequential, Size = 0x80)] + public struct MemoryReportInfo + { + long PooledBufferFreeSizePeak; + long PooledBufferRetriedCount; + long PooledBufferReduceAllocationCount; + long BufferManagerFreeSizePeak; + long BufferManagerRetiredCount; + long ExpHeapFreeSizePeak; + long BufferPoolFreeSizePeak; + long PatrolAllocateSuccessCount; + long PatrolAllocateFailureCount; + long BufferManagerTotalAllocatableSizePeak; + long BufferPoolAllocateSizeMax; + }; + +} diff --git a/src/LibHac/FsSrv/FileSystemProxyImpl.cs b/src/LibHac/FsSrv/FileSystemProxyImpl.cs index f8f480d7..a830c084 100644 --- a/src/LibHac/FsSrv/FileSystemProxyImpl.cs +++ b/src/LibHac/FsSrv/FileSystemProxyImpl.cs @@ -381,6 +381,12 @@ namespace LibHac.FsSrv return GetBaseFileSystemService().OpenImageDirectoryFileSystem(out fileSystem, directoryId); } + public Result OpenBaseFileSystem(out ReferenceCountedDisposable fileSystem, + BaseFileSystemId fileSystemId) + { + throw new NotImplementedException(); + } + public Result OpenBisFileSystem(out ReferenceCountedDisposable fileSystem, in FspPath rootPath, BisPartitionId partitionId) { @@ -630,6 +636,35 @@ namespace LibHac.FsSrv return saveFsService.GetCacheStorageSize(out dataSize, out journalSize, index); } + public Result OpenSaveDataTransferManager(out ReferenceCountedDisposable manager) + { + throw new NotImplementedException(); + } + + public Result OpenSaveDataTransferManagerVersion2( + out ReferenceCountedDisposable manager) + { + throw new NotImplementedException(); + } + + public Result OpenSaveDataTransferManagerForSaveDataRepair( + out ReferenceCountedDisposable manager) + { + throw new NotImplementedException(); + } + + public Result OpenSaveDataTransferManagerForRepair( + out ReferenceCountedDisposable manager) + { + throw new NotImplementedException(); + } + + public Result OpenSaveDataTransferProhibiter( + out ReferenceCountedDisposable prohibiter, Ncm.ApplicationId applicationId) + { + throw new NotImplementedException(); + } + public Result ListAccessibleSaveDataOwnerId(out int readCount, OutBuffer idBuffer, ProgramId programId, int startIndex, int bufferIdCount) { @@ -826,6 +861,11 @@ namespace LibHac.FsSrv return ncaFsService.SetSdCardEncryptionSeed(in seed); } + public Result GetAndClearErrorInfo(out FileSystemProxyErrorInfo errorInfo) + { + throw new NotImplementedException(); + } + public Result RegisterProgramIndexMapInfo(InBuffer programIndexMapInfoBuffer, int programCount) { return GetProgramIndexRegistryService() @@ -914,6 +954,16 @@ namespace LibHac.FsSrv return GetAccessLogService().OutputMultiProgramTagAccessLog(); } + public Result OutputApplicationInfoAccessLog(in ApplicationInfo applicationInfo) + { + throw new NotImplementedException(); + } + + public Result FlushAccessLogOnSdCard() + { + throw new NotImplementedException(); + } + public Result RegisterUpdatePartition() { Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService); @@ -934,6 +984,16 @@ namespace LibHac.FsSrv return ncaFsService.OpenRegisteredUpdatePartition(out fileSystem); } + public Result GetAndClearMemoryReportInfo(out MemoryReportInfo report) + { + throw new NotImplementedException(); + } + + public Result GetFsStackUsage(out uint stackUsage, FsStackUsageThreadType threadType) + { + throw new NotImplementedException(); + } + public Result OverrideSaveDataTransferTokenSignVerificationKey(InBuffer key) { throw new NotImplementedException(); @@ -957,6 +1017,32 @@ namespace LibHac.FsSrv return saveFsService.IsSdCardAccessible(out isAccessible); } + public Result OpenAccessFailureDetectionEventNotifier(out ReferenceCountedDisposable notifier, + ulong processId, bool notifyOnDeepRetry) + { + throw new NotImplementedException(); + } + + public Result GetAccessFailureDetectionEvent(out NativeHandle eventHandle) + { + throw new NotImplementedException(); + } + + public Result IsAccessFailureDetected(out bool isDetected, ulong processId) + { + throw new NotImplementedException(); + } + + public Result ResolveAccessFailure(ulong processId) + { + throw new NotImplementedException(); + } + + public Result AbandonAccessFailure(ulong processId) + { + throw new NotImplementedException(); + } + public Result OpenMultiCommitManager(out ReferenceCountedDisposable commitManager) { commitManager = null; diff --git a/src/LibHac/FsSrv/Sf/IFileSystemProxy.cs b/src/LibHac/FsSrv/Sf/IFileSystemProxy.cs index 2d5aa070..dcc4f843 100644 --- a/src/LibHac/FsSrv/Sf/IFileSystemProxy.cs +++ b/src/LibHac/FsSrv/Sf/IFileSystemProxy.cs @@ -54,10 +54,15 @@ namespace LibHac.FsSrv.Sf Result WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(in SaveDataAttribute attribute, SaveDataSpaceId spaceId, InBuffer extraDataBuffer, InBuffer maskBuffer); Result ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(OutBuffer extraDataBuffer, SaveDataSpaceId spaceId, in SaveDataAttribute attribute, InBuffer maskBuffer); Result OpenSaveDataMetaFile(out ReferenceCountedDisposable file, SaveDataSpaceId spaceId, in SaveDataAttribute attribute, SaveDataMetaType type); - + Result OpenSaveDataTransferManager(out ReferenceCountedDisposable manager); + Result OpenSaveDataTransferManagerVersion2(out ReferenceCountedDisposable manager); + Result OpenSaveDataTransferProhibiter(out ReferenceCountedDisposable prohibiter, Ncm.ApplicationId applicationId); Result ListAccessibleSaveDataOwnerId(out int readCount, OutBuffer idBuffer, ProgramId programId, int startIndex, int bufferIdCount); + Result OpenSaveDataTransferManagerForSaveDataRepair(out ReferenceCountedDisposable manager); Result OpenSaveDataMover(out ReferenceCountedDisposable saveMover, SaveDataSpaceId sourceSpaceId, SaveDataSpaceId destinationSpaceId, NativeHandle workBufferHandle, ulong workBufferSize); + Result OpenSaveDataTransferManagerForRepair(out ReferenceCountedDisposable manager); Result OpenImageDirectoryFileSystem(out ReferenceCountedDisposable fileSystem, ImageDirectoryId directoryId); + Result OpenBaseFileSystem(out ReferenceCountedDisposable fileSystem, BaseFileSystemId fileSystemId); Result OpenContentStorageFileSystem(out ReferenceCountedDisposable fileSystem, ContentStorageId storageId); Result OpenCloudBackupWorkStorageFileSystem(out ReferenceCountedDisposable fileSystem, CloudBackupWorkStorageId storageId); Result OpenCustomStorageFileSystem(out ReferenceCountedDisposable fileSystem, CustomStorageId storageId); @@ -68,13 +73,11 @@ namespace LibHac.FsSrv.Sf Result OpenDataFileSystemWithProgramIndex(out ReferenceCountedDisposable fileSystem, byte programIndex); Result OpenDataStorageWithProgramIndex(out ReferenceCountedDisposable storage, byte programIndex); Result OpenDeviceOperator(out ReferenceCountedDisposable deviceOperator); - Result OpenSdCardDetectionEventNotifier(out ReferenceCountedDisposable eventNotifier); Result OpenGameCardDetectionEventNotifier(out ReferenceCountedDisposable eventNotifier); Result OpenSystemDataUpdateEventNotifier(out ReferenceCountedDisposable eventNotifier); Result NotifySystemDataUpdateEvent(); Result SimulateDeviceDetectionEvent(SdmmcPort port, SimulatingDeviceDetectionMode mode, bool signalEvent); - Result QuerySaveDataTotalSize(out long totalSize, long dataSize, long journalSize); Result VerifySaveDataFileSystem(ulong saveDataId, OutBuffer readBuffer); Result CorruptSaveDataFileSystem(ulong saveDataId); @@ -95,7 +98,12 @@ namespace LibHac.FsSrv.Sf Result SetSdCardEncryptionSeed(in EncryptionSeed seed); Result SetSdCardAccessibility(bool isAccessible); Result IsSdCardAccessible(out bool isAccessible); - + Result OpenAccessFailureDetectionEventNotifier(out ReferenceCountedDisposable notifier, ulong processId, bool notifyOnDeepRetry); + Result GetAccessFailureDetectionEvent(out NativeHandle eventHandle); + Result IsAccessFailureDetected(out bool isDetected, ulong processId); + Result ResolveAccessFailure(ulong processId); + Result AbandonAccessFailure(ulong processId); + Result GetAndClearErrorInfo(out FileSystemProxyErrorInfo errorInfo); Result RegisterProgramIndexMapInfo(InBuffer programIndexMapInfoBuffer, int programCount); Result SetBisRootForHost(BisPartitionId partitionId, in FspPath path); Result SetSaveDataSize(long saveDataSize, long saveDataJournalSize); @@ -106,9 +114,12 @@ namespace LibHac.FsSrv.Sf Result OutputAccessLogToSdCard(InBuffer textBuffer); Result RegisterUpdatePartition(); Result OpenRegisteredUpdatePartition(out ReferenceCountedDisposable fileSystem); - + Result GetAndClearMemoryReportInfo(out MemoryReportInfo report); Result GetProgramIndexForAccessLog(out int programIndex, out int programCount); + Result GetFsStackUsage(out uint stackUsage, FsStackUsageThreadType threadType); Result UnsetSaveDataRootPath(); + Result FlushAccessLogOnSdCard(); + Result OutputApplicationInfoAccessLog(in ApplicationInfo applicationInfo); Result OutputMultiProgramTagAccessLog(); Result OverrideSaveDataTransferTokenSignVerificationKey(InBuffer key); Result CorruptSaveDataFileSystemByOffset(SaveDataSpaceId spaceId, ulong saveDataId, long offset);