mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Add more methods to IFileSystemProxy
This commit is contained in:
parent
7222c7d469
commit
7e2dd22079
5 changed files with 115 additions and 22 deletions
|
@ -43,7 +43,7 @@
|
||||||
Writable = 2
|
Writable = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SaveDataSpaceId
|
public enum SaveDataSpaceId : byte
|
||||||
{
|
{
|
||||||
System = 0,
|
System = 0,
|
||||||
User = 1,
|
User = 1,
|
||||||
|
@ -51,7 +51,8 @@
|
||||||
TemporaryStorage = 3,
|
TemporaryStorage = 3,
|
||||||
SdCache = 4,
|
SdCache = 4,
|
||||||
ProperSystem = 100,
|
ProperSystem = 100,
|
||||||
Safe = 101
|
Safe = 101,
|
||||||
|
BisAuto = 127
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CustomStorageId
|
public enum CustomStorageId
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using LibHac.Fs.Save;
|
|
||||||
|
|
||||||
namespace LibHac.Fs
|
|
||||||
{
|
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 0x40)]
|
|
||||||
public struct SaveDataAttribute2
|
|
||||||
{
|
|
||||||
[FieldOffset(0x00)] public ulong TitleId;
|
|
||||||
[FieldOffset(0x08)] public UserId UserId;
|
|
||||||
[FieldOffset(0x18)] public ulong SaveDataId;
|
|
||||||
[FieldOffset(0x20)] public SaveDataType Type;
|
|
||||||
[FieldOffset(0x21)] public byte Rank;
|
|
||||||
[FieldOffset(0x22)] public short Index;
|
|
||||||
}
|
|
||||||
}
|
|
70
src/LibHac/Fs/SaveDataStructs.cs
Normal file
70
src/LibHac/Fs/SaveDataStructs.cs
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using LibHac.Common;
|
||||||
|
using LibHac.Fs.Save;
|
||||||
|
using LibHac.Ncm;
|
||||||
|
|
||||||
|
namespace LibHac.Fs
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Explicit, Size = 0x40)]
|
||||||
|
public struct SaveDataAttribute2
|
||||||
|
{
|
||||||
|
[FieldOffset(0x00)] public ulong TitleId;
|
||||||
|
[FieldOffset(0x08)] public UserId UserId;
|
||||||
|
[FieldOffset(0x18)] public ulong SaveDataId;
|
||||||
|
[FieldOffset(0x20)] public SaveDataType Type;
|
||||||
|
[FieldOffset(0x21)] public byte Rank;
|
||||||
|
[FieldOffset(0x22)] public short Index;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Explicit, Size = 0x48)]
|
||||||
|
public struct SaveDataFilter
|
||||||
|
{
|
||||||
|
[FieldOffset(0x00)] public bool FilterByTitleId;
|
||||||
|
[FieldOffset(0x01)] public bool FilterBySaveDataType;
|
||||||
|
[FieldOffset(0x02)] public bool FilterByUserId;
|
||||||
|
[FieldOffset(0x03)] public bool FilterBySaveDataId;
|
||||||
|
[FieldOffset(0x04)] public bool FilterByIndex;
|
||||||
|
[FieldOffset(0x05)] public byte Rank;
|
||||||
|
|
||||||
|
[FieldOffset(0x08)] public TitleId TitleID;
|
||||||
|
[FieldOffset(0x10)] public UserId UserId;
|
||||||
|
[FieldOffset(0x20)] public ulong SaveDataId;
|
||||||
|
[FieldOffset(0x28)] public SaveDataType SaveDataType;
|
||||||
|
[FieldOffset(0x2A)] public short Index;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Explicit, Size = 0x50)]
|
||||||
|
public struct SaveDataFilterInternal
|
||||||
|
{
|
||||||
|
[FieldOffset(0x00)] public bool FilterBySaveDataSpaceId;
|
||||||
|
[FieldOffset(0x01)] public SaveDataSpaceId SpaceId;
|
||||||
|
|
||||||
|
[FieldOffset(0x08)] public bool FilterByTitleId;
|
||||||
|
[FieldOffset(0x10)] public TitleId TitleID;
|
||||||
|
|
||||||
|
[FieldOffset(0x18)] public bool FilterBySaveDataType;
|
||||||
|
[FieldOffset(0x19)] public SaveDataType SaveDataType;
|
||||||
|
|
||||||
|
[FieldOffset(0x20)] public bool FilterByUserId;
|
||||||
|
[FieldOffset(0x28)] public UserId UserId;
|
||||||
|
|
||||||
|
[FieldOffset(0x38)] public bool FilterBySaveDataId;
|
||||||
|
[FieldOffset(0x40)] public ulong SaveDataId;
|
||||||
|
|
||||||
|
[FieldOffset(0x48)] public bool FilterByIndex;
|
||||||
|
[FieldOffset(0x4A)] public short Index;
|
||||||
|
|
||||||
|
[FieldOffset(0x4C)] public int Rank;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Explicit, Size = HashLength)]
|
||||||
|
public struct HashSalt
|
||||||
|
{
|
||||||
|
private const int HashLength = 0x20;
|
||||||
|
|
||||||
|
[FieldOffset(0x00)] private byte _hashStart;
|
||||||
|
|
||||||
|
public Span<byte> Hash => SpanHelpers.CreateSpan(ref _hashStart, HashLength);
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,19 +18,48 @@ namespace LibHac.FsService
|
||||||
Result OpenHostFileSystem(out IFileSystem fileSystem, U8Span subPath);
|
Result OpenHostFileSystem(out IFileSystem fileSystem, U8Span subPath);
|
||||||
Result OpenSdCardFileSystem(out IFileSystem fileSystem);
|
Result OpenSdCardFileSystem(out IFileSystem fileSystem);
|
||||||
Result FormatSdCardFileSystem();
|
Result FormatSdCardFileSystem();
|
||||||
Result DeleteSaveDataFileSystem(long saveDataId);
|
Result DeleteSaveDataFileSystem(ulong saveDataId);
|
||||||
Result CreateSaveDataFileSystem(ref SaveDataAttribute2 attribute, ref SaveDataCreateInfo createInfo, ref SaveMetaCreateInfo metaCreateInfo);
|
Result CreateSaveDataFileSystem(ref SaveDataAttribute2 attribute, ref SaveDataCreateInfo createInfo, ref SaveMetaCreateInfo metaCreateInfo);
|
||||||
Result CreateSaveDataFileSystemBySystemSaveDataId(ref SaveDataAttribute2 attribute, ref SaveDataCreateInfo createInfo);
|
Result CreateSaveDataFileSystemBySystemSaveDataId(ref SaveDataAttribute2 attribute, ref SaveDataCreateInfo createInfo);
|
||||||
Result RegisterSaveDataFileSystemAtomicDeletion(ReadOnlySpan<ulong> saveDataIds);
|
Result RegisterSaveDataFileSystemAtomicDeletion(ReadOnlySpan<ulong> saveDataIds);
|
||||||
|
Result DeleteSaveDataFileSystemBySaveDataSpaceId(SaveDataSpaceId spaceId, ulong saveDataId);
|
||||||
|
Result FormatSdCardDryRun();
|
||||||
|
Result IsExFatSupported(out bool isSupported);
|
||||||
|
Result DeleteSaveDataFileSystemBySaveDataAttribute(SaveDataSpaceId spaceId, ref SaveDataAttribute2 attribute);
|
||||||
Result OpenGameCardStorage(out IStorage storage, GameCardHandle handle, GameCardPartitionRaw partitionId);
|
Result OpenGameCardStorage(out IStorage storage, GameCardHandle handle, GameCardPartitionRaw partitionId);
|
||||||
Result OpenSaveDataFileSystem(out IFileSystem fileSystem, SaveDataSpaceId spaceId, SaveDataAttribute attribute);
|
Result OpenGameCardFileSystem(out IFileSystem fileSystem, GameCardHandle handle, GameCardPartition partitionId);
|
||||||
Result OpenSaveDataFileSystemBySystemSaveDataId(out IFileSystem fileSystem, SaveDataSpaceId spaceId, SaveDataAttribute attribute);
|
Result ExtendSaveDataFileSystem(SaveDataSpaceId spaceId, ulong saveDataId, long dataSize, long journalSize);
|
||||||
|
Result DeleteCacheStorage(short index);
|
||||||
|
Result GetCacheStorageSize(out long dataSize, out long journalSize, short index);
|
||||||
|
Result CreateSaveDataFileSystemWithHashSalt(ref SaveDataAttribute2 attribute, ref SaveDataCreateInfo createInfo, ref SaveMetaCreateInfo metaCreateInfo, ref HashSalt hashSalt);
|
||||||
|
Result OpenSaveDataFileSystem(out IFileSystem fileSystem, SaveDataSpaceId spaceId, ref SaveDataAttribute attribute);
|
||||||
|
Result OpenSaveDataFileSystemBySystemSaveDataId(out IFileSystem fileSystem, SaveDataSpaceId spaceId, ref SaveDataAttribute attribute);
|
||||||
|
Result OpenReadOnlySaveDataFileSystem(out IFileSystem fileSystem, SaveDataSpaceId spaceId, ref SaveDataAttribute attribute);
|
||||||
|
Result ReadSaveDataFileSystemExtraDataBySaveDataSpaceId(Span<byte> extraDataBuffer, SaveDataSpaceId spaceId, ulong saveDataId);
|
||||||
|
Result ReadSaveDataFileSystemExtraData(Span<byte> extraDataBuffer, ulong saveDataId);
|
||||||
|
Result WriteSaveDataFileSystemExtraData(ulong saveDataId, SaveDataSpaceId spaceId, ReadOnlySpan<byte> extraDataBuffer);
|
||||||
|
Result OpenSaveDataInfoReader(out ISaveDataInfoReader infoReader);
|
||||||
|
Result OpenSaveDataInfoReaderBySaveDataSpaceId(out ISaveDataInfoReader infoReader, SaveDataSpaceId spaceId);
|
||||||
|
Result OpenSaveDataInfoReaderOnlyCacheStorage(out ISaveDataInfoReader infoReader);
|
||||||
|
Result OpenSaveDataInternalStorageFileSystem(out IFileSystem fileSystem, SaveDataSpaceId spaceId, ulong saveDataId);
|
||||||
|
Result UpdateSaveDataMacForDebug(SaveDataSpaceId spaceId, ulong saveDataId);
|
||||||
|
Result WriteSaveDataFileSystemExtraDataWithMask(ulong saveDataId, SaveDataSpaceId spaceId, ReadOnlySpan<byte> extraDataBuffer, ReadOnlySpan<byte> maskBuffer);
|
||||||
|
Result FindSaveDataWithFilter(out long count, Span<byte> saveDataInfoBuffer, SaveDataSpaceId spaceId, ref SaveDataFilter filter);
|
||||||
|
Result OpenSaveDataInfoReaderWithFilter(out ISaveDataInfoReader infoReader, SaveDataSpaceId spaceId, ref SaveDataFilter filter);
|
||||||
|
Result ReadSaveDataFileSystemExtraDataBySaveDataAttribute(Span<byte> extraDataBuffer, SaveDataSpaceId spaceId, ref SaveDataAttribute2 attribute);
|
||||||
|
Result WriteSaveDataFileSystemExtraDataBySaveDataAttribute(ref SaveDataAttribute2 attribute, SaveDataSpaceId spaceId, ReadOnlySpan<byte> extraDataBuffer, ReadOnlySpan<byte> maskBuffer);
|
||||||
|
Result OpenSaveDataMetaFile(out IFile file, SaveDataSpaceId spaceId, ref SaveDataAttribute2 attribute, SaveMetaType type);
|
||||||
|
|
||||||
Result OpenContentStorageFileSystem(out IFileSystem fileSystem, ContentStorageId storageId);
|
Result OpenContentStorageFileSystem(out IFileSystem fileSystem, ContentStorageId storageId);
|
||||||
Result OpenCustomStorageFileSystem(out IFileSystem fileSystem, CustomStorageId storageId);
|
Result OpenCustomStorageFileSystem(out IFileSystem fileSystem, CustomStorageId storageId);
|
||||||
Result SetSdCardEncryptionSeed(ReadOnlySpan<byte> seed);
|
Result SetSdCardEncryptionSeed(ReadOnlySpan<byte> seed);
|
||||||
Result SetSaveDataSize(long saveDataSize, long saveDataJournalSize);
|
Result SetSaveDataSize(long saveDataSize, long saveDataJournalSize);
|
||||||
Result SetSaveDataRootPath(U8Span path);
|
Result SetSaveDataRootPath(U8Span path);
|
||||||
Result DisableAutoSaveDataCreation();
|
Result DisableAutoSaveDataCreation();
|
||||||
|
Result SetGlobalAccessLogMode(int mode);
|
||||||
|
Result GetGlobalAccessLogMode(out int mode);
|
||||||
|
Result OutputAccessLogToSdCard(U8Span logString);
|
||||||
|
Result RegisterUpdatePartition();
|
||||||
|
Result OpenRegisteredUpdatePartition(out IFileSystem fileSystem);
|
||||||
}
|
}
|
||||||
}
|
}
|
9
src/LibHac/FsService/ISaveDataInfoReader.cs
Normal file
9
src/LibHac/FsService/ISaveDataInfoReader.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace LibHac.FsService
|
||||||
|
{
|
||||||
|
public interface ISaveDataInfoReader
|
||||||
|
{
|
||||||
|
Result ReadSaveDataInfo(out long readCount, Span<byte> saveDataInfoBuffer);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue