2019-11-14 06:18:44 +01: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 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;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-18 12:16:26 +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);
|
|
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ResultCode GetResult()
|
|
|
|
|
{
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private byte[] BuildResponse()
|
|
|
|
|
{
|
|
|
|
|
UserProfile currentUser = _system.State.Account.LastOpenedUser;
|
|
|
|
|
|
|
|
|
|
using (MemoryStream stream = new MemoryStream())
|
|
|
|
|
using (BinaryWriter writer = new BinaryWriter(stream))
|
|
|
|
|
{
|
|
|
|
|
writer.Write((ulong)PlayerSelectResult.Success);
|
|
|
|
|
|
|
|
|
|
currentUser.UserId.Write(writer);
|
|
|
|
|
|
|
|
|
|
return stream.ToArray();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|