aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2023-03-31 21:16:46 +0200
committerGitHub <noreply@github.com>2023-03-31 21:16:46 +0200
commit4c2d9ff3ff9d7afb1fd0bd764bee5931fa5f053c (patch)
tree1245f5ec356551bd20a9594d114d06a53c41d036 /Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs
parent8198b99935f562ffb2fb9a75175a8df24d235152 (diff)
HLE: Refactoring of ApplicationLoader (#4480)1.1.689
* HLE: Refactoring of ApplicationLoader * Fix SDL2 Headless * Addresses gdkchan feedback * Fixes LoadUnpackedNca RomFS loading * remove useless casting * Cleanup and fixe empty application name * Remove ProcessInfo * Fixes typo * ActiveProcess to ActiveApplication * Update check * Clean using. * Use the correct filepath when loading Homebrew.npdm * Fix NRE in ProcessResult if MetaLoader is null * Add more checks for valid processId & return success * Add missing logging statement for npdm error * Return result for LoadKip() * Move error logging out of PFS load extension method This avoids logging "Could not find Main NCA" followed by "Loading main..." when trying to start hbl. * Fix GUIs not checking load results * Fix style and formatting issues * Fix formatting and wording * gtk: Refactor LoadApplication() --------- Co-authored-by: TSR Berry <20988865+TSRBerry@users.noreply.github.com>
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs35
1 files changed, 9 insertions, 26 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs
index f8f88a1c..924f5429 100644
--- a/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs
@@ -115,28 +115,12 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
Uid userId = context.RequestData.ReadStruct<AccountUid>().ToLibHacUid();
// Mask out the low nibble of the program ID to get the application ID
- ApplicationId applicationId = new ApplicationId(context.Device.Application.TitleId & ~0xFul);
+ ApplicationId applicationId = new ApplicationId(context.Device.Processes.ActiveApplication.ProgramId & ~0xFul);
- BlitStruct<ApplicationControlProperty> controlHolder = context.Device.Application.ControlData;
-
- ref ApplicationControlProperty control = ref controlHolder.Value;
-
- if (LibHac.Common.Utilities.IsZeros(controlHolder.ByteSpan))
- {
- // If the current application doesn't have a loaded control property, create a dummy one
- // and set the savedata sizes so a user savedata will be created.
- control = ref new BlitStruct<ApplicationControlProperty>(1).Value;
-
- // The set sizes don't actually matter as long as they're non-zero because we use directory savedata.
- control.UserAccountSaveDataSize = 0x4000;
- control.UserAccountSaveDataJournalSize = 0x4000;
-
- Logger.Warning?.Print(LogClass.ServiceAm,
- "No control file was found for this game. Using a dummy one instead. This may cause inaccuracies in some games.");
- }
+ ApplicationControlProperty nacp = context.Device.Processes.ActiveApplication.ApplicationControlProperties;
LibHac.HorizonClient hos = context.Device.System.LibHacHorizonManager.AmClient;
- LibHac.Result result = hos.Fs.EnsureApplicationSaveData(out long requiredSize, applicationId, in control, in userId);
+ LibHac.Result result = hos.Fs.EnsureApplicationSaveData(out long requiredSize, applicationId, in nacp, in userId);
context.ResponseData.Write(requiredSize);
@@ -153,7 +137,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
// TODO: When above calls are implemented, switch to using ns:am
long desiredLanguageCode = context.Device.System.State.DesiredLanguageCode;
- int supportedLanguages = (int)context.Device.Application.ControlData.Value.SupportedLanguageFlag;
+ int supportedLanguages = (int)context.Device.Processes.ActiveApplication.ApplicationControlProperties.SupportedLanguageFlag;
int firstSupported = BitOperations.TrailingZeroCount(supportedLanguages);
if (firstSupported > (int)TitleLanguage.BrazilianPortuguese)
@@ -196,7 +180,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
public ResultCode GetDisplayVersion(ServiceCtx context)
{
// If an NACP isn't found, the buffer will be all '\0' which seems to be the correct implementation.
- context.ResponseData.Write(context.Device.Application.ControlData.Value.DisplayVersion);
+ context.ResponseData.Write(context.Device.Processes.ActiveApplication.ApplicationControlProperties.DisplayVersion);
return ResultCode.Success;
}
@@ -251,13 +235,12 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
long journalSize = context.RequestData.ReadInt64();
// Mask out the low nibble of the program ID to get the application ID
- ApplicationId applicationId = new ApplicationId(context.Device.Application.TitleId & ~0xFul);
+ ApplicationId applicationId = new ApplicationId(context.Device.Processes.ActiveApplication.ProgramId & ~0xFul);
- BlitStruct<ApplicationControlProperty> controlHolder = context.Device.Application.ControlData;
+ ApplicationControlProperty nacp = context.Device.Processes.ActiveApplication.ApplicationControlProperties;
LibHac.Result result = _horizon.Fs.CreateApplicationCacheStorage(out long requiredSize,
- out CacheStorageTargetMedia storageTarget, applicationId, in controlHolder.Value, index, saveSize,
- journalSize);
+ out CacheStorageTargetMedia storageTarget, applicationId, in nacp, index, saveSize, journalSize);
if (result.IsFailure()) return (ResultCode)result.Value;
@@ -677,7 +660,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
throw new InvalidSystemResourceException($"JIT (010000000000003B) system title not found! The JIT will not work, provide the system archive to fix this error. (See https://github.com/Ryujinx/Ryujinx#requirements for more information)");
}
- context.Device.Application.LoadServiceNca(filePath);
+ context.Device.LoadNca(filePath);
// FIXME: Most likely not how this should be done?
while (!context.Device.System.SmRegistry.IsServiceRegistered("jit:u"))