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