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