aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services
diff options
context:
space:
mode:
authorAlex Barney <thealexbarney@gmail.com>2020-01-12 04:15:17 -0700
committerThog <me@thog.eu>2020-01-12 12:15:17 +0100
commite348f95495d3af9742010b1e44a2c3d7f30dba1a (patch)
tree4d9afcf3dfc982ab4cd4b6796ad760f4045efc18 /Ryujinx.HLE/HOS/Services
parent9c8d48edff8e43318550a087816542391dffea83 (diff)
Call EnsureApplicationSaveData when launching a game (#871)
* Workaround for the lack of a program registry * Call EnsureApplicationSaveData when launching a game
Diffstat (limited to 'Ryujinx.HLE/HOS/Services')
-rw-r--r--Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs6
-rw-r--r--Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs30
2 files changed, 32 insertions, 4 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs b/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs
index 4962e3ff..686577d7 100644
--- a/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs
+++ b/Ryujinx.HLE/HOS/Services/Arp/ApplicationLaunchProperty.cs
@@ -1,12 +1,10 @@
using Ryujinx.HLE.FileSystem;
-using Ryujinx.HLE.Utilities;
-using System;
namespace Ryujinx.HLE.HOS.Services.Arp
{
class ApplicationLaunchProperty
{
- public long TitleId;
+ public ulong TitleId;
public int Version;
public byte BaseGameStorageId;
public byte UpdateGameStorageId;
@@ -33,7 +31,7 @@ namespace Ryujinx.HLE.HOS.Services.Arp
return new ApplicationLaunchProperty
{
- TitleId = BitConverter.ToInt64(StringUtils.HexToBytes(context.Device.System.TitleId), 0),
+ TitleId = context.Device.System.TitleId,
Version = 0x00,
BaseGameStorageId = (byte)StorageId.NandSystem,
UpdateGameStorageId = (byte)StorageId.None
diff --git a/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs b/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs
index 60f4a3f4..4e967886 100644
--- a/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs
+++ b/Ryujinx.HLE/HOS/Services/Fs/IFileSystemProxy.cs
@@ -133,6 +133,20 @@ namespace Ryujinx.HLE.HOS.Services.Fs
SaveDataCreateInfo createInfo = context.RequestData.ReadStruct<SaveDataCreateInfo>();
SaveMetaCreateInfo metaCreateInfo = context.RequestData.ReadStruct<SaveMetaCreateInfo>();
+ // TODO: There's currently no program registry for FS to reference.
+ // Workaround that by setting the application ID and owner ID if they're not already set
+ if (attribute.TitleId == TitleId.Zero)
+ {
+ attribute.TitleId = new TitleId(context.Process.TitleId);
+ }
+
+ if (createInfo.OwnerId == TitleId.Zero)
+ {
+ createInfo.OwnerId = new TitleId(context.Process.TitleId);
+ }
+
+ Logger.PrintInfo(LogClass.ServiceFs, $"Creating save with title ID {attribute.TitleId.Value:x16}");
+
Result result = _baseFileSystemProxy.CreateSaveDataFileSystem(ref attribute, ref createInfo, ref metaCreateInfo);
return (ResultCode)result.Value;
@@ -196,6 +210,18 @@ namespace Ryujinx.HLE.HOS.Services.Fs
SaveMetaCreateInfo metaCreateInfo = context.RequestData.ReadStruct<SaveMetaCreateInfo>();
HashSalt hashSalt = context.RequestData.ReadStruct<HashSalt>();
+ // TODO: There's currently no program registry for FS to reference.
+ // Workaround that by setting the application ID and owner ID if they're not already set
+ if (attribute.TitleId == TitleId.Zero)
+ {
+ attribute.TitleId = new TitleId(context.Process.TitleId);
+ }
+
+ if (createInfo.OwnerId == TitleId.Zero)
+ {
+ createInfo.OwnerId = new TitleId(context.Process.TitleId);
+ }
+
Result result = _baseFileSystemProxy.CreateSaveDataFileSystemWithHashSalt(ref attribute, ref createInfo, ref metaCreateInfo, ref hashSalt);
return (ResultCode)result.Value;
@@ -208,6 +234,8 @@ namespace Ryujinx.HLE.HOS.Services.Fs
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
+ // TODO: There's currently no program registry for FS to reference.
+ // Workaround that by setting the application ID if it's not already set
if (attribute.TitleId == TitleId.Zero)
{
attribute.TitleId = new TitleId(context.Process.TitleId);
@@ -247,6 +275,8 @@ namespace Ryujinx.HLE.HOS.Services.Fs
SaveDataSpaceId spaceId = (SaveDataSpaceId)context.RequestData.ReadInt64();
SaveDataAttribute attribute = context.RequestData.ReadStruct<SaveDataAttribute>();
+ // TODO: There's currently no program registry for FS to reference.
+ // Workaround that by setting the application ID if it's not already set
if (attribute.TitleId == TitleId.Zero)
{
attribute.TitleId = new TitleId(context.Process.TitleId);