diff options
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Fs')
4 files changed, 74 insertions, 18 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/FileSystemProxyHelper.cs b/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/FileSystemProxyHelper.cs index c0f28166..46151cbc 100644 --- a/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/FileSystemProxyHelper.cs +++ b/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/FileSystemProxyHelper.cs @@ -1,4 +1,5 @@ using LibHac; +using LibHac.Common; using LibHac.Fs; using LibHac.FsSystem; using LibHac.FsSystem.NcaUtils; @@ -81,7 +82,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy string filename = fullPath.Replace(archivePath.FullName, string.Empty).TrimStart('\\'); - Result result = nsp.OpenFile(out LibHac.Fs.IFile ncaFile, filename, OpenMode.Read); + Result result = nsp.OpenFile(out LibHac.Fs.IFile ncaFile, filename.ToU8Span(), OpenMode.Read); if (result.IsFailure()) { return (ResultCode)result.Value; @@ -102,7 +103,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy { foreach (DirectoryEntryEx ticketEntry in nsp.EnumerateEntries("/", "*.tik")) { - Result result = nsp.OpenFile(out LibHac.Fs.IFile ticketFile, ticketEntry.FullPath, OpenMode.Read); + Result result = nsp.OpenFile(out LibHac.Fs.IFile ticketFile, ticketEntry.FullPath.ToU8Span(), OpenMode.Read); if (result.IsSuccess()) { diff --git a/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/IFileSystem.cs b/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/IFileSystem.cs index ed7ae0c1..b907e17a 100644 --- a/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/IFileSystem.cs +++ b/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/IFileSystem.cs @@ -1,4 +1,5 @@ using LibHac; +using LibHac.Common; using LibHac.Fs; using static Ryujinx.HLE.Utilities.StringUtils; @@ -14,11 +15,16 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy _fileSystem = provider; } + public LibHac.Fs.IFileSystem GetBaseFileSystem() + { + return _fileSystem; + } + [Command(0)] // CreateFile(u32 createOption, u64 size, buffer<bytes<0x301>, 0x19, 0x301> path) public ResultCode CreateFile(ServiceCtx context) { - string name = ReadUtf8String(context); + U8Span name = ReadUtf8Span(context); CreateFileOptions createOption = (CreateFileOptions)context.RequestData.ReadInt32(); context.RequestData.BaseStream.Position += 4; @@ -32,7 +38,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy // DeleteFile(buffer<bytes<0x301>, 0x19, 0x301> path) public ResultCode DeleteFile(ServiceCtx context) { - string name = ReadUtf8String(context); + U8Span name = ReadUtf8Span(context); return (ResultCode)_fileSystem.DeleteFile(name).Value; } @@ -41,7 +47,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy // CreateDirectory(buffer<bytes<0x301>, 0x19, 0x301> path) public ResultCode CreateDirectory(ServiceCtx context) { - string name = ReadUtf8String(context); + U8Span name = ReadUtf8Span(context); return (ResultCode)_fileSystem.CreateDirectory(name).Value; } @@ -50,7 +56,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy // DeleteDirectory(buffer<bytes<0x301>, 0x19, 0x301> path) public ResultCode DeleteDirectory(ServiceCtx context) { - string name = ReadUtf8String(context); + U8Span name = ReadUtf8Span(context); return (ResultCode)_fileSystem.DeleteDirectory(name).Value; } @@ -59,7 +65,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy // DeleteDirectoryRecursively(buffer<bytes<0x301>, 0x19, 0x301> path) public ResultCode DeleteDirectoryRecursively(ServiceCtx context) { - string name = ReadUtf8String(context); + U8Span name = ReadUtf8Span(context); return (ResultCode)_fileSystem.DeleteDirectoryRecursively(name).Value; } @@ -68,8 +74,8 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy // RenameFile(buffer<bytes<0x301>, 0x19, 0x301> oldPath, buffer<bytes<0x301>, 0x19, 0x301> newPath) public ResultCode RenameFile(ServiceCtx context) { - string oldName = ReadUtf8String(context, 0); - string newName = ReadUtf8String(context, 1); + U8Span oldName = ReadUtf8Span(context, 0); + U8Span newName = ReadUtf8Span(context, 1); return (ResultCode)_fileSystem.RenameFile(oldName, newName).Value; } @@ -78,8 +84,8 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy // RenameDirectory(buffer<bytes<0x301>, 0x19, 0x301> oldPath, buffer<bytes<0x301>, 0x19, 0x301> newPath) public ResultCode RenameDirectory(ServiceCtx context) { - string oldName = ReadUtf8String(context, 0); - string newName = ReadUtf8String(context, 1); + U8Span oldName = ReadUtf8Span(context, 0); + U8Span newName = ReadUtf8Span(context, 1); return (ResultCode)_fileSystem.RenameDirectory(oldName, newName).Value; } @@ -88,7 +94,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy // GetEntryType(buffer<bytes<0x301>, 0x19, 0x301> path) -> nn::fssrv::sf::DirectoryEntryType public ResultCode GetEntryType(ServiceCtx context) { - string name = ReadUtf8String(context); + U8Span name = ReadUtf8Span(context); Result result = _fileSystem.GetEntryType(out DirectoryEntryType entryType, name); @@ -103,7 +109,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy { OpenMode mode = (OpenMode)context.RequestData.ReadInt32(); - string name = ReadUtf8String(context); + U8Span name = ReadUtf8Span(context); Result result = _fileSystem.OpenFile(out LibHac.Fs.IFile file, name, mode); @@ -123,7 +129,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy { OpenDirectoryMode mode = (OpenDirectoryMode)context.RequestData.ReadInt32(); - string name = ReadUtf8String(context); + U8Span name = ReadUtf8Span(context); Result result = _fileSystem.OpenDirectory(out LibHac.Fs.IDirectory dir, name, mode); @@ -148,7 +154,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy // GetFreeSpaceSize(buffer<bytes<0x301>, 0x19, 0x301> path) -> u64 totalFreeSpace public ResultCode GetFreeSpaceSize(ServiceCtx context) { - string name = ReadUtf8String(context); + U8Span name = ReadUtf8Span(context); Result result = _fileSystem.GetFreeSpaceSize(out long size, name); @@ -161,7 +167,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy // GetTotalSpaceSize(buffer<bytes<0x301>, 0x19, 0x301> path) -> u64 totalSize public ResultCode GetTotalSpaceSize(ServiceCtx context) { - string name = ReadUtf8String(context); + U8Span name = ReadUtf8Span(context); Result result = _fileSystem.GetTotalSpaceSize(out long size, name); @@ -174,7 +180,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy // CleanDirectoryRecursively(buffer<bytes<0x301>, 0x19, 0x301> path) public ResultCode CleanDirectoryRecursively(ServiceCtx context) { - string name = ReadUtf8String(context); + U8Span name = ReadUtf8Span(context); return (ResultCode)_fileSystem.CleanDirectoryRecursively(name).Value; } @@ -183,7 +189,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy // GetFileTimeStampRaw(buffer<bytes<0x301>, 0x19, 0x301> path) -> bytes<0x20> timestamp public ResultCode GetFileTimeStampRaw(ServiceCtx context) { - string name = ReadUtf8String(context); + U8Span name = ReadUtf8Span(context); Result result = _fileSystem.GetFileTimeStampRaw(out FileTimeStampRaw timestamp, name); diff --git a/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs b/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs index 43ae80aa..537882f1 100644 --- a/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs +++ b/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs @@ -513,5 +513,19 @@ namespace Ryujinx.HLE.HOS.Services.Fs return ResultCode.Success; } + + [Command(1200)] // 6.0.0+ + // OpenMultiCommitManager() -> object<nn::fssrv::sf::IMultiCommitManager> + public ResultCode OpenMultiCommitManager(ServiceCtx context) + { + Result result = _baseFileSystemProxy.OpenMultiCommitManager(out LibHac.FsService.IMultiCommitManager commitManager); + + if (result.IsSuccess()) + { + MakeObject(context, new IMultiCommitManager(commitManager)); + } + + return (ResultCode)result.Value; + } } }
\ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Fs/IMultiCommitManager.cs b/Ryujinx.HLE/HOS/Services/Fs/IMultiCommitManager.cs new file mode 100644 index 00000000..c26f54b6 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Fs/IMultiCommitManager.cs @@ -0,0 +1,35 @@ +using LibHac; +using Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy; + +namespace Ryujinx.HLE.HOS.Services.Fs +{ + class IMultiCommitManager : IpcService // 6.0.0+ + { + private LibHac.FsService.IMultiCommitManager _baseCommitManager; + + public IMultiCommitManager(LibHac.FsService.IMultiCommitManager baseCommitManager) + { + _baseCommitManager = baseCommitManager; + } + + [Command(1)] // 6.0.0+ + // Add(object<nn::fssrv::sf::IFileSystem>) + public ResultCode Add(ServiceCtx context) + { + IFileSystem fileSystem = GetObject<IFileSystem>(context, 0); + + Result result = _baseCommitManager.Add(fileSystem.GetBaseFileSystem()); + + return (ResultCode)result.Value; + } + + [Command(2)] // 6.0.0+ + // Commit() + public ResultCode Commit(ServiceCtx context) + { + Result result = _baseCommitManager.Commit(); + + return (ResultCode)result.Value; + } + } +} |
