Controller support

Moderator: Raze Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
User avatar
bisk89
Posts: 20
Joined: Tue Mar 24, 2020 6:53 am
Contact:

Re: Controller support

Post by bisk89 »

Ok, I understand. Is there any way that I can help to manage this issue?
User avatar
mjr4077au
Posts: 829
Joined: Sun Jun 16, 2019 9:17 pm
Graphics Processor: nVidia with Vulkan support
Location: Gosford NSW, Australia
Contact:

Re: Controller support

Post by mjr4077au »

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
bisk89
Posts: 20
Joined: Tue Mar 24, 2020 6:53 am
Contact:

Re: Controller support

Post by bisk89 »

It will be hard, cause I don't know how to compile :(
User avatar
mjr4077au
Posts: 829
Joined: Sun Jun 16, 2019 9:17 pm
Graphics Processor: nVidia with Vulkan support
Location: Gosford NSW, Australia
Contact:

Re: Controller support

Post by mjr4077au »

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
Posts: 829
Joined: Sun Jun 16, 2019 9:17 pm
Graphics Processor: nVidia with Vulkan support
Location: Gosford NSW, Australia
Contact:

Re: Controller support

Post by mjr4077au »

Any luck, mate?
User avatar
bisk89
Posts: 20
Joined: Tue Mar 24, 2020 6:53 am
Contact:

Re: Controller support

Post by bisk89 »

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 all

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
mjr4077au
Posts: 829
Joined: Sun Jun 16, 2019 9:17 pm
Graphics Processor: nVidia with Vulkan support
Location: Gosford NSW, Australia
Contact:

Re: Controller support

Post by mjr4077au »

bisk89 wrote:

Code: Select all

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
bisk89
Posts: 20
Joined: Tue Mar 24, 2020 6:53 am
Contact:

Re: Controller support

Post by bisk89 »

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
mjr4077au
Posts: 829
Joined: Sun Jun 16, 2019 9:17 pm
Graphics Processor: nVidia with Vulkan support
Location: Gosford NSW, Australia
Contact:

Re: Controller support

Post by mjr4077au »

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.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Controller support

Post by _mental_ »

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 all

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.
Attachments
xcode_raze.txt
(473 Bytes) Downloaded 37 times
User avatar
bisk89
Posts: 20
Joined: Tue Mar 24, 2020 6:53 am
Contact:

Re: Controller support

Post by bisk89 »

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
mjr4077au
Posts: 829
Joined: Sun Jun 16, 2019 9:17 pm
Graphics Processor: nVidia with Vulkan support
Location: Gosford NSW, Australia
Contact:

Re: Controller support

Post by mjr4077au »

_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
bisk89
Posts: 20
Joined: Tue Mar 24, 2020 6:53 am
Contact:

Re: Controller support

Post by bisk89 »

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
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Controller support

Post by Graf Zahl »

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
mjr4077au
Posts: 829
Joined: Sun Jun 16, 2019 9:17 pm
Graphics Processor: nVidia with Vulkan support
Location: Gosford NSW, Australia
Contact:

Re: Controller support

Post by mjr4077au »

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.
Post Reply

Return to “Closed Bugs [Raze]”