2023-03-17 12:14:50 +00:00
|
|
|
|
using Ryujinx.Common.Memory;
|
|
|
|
|
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
2020-02-02 03:24:17 +00:00
|
|
|
|
using System.IO;
|
2018-06-02 22:46:09 +00:00
|
|
|
|
|
2019-09-19 00:45:11 +00:00
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.Storage
|
2018-06-02 22:46:09 +00:00
|
|
|
|
{
|
|
|
|
|
class StorageHelper
|
|
|
|
|
{
|
|
|
|
|
private const uint LaunchParamsMagic = 0xc79497ca;
|
|
|
|
|
|
2020-02-02 03:24:17 +00:00
|
|
|
|
public static byte[] MakeLaunchParams(UserProfile userProfile)
|
2018-06-02 22:46:09 +00:00
|
|
|
|
{
|
2019-07-02 02:39:22 +00:00
|
|
|
|
// Size needs to be at least 0x88 bytes otherwise application errors.
|
2023-03-17 12:14:50 +00:00
|
|
|
|
using (MemoryStream ms = MemoryStreamManager.Shared.GetStream())
|
2018-06-02 22:46:09 +00:00
|
|
|
|
{
|
2018-12-06 11:16:24 +00:00
|
|
|
|
BinaryWriter writer = new BinaryWriter(ms);
|
2018-06-02 22:46:09 +00:00
|
|
|
|
|
2018-12-06 11:16:24 +00:00
|
|
|
|
ms.SetLength(0x88);
|
2018-06-02 22:46:09 +00:00
|
|
|
|
|
2018-12-06 11:16:24 +00:00
|
|
|
|
writer.Write(LaunchParamsMagic);
|
2019-09-19 00:45:11 +00:00
|
|
|
|
writer.Write(1); // IsAccountSelected? Only lower 8 bits actually used.
|
2020-02-02 03:24:17 +00:00
|
|
|
|
userProfile.UserId.Write(writer);
|
2018-06-02 22:46:09 +00:00
|
|
|
|
|
2018-12-06 11:16:24 +00:00
|
|
|
|
return ms.ToArray();
|
2018-06-02 22:46:09 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|