2023-03-17 13:14:50 +01:00
|
|
|
|
using Ryujinx.Common.Memory;
|
|
|
|
|
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
2019-11-14 06:18:44 +01:00
|
|
|
|
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Applets
|
|
|
|
|
{
|
|
|
|
|
internal class PlayerSelectApplet : IApplet
|
|
|
|
|
{
|
|
|
|
|
private Horizon _system;
|
|
|
|
|
|
2019-11-18 12:16:26 +01:00
|
|
|
|
private AppletSession _normalSession;
|
|
|
|
|
private AppletSession _interactiveSession;
|
2019-11-14 06:18:44 +01:00
|
|
|
|
|
|
|
|
|
public event EventHandler AppletStateChanged;
|
|
|
|
|
|
|
|
|
|
public PlayerSelectApplet(Horizon system)
|
|
|
|
|
{
|
|
|
|
|
_system = system;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-01 23:38:13 +01:00
|
|
|
|
public ResultCode Start(AppletSession normalSession, AppletSession interactiveSession)
|
2019-11-14 06:18:44 +01:00
|
|
|
|
{
|
2019-11-18 12:16:26 +01:00
|
|
|
|
_normalSession = normalSession;
|
|
|
|
|
_interactiveSession = interactiveSession;
|
2019-11-14 06:18:44 +01:00
|
|
|
|
|
|
|
|
|
// TODO(jduncanator): Parse PlayerSelectConfig from input data
|
2019-11-18 12:16:26 +01:00
|
|
|
|
_normalSession.Push(BuildResponse());
|
2019-11-14 06:18:44 +01:00
|
|
|
|
|
|
|
|
|
AppletStateChanged?.Invoke(this, null);
|
|
|
|
|
|
2021-04-17 18:57:03 +02:00
|
|
|
|
_system.ReturnFocus();
|
|
|
|
|
|
2019-11-14 06:18:44 +01:00
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ResultCode GetResult()
|
|
|
|
|
{
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private byte[] BuildResponse()
|
|
|
|
|
{
|
2021-04-13 03:16:43 +02:00
|
|
|
|
UserProfile currentUser = _system.AccountManager.LastOpenedUser;
|
2019-11-14 06:18:44 +01:00
|
|
|
|
|
2023-03-17 13:14:50 +01:00
|
|
|
|
using (MemoryStream stream = MemoryStreamManager.Shared.GetStream())
|
2019-11-14 06:18:44 +01:00
|
|
|
|
using (BinaryWriter writer = new BinaryWriter(stream))
|
|
|
|
|
{
|
|
|
|
|
writer.Write((ulong)PlayerSelectResult.Success);
|
|
|
|
|
|
|
|
|
|
currentUser.UserId.Write(writer);
|
|
|
|
|
|
|
|
|
|
return stream.ToArray();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|