Fix a crash when no controller is connected

This commit is contained in:
LotP1
2025-09-04 01:18:29 +02:00
committed by GreemDev
parent 91f5247e7f
commit f3953c6039
2 changed files with 30 additions and 0 deletions

View File

@@ -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,
};
}
}
}

View File

@@ -52,6 +52,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory
/// </summary>
[FieldOffset(0x3DC00)]
public RingLifo<DebugMouseState> DebugMouse;
/// <summary>
/// Pad Condition.
/// </summary>
[FieldOffset(0x3e200)]
public NpadCondition Condition;
public static SharedMemory Create()
{
@@ -61,6 +67,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();