This plugin uses SDL2 functions to get input instead of DirectInput.
Thank you Ikarus76 and samiljan for the good working basis. My implementation is a bit hacky, but I did not have much exercise and UE 4 is not easy. I was free and did everything so adjusted as I need it for my lab projects.
Status: Sam Persson did code review, polishing and adding hotplug functionality.
Links for Software needed to compile the plugin:
Windows:
Compiling SDL2 with Visual C++ 2015 is a painful process. Compiling with the Dynamic or Static library will do. But I am not able get the static version linked to my plugin at the moment, so for now I am using the dynamically linked (DLL) version.
- Clone the repository branch 4.11 for UE4 version 4.11 (Or whichever is applicable)
- If the binary versions in repo are older, please consult the following steps. I put compiled versions for 4.10.1 in the repository.
- Go to Plugins/JoystickPlugin/ThirdParty/SDL2
- If you are doing this for the first time, run setup.bat. This will download the latest Mercurial branch source of SDL2.
- Run build.bat to build the latest version of SDL2. This batch-files will copy the binaries to the bin directory of the plugin.
- If you have installed CMake, Visual Studio 2013 or 2015, DirectX SDK Jun2010, the Windows 8.1/10 SDK and have built the SDL2 code, you should get SDL2 files in the SDL2/Lib directory.
- You should have an UE4 Project (your project) with C++ Sources. If you do not have C++ sources, then create a Dummy Class. This will create an Visual Studio Project (to recreate: File -> Refresh Visual Studio Project). Once you have created a Class, the Visual Studio Editor comes up, the Editor initiates compiling in background. Now you can close VS and UE4 Editor.
- Copy the Plugins-Directory you checked out to your project. The Plugins folder should be in the root of the project. Refresh the Visual Studio Project files: File -> Refresh Visual Studio Project.
- Open the UE4 Project and be sure you have activated the JoystickPlugin.
Now you can map Inputs to Joystick devices in Project Settings. (Engine->Input)
Here is a Test Project using the Third-Person Template: Download Here is an minimal demo project: Download
(TODO: test on fresh install systems (maybe I forgot something))
- Go to Engine/Source/ThirdParty/SDL2
- Call build.sh
- Ensure SDL2 has built successfully.
- Copy (or Link <- Symlinks seems not to work?!) the JoystickPlugin into /Engine/Plugins (result -> UnrealEngine/Engine/Plugins/JoystickPlugin)
- ./GenerateProjectFiles.sh to create the makefile which compiles the JoystickPlugin with the whole engine
- Compile
- Start editor and enable the JoystickPlugin
- If you have a compiled version of the plugin, you can copy/move the JoysticlPlugin directory to the project's plugins directory you want to use it.
A first howto video to show how it should work.YouTube