stride3d / stride3d/stride

[Input] Direct input controller OutOfRange

Open
#678 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-GameStudio area-Input bug
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
2d 17h
Merged PRs (30d)
49

Description

This has been worked around through #696 , leaving this open until someone more knowledgeable about direct input comes around to clarify this stuff / fix it.

Release Type: Launcher

Version: 4.0

Platform(s): Windows, build and editor

Describe the bug
Exceptions are being thrown in GameControllerDirectInput.cs's update

To Reproduce
Steps to reproduce the behavior:

  1. Generate 'New Game' template.
  2. Connect non-standard direct input USB device.

Expected behavior
Append input from DI devices successfully.

Screenshots
image

Log and callstacks

Exception: IndexOutOfRangeException: Index was outside the bounds of the array.
   at Stride.Input.GameControllerDirectInput.Update(List`1 inputEvents)
   at Stride.Input.InputManager.Update(GameTime gameTime)
   at Stride.Games.GameSystemCollection.Update(GameTime gameTime)
   at Stride.Editor.EditorGame.Game.EditorServiceGame.Update(GameTime gameTime)
   at Stride.Games.GameBase.InitializeBeforeRun()
   at Stride.Games.GamePlatform.OnInitCallback()
   at Stride.Games.GameWindowWinforms.Run()
   at Stride.Games.GameBase.Run(GameContext gameContext)
   at Stride.Assets.Presentation.AssetEditors.GameEditor.Services.EditorGameController`1.SceneGameRunThread()
   at Stride.Core.Diagnostics.SafeAction.<>c__DisplayClass1_0.<Wrap>b__0()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
[SceneEditorGame]: Error: Unexpected exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Stride.Input.GameControllerDirectInput.Update(List`1 inputEvents)
   at Stride.Input.InputManager.Update(GameTime gameTime)
   at Stride.Games.GameSystemCollection.Update(GameTime gameTime)
   at Stride.Editor.EditorGame.Game.EditorServiceGame.Update(GameTime gameTime)
   at Stride.Games.GameBase.InitializeBeforeRun()
[SafeAction]: Fatal: Unexpected exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Stride.Input.GameControllerDirectInput.Update(List`1 inputEvents)
   at Stride.Input.InputManager.Update(GameTime gameTime)
   at Stride.Games.GameSystemCollection.Update(GameTime gameTime)
   at Stride.Editor.EditorGame.Game.EditorServiceGame.Update(GameTime gameTime)
   at Stride.Games.GameBase.InitializeBeforeRun()
   at Stride.Games.GamePlatform.OnInitCallback()
   at Stride.Games.GameWindowWinforms.Run()
   at Stride.Games.GameBase.Run(GameContext gameContext)
   at Stride.Assets.Presentation.AssetEditors.GameEditor.Services.EditorGameController`1.SceneGameRunThread()
   at Stride.Core.Diagnostics.SafeAction.<>c__DisplayClass1_0.<Wrap>b__0()

Additional context
Initially brought up here https://github.com/stride3d/stride/issues/673#issuecomment-621101365
More context from @tre4b

I have a foot controller, 3 button USB device. Unplugged that and it all worked.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at sources/engine/Stride.Input/Windows/GameControllerDirectInput.cs around line 142 and review the Update call in the supplied stack trace, then read the workaround in issue #696. Reproduce with a non-standard DirectInput USB device on Windows; done means the device input is appended successfully without an IndexOutOfRangeException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.