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:
Alex Barney 2020-09-01 13:08:59 -07:00 committed by GitHub
parent 6cc187da59
commit 1bb7fdaca4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 122 additions and 110 deletions

View file

@ -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())
{