Call EnsureApplicationSaveData when launching a game (#871)

* Workaround for the lack of a program registry

* Call EnsureApplicationSaveData when launching a game
This commit is contained in:
Alex Barney 2020-01-12 04:15:17 -07:00 committed by Thog
parent 9c8d48edff
commit e348f95495
5 changed files with 85 additions and 14 deletions

View file

@ -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

View file

@ -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);