anegostudios / VintageStory-Issues

Vintage Story's public issue tracker for reporting bugs, crashes and the like
46 stars 16 forks source link

Game crashing when game pads or similar are plugged in #405

Closed tyronx closed 4 years ago

tyronx commented 4 years ago

Reported by a user through a support ticket

Running on 64 bit Windows with 32 GB RAM
Version: v1.12.5 (Stable)03.03.2020 08:30:31: Critical error occurred
System.ArgumentOutOfRangeException: Das angegebene Argument liegt außerhalb des gültigen Wertebereichs.
Parametername: button
   bei OpenTK.Input.JoystickState.SetButton(Int32 button, Boolean value)
   bei OpenTK.Platform.Windows.WinRawJoystick.QueryDeviceCaps(Device stick)
   bei OpenTK.Platform.Windows.WinRawJoystick.RefreshDevices()
   bei OpenTK.Platform.Windows.WinRawJoystick..ctor(IntPtr window)
   bei OpenTK.Platform.Windows.WinRawInput.CreateDrivers()
   bei OpenTK.Platform.Windows.WinInputBase.ProcessEvents()
   bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   bei System.Threading.ThreadHelper.ThreadStart()
-------------------------------

My Game crashed when i click on Vintagestory.exe

tyronx commented 4 years ago

Most likely caused by a physical or virtual game controller connected to the system

tyronx commented 4 years ago

Update: Cannot reproduce by installing vJoy, which is the game controller (emulator) installed at this users machine.

Bloodsaw commented 4 years ago

How are the steps for reproduction? Plug-In while game is already running?

I could test it with Xbox 360, PS2, PS4, xbox one (1st generation) and xbox elite (1st generation).

tyronx commented 4 years ago

I managed to fix it, actually. Repro steps are installing vJoy and configuring a joystick with button quantity above 64.

I've added some exception catching code into OpenTK so it no longer crashese, but instead ignores the joystick.