Add IMultiCommitManager (#1011)
* Update LibHac * Add IMultiCommitManager * Updates * Delete NuGet.Config * Add command version
This commit is contained in:
parent
f695a215ad
commit
21c9c04f9f
15 changed files with 131 additions and 59 deletions
|
@ -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())
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
35
Ryujinx.HLE/HOS/Services/Fs/IMultiCommitManager.cs
Normal file
35
Ryujinx.HLE/HOS/Services/Fs/IMultiCommitManager.cs
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,8 +17,9 @@ namespace Ryujinx.HLE.HOS.Services.Mii
|
|||
private const ulong DatabaseSaveDataId = 0x8000000000000030;
|
||||
private const ulong NsTitleId = 0x010000000000001F;
|
||||
private const ulong SdbTitleId = 0x0100000000000039;
|
||||
private const string DatabasePath = "mii:/MiiDatabase.dat";
|
||||
private const string MountName = "mii";
|
||||
|
||||
private static U8String DatabasePath = new U8String("mii:/MiiDatabase.dat");
|
||||
private static U8String MountName = new U8String("mii");
|
||||
|
||||
private NintendoFigurineDatabase _database;
|
||||
private bool _isDirty;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using LibHac;
|
||||
using LibHac.Common;
|
||||
using LibHac.Fs;
|
||||
using LibHac.FsSystem;
|
||||
using LibHac.FsSystem.NcaUtils;
|
||||
|
@ -231,7 +232,7 @@ namespace Ryujinx.HLE.HOS.Services.Settings
|
|||
|
||||
IFileSystem firmwareRomFs = firmwareContent.OpenFileSystem(NcaSectionType.Data, device.System.FsIntegrityCheckLevel);
|
||||
|
||||
Result result = firmwareRomFs.OpenFile(out IFile firmwareFile, "/file", OpenMode.Read);
|
||||
Result result = firmwareRomFs.OpenFile(out IFile firmwareFile, "/file".ToU8Span(), OpenMode.Read);
|
||||
if (result.IsFailure())
|
||||
{
|
||||
return null;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using LibHac;
|
||||
using LibHac.Common;
|
||||
using LibHac.Fs;
|
||||
using LibHac.FsSystem;
|
||||
using LibHac.FsSystem.NcaUtils;
|
||||
|
@ -61,7 +62,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
|||
Nca nca = new Nca(_device.System.KeySet, ncaFileStream);
|
||||
IFileSystem romfs = nca.OpenFileSystem(NcaSectionType.Data, _device.System.FsIntegrityCheckLevel);
|
||||
|
||||
romfs.OpenFile(out IFile binaryListFile, "/binaryList.txt", OpenMode.Read).ThrowIfFailure();
|
||||
romfs.OpenFile(out IFile binaryListFile, "/binaryList.txt".ToU8Span(), OpenMode.Read).ThrowIfFailure();
|
||||
|
||||
StreamReader reader = new StreamReader(binaryListFile.AsStream());
|
||||
|
||||
|
@ -165,7 +166,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
|||
Nca nca = new Nca(_device.System.KeySet, ncaFile);
|
||||
IFileSystem romfs = nca.OpenFileSystem(NcaSectionType.Data, _device.System.FsIntegrityCheckLevel);
|
||||
|
||||
Result result = romfs.OpenFile(out IFile timeZoneBinaryFile, $"/zoneinfo/{locationName}", OpenMode.Read);
|
||||
Result result = romfs.OpenFile(out IFile timeZoneBinaryFile, $"/zoneinfo/{locationName}".ToU8Span(), OpenMode.Read);
|
||||
|
||||
timeZoneBinaryStream = timeZoneBinaryFile.AsStream();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue