Announcement

Collapse
No announcement yet.

Joystick support via SDL2 library ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Originally posted by tsky View Post
    Before someone complains : Did you recompile the code ? In the file "InputSettingsCustomization.cpp " in line 68 and 185 : I had to add toString(), because of complaints of the compiler.
    Ohh, it seems this was recently changed in UE - I only tried this with UE 4.7 Preview.
    That's the danger when poking around in internal code I guess, it's much less stable. Maybe there is a workaround that compiles both on 4.6 and 4.7?

    Comment


      #17
      If we had the Engine Source available then we could use:

      #if ENGINE_MINOR_VERSION<7
      StructBuilder.AddChildContent(LOCTEXT("KeySearchStr", "Key"))
      #else
      StructBuilder.AddChildContent(LOCTEXT("KeySearchStr", "Key").ToString())
      #endif

      =8-O

      But it´s an "workaround" that seems to work -> only with engine source.

      Comment


        #18
        I made a simple workaround for now - a wrapper class that calls ToString if needed

        tsky, a suggestion: if you add my repo as a git remote and merge into your branch the commit history won't get lost.
        Something like this:
        Code:
        // Only once
        git remote add samiljan https://github.com/samiljan/UEJoystickPlugin.git
        
        // Fetch and merge new commits into the current branch
        git fetch samiljan
        git merge samiljan/IInputDeviceModule

        Comment


          #19
          ok this solution works and ist much nicer as the #if style.

          repos: I normally not use github, because i am running my own servers (no remotes to github etc.). Now i change my working style and use remotes on github too. ;-)

          Comment


            #20
            Originally posted by tsky View Post
            ok this solution works and ist much nicer as the #if style.

            repos: I normally not use github, because i am running my own servers (no remotes to github etc.). Now i change my working style and use remotes on github too. ;-)
            I'm no git expert, I just learned how merge from another remote the other day and wanted to share
            All these branches and forks of this plugin has forced me to learn a lot, it's great! And you have to admit github is great for sharing code!

            Comment


              #21
              Has anyone modified the JoystickPlugin.Build.cs so that Linux and Mac builds do not require system installs of SDL2?
              Descent: Underground |

              Comment


                #22
                You guys are the best. My NES USB controller is working with UE4.

                Comment


                  #23
                  Originally posted by Stormwind View Post
                  Has anyone modified the JoystickPlugin.Build.cs so that Linux and Mac builds do not require system installs of SDL2?
                  Hi,
                  theoretically you can try this:

                  Code:
                  JoystickPlugin.Build.cs
                  line 106
                                          else if (Target.Platform == UnrealTargetPlatform.Linux)
                  			{			
                  				PublicAdditionalLibraries.Add(Path.Combine(ThirdPartyPath, "SDL2", "Lib", "Linux", "SDL2"));
                  				//tsky PublicAdditionalLibraries.Add("SDL2");
                  			}
                  I try to add the SDL2 linux files in a couple of days to my github branch. At this time i got this error while linking :

                  Code:
                  Distributing 2 actions to XGE
                  Performing 2 actions (8 in parallel)
                  [1/2] Link libUE4Editor-JoystickPlugin.so
                  /usr/bin/ld: ld: wcsrtombs.c:99: __wcsrtombs: Zusicherung »data.__outbuf[-1] == '\0'« nicht erfüllt.
                  clang: error: unable to execute command: Aborted (core dumped)
                  clang: error: linker command failed due to signal (use -v to see invocation)
                  -------- End Detailed Actions Stats -----------------------------------------------------------
                  ERROR: UBT ERROR: Failed to produce item: /home/tsky/UE4/cglabUnrealEngine/Engine/Plugins/JoystickPlugin/Binaries/Linux/libUE4Editor-JoystickPlugin.so
                  Total build time: 16,30 seconds
                  make: *** [UE4Editor] Fehler 5
                  and i have to figure out whats happened.

                  tsky

                  Comment


                    #24
                    FYI - With UE4.10 under Windows and Visual Studio 2015 you'll need to rebuild the SDL2 libraries and copy them to the Lib directory to avoid linker errors due to Windows CRT (C RunTime library) changes.
                    Last edited by Stormwind; 11-11-2015, 10:22 PM.
                    Descent: Underground |

                    Comment


                      #25
                      Hi,
                      thanks for the hint.

                      I work on a solution to build a static sdl2 that works out of the box with the plugin. On linux you could take the engine/source/thirdparty sdl2, if you call the build.sh script before compiling ue4. The changes on the .build.cs are very small.

                      The windows stuff will take some time, i don´t have much spare time to do this.

                      tsky

                      Comment


                        #26
                        The SDL2 build for Release configuration is normally a DLL with a lib loader. To build a static SDL2 lib file, I followed the directions from this bug entry: https://bugzilla.libsdl.org/show_bug.cgi?id=1820
                        Descent: Underground |

                        Comment


                          #27
                          Maybe you try this: https://github.com/tsky1971/UEJoystickPlugin/tree/4.11

                          Comment


                            #28
                            Hi,

                            So here is a Testproject with binaries. This is compiled with VC2015 and as dynamic version. I created/tested this with the editor version 4.10 from launcher. Sorry for the size.

                            The branch 4.10 has precompiled dll and build batches etc. I had to add some libs for the crt linker problems into the cmakefiles.txt. So it compiles and links now all the sdl2 libraries.

                            The JoystickPlugin uses the dynamic version of dll due to linker errors with the static version. A well known problem with VC2015!?

                            At this time it´s very painful to work with windows version - due to the changes of VC2015. On Linux it seems to be more smooth...

                            tsky

                            Comment


                              #29
                              @tksy - I'm guessing you are referring to the following link errors when trying to build against a non-dll SDL2.lib?

                              Code:
                              2>  [1/1] Link UE4Editor-JoystickPlugin.dll
                              2>     Creating library C:\Users\Jason\Dev\DescentUnderground\GameProject\Plugins\JoystickPlugin\Intermediate/Build/Win64\UE4Editor\Development\UE4Editor-JoystickPlugin.lib and object C:\Users\Jason\Dev\DescentUnderground\GameProject\Plugins\JoystickPlugin\Intermediate/Build/Win64\UE4Editor\Development\UE4Editor-JoystickPlugin.exp
                              2>msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __vcrt_initialize referenced in function __scrt_initialize_crt
                              2>msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __vcrt_uninitialize referenced in function __scrt_initialize_crt
                              2>msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __vcrt_uninitialize_critical referenced in function __scrt_dllmain_uninitialize_critical
                              2>msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __vcrt_thread_attach referenced in function __scrt_dllmain_crt_thread_attach
                              2>msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __vcrt_thread_detach referenced in function __scrt_dllmain_crt_thread_attach
                              2>msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol _is_c_termination_complete referenced in function __scrt_dllmain_uninitialize_c
                              2>msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_initialize referenced in function __scrt_initialize_crt
                              2>msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_uninitialize referenced in function __scrt_uninitialize_crt
                              2>msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_uninitialize_critical referenced in function __scrt_dllmain_uninitialize_critical
                              2>msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_thread_attach referenced in function __scrt_dllmain_crt_thread_attach
                              2>msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __acrt_thread_detach referenced in function __scrt_dllmain_crt_thread_detach
                              2>C:\Users\Jason\Dev\DescentUnderground\GameProject\Plugins\JoystickPlugin\Binaries\Win64\UE4Editor-JoystickPlugin.dll : fatal error LNK1120: 11 unresolved externals
                              Down in Makefile.ubt I found lots of nodefaultlib options being generated by UBT for the JoystickPlugin link - I suspect it may be related:

                              Code:
                              /NODEFAULTLIB:"LIBCMT" /NODEFAULTLIB:"LIBCPMT" /NODEFAULTLIB:"LIBCMTD" /NODEFAULTLIB:"LIBCPMTD" /NODEFAULTLIB:"MSVCRTD" /NODEFAULTLIB:"MSVCPRTD" /NODEFAULTLIB:"LIBC" /NODEFAULTLIB:"LIBCP" /NODEFAULTLIB:"LIBCD" /NODEFAULTLIB:"LIBCPD"
                              Last edited by Stormwind; 12-09-2015, 03:07 AM.
                              Descent: Underground |

                              Comment


                                #30
                                Hello guys!

                                Could you help a total noob with the steps of enabling this great plug-in with UE4.10.1?
                                Running on windows 8.1, I am stuck at these steps:
                                4) Now you should have an UE4-Project with C++ Sources. At least a Dummy-Class, you need to create an VisualStudio Project-File create from the UE-Project-File (RMB - Generate VisualStudio...).

                                5) Now open the VS-Solution and compile all.

                                I got the static.lib file, but have no idea what I should actually do right now :<
                                Thanks guys and sorry to bring noob questions on this thread!

                                Comment

                                Working...
                                X