2019-11-13 21:18:44 -08:00
|
|
|
|
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
|
|
|
|
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 03:16:26 -08:00
|
|
|
|
private AppletSession _normalSession;
|
|
|
|
|
private AppletSession _interactiveSession;
|
2019-11-13 21:18:44 -08:00
|
|
|
|
|
|
|
|
|
public event EventHandler AppletStateChanged;
|
|
|
|
|
|
|
|
|
|
public PlayerSelectApplet(Horizon system)
|
|
|
|
|
{
|
|
|
|
|
_system = system;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-01 15:38:13 -07:00
|
|
|
|
public ResultCode Start(AppletSession normalSession, AppletSession interactiveSession)
|
2019-11-13 21:18:44 -08:00
|
|
|
|
{
|
2019-11-18 03:16:26 -08:00
|
|
|
|
_normalSession = normalSession;
|
|
|
|
|
_interactiveSession = interactiveSession;
|
2019-11-13 21:18:44 -08:00
|
|
|
|
|
|
|
|
|
// TODO(jduncanator): Parse PlayerSelectConfig from input data
|
2019-11-18 03:16:26 -08:00
|
|
|
|
_normalSession.Push(BuildResponse());
|
2019-11-13 21:18:44 -08:00
|
|
|
|
|
|
|
|
|
AppletStateChanged?.Invoke(this, null);
|
|
|
|
|
|
2021-04-17 09:57:03 -07:00
|
|
|
|
_system.ReturnFocus();
|
|
|
|
|
|
2019-11-13 21:18:44 -08:00
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ResultCode GetResult()
|
|
|
|
|
{
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private byte[] BuildResponse()
|
|
|
|
|
{
|
2021-04-12 18:16:43 -07:00
|
|
|
|
UserProfile currentUser = _system.AccountManager.LastOpenedUser;
|
2019-11-13 21:18:44 -08:00
|
|
|
|
|
|
|
|
|
using (MemoryStream stream = new MemoryStream())
|
|
|
|
|
using (BinaryWriter writer = new BinaryWriter(stream))
|
|
|
|
|
{
|
|
|
|
|
writer.Write((ulong)PlayerSelectResult.Success);
|
|
|
|
|
|
|
|
|
|
currentUser.UserId.Write(writer);
|
|
|
|
|
|
|
|
|
|
return stream.ToArray();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|