mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-21 06:15:54 +01:00
f41687f4c1
* Remove a bit of unsafety around * Regenerate StructArrayHelpers with a max element value of 256 * hle: remove unsafe marker from all struct that had it * hle: make SoftwareKeyboardRenderer.TryCopyTo safe * hle: remove unsafety in NpadDevice and remove AllowUnsafeBlocks from csproj * Revert "Regenerate StructArrayHelpers with a max element value of 256" This reverts commit f32a6e5be094f50571970eb1116b65c080781d05. * Introduce ByteArray of various size and use that instead of ArrayXXX to avoid stackoverflow in .NET runtime type resolution * Use ByteArray more * Add some missing spaces on Pack = 1 for various structs * Fix broken logic for TryCopyTo * Address gdkchan's comment * Address gdkchan's comment
58 lines
1.5 KiB
C#
58 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);
|
|
|
|
_system.ReturnFocus();
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
public ResultCode GetResult()
|
|
{
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
private byte[] BuildResponse()
|
|
{
|
|
UserProfile currentUser = _system.AccountManager.LastOpenedUser;
|
|
|
|
using (MemoryStream stream = new MemoryStream())
|
|
using (BinaryWriter writer = new BinaryWriter(stream))
|
|
{
|
|
writer.Write((ulong)PlayerSelectResult.Success);
|
|
|
|
currentUser.UserId.Write(writer);
|
|
|
|
return stream.ToArray();
|
|
}
|
|
}
|
|
}
|
|
}
|