From 0e06aace458109f70dc5f36535f77117465ea707 Mon Sep 17 00:00:00 2001 From: Mary Date: Mon, 8 May 2023 01:50:07 +0200 Subject: [PATCH] misc: Avoid copy of ApplicationControlProperty (#4849) Avoid more giant copy when passing it around. --- .../Extensions/FileSystemExtensions.cs | 2 +- .../Loaders/Processes/ProcessLoader.cs | 2 +- .../Loaders/Processes/ProcessLoaderHelper.cs | 4 +-- .../Loaders/Processes/ProcessResult.cs | 25 ++++++++++--------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs b/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs index 58759ddb..782ccef3 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/Extensions/FileSystemExtensions.cs @@ -116,7 +116,7 @@ namespace Ryujinx.HLE.Loaders.Processes.Extensions device, device.System.KernelContext, metaLoader, - nacpData.Value, + nacpData, enablePtc, allowCodeMemoryForJit, programName, diff --git a/src/Ryujinx.HLE/Loaders/Processes/ProcessLoader.cs b/src/Ryujinx.HLE/Loaders/Processes/ProcessLoader.cs index 785db0e5..0eedc213 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/ProcessLoader.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/ProcessLoader.cs @@ -209,7 +209,7 @@ namespace Ryujinx.HLE.Loaders.Processes ProcessResult processResult = ProcessLoaderHelper.LoadNsos(_device, _device.System.KernelContext, dummyExeFs.GetNpdm(), - nacpData.Value, + nacpData, diskCacheEnabled: false, allowCodeMemoryForJit: true, programName, diff --git a/src/Ryujinx.HLE/Loaders/Processes/ProcessLoaderHelper.cs b/src/Ryujinx.HLE/Loaders/Processes/ProcessLoaderHelper.cs index b802a642..d1c60f16 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/ProcessLoaderHelper.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/ProcessLoaderHelper.cs @@ -219,7 +219,7 @@ namespace Ryujinx.HLE.Loaders.Processes Switch device, KernelContext context, MetaLoader metaLoader, - ApplicationControlProperty applicationControlProperties, + BlitStruct applicationControlProperties, bool diskCacheEnabled, bool allowCodeMemoryForJit, string name, @@ -355,7 +355,7 @@ namespace Ryujinx.HLE.Loaders.Processes context.Device.System.TickSource, context.Device.Gpu, $"{programId:x16}", - applicationControlProperties.DisplayVersionString.ToString(), + applicationControlProperties.Value.DisplayVersionString.ToString(), diskCacheEnabled, codeStart, codeSize); diff --git a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs index cf8168f7..81e75e27 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs @@ -1,4 +1,5 @@ -using LibHac.Loader; +using LibHac.Common; +using LibHac.Loader; using LibHac.Ns; using Ryujinx.Common.Logging; using Ryujinx.Cpu; @@ -11,7 +12,7 @@ namespace Ryujinx.HLE.Loaders.Processes { public class ProcessResult { - public static ProcessResult Failed => new(null, new ApplicationControlProperty(), false, false, null, 0, 0, 0, TitleLanguage.AmericanEnglish); + public static ProcessResult Failed => new(null, new BlitStruct(1), false, false, null, 0, 0, 0, TitleLanguage.AmericanEnglish); private readonly byte _mainThreadPriority; private readonly uint _mainThreadStackSize; @@ -31,15 +32,15 @@ namespace Ryujinx.HLE.Loaders.Processes public readonly bool AllowCodeMemoryForJit; public ProcessResult( - MetaLoader metaLoader, - ApplicationControlProperty applicationControlProperties, - bool diskCacheEnabled, - bool allowCodeMemoryForJit, - IDiskCacheLoadState diskCacheLoadState, - ulong pid, - byte mainThreadPriority, - uint mainThreadStackSize, - TitleLanguage titleLanguage) + MetaLoader metaLoader, + BlitStruct applicationControlProperties, + bool diskCacheEnabled, + bool allowCodeMemoryForJit, + IDiskCacheLoadState diskCacheLoadState, + ulong pid, + byte mainThreadPriority, + uint mainThreadStackSize, + TitleLanguage titleLanguage) { _mainThreadPriority = mainThreadPriority; _mainThreadStackSize = mainThreadStackSize; @@ -48,7 +49,7 @@ namespace Ryujinx.HLE.Loaders.Processes ProcessId = pid; MetaLoader = metaLoader; - ApplicationControlProperties = applicationControlProperties; + ApplicationControlProperties = applicationControlProperties.Value; if (metaLoader is not null) {