Skip to content

Commit 2287ab2

Browse files
Merge branch 'develop' into isxb-483-touchsimulation-playerinput-fix
2 parents 5613965 + 3a96dac commit 2287ab2

File tree

4 files changed

+50
-8
lines changed

4 files changed

+50
-8
lines changed

Assets/Tests/InputSystem/CoreTests_Devices.cs

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4162,13 +4162,40 @@ public void Devices_RemovingAndReaddingDevice_DoesNotAllocateMemory()
41624162
recorder.CollectFromAllThreads();
41634163
#endif
41644164

4165-
// We expect a single allocation for each call to ReportNewInputDevice when there is one disconnected device
4166-
//
4167-
int numberOfRepeats = 2;
4168-
int numberOfDisconnectedDevices = 1;
4169-
int numberOfCallsToReportNewInputDevicePerRun = 2;
4170-
int expectedAllocations = numberOfRepeats * numberOfDisconnectedDevices * numberOfCallsToReportNewInputDevicePerRun;
4171-
Assert.AreEqual(expectedAllocations, recorder.sampleBlockCount);
4165+
// No allocations are expected.
4166+
Assert.AreEqual(0, recorder.sampleBlockCount);
4167+
}
4168+
4169+
// Regression test to cover having null descriptor fields for a device. Some non-desktop gamepad device types do this.
4170+
[Test]
4171+
[Category("Devices")]
4172+
public void Devices_RemovingAndReaddingDeviceWithNullDescriptorFields_DoesNotThrow()
4173+
{
4174+
// InputDeviceDescription.ToJson writes empty string fields and not null values, whereas reporting a device via an incomplete description string will fully omit the fields.
4175+
string description = @"{
4176+
""type"": ""Gamepad"",
4177+
""product"": ""TestProduct""
4178+
}";
4179+
4180+
var deviceId = runtime.ReportNewInputDevice(description);
4181+
InputSystem.Update();
4182+
4183+
// "Unplug" device.
4184+
var removeEvent1 = DeviceRemoveEvent.Create(deviceId);
4185+
InputSystem.QueueEvent(ref removeEvent1);
4186+
InputSystem.Update();
4187+
4188+
// "Plug" it back in.
4189+
deviceId = runtime.ReportNewInputDevice(description);
4190+
InputSystem.Update();
4191+
4192+
// Repeat that sequence.
4193+
var removeEvent2 = DeviceRemoveEvent.Create(deviceId);
4194+
InputSystem.QueueEvent(ref removeEvent2);
4195+
InputSystem.Update();
4196+
4197+
runtime.ReportNewInputDevice(description);
4198+
InputSystem.Update();
41724199
}
41734200

41744201
[Test]

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@ however, it has to be formatted properly to pass verification tests.
1010

1111
## [Unreleased] - yyyy-mm-dd
1212

13+
### Fixed
14+
- Fixed `NullReferenceException` from disconnecting and reconnecting a GXDKGamepad.
15+
1316
### Added
1417
- Added the display of the device flag `CanRunInBackground` in device debug view.
1518
- Added analytics for programmatic `InputAction` setup via `InputActionSetupExtensions` when exiting play-mode.
1619

20+
### Fixed
21+
- Fixed wrong mapping of Xbox Series S|X and Xbox One wireless controllers "View" button on macOS.[ISXB-385](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-385)
22+
1723
## [1.11.1] - 2024-09-26
1824

1925
### Fixed

Packages/com.unity.inputsystem/InputSystem/InputManager.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2562,6 +2562,15 @@ private JsonParser.JsonString MakeEscapedJsonString(string theString)
25622562
// To avoid a very costly escape-skipping character-by-character string comparison in JsonParser.Json.Equals() we
25632563
// reconstruct an escaped string and make an escaped JsonParser.JsonString and use that for the comparison instead.
25642564
//
2565+
if (string.IsNullOrEmpty(theString))
2566+
{
2567+
return new JsonParser.JsonString
2568+
{
2569+
text = string.Empty, // text should be an empty string and not null for consistency on property comparisons
2570+
hasEscapes = false
2571+
};
2572+
}
2573+
25652574
var builder = new StringBuilder();
25662575
var length = theString.Length;
25672576
var hasEscapes = false;

Packages/com.unity.inputsystem/InputSystem/Plugins/XInput/XboxGamepadMacOS.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ internal struct XInputControllerWirelessOSXState : IInputStateTypeInfo
111111
public enum Button
112112
{
113113
Start = 11,
114-
Select = 16,
114+
Select = 10,
115115
LeftThumbstickPress = 13,
116116
RightThumbstickPress = 14,
117117
LeftShoulder = 6,

0 commit comments

Comments
 (0)