Joystick support via SDL2 library?

Hi,
this is not so complicated.

clone the repository: GitHub - tsky1971/UEJoystickPlugin: Unofficial Joystick Plugin for the Unreal Engine
checkout branch 4.11 (if binary api not changed there are compiled dll´s)
copy the content to your project -> be sure your project has source and vs project before copy

if you want to recompile run: (E:\Unreal Projects\JoystickDemo411\Plugins\JoystickPlugin\ThirdParty\SDL2) setup and build (if your system has all dependencies (directx, winsdk etc.) it will say success at the end)

Here is a complete project.
I did not make action bindings. So no action with joystick. I use this plugin in my lab projects nearly every day… so it works.

Here is a compiled version Plugin only.

tsky

Hi,

This plugin is great, and I’m able to use it in 4.11 but only in the editor. Like mentioned before, packaging does not include the SDL dll on Windows so one has to manually copy it over.

Have there been any developments on statically linking on Windows? so copying the DLL is not necessary?

I get


unresolved external symbol _purecall

errors when I switch the bool at the top of the JoystickPlugin.Build.cs file. Is this the same issue from before?

Thanks.

Hi,
as we never publish games i never solve this issue. If i had to deploy an version i do copy the sdl.dll to the place where the game executable is placed. This should solve the problem. See in my demo deployment.

tsky

PS: If someone would dive into the .build.cs file this can perhaps be solved in a better way :wink:

Hi!

After you had packaged the game, what file do you need to copy over to the packaged file?

Thank you

Yes, I tried that some time ago, but if I remember correctly I had to build SDL myself with static linking support. Only then will the switch in the build file work. You should be able to use the .dll and .lib I included in this commit: Link SDL statically to avoid need to copy dll to output dir · SamPersson/UEJoystickPlugin@4e15a01 · GitHub

Hi,
normally i only have to copy the sdl.dll into the WindowsNoEditor-Directory.
T.

Hi tsky!

Correct me if I am wrong , I am supposed to copy and paste sdl2.dll into (C:\Users
g\Desktop\mygame\New folder\WindowsNoEditor\MyProject2\Binaries\Win32) right ?

If yes, I cannot move it with my joystick . Do you have any idea ?

Thank you!

Hi samiljam !

I not very familiar with the method you had mention. I am still very new to programming, Do you mind guiding me how to do it ?

Thank you !

Hi,
hmm as i wrote before: it should be the “WindowsNoEditor” Directory.
WindowsEditor.PNG
You point out an Win32 directory, so be carefully i only use 64bit. So there is no precompiled version of sdl nor joystickplugin in my github. May be there is your error. Look in the demos i posted here in the thread to get a working example.

T.

Wow that totally worked. Thanks a bunch!

Hi, tsky !

For some reason after I close everything and start the exe file again then it works.

Anywhere thank a lot !

Does this plugin work with Thrustmaster Warthog Hotas? I can not seem to get the axis bindings.

Hmm,

if you mean this: http://www.thrustmaster.com/de_DE/produkte/hotas-warthog i have to say thats the same i use in our lab and the plugins works well til UE 4.13. If i can (have time), i will check this next week. I have to update the binaries for newer versions.

t.

Update:
Update all binaries for UE 4.15+ for Plattform Windows (32,64).
Test with Thrustmaster HOTAS was ok. I got all all axis and buttons from joystick and throttle.
hotas.PNG
If you need a Demo Project with configured plugins send me an PM.

t.

Thanks, it works. Just need to be able to choose a device. That the first player would use one joystick, and the second player would use the other. How to do it?

Why did they do this? What would appear in the list of all connected devices that they would have different names.

Безымянный34.png and Безымянный34.png

If you connect two identical devices, they will work as one. Please correct.

To write a correctly working program you need to know the names of all the existing joysticks in the world? What would be possible to specify them in the input settings?

Correct, that’s the controller I am talking about.

The problem is, stick and throttle inputs are not received when the game is run in new editor window. When I run over the stanalone game option, inputs are received just fine. This same problem also occurs on Logitech 3D Extreme stick.

I answered my own question. How to connect two or more joysticks to the project. One character can be controlled by one joystick, the second character by another. The name of the joystick is not needed. Specify only the port number.Thank you for the plugin

I know this is old, but, head’s up - I created a PR so that multiple devices of the same type will show up as separate controllers now:

It just makes it a lot easier to work with this way.

Untitled1.jpg

Here is a new version for tests with 4.25.3

Only recompiled. No further updates.

One manual step is to do for own deployments: copy sdl2.dll to binaries directory.

Quick question, I’m using this plugin to add DualShock 4 and DualSense support, and I’m wondering how I would go about adjusting the deadzones and such for the triggers and analog sticks.
It seems like they go beyond -1 and 1, while being still doesn’t produce 0.

EDIT:

Here’s a video showing what I mean. Something is really off about the analog stick movement and triggers.

https://streamable.com/3fklql