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