Update to LibHac 0.12.0 (#1485)
* Update to LibHac 0.12.0 * Auto-formatting. Fixed a bug in SetApplicationCopyrightImage
This commit is contained in:
parent
6cc187da59
commit
1bb7fdaca4
26 changed files with 122 additions and 110 deletions
|
@ -44,7 +44,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||
return ResultCode.PartitionNotFound;
|
||||
}
|
||||
|
||||
LibHac.Fs.IFileSystem fileSystem = nca.OpenFileSystem(NcaSectionType.Data, context.Device.System.FsIntegrityCheckLevel);
|
||||
LibHac.Fs.Fsa.IFileSystem fileSystem = nca.OpenFileSystem(NcaSectionType.Data, context.Device.System.FsIntegrityCheckLevel);
|
||||
|
||||
openedFileSystem = new IFileSystem(fileSystem);
|
||||
}
|
||||
|
@ -82,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.ToU8Span(), OpenMode.Read);
|
||||
Result result = nsp.OpenFile(out LibHac.Fs.Fsa.IFile ncaFile, filename.ToU8Span(), OpenMode.Read);
|
||||
if (result.IsFailure())
|
||||
{
|
||||
return (ResultCode)result.Value;
|
||||
|
@ -99,11 +99,11 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||
return ResultCode.PathDoesNotExist;
|
||||
}
|
||||
|
||||
public static void ImportTitleKeysFromNsp(LibHac.Fs.IFileSystem nsp, Keyset keySet)
|
||||
public static void ImportTitleKeysFromNsp(LibHac.Fs.Fsa.IFileSystem nsp, Keyset keySet)
|
||||
{
|
||||
foreach (DirectoryEntryEx ticketEntry in nsp.EnumerateEntries("/", "*.tik"))
|
||||
{
|
||||
Result result = nsp.OpenFile(out LibHac.Fs.IFile ticketFile, ticketEntry.FullPath.ToU8Span(), OpenMode.Read);
|
||||
Result result = nsp.OpenFile(out LibHac.Fs.Fsa.IFile ticketFile, ticketEntry.FullPath.ToU8Span(), OpenMode.Read);
|
||||
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
|
|
|
@ -7,9 +7,9 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||
{
|
||||
class IDirectory : IpcService
|
||||
{
|
||||
private LibHac.Fs.IDirectory _baseDirectory;
|
||||
private LibHac.Fs.Fsa.IDirectory _baseDirectory;
|
||||
|
||||
public IDirectory(LibHac.Fs.IDirectory directory)
|
||||
public IDirectory(LibHac.Fs.Fsa.IDirectory directory)
|
||||
{
|
||||
_baseDirectory = directory;
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||
{
|
||||
class IFile : IpcService, IDisposable
|
||||
{
|
||||
private LibHac.Fs.IFile _baseFile;
|
||||
private LibHac.Fs.Fsa.IFile _baseFile;
|
||||
|
||||
public IFile(LibHac.Fs.IFile baseFile)
|
||||
public IFile(LibHac.Fs.Fsa.IFile baseFile)
|
||||
{
|
||||
_baseFile = baseFile;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||
{
|
||||
long position = context.Request.ReceiveBuff[0].Position;
|
||||
|
||||
ReadOption readOption = (ReadOption)context.RequestData.ReadInt32();
|
||||
ReadOption readOption = new ReadOption(context.RequestData.ReadInt32());
|
||||
context.RequestData.BaseStream.Position += 4;
|
||||
|
||||
long offset = context.RequestData.ReadInt64();
|
||||
|
@ -42,7 +42,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||
{
|
||||
long position = context.Request.SendBuff[0].Position;
|
||||
|
||||
WriteOption writeOption = (WriteOption)context.RequestData.ReadInt32();
|
||||
WriteOption writeOption = new WriteOption(context.RequestData.ReadInt32());
|
||||
context.RequestData.BaseStream.Position += 4;
|
||||
|
||||
long offset = context.RequestData.ReadInt64();
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
using LibHac;
|
||||
using LibHac.Common;
|
||||
using LibHac.Fs;
|
||||
|
||||
using LibHac.Fs.Fsa;
|
||||
using static Ryujinx.HLE.Utilities.StringUtils;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
||||
{
|
||||
class IFileSystem : IpcService
|
||||
{
|
||||
private LibHac.Fs.IFileSystem _fileSystem;
|
||||
private LibHac.Fs.Fsa.IFileSystem _fileSystem;
|
||||
|
||||
public IFileSystem(LibHac.Fs.IFileSystem provider)
|
||||
public IFileSystem(LibHac.Fs.Fsa.IFileSystem provider)
|
||||
{
|
||||
_fileSystem = provider;
|
||||
}
|
||||
|
||||
public LibHac.Fs.IFileSystem GetBaseFileSystem()
|
||||
public LibHac.Fs.Fsa.IFileSystem GetBaseFileSystem()
|
||||
{
|
||||
return _fileSystem;
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||
|
||||
U8Span name = ReadUtf8Span(context);
|
||||
|
||||
Result result = _fileSystem.OpenFile(out LibHac.Fs.IFile file, name, mode);
|
||||
Result result = _fileSystem.OpenFile(out LibHac.Fs.Fsa.IFile file, name, mode);
|
||||
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
|
|||
|
||||
U8Span name = ReadUtf8Span(context);
|
||||
|
||||
Result result = _fileSystem.OpenDirectory(out LibHac.Fs.IDirectory dir, name, mode);
|
||||
Result result = _fileSystem.OpenDirectory(out LibHac.Fs.Fsa.IDirectory dir, name, mode);
|
||||
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
using LibHac;
|
||||
using LibHac.FsService;
|
||||
using LibHac.FsSrv;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Fs
|
||||
{
|
||||
class IDeviceOperator : IpcService
|
||||
{
|
||||
private LibHac.FsService.IDeviceOperator _baseOperator;
|
||||
private LibHac.FsSrv.IDeviceOperator _baseOperator;
|
||||
|
||||
public IDeviceOperator(LibHac.FsService.IDeviceOperator baseOperator)
|
||||
public IDeviceOperator(LibHac.FsSrv.IDeviceOperator baseOperator)
|
||||
{
|
||||
_baseOperator = baseOperator;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using LibHac;
|
||||
using LibHac.Fs;
|
||||
using LibHac.FsService;
|
||||
using LibHac.FsSrv;
|
||||
using LibHac.FsSystem;
|
||||
using LibHac.FsSystem.NcaUtils;
|
||||
using LibHac.Ncm;
|
||||
|
@ -18,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
[Service("fsp-srv")]
|
||||
class IFileSystemProxy : IpcService
|
||||
{
|
||||
private LibHac.FsService.IFileSystemProxy _baseFileSystemProxy;
|
||||
private LibHac.FsSrv.IFileSystemProxy _baseFileSystemProxy;
|
||||
|
||||
public IFileSystemProxy(ServiceCtx context)
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
Result rc = FileSystemProxyHelper.ReadFsPath(out FsPath path, context);
|
||||
if (rc.IsFailure()) return (ResultCode)rc.Value;
|
||||
|
||||
rc = _baseFileSystemProxy.OpenBisFileSystem(out LibHac.Fs.IFileSystem fileSystem, ref path, bisPartitionId);
|
||||
rc = _baseFileSystemProxy.OpenBisFileSystem(out LibHac.Fs.Fsa.IFileSystem fileSystem, ref path, bisPartitionId);
|
||||
if (rc.IsFailure()) return (ResultCode)rc.Value;
|
||||
|
||||
MakeObject(context, new FileSystemProxy.IFileSystem(fileSystem));
|
||||
|
@ -109,7 +109,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
// OpenSdCardFileSystem() -> object<nn::fssrv::sf::IFileSystem>
|
||||
public ResultCode OpenSdCardFileSystem(ServiceCtx context)
|
||||
{
|
||||
Result rc = _baseFileSystemProxy.OpenSdCardFileSystem(out LibHac.Fs.IFileSystem fileSystem);
|
||||
Result rc = _baseFileSystemProxy.OpenSdCardFileSystem(out LibHac.Fs.Fsa.IFileSystem fileSystem);
|
||||
if (rc.IsFailure()) return (ResultCode)rc.Value;
|
||||
|
||||
MakeObject(context, new FileSystemProxy.IFileSystem(fileSystem));
|
||||
|
@ -136,17 +136,17 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
|
||||
// TODO: There's currently no program registry for FS to reference.
|
||||
// Workaround that by setting the application ID and owner ID if they're not already set
|
||||
if (attribute.TitleId == TitleId.Zero)
|
||||
if (attribute.ProgramId == ProgramId.InvalidId)
|
||||
{
|
||||
attribute.TitleId = new TitleId(context.Process.TitleId);
|
||||
attribute.ProgramId = new ProgramId(context.Process.TitleId);
|
||||
}
|
||||
|
||||
if (creationInfo.OwnerId == TitleId.Zero)
|
||||
if (creationInfo.OwnerId == 0)
|
||||
{
|
||||
creationInfo.OwnerId = new TitleId(context.Process.TitleId);
|
||||
creationInfo.OwnerId = 0;
|
||||
}
|
||||
|
||||
Logger.Info?.Print(LogClass.ServiceFs, $"Creating save with title ID {attribute.TitleId.Value:x16}");
|
||||
Logger.Info?.Print(LogClass.ServiceFs, $"Creating save with title ID {attribute.ProgramId.Value:x16}");
|
||||
|
||||
Result result = _baseFileSystemProxy.CreateSaveDataFileSystem(ref attribute, ref creationInfo, ref metaCreateInfo);
|
||||
|
||||
|
@ -213,14 +213,14 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
|
||||
// TODO: There's currently no program registry for FS to reference.
|
||||
// Workaround that by setting the application ID and owner ID if they're not already set
|
||||
if (attribute.TitleId == TitleId.Zero)
|
||||
if (attribute.ProgramId == ProgramId.InvalidId)
|
||||
{
|
||||
attribute.TitleId = new TitleId(context.Process.TitleId);
|
||||
attribute.ProgramId = new ProgramId(context.Process.TitleId);
|
||||
}
|
||||
|
||||
if (creationInfo.OwnerId == TitleId.Zero)
|
||||
if (creationInfo.OwnerId == 0)
|
||||
{
|
||||
creationInfo.OwnerId = new TitleId(context.Process.TitleId);
|
||||
creationInfo.OwnerId = 0;
|
||||
}
|
||||
|
||||
Result result = _baseFileSystemProxy.CreateSaveDataFileSystemWithHashSalt(ref attribute, ref creationInfo, ref metaCreateInfo, ref hashSalt);
|
||||
|
@ -237,12 +237,12 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
|
||||
// TODO: There's currently no program registry for FS to reference.
|
||||
// Workaround that by setting the application ID if it's not already set
|
||||
if (attribute.TitleId == TitleId.Zero)
|
||||
if (attribute.ProgramId == ProgramId.InvalidId)
|
||||
{
|
||||
attribute.TitleId = new TitleId(context.Process.TitleId);
|
||||
attribute.ProgramId = new ProgramId(context.Process.TitleId);
|
||||
}
|
||||
|
||||
Result result = _baseFileSystemProxy.OpenSaveDataFileSystem(out LibHac.Fs.IFileSystem fileSystem, spaceId, ref attribute);
|
||||
Result result = _baseFileSystemProxy.OpenSaveDataFileSystem(out LibHac.Fs.Fsa.IFileSystem fileSystem, spaceId, ref attribute);
|
||||
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
|
@ -259,7 +259,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
|
||||
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
|
||||
|
||||
Result result = _baseFileSystemProxy.OpenSaveDataFileSystemBySystemSaveDataId(out LibHac.Fs.IFileSystem fileSystem, spaceId, ref attribute);
|
||||
Result result = _baseFileSystemProxy.OpenSaveDataFileSystemBySystemSaveDataId(out LibHac.Fs.Fsa.IFileSystem fileSystem, spaceId, ref attribute);
|
||||
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
|
@ -278,12 +278,12 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
|
||||
// TODO: There's currently no program registry for FS to reference.
|
||||
// Workaround that by setting the application ID if it's not already set
|
||||
if (attribute.TitleId == TitleId.Zero)
|
||||
if (attribute.ProgramId == ProgramId.InvalidId)
|
||||
{
|
||||
attribute.TitleId = new TitleId(context.Process.TitleId);
|
||||
attribute.ProgramId = new ProgramId(context.Process.TitleId);
|
||||
}
|
||||
|
||||
Result result = _baseFileSystemProxy.OpenReadOnlySaveDataFileSystem(out LibHac.Fs.IFileSystem fileSystem, spaceId, ref attribute);
|
||||
Result result = _baseFileSystemProxy.OpenReadOnlySaveDataFileSystem(out LibHac.Fs.Fsa.IFileSystem fileSystem, spaceId, ref attribute);
|
||||
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
|
@ -296,7 +296,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
[Command(60)]
|
||||
public ResultCode OpenSaveDataInfoReader(ServiceCtx context)
|
||||
{
|
||||
Result result = _baseFileSystemProxy.OpenSaveDataInfoReader(out LibHac.FsService.ISaveDataInfoReader infoReader);
|
||||
Result result = _baseFileSystemProxy.OpenSaveDataInfoReader(out ReferenceCountedDisposable<LibHac.FsSrv.ISaveDataInfoReader> infoReader);
|
||||
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
|
@ -311,7 +311,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
{
|
||||
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadByte();
|
||||
|
||||
Result result = _baseFileSystemProxy.OpenSaveDataInfoReaderBySaveDataSpaceId(out LibHac.FsService.ISaveDataInfoReader infoReader, spaceId);
|
||||
Result result = _baseFileSystemProxy.OpenSaveDataInfoReaderBySaveDataSpaceId(out ReferenceCountedDisposable<LibHac.FsSrv.ISaveDataInfoReader> infoReader, spaceId);
|
||||
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
|
@ -326,12 +326,12 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
{
|
||||
SaveDataFilter filter = new SaveDataFilter();
|
||||
filter.SetSaveDataType(SaveDataType.Cache);
|
||||
filter.SetProgramId(new TitleId(context.Process.TitleId));
|
||||
filter.SetProgramId(new ProgramId(context.Process.TitleId));
|
||||
|
||||
// FS would query the User and SdCache space IDs to find where the existing cache is (if any).
|
||||
// We always have the SD card inserted, so we can always use SdCache for now.
|
||||
Result result = _baseFileSystemProxy.OpenSaveDataInfoReaderBySaveDataSpaceId(
|
||||
out LibHac.FsService.ISaveDataInfoReader infoReader, SaveDataSpaceId.SdCache);
|
||||
out ReferenceCountedDisposable<LibHac.FsSrv.ISaveDataInfoReader> infoReader, SaveDataSpaceId.SdCache);
|
||||
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
|
@ -366,7 +366,8 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
|
||||
SaveDataFilter filter = context.RequestData.ReadStruct<SaveDataFilter>();
|
||||
|
||||
Result result = _baseFileSystemProxy.OpenSaveDataInfoReaderWithFilter(out LibHac.FsService.ISaveDataInfoReader infoReader, spaceId, ref filter);
|
||||
Result result = _baseFileSystemProxy.OpenSaveDataInfoReaderWithFilter(
|
||||
out ReferenceCountedDisposable<LibHac.FsSrv.ISaveDataInfoReader> infoReader, spaceId, ref filter);
|
||||
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
|
@ -478,7 +479,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
// OpenDataStorageByCurrentProcess() -> object<nn::fssrv::sf::IStorage> dataStorage
|
||||
public ResultCode OpenDeviceOperator(ServiceCtx context)
|
||||
{
|
||||
Result result = _baseFileSystemProxy.OpenDeviceOperator(out LibHac.FsService.IDeviceOperator deviceOperator);
|
||||
Result result = _baseFileSystemProxy.OpenDeviceOperator(out LibHac.FsSrv.IDeviceOperator deviceOperator);
|
||||
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
|
@ -558,7 +559,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
// OpenMultiCommitManager() -> object<nn::fssrv::sf::IMultiCommitManager>
|
||||
public ResultCode OpenMultiCommitManager(ServiceCtx context)
|
||||
{
|
||||
Result result = _baseFileSystemProxy.OpenMultiCommitManager(out LibHac.FsService.IMultiCommitManager commitManager);
|
||||
Result result = _baseFileSystemProxy.OpenMultiCommitManager(out LibHac.FsSrv.IMultiCommitManager commitManager);
|
||||
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
|
|
|
@ -5,9 +5,9 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
{
|
||||
class IMultiCommitManager : IpcService // 6.0.0+
|
||||
{
|
||||
private LibHac.FsService.IMultiCommitManager _baseCommitManager;
|
||||
private LibHac.FsSrv.IMultiCommitManager _baseCommitManager;
|
||||
|
||||
public IMultiCommitManager(LibHac.FsService.IMultiCommitManager baseCommitManager)
|
||||
public IMultiCommitManager(LibHac.FsSrv.IMultiCommitManager baseCommitManager)
|
||||
{
|
||||
_baseCommitManager = baseCommitManager;
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
using LibHac;
|
||||
using System;
|
||||
using LibHac;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Fs
|
||||
{
|
||||
class ISaveDataInfoReader : IpcService
|
||||
class ISaveDataInfoReader : IpcService, IDisposable
|
||||
{
|
||||
private LibHac.FsService.ISaveDataInfoReader _baseReader;
|
||||
private ReferenceCountedDisposable<LibHac.FsSrv.ISaveDataInfoReader> _baseReader;
|
||||
|
||||
public ISaveDataInfoReader(LibHac.FsService.ISaveDataInfoReader baseReader)
|
||||
public ISaveDataInfoReader(ReferenceCountedDisposable<LibHac.FsSrv.ISaveDataInfoReader> baseReader)
|
||||
{
|
||||
_baseReader = baseReader;
|
||||
}
|
||||
|
@ -20,12 +21,17 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
|||
|
||||
byte[] infoBuffer = new byte[bufferLen];
|
||||
|
||||
Result result = _baseReader.ReadSaveDataInfo(out long readCount, infoBuffer);
|
||||
Result result = _baseReader.Target.Read(out long readCount, infoBuffer);
|
||||
|
||||
context.Memory.Write((ulong)bufferPosition, infoBuffer);
|
||||
context.ResponseData.Write(readCount);
|
||||
|
||||
return (ResultCode)result.Value;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_baseReader.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue