grumbel / sdl-jstest Goto Github PK
View Code? Open in Web Editor NEWSimple SDL joystick test application for the console
License: GNU General Public License v3.0
Simple SDL joystick test application for the console
License: GNU General Public License v3.0
I was puzzled (as were others in forums) by the message "not a gamepad". The error should instead read, "SDL cannot use this as a GameController until it is added to gamecontrollerdb.txt or SDL_GAMECONTROLLERCONFIG."
In commit 5bc418e the appdata files were removed, but the BUILD_TESTS
cmake option remained.
Lines 52 to 55 in a73cfcb
It now does nothing since the appdata files are gone, what was the intent here? Are different tests going to be created in the future? Should BUILD_TESTS
be removed altogether? Should the appdata files be restored? I don't have a personal preference here.
Hey there, the AUR build of sdl2-jstest is broken, so I wanted to compile from source, but there is no Makefile, and make
fails. I don't really know how to use CMake. Could you put updated instructions in the readme? Thank you!
On OS X, I need to apply the following to get things to build
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 47e5e1a..0c75d53 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,6 +44,7 @@ if(WERROR)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif()
+link_directories("/usr/local/lib")
add_executable(sdl2-jstest sdl2-jstest.c)
target_link_libraries(sdl2-jstest ${SDL2_LIBRARIES} ${CURSES_LIBRARIES})
target_include_directories(sdl2-jstest PUBLIC ${SDL2_INCLUDE_DIRS} ${CURSES_INCLUDE_DIR})
I don't really know much cmake-fu, but the above is obviously not suitable for committing. I have sdl2 via brew, and pkg-config
outputs the correct arguments for the linker:
$ brew info sdl2
sdl2: stable 2.0.4 (bottled), HEAD
Low-level access to audio, keyboard, mouse, joystick, and graphics
https://www.libsdl.org/
/usr/local/Cellar/sdl2/2.0.3 (75 files, 3.7M)
Poured from bottle
/usr/local/Cellar/sdl2/2.0.4 (82 files, 3.9M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/sdl2.rb
==> Options
--universal
Build a universal binary
--HEAD
Install HEAD version
$ pkg-config --libs sdl2
-L/usr/local/lib -lSDL2
Not sure if the fault is in your CMakeLists.txt
file or in whatever package provides the Cmake helpers for SDL2 (perhaps SDL2-via-brew itself?)
In both sdl2-jstest.c, sdl-jstest.c, there is a small typo that causes the two values displayed for each 'ball' to be the same:
printw(" %2d: %6d %6d\n", i, balls[2*i+0], balls[2*i+0]);
Should be:
printw(" %2d: %6d %6d\n", i, balls[2*i+0], balls[2*i+1]);
Hi,
I maintain a port of sdl-jstest on OpenBSD. It would be great if you would consider making releases of this awesome port on github, ideally with an upload of the sourcefiles/distfiles. The issue is that this is the only way that there is some guarantee that size/hash may not change when github changes some of its tools or other behind-the-scenes stuff. Our ports system (and that of other OS, too) checks the size and hash of the distfiles; so github's changes regularly break stuff unnecessarily.
Thanks!
I get this on Archlinux when trying to build.
$ cmake . 12:24
-- The C compiler identification is GNU 7.2.0
-- The CXX compiler identification is GNU 7.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Curses: /usr/lib/libcurses.so
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found SDL: /usr/lib/libSDLmain.a;/usr/lib/libSDL.so;-lpthread (found version "1.2.15")
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Checking for one of the modules 'sdl2'
-- docbook2x-man: not found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest
$ make
Scanning dependencies of target sdl2-jstest
[ 25%] Building C object CMakeFiles/sdl2-jstest.dir/sdl2-jstest.c.o
[ 50%] Linking C executable sdl2-jstest
/usr/bin/ld: CMakeFiles/sdl2-jstest.dir/sdl2-jstest.c.o: undefined reference to symbol 'stdscr'
/usr/lib/libtinfo.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/sdl2-jstest.dir/build.make:97: sdl2-jstest] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/sdl2-jstest.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
Versions:
ncurses 6.0+20170902
sdl2 2.0.7
docbook2x 0.8.8
OS: Gentoo
sdl-jstest: fbfb4dd
SDL: 1.2.64
musl:1.2.4
With SDL1 there is no output when testing a controller with sdl-jstest, the command sdl-jstest -t 0
will only show a blank terminal.
I am not sure if its worth fixing this or just dropping support for SDL1?
Is it possible to host the image required for the test inside of the repo? Downloading them during the build is problematic in Gentoo where network can be restricted during the build process.
Start testing: Jul 13 13:51 PDT
----------------------------------------------------------
1/2 Testing: sdl-jstest.appdata.xml
1/2 Test: sdl-jstest.appdata.xml
Command: "/usr/bin/appstream-util" "validate-relax" "/var/tmp/portage/dev-util/sdl-jstest-9999/work/sdl-jstest-9999_build/sdl-jstest.appdata.xml"
Directory: /var/tmp/portage/dev-util/sdl-jstest-9999/work/sdl-jstest-9999_build
"sdl-jstest.appdata.xml" start time: Jul 13 13:51 PDT
Output:
----------------------------------------------------------
/var/tmp/portage/dev-util/sdl-jstest-9999/work/sdl-jstest-9999_build/sdl-jstest.appdata.xml: FAILED:
• url-not-found : <screenshot> url not valid [https://sdl-jstest.gitlab.io/screenshot-0.2.1-1.png]: Could not resolve host: sdl-jstest.gitlab.io
Validation of files failed
<end of output>
Test time = 0.01 sec
----------------------------------------------------------
Test Failed.
"sdl-jstest.appdata.xml" end time: Jul 13 13:51 PDT
"sdl-jstest.appdata.xml" time elapsed: 00:00:00
----------------------------------------------------------
2/2 Testing: sdl2-jstest.appdata.xml
2/2 Test: sdl2-jstest.appdata.xml
Command: "/usr/bin/appstream-util" "validate-relax" "/var/tmp/portage/dev-util/sdl-jstest-9999/work/sdl-jstest-9999_build/sdl2-jstest.appdata.xml"
Directory: /var/tmp/portage/dev-util/sdl-jstest-9999/work/sdl-jstest-9999_build
"sdl2-jstest.appdata.xml" start time: Jul 13 13:51 PDT
Output:
----------------------------------------------------------
/var/tmp/portage/dev-util/sdl-jstest-9999/work/sdl-jstest-9999_build/sdl2-jstest.appdata.xml: FAILED:
• url-not-found : <screenshot> url not valid [https://sdl-jstest.gitlab.io/screenshot-0.2.1-1.png]: Could not resolve host: sdl-jstest.gitlab.io
Validation of files failed
<end of output>
Test time = 0.01 sec
----------------------------------------------------------
Test Failed.
"sdl2-jstest.appdata.xml" end time: Jul 13 13:51 PDT
"sdl2-jstest.appdata.xml" time elapsed: 00:00:00
----------------------------------------------------------
End testing: Jul 13 13:51 PDT
OS: Gentoo
sdl-jstest: 62124aa
clang: 16.0.6
With clang it prints a few -Wtautological-constant-out-of-range-compare
warnings that seem somewhat concerning.
[1/4] /usr/lib/ccache/bin/x86_64-gentoo-linux-musl-clang -DSDL2_JSTEST_DATADIR=\"/usr/share/sdl-jstest\" -DSDL_JSTEST_VERSION=\"0.2.2-1-g62124aa\" -isystem /usr/include/SDL2 -isystem /usr/include/ncursesw -O2 -pipe -Werror=implicit-function-declaration -Werror=implicit-int -std=c99 -D_REENTRANT -DNCURSES_WIDECHAR -MD -MT CMakeFiles/sdl2-jstest.dir/src/sdl2-jstest.c.o -MF CMakeFiles/sdl2-jstest.dir/src/sdl2-jstest.c.o.d -o CMakeFiles/sdl2-jstest.dir/src/sdl2-jstest.c.o -c /var/tmp/portage/dev-util/sdl-jstest-9999/work/sdl-jstest-9999/src/sdl2-jstest.c
[2/4] /usr/lib/ccache/bin/x86_64-gentoo-linux-musl-clang -DSDL_JSTEST_VERSION=\"0.2.2-1-g62124aa\" -isystem /usr/include/SDL -isystem /usr/include/ncursesw -O2 -pipe -Werror=implicit-function-declaration -Werror=implicit-int -std=c99 -DNCURSES_WIDECHAR -MD -MT CMakeFiles/sdl-jstest.dir/src/sdl-jstest.c.o -MF CMakeFiles/sdl-jstest.dir/src/sdl-jstest.c.o.d -o CMakeFiles/sdl-jstest.dir/src/sdl-jstest.c.o -c /var/tmp/portage/dev-util/sdl-jstest-9999/work/sdl-jstest-9999/src/sdl-jstest.c
/var/tmp/portage/dev-util/sdl-jstest-9999/work/sdl-jstest-9999/src/sdl-jstest.c:53:53: warning: result of comparison of constant -9223372036854775808 with expression of type 'int' is always false [-Wtautological-constant-out-of-range-compare]
if ((errno == ERANGE && (*val == LONG_MAX || *val == LONG_MIN))
~~~~ ^ ~~~~~~~~
/var/tmp/portage/dev-util/sdl-jstest-9999/work/sdl-jstest-9999/src/sdl-jstest.c:53:33: warning: result of comparison of constant 9223372036854775807 with expression of type 'int' is always false [-Wtautological-constant-out-of-range-compare]
if ((errno == ERANGE && (*val == LONG_MAX || *val == LONG_MIN))
~~~~ ^ ~~~~~~~~
2 warnings generated.
[3/4] : && /usr/lib/ccache/bin/x86_64-gentoo-linux-musl-clang -O2 -pipe -Werror=implicit-function-declaration -Werror=implicit-int -std=c99 -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed -rdynamic CMakeFiles/sdl-jstest.dir/src/sdl-jstest.c.o -o sdl-jstest -Wl,-Bstatic -lSDLmain -Wl,-Bdynamic -lSDL -lncursesw -ltinfow && :
/var/tmp/portage/dev-util/sdl-jstest-9999/work/sdl-jstest-9999/src/sdl2-jstest.c:46:53: warning: result of comparison of constant -9223372036854775808 with expression of type 'int' is always false [-Wtautological-constant-out-of-range-compare]
if ((errno == ERANGE && (*val == LONG_MAX || *val == LONG_MIN))
~~~~ ^ ~~~~~~~~
/var/tmp/portage/dev-util/sdl-jstest-9999/work/sdl-jstest-9999/src/sdl2-jstest.c:46:33: warning: result of comparison of constant 9223372036854775807 with expression of type 'int' is always false [-Wtautological-constant-out-of-range-compare]
if ((errno == ERANGE && (*val == LONG_MAX || *val == LONG_MIN))
~~~~ ^ ~~~~~~~~
2 warnings generated.
[4/4] : && /usr/lib/ccache/bin/x86_64-gentoo-linux-musl-clang -O2 -pipe -Werror=implicit-function-declaration -Werror=implicit-int -std=c99 -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed -rdynamic CMakeFiles/sdl2-jstest.dir/src/sdl2-jstest.c.o -o sdl2-jstest -lSDL2 -lncursesw -ltinfow && :
I couldn't build without the submodules, so I think it would be nice for the readme to call that out as part of the build process or maybe in the requirements.
Thanks for the super helpful tool.
Before checking with SDL_IsGameController(), it makes sense to see if there is an updated database in the current directory. Traditionally this is called "gamecontrollerdb.txt". You can load it automatically (and ignore it if it is missing) by adding this line:
SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt");
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.