Update to LibHac 0.8.2 (#889)
* Update to LibHac 0.8.2 This brings support for temporary savedata, ignores case in key names when loading from a file, and prints the rights ID correctly when missing a title key. * Auto-format IFileSystemProxy
This commit is contained in:
parent
892df335e6
commit
c5f872c70a
3 changed files with 36 additions and 37 deletions
|
@ -37,9 +37,9 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
public ResultCode OpenFileSystemWithId(ServiceCtx context)
|
public ResultCode OpenFileSystemWithId(ServiceCtx context)
|
||||||
{
|
{
|
||||||
FileSystemType fileSystemType = (FileSystemType)context.RequestData.ReadInt32();
|
FileSystemType fileSystemType = (FileSystemType)context.RequestData.ReadInt32();
|
||||||
long titleId = context.RequestData.ReadInt64();
|
long titleId = context.RequestData.ReadInt64();
|
||||||
string switchPath = ReadUtf8String(context);
|
string switchPath = ReadUtf8String(context);
|
||||||
string fullPath = context.Device.FileSystem.SwitchPathToSystemPath(switchPath);
|
string fullPath = context.Device.FileSystem.SwitchPathToSystemPath(switchPath);
|
||||||
|
|
||||||
if (!File.Exists(fullPath))
|
if (!File.Exists(fullPath))
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
}
|
}
|
||||||
|
|
||||||
FileStream fileStream = new FileStream(fullPath, FileMode.Open, FileAccess.Read);
|
FileStream fileStream = new FileStream(fullPath, FileMode.Open, FileAccess.Read);
|
||||||
string extension = Path.GetExtension(fullPath);
|
string extension = Path.GetExtension(fullPath);
|
||||||
|
|
||||||
if (extension == ".nca")
|
if (extension == ".nca")
|
||||||
{
|
{
|
||||||
|
@ -129,8 +129,8 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
[Command(22)]
|
[Command(22)]
|
||||||
public ResultCode CreateSaveDataFileSystem(ServiceCtx context)
|
public ResultCode CreateSaveDataFileSystem(ServiceCtx context)
|
||||||
{
|
{
|
||||||
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
|
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
|
||||||
SaveDataCreateInfo createInfo = context.RequestData.ReadStruct<SaveDataCreateInfo>();
|
SaveDataCreationInfo creationInfo = context.RequestData.ReadStruct<SaveDataCreationInfo>();
|
||||||
SaveMetaCreateInfo metaCreateInfo = context.RequestData.ReadStruct<SaveMetaCreateInfo>();
|
SaveMetaCreateInfo metaCreateInfo = context.RequestData.ReadStruct<SaveMetaCreateInfo>();
|
||||||
|
|
||||||
// TODO: There's currently no program registry for FS to reference.
|
// TODO: There's currently no program registry for FS to reference.
|
||||||
|
@ -140,14 +140,14 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
attribute.TitleId = new TitleId(context.Process.TitleId);
|
attribute.TitleId = new TitleId(context.Process.TitleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createInfo.OwnerId == TitleId.Zero)
|
if (creationInfo.OwnerId == TitleId.Zero)
|
||||||
{
|
{
|
||||||
createInfo.OwnerId = new TitleId(context.Process.TitleId);
|
creationInfo.OwnerId = new TitleId(context.Process.TitleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.PrintInfo(LogClass.ServiceFs, $"Creating save with title ID {attribute.TitleId.Value:x16}");
|
Logger.PrintInfo(LogClass.ServiceFs, $"Creating save with title ID {attribute.TitleId.Value:x16}");
|
||||||
|
|
||||||
Result result = _baseFileSystemProxy.CreateSaveDataFileSystem(ref attribute, ref createInfo, ref metaCreateInfo);
|
Result result = _baseFileSystemProxy.CreateSaveDataFileSystem(ref attribute, ref creationInfo, ref metaCreateInfo);
|
||||||
|
|
||||||
return (ResultCode)result.Value;
|
return (ResultCode)result.Value;
|
||||||
}
|
}
|
||||||
|
@ -155,10 +155,10 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
[Command(23)]
|
[Command(23)]
|
||||||
public ResultCode CreateSaveDataFileSystemBySystemSaveDataId(ServiceCtx context)
|
public ResultCode CreateSaveDataFileSystemBySystemSaveDataId(ServiceCtx context)
|
||||||
{
|
{
|
||||||
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
|
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
|
||||||
SaveDataCreateInfo createInfo = context.RequestData.ReadStruct<SaveDataCreateInfo>();
|
SaveDataCreationInfo creationInfo = context.RequestData.ReadStruct<SaveDataCreationInfo>();
|
||||||
|
|
||||||
Result result = _baseFileSystemProxy.CreateSaveDataFileSystemBySystemSaveDataId(ref attribute, ref createInfo);
|
Result result = _baseFileSystemProxy.CreateSaveDataFileSystemBySystemSaveDataId(ref attribute, ref creationInfo);
|
||||||
|
|
||||||
return (ResultCode)result.Value;
|
return (ResultCode)result.Value;
|
||||||
}
|
}
|
||||||
|
@ -166,8 +166,8 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
[Command(25)]
|
[Command(25)]
|
||||||
public ResultCode DeleteSaveDataFileSystemBySaveDataSpaceId(ServiceCtx context)
|
public ResultCode DeleteSaveDataFileSystemBySaveDataSpaceId(ServiceCtx context)
|
||||||
{
|
{
|
||||||
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
|
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
|
||||||
ulong saveDataId = context.RequestData.ReadUInt64();
|
ulong saveDataId = context.RequestData.ReadUInt64();
|
||||||
|
|
||||||
Result result = _baseFileSystemProxy.DeleteSaveDataFileSystemBySaveDataSpaceId(spaceId, saveDataId);
|
Result result = _baseFileSystemProxy.DeleteSaveDataFileSystemBySaveDataSpaceId(spaceId, saveDataId);
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
[Command(28)]
|
[Command(28)]
|
||||||
public ResultCode DeleteSaveDataFileSystemBySaveDataAttribute(ServiceCtx context)
|
public ResultCode DeleteSaveDataFileSystemBySaveDataAttribute(ServiceCtx context)
|
||||||
{
|
{
|
||||||
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
|
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
|
||||||
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
|
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
|
||||||
|
|
||||||
Result result = _baseFileSystemProxy.DeleteSaveDataFileSystemBySaveDataAttribute(spaceId, ref attribute);
|
Result result = _baseFileSystemProxy.DeleteSaveDataFileSystemBySaveDataAttribute(spaceId, ref attribute);
|
||||||
|
@ -189,7 +189,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
// OpenGameCardStorage(u32, u32) -> object<nn::fssrv::sf::IStorage>
|
// OpenGameCardStorage(u32, u32) -> object<nn::fssrv::sf::IStorage>
|
||||||
public ResultCode OpenGameCardStorage(ServiceCtx context)
|
public ResultCode OpenGameCardStorage(ServiceCtx context)
|
||||||
{
|
{
|
||||||
GameCardHandle handle = new GameCardHandle(context.RequestData.ReadInt32());
|
GameCardHandle handle = new GameCardHandle(context.RequestData.ReadInt32());
|
||||||
GameCardPartitionRaw partitionId = (GameCardPartitionRaw)context.RequestData.ReadInt32();
|
GameCardPartitionRaw partitionId = (GameCardPartitionRaw)context.RequestData.ReadInt32();
|
||||||
|
|
||||||
Result result = _baseFileSystemProxy.OpenGameCardStorage(out LibHac.Fs.IStorage storage, handle, partitionId);
|
Result result = _baseFileSystemProxy.OpenGameCardStorage(out LibHac.Fs.IStorage storage, handle, partitionId);
|
||||||
|
@ -205,10 +205,10 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
[Command(35)]
|
[Command(35)]
|
||||||
public ResultCode CreateSaveDataFileSystemWithHashSalt(ServiceCtx context)
|
public ResultCode CreateSaveDataFileSystemWithHashSalt(ServiceCtx context)
|
||||||
{
|
{
|
||||||
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
|
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
|
||||||
SaveDataCreateInfo createInfo = context.RequestData.ReadStruct<SaveDataCreateInfo>();
|
SaveDataCreationInfo creationInfo = context.RequestData.ReadStruct<SaveDataCreationInfo>();
|
||||||
SaveMetaCreateInfo metaCreateInfo = context.RequestData.ReadStruct<SaveMetaCreateInfo>();
|
SaveMetaCreateInfo metaCreateInfo = context.RequestData.ReadStruct<SaveMetaCreateInfo>();
|
||||||
HashSalt hashSalt = context.RequestData.ReadStruct<HashSalt>();
|
HashSalt hashSalt = context.RequestData.ReadStruct<HashSalt>();
|
||||||
|
|
||||||
// TODO: There's currently no program registry for FS to reference.
|
// 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
|
// Workaround that by setting the application ID and owner ID if they're not already set
|
||||||
|
@ -217,12 +217,12 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
attribute.TitleId = new TitleId(context.Process.TitleId);
|
attribute.TitleId = new TitleId(context.Process.TitleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createInfo.OwnerId == TitleId.Zero)
|
if (creationInfo.OwnerId == TitleId.Zero)
|
||||||
{
|
{
|
||||||
createInfo.OwnerId = new TitleId(context.Process.TitleId);
|
creationInfo.OwnerId = new TitleId(context.Process.TitleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result result = _baseFileSystemProxy.CreateSaveDataFileSystemWithHashSalt(ref attribute, ref createInfo, ref metaCreateInfo, ref hashSalt);
|
Result result = _baseFileSystemProxy.CreateSaveDataFileSystemWithHashSalt(ref attribute, ref creationInfo, ref metaCreateInfo, ref hashSalt);
|
||||||
|
|
||||||
return (ResultCode)result.Value;
|
return (ResultCode)result.Value;
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
// OpenSaveDataFileSystem(u8 save_data_space_id, nn::fssrv::sf::SaveStruct saveStruct) -> object<nn::fssrv::sf::IFileSystem> saveDataFs
|
// OpenSaveDataFileSystem(u8 save_data_space_id, nn::fssrv::sf::SaveStruct saveStruct) -> object<nn::fssrv::sf::IFileSystem> saveDataFs
|
||||||
public ResultCode OpenSaveDataFileSystem(ServiceCtx context)
|
public ResultCode OpenSaveDataFileSystem(ServiceCtx context)
|
||||||
{
|
{
|
||||||
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
|
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
|
||||||
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
|
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
|
||||||
|
|
||||||
// TODO: There's currently no program registry for FS to reference.
|
// TODO: There's currently no program registry for FS to reference.
|
||||||
|
@ -242,7 +242,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
}
|
}
|
||||||
|
|
||||||
Result result = _baseFileSystemProxy.OpenSaveDataFileSystem(out LibHac.Fs.IFileSystem fileSystem, spaceId, ref attribute);
|
Result result = _baseFileSystemProxy.OpenSaveDataFileSystem(out LibHac.Fs.IFileSystem fileSystem, spaceId, ref attribute);
|
||||||
|
|
||||||
if (result.IsSuccess())
|
if (result.IsSuccess())
|
||||||
{
|
{
|
||||||
MakeObject(context, new FileSystemProxy.IFileSystem(fileSystem));
|
MakeObject(context, new FileSystemProxy.IFileSystem(fileSystem));
|
||||||
|
@ -255,7 +255,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
// OpenSaveDataFileSystemBySystemSaveDataId(u8 save_data_space_id, nn::fssrv::sf::SaveStruct saveStruct) -> object<nn::fssrv::sf::IFileSystem> systemSaveDataFs
|
// OpenSaveDataFileSystemBySystemSaveDataId(u8 save_data_space_id, nn::fssrv::sf::SaveStruct saveStruct) -> object<nn::fssrv::sf::IFileSystem> systemSaveDataFs
|
||||||
public ResultCode OpenSaveDataFileSystemBySystemSaveDataId(ServiceCtx context)
|
public ResultCode OpenSaveDataFileSystemBySystemSaveDataId(ServiceCtx context)
|
||||||
{
|
{
|
||||||
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
|
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
|
||||||
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
|
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.IFileSystem fileSystem, spaceId, ref attribute);
|
||||||
|
@ -324,10 +324,10 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
public ResultCode FindSaveDataWithFilter(ServiceCtx context)
|
public ResultCode FindSaveDataWithFilter(ServiceCtx context)
|
||||||
{
|
{
|
||||||
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
|
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
|
||||||
SaveDataFilter filter = context.RequestData.ReadStruct<SaveDataFilter>();
|
SaveDataFilter filter = context.RequestData.ReadStruct<SaveDataFilter>();
|
||||||
|
|
||||||
long bufferPosition = context.Request.ReceiveBuff[0].Position;
|
long bufferPosition = context.Request.ReceiveBuff[0].Position;
|
||||||
long bufferLen = context.Request.ReceiveBuff[0].Size;
|
long bufferLen = context.Request.ReceiveBuff[0].Size;
|
||||||
|
|
||||||
byte[] infoBuffer = new byte[bufferLen];
|
byte[] infoBuffer = new byte[bufferLen];
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
public ResultCode OpenSaveDataInfoReaderWithFilter(ServiceCtx context)
|
public ResultCode OpenSaveDataInfoReaderWithFilter(ServiceCtx context)
|
||||||
{
|
{
|
||||||
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
|
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
|
||||||
SaveDataFilter filter = context.RequestData.ReadStruct<SaveDataFilter>();
|
SaveDataFilter filter = context.RequestData.ReadStruct<SaveDataFilter>();
|
||||||
|
|
||||||
Result result = _baseFileSystemProxy.OpenSaveDataInfoReaderWithFilter(out LibHac.FsService.ISaveDataInfoReader infoReader, spaceId, ref filter);
|
Result result = _baseFileSystemProxy.OpenSaveDataInfoReaderWithFilter(out LibHac.FsService.ISaveDataInfoReader infoReader, spaceId, ref filter);
|
||||||
|
|
||||||
|
@ -369,8 +369,8 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
public ResultCode OpenDataStorageByDataId(ServiceCtx context)
|
public ResultCode OpenDataStorageByDataId(ServiceCtx context)
|
||||||
{
|
{
|
||||||
StorageId storageId = (StorageId)context.RequestData.ReadByte();
|
StorageId storageId = (StorageId)context.RequestData.ReadByte();
|
||||||
byte[] padding = context.RequestData.ReadBytes(7);
|
byte[] padding = context.RequestData.ReadBytes(7);
|
||||||
long titleId = context.RequestData.ReadInt64();
|
long titleId = context.RequestData.ReadInt64();
|
||||||
|
|
||||||
NcaContentType contentType = NcaContentType.Data;
|
NcaContentType contentType = NcaContentType.Data;
|
||||||
|
|
||||||
|
@ -398,8 +398,8 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LibHac.Fs.IStorage ncaStorage = new LocalStorage(ncaPath, FileAccess.Read, FileMode.Open);
|
LibHac.Fs.IStorage ncaStorage = new LocalStorage(ncaPath, FileAccess.Read, FileMode.Open);
|
||||||
Nca nca = new Nca(context.Device.System.KeySet, ncaStorage);
|
Nca nca = new Nca(context.Device.System.KeySet, ncaStorage);
|
||||||
LibHac.Fs.IStorage romfsStorage = nca.OpenStorage(NcaSectionType.Data, context.Device.System.FsIntegrityCheckLevel);
|
LibHac.Fs.IStorage romfsStorage = nca.OpenStorage(NcaSectionType.Data, context.Device.System.FsIntegrityCheckLevel);
|
||||||
|
|
||||||
MakeObject(context, new FileSystemProxy.IStorage(romfsStorage));
|
MakeObject(context, new FileSystemProxy.IStorage(romfsStorage));
|
||||||
|
@ -412,12 +412,12 @@ namespace Ryujinx.HLE.HOS.Services.Fs
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new FileNotFoundException($"No Nca found in Path `{ncaPath}`.");
|
throw new FileNotFoundException($"No Nca found in Path `{ncaPath}`.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new DirectoryNotFoundException($"Path for title id {titleId:x16} on Storage {storageId} was not found in Path {installPath}.");
|
throw new DirectoryNotFoundException($"Path for title id {titleId:x16} on Storage {storageId} was not found in Path {installPath}.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Concentus" Version="1.1.7" />
|
<PackageReference Include="Concentus" Version="1.1.7" />
|
||||||
<PackageReference Include="LibHac" Version="0.7.0" />
|
<PackageReference Include="LibHac" Version="0.8.2" />
|
||||||
<PackageReference Include="TimeZoneConverter.Posix" Version="2.1.0" />
|
<PackageReference Include="TimeZoneConverter.Posix" Version="2.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ using LibHac.Common;
|
||||||
using LibHac.Fs;
|
using LibHac.Fs;
|
||||||
using LibHac.Fs.Shim;
|
using LibHac.Fs.Shim;
|
||||||
using LibHac.FsSystem;
|
using LibHac.FsSystem;
|
||||||
using LibHac.FsSystem.Save;
|
|
||||||
using LibHac.Ncm;
|
using LibHac.Ncm;
|
||||||
using Ryujinx.HLE.Utilities;
|
using Ryujinx.HLE.Utilities;
|
||||||
using System;
|
using System;
|
||||||
|
@ -131,7 +130,7 @@ namespace Ryujinx.Ui
|
||||||
{
|
{
|
||||||
SaveDataAttribute attribute = new SaveDataAttribute
|
SaveDataAttribute attribute = new SaveDataAttribute
|
||||||
{
|
{
|
||||||
Type = SaveDataType.SaveData,
|
Type = SaveDataType.Account,
|
||||||
UserId = userId,
|
UserId = userId,
|
||||||
TitleId = new TitleId(titleId)
|
TitleId = new TitleId(titleId)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue