[Fixed] Controller support

Moderator: Raze Developers

Re: Controller support

Postby bisk89 » Thu Mar 26, 2020 5:19 am

Ok, I understand. Is there any way that I can help to manage this issue?
User avatar
bisk89
 
Joined: 24 Mar 2020
Github ID: bisk89
Operating System: Mac OS X 10.8 or later

Re: Controller support

Postby mjr4077au » Thu Mar 26, 2020 4:24 pm

bisk89 wrote:Ok, I understand. Is there any way that I can help to manage this issue?

I might have spoken out of turn. It appears that macOS has native support and doesn't use SDL, so that makes the issues I was experiencing worthy of their own issue.

I see you've forked the code. Perhaps in the first instance, compile it directly on your machine and see if it works. I wouldn't expect it, but if there's something different in your macOS version vs. the compiled version, it might expose an issue.

An example of that would be that the GZDoom/Raze devs built the system on Ubuntu with SDL 2.0.8 or something, and here comes me with Arch Linux with SDL 2.0.12 because it's rolling release and always up to date. There are potential changes/bugs between versions, etc that might require amendments within the project.
User avatar
mjr4077au
 
Joined: 17 Jun 2019
Location: Gosford NSW, Australia
Discord: mjr4077au#1027
Github ID: mjr4077au
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Controller support

Postby bisk89 » Sat Mar 28, 2020 4:59 pm

It will be hard, cause I don't know how to compile :(
User avatar
bisk89
 
Joined: 24 Mar 2020
Github ID: bisk89
Operating System: Mac OS X 10.8 or later

Re: Controller support

Postby mjr4077au » Sun Mar 29, 2020 7:24 am

Download cmake and Xcode. Cmake should create a project file for Xcode that you can then open and build.

Unsure whether you'll have any external dependency requirements, but I'm lead to believe macOS development is fairly self-contained.
User avatar
mjr4077au
 
Joined: 17 Jun 2019
Location: Gosford NSW, Australia
Discord: mjr4077au#1027
Github ID: mjr4077au
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Controller support

Postby mjr4077au » Sat Apr 04, 2020 6:08 am

Any luck, mate?
User avatar
mjr4077au
 
Joined: 17 Jun 2019
Location: Gosford NSW, Australia
Discord: mjr4077au#1027
Github ID: mjr4077au
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Controller support

Postby bisk89 » Sat Apr 04, 2020 6:58 am

I really want to do it, but I don't know how. I downloaded 0.5.1 Raze source code, CMake and Xcode, but I'm stuck with CMake, look:

Code: Select allExpand view
The C compiler identification is AppleClang 9.0.0.9000039
The CXX compiler identification is AppleClang 9.0.0.9000039
Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Found BZip2: /usr/lib/libbz2.dylib (found version "1.0.6")
Looking for BZ2_bzCompressInit
Looking for BZ2_bzCompressInit - found
Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
Could NOT find VPX (missing: VPX_LIBRARIES VPX_INCLUDE_DIR)
Found ZLIB: /usr/lib/libz.dylib (found version "1.2.8")
Looking for fts_set
Looking for fts_set - found
Using system zlib, includes found at /usr/include
Using internal jpeg library
Using system bzip2 library, includes found at /usr/include
Looking for strdup
Looking for strdup - found
Looking for strndup
Looking for strndup - found
Looking for sys/types.h
Looking for sys/types.h - found
Looking for stdint.h
Looking for stdint.h - found
Looking for stddef.h
Looking for stddef.h - found
Check size of 0i8
Check size of 0i8 - failed
Check size of 0l
Check size of 0l - done
Check size of 0ll
Check size of 0ll - done
Check size of char
Check size of char - done
Check size of short
Check size of short - done
Check size of int
Check size of int - done
Check size of long
Check size of long - done
Check size of long long
Check size of long long - done
Check size of void *
Check size of void * - done
Check size of __int64
Check size of __int64 - failed
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Architecture is x86_64
Performing Test HAVE_PARALLEL_FOR
Performing Test HAVE_PARALLEL_FOR - Failed
Performing Test HAVE_DISPATCH_APPLY
Performing Test HAVE_DISPATCH_APPLY - Success
Looking for filelength
Looking for filelength - not found
Looking for strupr
Looking for strupr - not found
Looking for stricmp
Looking for stricmp - not found
Looking for strnicmp
Looking for strnicmp - not found
Looking for clock_gettime in rt
Looking for clock_gettime in rt - not found
Looking for clock_gettime
Looking for clock_gettime - found
Could NOT find ZMusic (missing: ZMUSIC_LIBRARIES ZMUSIC_INCLUDE_DIR)
Looking for backtrace
Looking for backtrace - found
backtrace facility detected in default set of libraries
Found Backtrace: /usr/include 
Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ZMUSIC_INCLUDE_DIR (ADVANCED)
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/duke3d
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/duke3d
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/blood
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/blood
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/rr
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/rr
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/sw
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/sw
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/exhumed
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/exhumed
ZMUSIC_LIBRARIES (ADVANCED)
    linked by target "raze" in directory /Users/player/Desktop/Raze-0.5.1/source

Generating done
User avatar
bisk89
 
Joined: 24 Mar 2020
Github ID: bisk89
Operating System: Mac OS X 10.8 or later

Re: Controller support

Postby mjr4077au » Sat Apr 04, 2020 3:43 pm

bisk89 wrote:
Code: Select allExpand view
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ZMUSIC_INCLUDE_DIR (ADVANCED)
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/duke3d
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/duke3d
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/blood
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/blood
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/rr
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/rr
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/sw
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/sw
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/exhumed
   used as include directory in directory /Users/player/Desktop/Raze-0.5.1/source/exhumed
ZMUSIC_LIBRARIES (ADVANCED)
    linked by target "raze" in directory /Users/player/Desktop/Raze-0.5.1/source

You're on the right path, but you're missing the ZMusic dependency as per the above. ZMusic is available here. You'd need to build it with CMake and Xcode similar to what you're doing now. It'll have its own dependencies which it will list in the output (probably libsndfile, fluidsynth and mpg123 from memory).

Windows and macOS aren't amazing for compiling projects in this regard. On a system like Arch Linux that provides a PKGBUILD (package build) file, it will just sort this out for you. Also, I'd recommend compiling against the latest code in Master vs. the 0.5.1 release. There's a lot of improvements in master that you'll be missing out on if you just compile the 0.5.1 code.

As per some of the earlier posts about the analogue sticks not working, it might not be worth this effort in the end. I believe the issue lays in the code and compiling from source against your machine isn't the fix like I initially suggested. I want to have a look at the analogue input but can only do so when my son goes back to his mum (it's my weekend with him and I like to spend it 100% with him :))
User avatar
mjr4077au
 
Joined: 17 Jun 2019
Location: Gosford NSW, Australia
Discord: mjr4077au#1027
Github ID: mjr4077au
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Controller support

Postby bisk89 » Sat Apr 04, 2020 5:09 pm

Thank's for the tip, I downloaded ZMusic, and end up with this:

CMake:


Xcode:


I totally understand, wish you nice weekend and have a good time with son! :)
User avatar
bisk89
 
Joined: 24 Mar 2020
Github ID: bisk89
Operating System: Mac OS X 10.8 or later

Re: Controller support

Postby mjr4077au » Sat Apr 04, 2020 8:35 pm

So had a quick look before tonight. I can see that in some files there's the use of 'in_joystick' to determine whether that's enabled whereas most of the project uses "use_joystick" instead. Making that consistent for a quick fix did not resolve the issue like I'd hoped.

Will concentrate more effort around what CONTROL_GetInput() in inputstate.cpp is doing and work backwards from there. This is the function each game calls when it requests input from the mouse and joystick.
User avatar
mjr4077au
 
Joined: 17 Jun 2019
Location: Gosford NSW, Australia
Discord: mjr4077au#1027
Github ID: mjr4077au
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Controller support

Postby _mental_ » Sun Apr 05, 2020 3:39 am

Here is a shell script that generates Xcode project with all dependencies configured.
Download it, open Terminal, and do the following command, probably with full path to the script if needed.
Code: Select allExpand view
sh xcode_raze.txt

It will clone dependencies repository to the current directory, Raze repository will cloned to as well, CMake will run, and Xcode will open after that.
Switch to ALL_BUILD scheme if it was not selected automatically, edit it, and change an executable to raze.app on Info page.
You do not have the required permissions to view the files attached to this post.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Controller support

Postby bisk89 » Sun Apr 05, 2020 5:36 am

Thanks for the script, It worked (finally! :)). Unfortunately my analog sticks don't work, just like before :cry:

mjr4077au wrote:Will concentrate more effort around what CONTROL_GetInput() in inputstate.cpp is doing and work backwards from there. This is the function each game calls when it requests input from the mouse and joystick.

great :D
User avatar
bisk89
 
Joined: 24 Mar 2020
Github ID: bisk89
Operating System: Mac OS X 10.8 or later

Re: Controller support

Postby mjr4077au » Sun Apr 05, 2020 6:18 am

_mental_, thanks for providing that build script. Awesome stuff :D

bisk89, from the console while in-game, can you please type 'in_joystick 1'? When joysticks are enabled from the menu at the moment, it sets use_joystick to true/1, however the game is checking whether to get joystick axes only if in_joystick is true/1.

Fixing this did not resolve the issues for me on Windows, but interested in feedback from a macOS user to eliminate an OS-specific issue.
User avatar
mjr4077au
 
Joined: 17 Jun 2019
Location: Gosford NSW, Australia
Discord: mjr4077au#1027
Github ID: mjr4077au
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Controller support

Postby bisk89 » Sun Apr 05, 2020 8:44 am

mjr4077au wrote:bisk89, from the console while in-game, can you please type 'in_joystick 1'? When joysticks are enabled from the menu at the moment, it sets use_joystick to true/1, however the game is checking whether to get joystick axes only if in_joystick is true/1.

Tried while ago, but just as you thought, it changes nothing
User avatar
bisk89
 
Joined: 24 Mar 2020
Github ID: bisk89
Operating System: Mac OS X 10.8 or later

Re: Controller support

Postby Graf Zahl » Wed Apr 08, 2020 2:24 am

I think I found the problem here.
First, as has been said, there are 2 CVARs that control this, but the worse part is that after migrating to GZDoom's input system the joystick polling code wasn't reactivated again when use_joystick was toggled.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Controller support

Postby mjr4077au » Wed Apr 08, 2020 2:27 am

Graf Zahl wrote:I think I found the problem here.
First, as has been said, there are 2 CVARs that control this, but the worse part is that after migrating to GZDoom's input system the joystick polling code wasn't reactivated again when use_joystick was toggled.

Nice one! Happy to test locally if you don't have a suitable pad at home?

Are you planning to ditch in_joystick? It was the lesser used of the two from my review.
User avatar
mjr4077au
 
Joined: 17 Jun 2019
Location: Gosford NSW, Australia
Discord: mjr4077au#1027
Github ID: mjr4077au
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

PreviousNext

Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 0 guests