mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Implement more OpenSaveDataInfoReader commands
This commit is contained in:
parent
04b123f16e
commit
bf8b975fa6
4 changed files with 69 additions and 6 deletions
|
@ -89,7 +89,7 @@ namespace LibHac.Fs
|
||||||
Creating = 1,
|
Creating = 1,
|
||||||
State2 = 2,
|
State2 = 2,
|
||||||
MarkedForDeletion = 3,
|
MarkedForDeletion = 3,
|
||||||
State4 = 4,
|
Extending = 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ImageDirectoryId
|
public enum ImageDirectoryId
|
||||||
|
|
|
@ -139,6 +139,6 @@
|
||||||
|
|
||||||
public static Result SubStorageNotInitialized => new Result(ModuleFs, 6902);
|
public static Result SubStorageNotInitialized => new Result(ModuleFs, 6902);
|
||||||
public static Result MountNameNotFound => new Result(ModuleFs, 6905);
|
public static Result MountNameNotFound => new Result(ModuleFs, 6905);
|
||||||
public static Result Result6906 => new Result(ModuleFs, 6906);
|
public static Result SaveDataIsExtending => new Result(ModuleFs, 6906);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,6 +219,30 @@ namespace LibHac.Fs.Shim
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Result OpenSaveDataIterator(this FileSystemClient fs, out SaveDataIterator iterator, SaveDataSpaceId spaceId, ref SaveDataFilter filter)
|
||||||
|
{
|
||||||
|
var tempIterator = new SaveDataIterator();
|
||||||
|
SaveDataFilter tempFilter = filter;
|
||||||
|
|
||||||
|
Result result = fs.RunOperationWithAccessLog(LocalAccessLogMode.System,
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject();
|
||||||
|
|
||||||
|
Result rc = fsProxy.OpenSaveDataInfoReaderWithFilter(out ISaveDataInfoReader reader, spaceId, ref tempFilter);
|
||||||
|
if (rc.IsFailure()) return rc;
|
||||||
|
|
||||||
|
tempIterator = new SaveDataIterator(fs, reader);
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
},
|
||||||
|
() => $", savedataspaceid: {spaceId}");
|
||||||
|
|
||||||
|
iterator = result.IsSuccess() ? tempIterator : default;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public static Result DisableAutoSaveDataCreation(this FileSystemClient fsClient)
|
public static Result DisableAutoSaveDataCreation(this FileSystemClient fsClient)
|
||||||
{
|
{
|
||||||
IFileSystemProxy fsProxy = fsClient.GetFileSystemProxyServiceObject();
|
IFileSystemProxy fsProxy = fsClient.GetFileSystemProxyServiceObject();
|
||||||
|
|
|
@ -494,8 +494,8 @@ namespace LibHac.FsService
|
||||||
if (indexerValue.SpaceId != indexerSpaceId)
|
if (indexerValue.SpaceId != indexerSpaceId)
|
||||||
return ResultFs.TargetNotFound.Log();
|
return ResultFs.TargetNotFound.Log();
|
||||||
|
|
||||||
if (indexerValue.State == SaveDataState.State4)
|
if (indexerValue.State == SaveDataState.Extending)
|
||||||
return ResultFs.Result6906.Log();
|
return ResultFs.SaveDataIsExtending.Log();
|
||||||
|
|
||||||
saveDataId = indexerValue.SaveDataId;
|
saveDataId = indexerValue.SaveDataId;
|
||||||
}
|
}
|
||||||
|
@ -703,7 +703,23 @@ namespace LibHac.FsService
|
||||||
|
|
||||||
public Result OpenSaveDataInfoReader(out ISaveDataInfoReader infoReader)
|
public Result OpenSaveDataInfoReader(out ISaveDataInfoReader infoReader)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
infoReader = default;
|
||||||
|
|
||||||
|
// Missing permission check
|
||||||
|
|
||||||
|
SaveDataIndexerReader indexReader = default;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Result rc = FsServer.SaveDataIndexerManager.GetSaveDataIndexer(out indexReader, SaveDataSpaceId.System);
|
||||||
|
if (rc.IsFailure()) return rc;
|
||||||
|
|
||||||
|
return indexReader.Indexer.OpenSaveDataInfoReader(out infoReader);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
indexReader.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenSaveDataInfoReaderBySaveDataSpaceId(out ISaveDataInfoReader infoReader, SaveDataSpaceId spaceId)
|
public Result OpenSaveDataInfoReaderBySaveDataSpaceId(out ISaveDataInfoReader infoReader, SaveDataSpaceId spaceId)
|
||||||
|
@ -741,7 +757,30 @@ namespace LibHac.FsService
|
||||||
public Result OpenSaveDataInfoReaderWithFilter(out ISaveDataInfoReader infoReader, SaveDataSpaceId spaceId,
|
public Result OpenSaveDataInfoReaderWithFilter(out ISaveDataInfoReader infoReader, SaveDataSpaceId spaceId,
|
||||||
ref SaveDataFilter filter)
|
ref SaveDataFilter filter)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
infoReader = default;
|
||||||
|
|
||||||
|
// Missing permission check
|
||||||
|
|
||||||
|
SaveDataIndexerReader indexReader = default;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Result rc = FsServer.SaveDataIndexerManager.GetSaveDataIndexer(out indexReader, spaceId);
|
||||||
|
if (rc.IsFailure()) return rc;
|
||||||
|
|
||||||
|
rc = indexReader.Indexer.OpenSaveDataInfoReader(out ISaveDataInfoReader baseInfoReader);
|
||||||
|
if (rc.IsFailure()) return rc;
|
||||||
|
|
||||||
|
var filterInternal = new SaveDataFilterInternal(ref filter, spaceId);
|
||||||
|
|
||||||
|
infoReader = new SaveDataInfoFilterReader(baseInfoReader, ref filterInternal);
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
indexReader.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result FindSaveDataWithFilter(out long count, Span<byte> saveDataInfoBuffer, SaveDataSpaceId spaceId,
|
public Result FindSaveDataWithFilter(out long count, Span<byte> saveDataInfoBuffer, SaveDataSpaceId spaceId,
|
||||||
|
|
Loading…
Reference in a new issue