Commit graph

1211 commits

Author SHA1 Message Date
Sam Lantinga
40924be014 Fixed binding the D-pad on some Super NES style controllers
Fixed a case where partial trigger pull could be bound to another button

There is a fundamental problem not resolved by this commit:

Some controllers have axes (triggers, pedals, etc.) that don't start at zero, but we're guaranteed that if we get a value that it's correct. For these controllers, the current code works, where we take the first value we get and use that as the zero point and generate axis motion starting from that point on.

Other controllers have digital axes (D-pad) that assume a zero starting point, and the first value we get is the min or max axis value when the D-pad is moved. For these controllers, the current code thinks that the zero point is the axis value after the D-pad motion and this doesn't work.

My hypothesis is that the first class of devices is more common and that we should solve for that, and add an exception to SDL_JoystickAxesCenteredAtZero() as needed for the second class of devices.
2017-01-03 23:39:28 -08:00
Sam Lantinga
1b24bfad38 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Philipp Wiesemann
9fa61fb93c Fixed warning and missing animation delay in testoverlay2 program. 2016-12-30 19:57:50 +01:00
Philipp Wiesemann
c8d8045c0d Fixed compiling of testgamecontroller program with C++. 2016-12-28 20:11:29 +01:00
Philipp Wiesemann
f848ed47c9 Fixed warning about unused variable in controllermap program. 2016-12-28 20:11:12 +01:00
Sam Lantinga
899ab7a827 Make sure we go all the way back (within the XBox controller dead zone) to prevent accidentally binding axes inverted 2016-12-27 09:51:58 -08:00
Sam Lantinga
c6e0424049 Split controller axes into positive and negative sides so each can be bound independently.
Using this a D-Pad can be mapped to a thumbstick and vice versa.
Also added support for inverted axes, improving trigger binding support
2016-12-27 01:39:07 -08:00
Philipp Wiesemann
4db75ddb41 Fixed hotplug with more than one device in testjoystick program. 2016-12-16 22:58:32 +01:00
Philipp Wiesemann
1a614928de Fixed warning about unused variable in controllermap program. 2016-12-16 22:58:16 +01:00
Sam Lantinga
9b86fb09cb Fixed handling joysticks that send multiple events for a single control, e.g. both a button and axis event for a trigger.
Tested with the 8Bitdo NES30 Pro on Linux
2016-12-15 14:27:22 -08:00
Sam Lantinga
9fc407dda0 Only print out the controller mappings if we're not going to test a controller 2016-12-09 04:17:10 -08:00
Sam Lantinga
5ab2eefa0d Fixed bug 3508 - variably modified ‘SDL_dummy_size’ at file scope in test/testatomic.c
Ciro Santilli

GCC 6, Ubuntu 16.10, cd test; ./configure; make

/bin/sh config.status Makefile
config.status: creating Makefile
gcc -o loopwave loopwave.c -g -O2 -D_REENTRANT -I/usr/include/SDL2 -DHAVE_OPENGLES2 -DHAVE_OPENGL -DHAVE_SDL_TTF -g -lSDL2_test -lSDL2
gcc -o testatomic testatomic.c -g -O2 -D_REENTRANT -I/usr/include/SDL2 -DHAVE_OPENGLES2 -DHAVE_OPENGL -DHAVE_SDL_TTF -g -lSDL2_test -lSDL2
In file included from /usr/include/SDL2/SDL_main.h:25:0,
                 from /usr/include/SDL2/SDL.h:32,
                 from testatomic.c:14:
/usr/include/SDL2/SDL_stdinc.h:261:20: error: variably modified ‘SDL_dummy_size’ at file scope
        typedef int SDL_dummy_ ## name[(x) * 2 - 1]
                    ^
testatomic.c:106:1: note: in expansion of macro ‘SDL_COMPILE_TIME_ASSERT’
 SDL_COMPILE_TIME_ASSERT(size, CountTo>0); /* check for rollover */
 ^~~~~~~~~~~~~~~~~~~~~~~
Makefile:114: recipe for target 'testatomic' failed
make: *** [testatomic] Error 1

If I remove the line SDL_COMPILE_TIME_ASSERT(size, CountTo>0); /* check for rollover */ it works, lazy to figure out the best way to do this.
2016-12-06 00:40:09 -08:00
Sam Lantinga
a31f3d2c25 Added an API to iterate over game controller mappings 2016-11-29 06:36:57 -08:00
Ryan C. Gordon
79c41b1692 cpuinfo: first attempt at SDL_HasNEON() implementation. 2016-11-17 01:15:16 -05:00
Sam Lantinga
3055d5af65 Added USB VID/PID information to the SDL test programs 2016-11-10 18:53:50 -08:00
Sam Lantinga
27e26897ed Shifting a value by more than its bits isn't defined and has varying behavior depending on compiler and platform 2016-11-06 14:13:28 -08:00
Sam Lantinga
de702a534a Fixed bug 3468 - _allshr in SDL_stdlib.c is not working properly
Mark Pizzolato

On Windows with Visual Studio, when building SDL as a static library using the x86 (32bit) mode, several intrinsic operations are implemented in code in SDL_stdlib.c.

One of these, _allshr() is not properly implemented and fails for some input.  As a result, some operations on 64bit data elements (long long) don't always work.

I classified this bug as a blocker since things absolutely don't work when the affected code is invoked.  The affected code is only invoked when SDL is compiled in x86 mode on Visual Studio when building a SDL as a static library.  This build environment isn't common, and hence the bug hasn't been noticed previously.

I reopened #2537 and mentioned this problem and provided a fix.  That fix is provided again here along with test code which could be added to some of the SDL test code.  This test code verifies that the x86 intrinsic routines produce the same results as the native x64 instructions which these routines emulate under the Microsoft compiler.  The point of the tests is to make sure that Visual Studio x86 code produces the same results as Visual Studio x64 code.  Some of the arguments (or boundary conditions) may produce different results on other compiler environments, so the tests really shouldn't be run on all compilers.  The test driver only actually exercised code when the compiler defines _MSC_VER, so the driver can generically be invoked without issue.
2016-11-06 10:01:08 -08:00
Sam Lantinga
c43d248bd0 Fixed bug 3480 - minor update to NACL common.js
Sylvain

All latest official NACL examples have a slightly different 'common.js' file. It seems it has been updated in the meantime to fix a bug.
2016-11-05 01:48:14 -07:00
Philipp Wiesemann
861dc7c97f Added call to SDL_HasAVX2() in platform test program. 2016-10-30 21:01:46 +01:00
Philipp Wiesemann
66335e4dc0 Removed unused constants in controllermap program. 2016-10-15 20:01:30 +02:00
Sam Lantinga
1e2589c229 Fixed black screen on Steam Link 2016-10-13 04:01:25 -07:00
Sam Lantinga
ed5b8e1246 Fixed black screen on Steam Link 2016-10-13 02:09:37 -07:00
Philipp Wiesemann
c514ae0303 Removed empty statements in tests. 2016-10-12 23:36:49 +02:00
Philipp Wiesemann
1b0a9a82c4 Fixed compiling of three test programs with C++. 2016-10-09 20:31:32 +02:00
Sam Lantinga
7a98ee6c96 Modified the custom cursor test to be able to load BMP files as cursors 2016-10-04 04:08:02 -07:00
Sam Lantinga
c897935592 Fixed bug 3318 - testime.c enhancement with GNU Unifont support
Simon Hug

I'm proposing some changes to the IME test program test/testime.c. The patch includes support for the GNU Unifont hex file, making the SDL_ttf dependency optional. There were also one or two bugs that prevented the text and underline from showing up poperly.
2016-10-01 12:43:14 -07:00
Sam Lantinga
8ad213418b Fixed bug 3319 - Getting the POSIX out of testqsort.c
Simon Hug

There's a call to the POSIX function random in test/testqsort.c. Naturally, Windows doesn't do that. The attached patch changes the call to the SDLtest framework random functions and adds some seed control.

