mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-09-10 03:45:24 +00:00
Fix a crash when no controller is connected
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad
|
||||||
|
{
|
||||||
|
struct NpadCondition
|
||||||
|
{
|
||||||
|
#pragma warning disable CS0414 // Field is assigned but its value is never used
|
||||||
|
private uint _00;
|
||||||
|
private uint _04;
|
||||||
|
private NpadJoyHoldType _holdType;
|
||||||
|
private uint _0C;
|
||||||
|
#pragma warning restore CS0414 // Field is assigned but its value is never used
|
||||||
|
|
||||||
|
public static NpadCondition Create()
|
||||||
|
{
|
||||||
|
return new NpadCondition()
|
||||||
|
{
|
||||||
|
_00 = 0,
|
||||||
|
_04 = 1,
|
||||||
|
_holdType = NpadJoyHoldType.Horizontal,
|
||||||
|
_0C = 1,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -52,6 +52,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[FieldOffset(0x3DC00)]
|
[FieldOffset(0x3DC00)]
|
||||||
public RingLifo<DebugMouseState> DebugMouse;
|
public RingLifo<DebugMouseState> DebugMouse;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Pad Condition.
|
||||||
|
/// </summary>
|
||||||
|
[FieldOffset(0x3e200)]
|
||||||
|
public NpadCondition Condition;
|
||||||
|
|
||||||
public static SharedMemory Create()
|
public static SharedMemory Create()
|
||||||
{
|
{
|
||||||
@@ -61,6 +67,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory
|
|||||||
TouchScreen = RingLifo<TouchScreenState>.Create(),
|
TouchScreen = RingLifo<TouchScreenState>.Create(),
|
||||||
Mouse = RingLifo<MouseState>.Create(),
|
Mouse = RingLifo<MouseState>.Create(),
|
||||||
Keyboard = RingLifo<KeyboardState>.Create(),
|
Keyboard = RingLifo<KeyboardState>.Create(),
|
||||||
|
Condition = NpadCondition.Create(),
|
||||||
};
|
};
|
||||||
|
|
||||||
Span<NpadState> npadsSpan = result.Npads.AsSpan();
|
Span<NpadState> npadsSpan = result.Npads.AsSpan();
|
||||||
|
Reference in New Issue
Block a user