Revert "infra: Update LibHac to v0.20.0."

This seems to have broken some mods.

This reverts commit 1d4928e859e15410fe9ffdbd2cdb13b59d048507.
This commit is contained in:
GreemDev 2025-05-14 21:35:20 -05:00
parent f1eb911d25
commit e18e27fbc5
18 changed files with 44 additions and 71 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator
NetworkError ConnectPrivate(ConnectPrivateRequest request); NetworkError ConnectPrivate(ConnectPrivateRequest request);
ResultCode Reject(DisconnectReason disconnectReason, uint nodeId); ResultCode Reject(DisconnectReason disconnectReason, uint nodeId);
NetworkInfo[] Scan(ushort channel, ScanFilter scanFilter); NetworkInfo[] Scan(ushort channel, ScanFilter scanFilter);
void SetGameVersion(ReadOnlySpan<byte> versionString); void SetGameVersion(byte[] versionString);
void SetStationAcceptPolicy(AcceptPolicy acceptPolicy); void SetStationAcceptPolicy(AcceptPolicy acceptPolicy);
void SetAdvertiseData(byte[] data); void SetAdvertiseData(byte[] data);
bool CreateNetwork(CreateAccessPointRequest request, byte[] advertiseData); 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. // TODO: Call nn::arp::GetApplicationControlProperty here when implemented.
ApplicationControlProperty controlProperty = context.Device.Processes.ActiveApplication.ApplicationControlProperties; ApplicationControlProperty controlProperty = context.Device.Processes.ActiveApplication.ApplicationControlProperties;
foreach (ulong localCommunicationId in controlProperty.LocalCommunicationId) foreach (ulong localCommunicationId in controlProperty.LocalCommunicationId.ItemsRo)
{ {
if (localCommunicationId == localCommunicationIdChecked) if (localCommunicationId == localCommunicationIdChecked)
{ {
@ -1114,7 +1114,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator
} }
// TODO: Call nn::arp::GetApplicationLaunchProperty here when implemented. // TODO: Call nn::arp::GetApplicationLaunchProperty here when implemented.
NetworkClient.SetGameVersion(context.Device.Processes.ActiveApplication.ApplicationControlProperties.DisplayVersion); NetworkClient.SetGameVersion(context.Device.Processes.ActiveApplication.ApplicationControlProperties.DisplayVersion.Items.ToArray());
resultCode = ResultCode.Success; resultCode = ResultCode.Success;

View File

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

View File

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

View File

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

View File

@ -55,16 +55,7 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory
_titleId = titleId; _titleId = titleId;
// TODO: Call nn::arp::GetApplicationControlProperty here when implemented, if it return ResultCode.Success we assign fields. // 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; _parentalControlFlag = context.Device.Processes.ActiveApplication.ApplicationControlProperties.ParentalControlFlag;
} }
} }

View File

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

View File

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

View File

@ -195,22 +195,16 @@ namespace Ryujinx.HLE.Loaders.Processes
nacpStorage.Read(0, nacpData.ByteSpan); nacpStorage.Read(0, nacpData.ByteSpan);
programName = nacpData.Value.Title[(int)_device.System.State.DesiredTitleLanguage].NameString.ToString(); 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" == if ("Switch Verification" ==
nacpData.Value.Title[(int)TitleLanguage.AmericanEnglish].NameString.ToString()) nacpData.Value.Title[(int)TitleLanguage.AmericanEnglish].NameString.ToString())
throw new InvalidOperationException(); 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) if (nacpData.Value.PresenceGroupId != 0)
{ {
programId = nacpData.Value.PresenceGroupId; programId = nacpData.Value.PresenceGroupId;

View File

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

View File

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

View File

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

View File

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

View File

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