mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-10-02 18:28:53 +02:00
Fix a crash when no controller is connected
Co-authored-by: LotP1 <68976644+LotP1@users.noreply.github.com>
This commit is contained in:
committed by
KeatonTheBot
co-authored by
LotP1
parent
47e55acf21
commit
1a1fe53535
@@ -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)]
|
[FieldOffset(0x9A00)]
|
||||||
public Array10<NpadState> Npads;
|
public Array10<NpadState> Npads;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Pad Condition.
|
||||||
|
/// </summary>
|
||||||
|
[FieldOffset(0x3e200)]
|
||||||
|
public NpadCondition Condition;
|
||||||
|
|
||||||
public static SharedMemory Create()
|
public static SharedMemory Create()
|
||||||
{
|
{
|
||||||
SharedMemory result = new()
|
SharedMemory result = new()
|
||||||
@@ -54,6 +60,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