Search code examples
javainputlibgdxjoystick

Libgdx 1.2.0 controllers extensions crash


I just recently updated to the newest Libgdx and set up my project with Gradle. Everything else seems to be working but I encountered a problem when attempting to add controller support to my game. When I attempt to get the controller or do anything with the Controller object the game crashes and presents this error.

Error creating joystick: Win32JoyStick::_initialize() >> failed to set cooperation level!
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000068904483, pid=2248, tid=716
#
# JRE version: Java(TM) SE Runtime Environment (8.0_11-b12) (build 1.8.0_11-b12)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.11-b03 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [gdx-controllers-desktop64.dll+0x4483]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
AL lib: (EE) alc_cleanup: 1 device not closed

I see all of the controller dependencies in the project folder for Android/Desktop and specified that I wanted to use the controller extension when setting up the Gradle project. I am using a PS3 controller and it works fine in other games.

Anyone have any ideas?

EDIT: Just tried with a PS2 controller and a USB adapter (not using the xbox360 drivers). Same issue with the crash.


Solution

  • Fixed by changing my DesktopLauncher class to not use my custom JFrame to display the game. You can see more information on why I changed this in the first place: https://stackoverflow.com/a/21731002/487578

    This means I'll need to find an alternative way to solve my other problem..but I guess controller support is far more important than a small bug.