aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs
diff options
context:
space:
mode:
authorAlex Barney <thealexbarney@gmail.com>2021-08-12 14:56:24 -0700
committerGitHub <noreply@github.com>2021-08-12 23:56:24 +0200
commitdadc0e59daa89c4dd7f0c3356f302481a4e75e6d (patch)
treee39b6cd5198fef1fb2fe3461072b0961fd63502d /Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs
parent3977d1f72b8f091443018b68277044a840931054 (diff)
Update to LibHac 0.13.1 (#2475)
* Update to LibHac 0.13.1 * Recreate directories for indexed saves if they're missing on emulator start
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.cs46
1 files changed, 39 insertions, 7 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 3ea956aa..b358606c 100644
--- a/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs
@@ -37,6 +37,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
private int _notificationStorageChannelEventHandle;
private int _healthWarningDisappearedSystemEventHandle;
+ private HorizonClient _horizon;
+
public IApplicationFunctions(Horizon system)
{
// TODO: Find where they are signaled.
@@ -44,6 +46,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
_friendInvitationStorageChannelEvent = new KEvent(system.KernelContext);
_notificationStorageChannelEvent = new KEvent(system.KernelContext);
_healthWarningDisappearedSystemEvent = new KEvent(system.KernelContext);
+
+ _horizon = system.LibHacHorizonManager.AmClient;
}
[CommandHipc(1)]
@@ -103,14 +107,16 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
// EnsureSaveData(nn::account::Uid) -> u64
public ResultCode EnsureSaveData(ServiceCtx context)
{
- Uid userId = context.RequestData.ReadStruct<AccountUid>().ToLibHacUid();
- ApplicationId applicationId = new ApplicationId(context.Process.TitleId);
+ 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);
BlitStruct<ApplicationControlProperty> controlHolder = context.Device.Application.ControlData;
ref ApplicationControlProperty control = ref controlHolder.Value;
- if (LibHac.Utilities.IsEmpty(controlHolder.ByteSpan))
+ if (LibHac.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.
@@ -124,7 +130,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
"No control file was found for this game. Using a dummy one instead. This may cause inaccuracies in some games.");
}
- Result result = EnsureApplicationSaveData(context.Device.FileSystem.FsClient, out long requiredSize, applicationId, ref control, ref userId);
+ HorizonClient hos = context.Device.System.LibHacHorizonManager.AmClient;
+ Result result = EnsureApplicationSaveData(hos.Fs, out long requiredSize, applicationId, ref control, ref userId);
context.ResponseData.Write(requiredSize);
@@ -195,7 +202,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
public ResultCode ExtendSaveData(ServiceCtx context)
{
SaveDataType saveDataType = (SaveDataType)context.RequestData.ReadUInt64();
- Uid userId = context.RequestData.ReadStruct<AccountUid>().ToLibHacUid();
+ Uid userId = context.RequestData.ReadStruct<Uid>();
ulong saveDataSize = context.RequestData.ReadUInt64();
ulong journalSize = context.RequestData.ReadUInt64();
@@ -217,7 +224,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
public ResultCode GetSaveDataSize(ServiceCtx context)
{
SaveDataType saveDataType = (SaveDataType)context.RequestData.ReadUInt64();
- Uid userId = context.RequestData.ReadStruct<AccountUid>().ToLibHacUid();
+ Uid userId = context.RequestData.ReadStruct<Uid>();
// NOTE: Service calls nn::fs::FindSaveDataWithFilter with SaveDataType = 1 hardcoded.
// Then it calls nn::fs::GetSaveDataAvailableSize and nn::fs::GetSaveDataJournalSize to get the sizes.
@@ -231,6 +238,31 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
return ResultCode.Success;
}
+ [CommandHipc(27)] // 5.0.0+
+ // CreateCacheStorage(u16 index, s64 save_size, s64 journal_size) -> (u32 storageTarget, u64 requiredSize)
+ public ResultCode CreateCacheStorage(ServiceCtx context)
+ {
+ ushort index = (ushort)context.RequestData.ReadUInt64();
+ long saveSize = context.RequestData.ReadInt64();
+ 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);
+
+ BlitStruct<ApplicationControlProperty> controlHolder = context.Device.Application.ControlData;
+
+ Result result = _horizon.Fs.CreateApplicationCacheStorage(out long requiredSize,
+ out CacheStorageTargetMedia storageTarget, applicationId, ref controlHolder.Value, index, saveSize,
+ journalSize);
+
+ if (result.IsFailure()) return (ResultCode)result.Value;
+
+ context.ResponseData.Write((ulong)storageTarget);
+ context.ResponseData.Write(requiredSize);
+
+ return ResultCode.Success;
+ }
+
[CommandHipc(30)]
// BeginBlockingHomeButtonShortAndLongPressed()
public ResultCode BeginBlockingHomeButtonShortAndLongPressed(ServiceCtx context)
@@ -517,7 +549,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_gpuErrorDetectedSystemEventHandle);
// NOTE: This is used by "sdk" NSO during applet-application initialization.
- // A seperate thread is setup where event-waiting is handled.
+ // A separate thread is setup where event-waiting is handled.
// When the Event is signaled, official sw will assert.
return ResultCode.Success;