Looking at SDLTest_RandomInitTime, I just want to say that 'srand((unsigned int)time(NULL)); a=rand(); srand(clock()); b=rand();' is an absolutely terrible way to initialize a seed on Windows because of its terrible LCG.
2016-10-01 12:33:26 -07:00
Sam Lantinga
574cc25ce1 Fixed bug 3322 - Missing error checking in testaudioinfo and testaudiohotplug
Simon Hug

The two tests test/testaudioinfo.c and test/testaudiohotplug.c are missing error checking when they call SDL_GetAudioDeviceName. This function can return NULL which the tests pass straight to SDL_Log.
2016-10-01 12:29:55 -07:00
Philipp Wiesemann
0f1075b48e Fixed compiling of three test programs with C++. 2016-09-21 23:06:38 +02:00
Philipp Wiesemann
63c0ba2c47 Fixed log message in audio capture test program. 2016-08-30 21:16:04 +02:00
Ryan C. Gordon
f098bb1934 testaudiocapture: ask for way more output samples.
Fixes Emscripten builds on Chrome for Android.
2016-08-12 22:50:48 -04:00
Ryan C. Gordon
7fd7e882eb testaudiocapture: open capture device to same spec as output device.
...since our resampler is still terrible (sorry!).
2016-08-09 16:57:49 -04:00
Ryan C. Gordon
532edaa024 testaudiocapture: use capture device buffer queueing, for better test coverage. 2016-08-06 02:48:00 -04:00
Ryan C. Gordon
3614f6b9d0 testaudiocapture: don't use fullscreen for the window. 2016-08-06 02:45:51 -04:00
Ryan C. Gordon
047cd6cf87 testaudiocapture: made test app interactive.
(hold down mouse/finger to record, then it plays back what it heard. Repeat.)
2016-08-03 00:31:08 -04:00
Ryan C. Gordon
effa79c36a testaudiocapture: Make a simple green/red window when recording/playing. 2016-08-02 19:17:51 -04:00
Ryan C. Gordon
9396cce861 testaudiocapture: Let specific devices be opened.
--HG--
extra : amend_source : f1b96012549325d102027b574420d369846f4d97
2016-08-02 13:38:56 -04:00
Ryan C. Gordon
d2873d0971 audio: Initial bits to enable audio capture support.
--HG--
extra : histedit_source : ae3938cddad98d32fdec1221ef1ed57ebb2d20e0
2016-08-01 00:18:56 -04:00
Brandon Schaefer
d1caaa42c9 Tests: Would be wise to compile this 2016-07-13 09:41:43 -07:00
Brandon Schaefer
5564d048dc Tests: Somehow tabs leaked in... 2016-07-13 07:39:01 -07:00
Brandon Schaefer
962f8d8766 Tests: Add a manual test for a custom cursor (Taken from the API docs) 2016-07-13 07:34:06 -07:00
Brandon Schaefer
bd6c92676a Tests: Mir needs the window to swap at lease 1 frame for the cursor to show. So render in testwm2 2016-07-13 07:07:46 -07:00
Philipp Wiesemann
93d29988d1 Fixed three source comments in tests. 2016-06-28 21:15:16 +02:00
Philipp Wiesemann
68ef914d7e Added a simple test case for SDL_sscanf() to tests.
It fails on platforms where SDL's custom implementation is used.

Relates to Bugzilla #3341.
2016-06-28 21:14:11 +02:00
Philipp Wiesemann
13dddf1a3b Fixed crash in shape test program if memory allocation failed. 2016-05-10 21:13:58 +02:00
Philipp Wiesemann
104af62971 Fixed error return values in filesystem test program. 2016-05-10 21:12:48 +02:00
Philipp Wiesemann
62a5ddb862 Fixed memory leak in game controller test program. 2016-05-05 22:05:21 +02:00
Philipp Wiesemann
085f0f8b59 Added missing error return in test program. 2016-04-14 21:10:08 +02:00
Philipp Wiesemann
ee01a42541 Removed not needed SDL_WINDOW_SHOWN from chessboard test program. 2016-03-28 21:02:30 +02:00
Philipp Wiesemann
7d41ef944e Fixed compiling IME test program with HAVE_SDL_TTF on C89 compilers. 2016-03-10 21:00:27 +01:00