Phase 6 updates

Phase 6 · Slice 55 ·

Real controllers

  • crates/script_host/src/controllers.rs reads connected controllers with gilrs (XInput and Windows.Gaming.Input on Windows, evdev, IOKit) once a frame for managed code (ControllersFetch, API 52): a controller whose layout gilrs knows (an SDL mapping, or one Windows.Gaming.Input reads as a gamepad, which gilrs marks with a nil UUID; gilrs's own mapping source can't tell, it says Driver for every device) is a gamepad, its buttons and axes in a fixed order; others are joysticks, raw. A joystick that's a gamepad's raw HID view (same vendor and product) is skipped: Windows lists such a pad twice.
  • The Input System adds a Gamepad or Joystick for each, with its product name as description.product, and removes it when it goes; gamepad sticks go through Unity's default dead zone (0.125 to 0.925), joysticks' first axes are the stick and first button the trigger.
  • Legacy Input: KeyCode.JoystickButton0-19 and Joystick1-8Button0-19, key names "joystick button 0" and "joystick 1 button 0", Input Manager joystick axes (axis and joyNum, dead zone, invert) numbered as Unity numbers an XInput pad on Windows (X and Y the left stick, the 3rd the triggers, 4th and 5th the right stick, 6th and 7th the d-pad, 9th and 10th the triggers alone), GetJoystickNames; a new project's joystick entries in the default axes (Horizontal and Vertical, Fire1-3, Jump, Submit, Cancel).
  • Hosts add virtual controllers (ScriptHost::input_controller); MCP's play_step takes input.gamepad (buttons held and tapped, sticks, triggers), and its sessions, conformance runs and benchmarks don't read the machine's controllers, so they stay deterministic. Checked by the e2e test a_virtual_gamepad_rolls_the_ball_and_reads_as_a_controller; on this machine an Xbox 360 pad reads as a Gamepad and a 3Dconnexion SpaceNavigator as a Joystick.
  • Fixed in passing: abi_layouts_are_stable (ColliderDesc is 96 bytes since the layer overrides).
  • Next: rumble (SetMotorSpeeds) and controller-specific layouts (DualShock, Switch Pro); URP render features; humanoid avatars and retargeting.