infra: Update LibHac to v0.20.0.

See merge request [ryubing/ryujinx!33](https://git.ryujinx.app/ryubing/ryujinx/-/merge_requests/33)
This commit is contained in:
GreemDev 2025-05-14 15:52:14 -05:00
parent 28b8dc14c7
commit 1d4928e859
18 changed files with 71 additions and 44 deletions

View File

@ -40,7 +40,7 @@
<PackageVersion Include="Ryujinx.Audio.OpenAL.Dependencies" Version="1.21.0.1" />
<PackageVersion Include="Ryujinx.Graphics.Nvdec.Dependencies.AllArch" Version="6.1.2-build3" />
<PackageVersion Include="Ryujinx.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.0" />
<PackageVersion Include="Ryujinx.LibHac" Version="0.19.0" />
<PackageVersion Include="Ryujinx.LibHac" Version="0.20.0-alpha.90" />
<PackageVersion Include="Ryujinx.SDL2-CS" Version="2.30.0-build32" />
<PackageVersion Include="Gommon" Version="2.7.1.1" />
<PackageVersion Include="securifybv.ShellLink" Version="0.1.0" />

View File

@ -3,13 +3,14 @@ using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSrv.FsCreator;
using System.Runtime.CompilerServices;
namespace Ryujinx.HLE.FileSystem
{
public class EncryptedFileSystemCreator : IEncryptedFileSystemCreator
{
public Result Create(ref SharedRef<IFileSystem> outEncryptedFileSystem,
ref SharedRef<IFileSystem> baseFileSystem, IEncryptedFileSystemCreator.KeyId idIndex,
ref readonly SharedRef<IFileSystem> baseFileSystem, IEncryptedFileSystemCreator.KeyId idIndex,
in EncryptionSeed encryptionSeed)
{
if (idIndex < IEncryptedFileSystemCreator.KeyId.Save || idIndex > IEncryptedFileSystemCreator.KeyId.CustomStorage)
@ -18,7 +19,7 @@ namespace Ryujinx.HLE.FileSystem
}
// TODO: Reenable when AesXtsFileSystem is fixed.
outEncryptedFileSystem = SharedRef<IFileSystem>.CreateMove(ref baseFileSystem);
outEncryptedFileSystem = SharedRef<IFileSystem>.CreateMove(ref baseFileSystem.Ref);
return Result.Success;
}

View File

@ -791,7 +791,7 @@ namespace Ryujinx.HLE.HOS
{
string buildId = p switch
{
NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()).TrimEnd('0'),
NsoExecutable nso => Convert.ToHexString(nso.BuildId).TrimEnd('0'),
NroExecutable nro => Convert.ToHexString(nro.Header.BuildId).TrimEnd('0'),
_ => string.Empty,
};

View File

@ -16,6 +16,7 @@ using Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy;
using Ryujinx.Memory;
using System;
using System.IO;
using System.Text;
using static Ryujinx.HLE.Utilities.StringUtils;
using GameCardHandle = System.UInt32;
using IFile = Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy.IFile;
@ -753,17 +754,9 @@ namespace Ryujinx.HLE.HOS.Services.Fs
public ResultCode OpenCloudBackupWorkStorageFileSystem(ServiceCtx context)
{
CloudBackupWorkStorageId storageId = (CloudBackupWorkStorageId)context.RequestData.ReadInt32();
using SharedRef<IFileSystem> fileSystem = new();
Result result = _baseFileSystemProxy.Get.OpenCloudBackupWorkStorageFileSystem(ref fileSystem.Ref, storageId);
if (result.IsFailure())
{
return (ResultCode)result.Value;
}
MakeObject(context, new FileSystemProxy.IFileSystem(ref fileSystem.Ref));
return ResultCode.Success;
Logger.Stub?.PrintStub(LogClass.ServiceFs, new { storageId });
throw new NotImplementedException(); // reimplementing behavior from LibHac 0.19.0
}
[CommandCmif(130)]
@ -1028,7 +1021,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
{
ref readonly FspPath path = ref FileSystemProxyHelper.GetFspPath(context);
Result result = _baseFileSystemProxy.Get.GetRightsIdByPath(out RightsId rightsId, in path);
Result result = _baseFileSystemProxy.Get.GetRightsIdAndKeyGenerationByPath(out RightsId rightsId, out byte _, in path, ContentAttributes.All);
if (result.IsFailure())
{
return (ResultCode)result.Value;
@ -1044,7 +1037,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs
{
ref readonly FspPath path = ref FileSystemProxyHelper.GetFspPath(context);
Result result = _baseFileSystemProxy.Get.GetRightsIdAndKeyGenerationByPath(out RightsId rightsId, out byte keyGeneration, in path);
Result result = _baseFileSystemProxy.Get.GetRightsIdAndKeyGenerationByPath(out RightsId rightsId, out byte keyGeneration, in path, ContentAttributes.All);
if (result.IsFailure())
{
return (ResultCode)result.Value;
@ -1241,7 +1234,9 @@ namespace Ryujinx.HLE.HOS.Services.Fs
BisPartitionId partitionId = (BisPartitionId)context.RequestData.ReadInt32();
ref readonly FspPath path = ref FileSystemProxyHelper.GetFspPath(context);
return (ResultCode)_baseFileSystemProxy.Get.SetBisRootForHost(partitionId, in path).Value;
Logger.Stub?.PrintStub(LogClass.ServiceFs, new { partitionId, path });
throw new NotImplementedException(); // reimplementing behavior from LibHac 0.19.0
}
[CommandCmif(1001)]

View File

@ -17,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator
NetworkError ConnectPrivate(ConnectPrivateRequest request);
ResultCode Reject(DisconnectReason disconnectReason, uint nodeId);
NetworkInfo[] Scan(ushort channel, ScanFilter scanFilter);
void SetGameVersion(byte[] versionString);
void SetGameVersion(ReadOnlySpan<byte> versionString);
void SetStationAcceptPolicy(AcceptPolicy acceptPolicy);
void SetAdvertiseData(byte[] data);
bool CreateNetwork(CreateAccessPointRequest request, byte[] advertiseData);

View File

@ -62,7 +62,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator
// TODO: Call nn::arp::GetApplicationControlProperty here when implemented.
ApplicationControlProperty controlProperty = context.Device.Processes.ActiveApplication.ApplicationControlProperties;
foreach (ulong localCommunicationId in controlProperty.LocalCommunicationId.ItemsRo)
foreach (ulong localCommunicationId in controlProperty.LocalCommunicationId)
{
if (localCommunicationId == localCommunicationIdChecked)
{
@ -1114,7 +1114,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator
}
// TODO: Call nn::arp::GetApplicationLaunchProperty here when implemented.
NetworkClient.SetGameVersion(context.Device.Processes.ActiveApplication.ApplicationControlProperties.DisplayVersion.Items.ToArray());
NetworkClient.SetGameVersion(context.Device.Processes.ActiveApplication.ApplicationControlProperties.DisplayVersion);
resultCode = ResultCode.Success;

View File

@ -61,7 +61,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator
public void SetAdvertiseData(byte[] data) { }
public void SetGameVersion(byte[] versionString) { }
public void SetGameVersion(ReadOnlySpan<byte> versionString) { }
public void SetStationAcceptPolicy(AcceptPolicy acceptPolicy) { }

View File

@ -85,7 +85,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
_lanDiscovery.SetAdvertiseData(data);
}
public void SetGameVersion(byte[] versionString)
public void SetGameVersion(ReadOnlySpan<byte> versionString)
{
// NOTE: This method is not implemented in ldn_mitm
Logger.Stub?.PrintMsg(LogClass.ServiceLdn, "LdnMitmClient SetGameVersion");

View File

@ -346,9 +346,9 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
}
}
public void SetGameVersion(byte[] versionString)
public void SetGameVersion(ReadOnlySpan<byte> versionString)
{
_gameVersion = versionString;
_gameVersion = versionString.ToArray();
if (_gameVersion.Length < 0x10)
{

View File

@ -55,7 +55,16 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory
_titleId = titleId;
// TODO: Call nn::arp::GetApplicationControlProperty here when implemented, if it return ResultCode.Success we assign fields.
_ratingAge = Array.ConvertAll(context.Device.Processes.ActiveApplication.ApplicationControlProperties.RatingAge.ItemsRo.ToArray(), Convert.ToInt32);
int[] tempRatingAge = new int[32];
for (int i = 0; i < 32; i++)
{
tempRatingAge[i] = Convert.ToInt32(context.Device.Processes.ActiveApplication.ApplicationControlProperties.RatingAge[i]);
}
Array.Copy(tempRatingAge, _ratingAge, tempRatingAge.Length);
_parentalControlFlag = context.Device.Processes.ActiveApplication.ApplicationControlProperties.ParentalControlFlag;
}
}

View File

@ -45,7 +45,10 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pdm.QueryService
// Check if input title ids are in the whitelist.
foreach (ulong titleId in titleIds)
{
if (!context.Device.Processes.ActiveApplication.ApplicationControlProperties.PlayLogQueryableApplicationId.ItemsRo.Contains(titleId))
ReadOnlySpan<ulong> temp = context.Device.Processes.ActiveApplication
.ApplicationControlProperties.PlayLogQueryableApplicationId;
if (!temp.Contains(titleId))
{
return (ResultCode)Am.ResultCode.ObjectInvalid;
}

View File

@ -91,7 +91,13 @@ namespace Ryujinx.HLE.Loaders.Processes.Extensions
if (string.IsNullOrWhiteSpace(programName))
{
programName = Array.Find(nacpData.Value.Title.ItemsRo.ToArray(), x => x.Name[0] != 0).NameString.ToString();
foreach (ApplicationControlProperty.ApplicationTitle nacpTitles in nacpData.Value.Title)
{
if (nacpTitles.Name[0] != 0)
continue;
programName = nacpTitles.NameString.ToString();
}
}
}

View File

@ -196,15 +196,21 @@ namespace Ryujinx.HLE.Loaders.Processes
programName = nacpData.Value.Title[(int)_device.System.State.DesiredTitleLanguage].NameString.ToString();
if (string.IsNullOrWhiteSpace(programName))
{
foreach (ApplicationControlProperty.ApplicationTitle nacpTitles in nacpData.Value.Title)
{
if (nacpTitles.Name[0] != 0)
continue;
programName = nacpTitles.NameString.ToString();
}
}
if ("Switch Verification" ==
nacpData.Value.Title[(int)TitleLanguage.AmericanEnglish].NameString.ToString())
throw new InvalidOperationException();
if (string.IsNullOrWhiteSpace(programName))
{
programName = Array.Find(nacpData.Value.Title.ItemsRo.ToArray(), x => x.Name[0] != 0).NameString.ToString();
}
if (nacpData.Value.PresenceGroupId != 0)
{
programId = nacpData.Value.PresenceGroupId;

View File

@ -258,7 +258,7 @@ namespace Ryujinx.HLE.Loaders.Processes
{
buildIds[i] = (executables[i] switch
{
NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()),
NsoExecutable nso => Convert.ToHexString(nso.BuildId),
NroExecutable nro => Convert.ToHexString(nro.Header.BuildId),
_ => string.Empty
}).ToUpper();

View File

@ -59,7 +59,13 @@ namespace Ryujinx.HLE.Loaders.Processes
if (string.IsNullOrWhiteSpace(Name))
{
Name = Array.Find(ApplicationControlProperties.Title.ItemsRo.ToArray(), x => x.Name[0] != 0).NameString.ToString();
foreach (ApplicationControlProperty.ApplicationTitle nacpTitles in ApplicationControlProperties.Title)
{
if (nacpTitles.Name[0] != 0)
continue;
Name = nacpTitles.NameString.ToString();
}
}
DisplayVersion = ApplicationControlProperties.DisplayVersionString.ToString();

View File

@ -221,7 +221,7 @@ namespace Ryujinx.Ava.Systems.AppLibrary
NsoReader reader = new();
reader.Initialize(nsoFile.Release().AsStorage().AsFile(OpenMode.Read)).ThrowIfFailure();
return Convert.ToHexString(reader.Header.ModuleId.ItemsRo.ToArray()).Replace("-", string.Empty).ToUpper()[..16];
return Convert.ToHexString(reader.Header.ModuleId).Replace("-", string.Empty).ToUpper()[..16];
}
}
}

View File

@ -1367,7 +1367,7 @@ namespace Ryujinx.Ava.Systems.AppLibrary
{
_ = Enum.TryParse(DesiredLanguage.ToString(), out TitleLanguage desiredTitleLanguage);
if (controlData.Title.ItemsRo.Length > (int)desiredTitleLanguage)
if (controlData.Title.Length > (int)desiredTitleLanguage)
{
data.Name = controlData.Title[(int)desiredTitleLanguage].NameString.ToString();
data.Developer = controlData.Title[(int)desiredTitleLanguage].PublisherString.ToString();
@ -1380,7 +1380,7 @@ namespace Ryujinx.Ava.Systems.AppLibrary
if (string.IsNullOrWhiteSpace(data.Name))
{
foreach (ref readonly ApplicationControlProperty.ApplicationTitle controlTitle in controlData.Title.ItemsRo)
foreach (ref readonly ApplicationControlProperty.ApplicationTitle controlTitle in controlData.Title)
{
if (!controlTitle.NameString.IsEmpty())
{
@ -1393,7 +1393,7 @@ namespace Ryujinx.Ava.Systems.AppLibrary
if (string.IsNullOrWhiteSpace(data.Developer))
{
foreach (ref readonly ApplicationControlProperty.ApplicationTitle controlTitle in controlData.Title.ItemsRo)
foreach (ref readonly ApplicationControlProperty.ApplicationTitle controlTitle in controlData.Title)
{
if (!controlTitle.PublisherString.IsEmpty())
{

View File

@ -20,10 +20,11 @@ namespace Ryujinx.Ava.Systems.AppLibrary
public static Array GetArrayForApp(
LdnGameData[] receivedData, ref ApplicationControlProperty acp)
{
LibHac.Common.FixedArrays.Array8<ulong> communicationId = acp.LocalCommunicationId;
ReadOnlySpan<ulong> communicationId = acp.LocalCommunicationId;
ulong[] allowedTitleIds = communicationId.ToArray();
return new Array(receivedData.Where(game =>
communicationId.Items.Contains(game.TitleId.ToULong())
allowedTitleIds.Contains(game.TitleId.ToULong())
));
}