ee81ab547e
* am: Initial swkbd implementation Currently only implements the full screen keyboard, inline keyboard will come later. * Remove unnecessary logging * Miscellaneous tidy up * am: Always pop incoming interactive session data * am: Add a reminder to implement the full config struct * am: Check for a max length of zero We should only limit/truncate text when the max length is set to a non-zero value. * Add documentation * am: Return IStorage not available when queue is empty We should be returning the appropriate error code when the FIFO is empty, rather than just throwing an exception and killing the emulator. * Fix typo * Code style changes
56 lines
1.5 KiB
C#
56 lines
1.5 KiB
C#
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;
|
|
|
|
private AppletSession _normalSession;
|
|
private AppletSession _interactiveSession;
|
|
|
|
public event EventHandler AppletStateChanged;
|
|
|
|
public PlayerSelectApplet(Horizon system)
|
|
{
|
|
_system = system;
|
|
}
|
|
|
|
public ResultCode Start(AppletSession normalSession,
|
|
AppletSession interactiveSession)
|
|
{
|
|
_normalSession = normalSession;
|
|
_interactiveSession = interactiveSession;
|
|
|
|
// TODO(jduncanator): Parse PlayerSelectConfig from input data
|
|
_normalSession.Push(BuildResponse());
|
|
|
|
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();
|
|
}
|
|
}
|
|
}
|
|
}
|