Download

SDL2InputDevice: Simple Direct-Media Layer 2.0 API for Joystick & Controller Support [UPDATED 1.1]

ForumPost.jpg](filedata/fetch?id=1834559&d=1605924518)

SDL2InputDevice provides a new UE4 input device that utilizes the Simple DirectMedia Layer (SDL2) library. This device can then be used to access or provide more advanced functionality than what is available in the engine by default. It was designed from the start to be as transparent to UE4 as possible. SDL2InputDevice is as its namesake suggests a new input device. This solution means that input is passed into the various game systems of UE4 through the existing input pipeline. With SDL2InputDevice, there is no need for hacky blueprint glue code or special processing

Marketplace Link: https://www.unrealengine.com/marketp…d2b133e777a5e6

Features:

  • Low level joystick and Game Controller support including all of the SDL2 Game Controller mappings
  • Supports more than 4 controllers in a single session
  • Utilizes the the existing UE4 input subsystem

Code Modules: (Please include a full list of each Plugin module and their module type (Runtime, Editor etc.))

  • SDL2InputDevice

Number of Blueprints: 1 Blueprint Function Library with 9 functions

Number of C++ Classes: 2

Network Replicated: Yes

Supported Development Platforms: Win32, Win64

Supported Target Build Platforms: Win32, Win64

Example Projects: JoeWilcox-WisEngineering (Joe Wilcox) · GitHub
Documentation: https://www.wisengineering.com/downl…umentation.pdf


Version 1.1 Now Available

12/16/2020

  • Added 4.24 and 4.26 support
  • Fixed a crash due to not handling the center position of the hat on a joystick
  • Reorganized the input binds to start a 0 instead of 1
  • Fixed RawSDL2Input binds showing up as Keyboard
  • Fixed a possible crash if the plugin can’t convert an SDL key to a UE4 key
  • Moved some logging to VeryVerbose
  • Added a dead zone for SDL axis devices
  • Fixed hat direction not being properly tracked in all cases

I got my hands on the new xbox series x controller and it crashes the project when pressing its xbox button (using the example project)

Sorry about that. It’s a left over bug from when I pulled the code out of the project it was originally used it. The system button doesn’t have a UE4 GamepdKey equivalent because typically the OS doesn’t pass that through. If you are familar with C++ you can apply a quick fix by making the following change to FSDL2InputDevice::GameControllerButton() in SDL2InputDevice.cpp:

Change:



FName UE4KeyName = SDL_GameControllerConversionTable.Contains(ButtonID) ? SDL_GameControllerConversionTable[ButtonID] : NAME_None;


to



FName UE4KeyName = SDL_GameControllerConversionTable.Contains(ButtonID) ? SDL_GameControllerConversionTable[ButtonID] : NAME_None;
if (UE4KeyName == NAME_None) return;


That will quick out if there isn’t a translation key. If you’re blueprint only, I’ll try to push a new version as quick as I can.

We have released version 1.1. This has some critical bug fixes that you’ll want if you are trying to use the plugin for non-game controller support. I’ve also released a new example project to our github page that is more flight-stick focused.

How do I uh… use a t16000m with this? I downloaded and installed the plugin, then tried using your flight stick demo and I was told by Unreal that the 4.25.3 is incompatible with the uproject file.

Is just want to rotate a cube using the flight stick at this point.

Cannot copy while packing

Failed to copy D:\hoevo_vehicle\Hoevo_Vehicle\Plugins\SDL2InputDevice\GameControllerDatabase\SDLControllerMappings.dat to D:\hoevo_vehicle\Hoevo_Vehicle\Saved\StagedBuilds\WindowsNoEditor\Hoevo_Vehicle\Plugins\SDL2InputDevice\GameControllerDatabase\SDLControllerMappings.dat

I just tested the plugin with 4.25.4 which is the last 4.25 version and it worked fine. You can try changing the “EngineVersion” value in the uplugin to just 4.25 and see if it clears up the notice. As for how to use it with a t16000m it should just work with RawInput. Check the examples.

@qtdshwg what engine version and I assume you’re using the latest build?

Hmmm. Couldn’t get it working. I tried axis 0 - 7, got nothing. Maybe I’m missing something…