0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2024-10-19 14:21:41 +00:00
ryujinx-fork/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs
Mary f41687f4c1
hle: Make Ryujinx.HLE project entirely safe (#2789)
* 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
2021-11-01 19:38:13 -03:00

65 lines
No EOL
3 KiB
C#

using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
{
struct NpadInternalState
{
public NpadStyleTag StyleSet;
public NpadJoyAssignmentMode JoyAssignmentMode;
public NpadFullKeyColorState FullKeyColor;
public NpadJoyColorState JoyColor;
public RingLifo<NpadCommonState> FullKey;
public RingLifo<NpadCommonState> Handheld;
public RingLifo<NpadCommonState> JoyDual;
public RingLifo<NpadCommonState> JoyLeft;
public RingLifo<NpadCommonState> JoyRight;
public RingLifo<NpadCommonState> Palma;
public RingLifo<NpadCommonState> SystemExt;
public RingLifo<SixAxisSensorState> FullKeySixAxisSensor;
public RingLifo<SixAxisSensorState> HandheldSixAxisSensor;
public RingLifo<SixAxisSensorState> JoyDualSixAxisSensor;
public RingLifo<SixAxisSensorState> JoyDualRightSixAxisSensor;
public RingLifo<SixAxisSensorState> JoyLeftSixAxisSensor;
public RingLifo<SixAxisSensorState> JoyRightSixAxisSensor;
public DeviceType DeviceType;
private uint _reserved1;
public NpadSystemProperties SystemProperties;
public NpadSystemButtonProperties SystemButtonProperties;
public NpadBatteryLevel BatteryLevelJoyDual;
public NpadBatteryLevel BatteryLevelJoyLeft;
public NpadBatteryLevel BatteryLevelJoyRight;
public uint AppletFooterUiAttributes;
public AppletFooterUiType AppletFooterUiType;
private Reserved2Struct _reserved2;
public RingLifo<NpadGcTriggerState> GcTrigger;
public NpadLarkType LarkTypeLeftAndMain;
public NpadLarkType LarkTypeRight;
public NpadLuciaType LuciaType;
public uint Unknown43EC;
[StructLayout(LayoutKind.Sequential, Size = 123, Pack = 1)]
private struct Reserved2Struct {}
public static NpadInternalState Create()
{
return new NpadInternalState
{
FullKey = RingLifo<NpadCommonState>.Create(),
Handheld = RingLifo<NpadCommonState>.Create(),
JoyDual = RingLifo<NpadCommonState>.Create(),
JoyLeft = RingLifo<NpadCommonState>.Create(),
JoyRight = RingLifo<NpadCommonState>.Create(),
Palma = RingLifo<NpadCommonState>.Create(),
SystemExt = RingLifo<NpadCommonState>.Create(),
FullKeySixAxisSensor = RingLifo<SixAxisSensorState>.Create(),
HandheldSixAxisSensor = RingLifo<SixAxisSensorState>.Create(),
JoyDualSixAxisSensor = RingLifo<SixAxisSensorState>.Create(),
JoyDualRightSixAxisSensor = RingLifo<SixAxisSensorState>.Create(),
JoyLeftSixAxisSensor = RingLifo<SixAxisSensorState>.Create(),
JoyRightSixAxisSensor = RingLifo<SixAxisSensorState>.Create(),
GcTrigger = RingLifo<NpadGcTriggerState>.Create(),
};
}
}
}