mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-20 09:41:14 +02:00
Fix a crash when no controller is connected
Co-authored-by: LotP1 <68976644+LotP1@users.noreply.github.com>
(cherry picked from commit 1a1fe53535)
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory
|
||||
[FieldOffset(0x9A00)]
|
||||
public Array10<NpadState> Npads;
|
||||
|
||||
/// <summary>
|
||||
/// Pad Condition.
|
||||
/// </summary>
|
||||
[FieldOffset(0x3e200)]
|
||||
public NpadCondition Condition;
|
||||
|
||||
public static SharedMemory Create()
|
||||
{
|
||||
SharedMemory result = new()
|
||||
@@ -54,6 +60,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory
|
||||
TouchScreen = RingLifo<TouchScreenState>.Create(),
|
||||
Mouse = RingLifo<MouseState>.Create(),
|
||||
Keyboard = RingLifo<KeyboardState>.Create(),
|
||||
Condition = NpadCondition.Create(),
|
||||
};
|
||||
|
||||
Span<NpadState> npadsSpan = result.Npads.AsSpan();
|
||||
|
||||
Reference in New Issue
Block a user