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