Commit Graph

4135 Commits

Author SHA1 Message Date
pgriffais@spaceport
7a3c8f1213 [SDL] X11+GL: Allow Visual override for GL windows.
SDL provides an SDL_VIDEO_X11_VISUALID environment variable that lets you override
window visuals, but it wasn't being checked for OpenGL windows.

CR: Sam.
2013-09-10 18:25:13 -07:00
Ryan C. Gordon
19b1e1f53f Disable thread naming on Win64 for now.
We can't use _try/_except without the C runtime, and we can't use inline
 asm with the Win64 compiler. We'll need to move this to an .asm file or
 something later.
2013-09-07 13:47:14 -04:00
Sam Lantinga
fdf0494a0a Fixed bug 2090 - Some joystick inputs are delayed on FreeBSD
kikuchan

Some joysticks with high sampling rate need to be read() more fast,
otherwise it delay user inputs due to internal queue.
Especially, an app that issues SDL_PollEvent() not so frequent
2013-09-06 20:54:14 -07:00
Sam Lantinga
c7f635ec01 Fixed time comparison and explicitly delay 1 ms instead of an arbitrary scheduled time. 2013-09-06 20:45:08 -07:00
Jørgen P. Tjernø
10f5e37d2e Fix to buffer overrun in SDL_JoystickGetGUIDString(). 2013-09-05 15:49:57 -07:00
Sam Lantinga
0a093f4eea Fixed bug 2076 - OpenGL doesn't work with --disable-threads
stepik-777

Thread local storage is used to store current window and current opengl context. OpenGL worked before this changeset: 7596 (45e5c263c096)
2013-09-05 07:15:26 -07:00
Sam Lantinga
47b4f56927 Fixed bug 2082 - SDL stdlib implementation does not force upper case for %X format specifier
norfanin

When SDL_vsnprintf handles the %x format specifier, a boolean is set to signal forced lower case. It also should be able to signal forced upper case for the %X specifier. A boolean is not sufficient anymore. The attached patch adds an enum for the three cases: lower, upper and no change.
2013-09-05 06:59:34 -07:00
Sam Lantinga
d7850de4ad Fixed bug 2084 - SDL_log xxx on Android outputs to Logcat with incorrect priority.
Pallav Nawani

This effects all SDL_Logxxx functions. On android, the debug output has a priority that is 1 higher than intended, ie, if you try SDL_LogInfo, the log has the priority of Warn instead.
2013-09-05 06:43:34 -07:00
Ryan C. Gordon
4e510b3a87 The SDL_PixelFormat* passed to SDL_ConvertSurface() should be const. 2013-09-04 23:40:11 -04:00
Ryan C. Gordon
314ecabd38 Enabled thread naming on Windows.
This is now done without compiler or C runtime support for __try/__except.

(Granted, it uses Visual Studio-style inline asm, but still...)
2013-08-31 01:36:38 -04:00
Gabriel Jacobo
6b6b23633c Fixes bug #2040, prepare SDL_GL_CONTEXT_EGL for deprecation on v2.1
SDL_GL_CONTEXT_EGL = 1 is now internally treated as profile_mask = SDL_GL_CONTEXT_PROFILE_ES
2013-08-29 15:02:32 -03:00
Gabriel Jacobo
eefc8fdad1 Fixes bug #2074 - Thanks Sylvain!
SDL_syssem.c:159 comparison of unsigned expression >= 0 is always true
Solved by comparing unsigneds directly

SDL_systimer.c:164: warning: control may reach end of Compile
Solved by returning the default value if all else fails.

SDL_androidgl.c:41:1: warning: type specifier missing, defaults to 'int'
SDL_androidgl.c:47:1: warning: control reaches end of non-void function
Solved by adding void return type to the function implementation
2013-08-29 14:03:44 -03:00
Sam Lantinga
da23163fbc Christoph Mallon: Replace strlen(x) == 0 (O(n)) by x[0] == '\0' (O(1)). 2013-08-29 08:30:21 -07:00
Sam Lantinga
6d9d4b6eba Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x) 2013-08-29 08:29:51 -07:00
Sam Lantinga
753aae78fc Christoph Mallon: Remove pointless if (x) before SDL_free(x) 2013-08-29 08:29:21 -07:00
Sam Lantinga
79bc5ff6ac Christoph Mallon: Correct indendation. 2013-08-29 08:27:25 -07:00
Sam Lantinga
e5bdcdce26 Christoph Mallon: Use SDL_arraysize() 2013-08-29 08:26:55 -07:00
Sam Lantinga
46659d953c Christoph Mallon: Simplify assignment. 2013-08-29 08:26:24 -07:00
Sam Lantinga
8f70297c38 Christoph Mallon: Report an error, if creating the directories in SDL_GetPrefPath() failed. 2013-08-29 08:25:54 -07:00
Sam Lantinga
3a2343d106 Christoph Mallon: Remove lone /* if */ comment. 2013-08-29 08:25:24 -07:00
Sam Lantinga
1f0046b99f Christoph Mallon: Simplify avoidance of duplicate / in SDL_GetPrefPath() 2013-08-29 08:24:43 -07:00
Ryan C. Gordon
1e3a064b1f Change order we enumerate Windows joysticks.
Make it so XInput devices are listed before DirectInput devices, and that the XInput
 devices are sorted by userid in ascending numeric order (so device 0 comes first).
2013-08-28 22:09:17 -04:00
Ryan C. Gordon
3d31c4ae53 Don't corrupt XInput device state during SDL_SYS_JoystickClose(). 2013-08-28 22:07:54 -04:00
Ryan C. Gordon
5c4541e9bc Fix endlines for logging via OutputDebugString(). 2013-08-28 22:05:16 -04:00
Ryan C. Gordon
39a1eb3f22 Make XInput joystick names match the numbers on the device.
(And how the Haptic code already names them.)
2013-08-28 17:17:21 -04:00
Ryan C. Gordon
efb67d6fdc Fixed comment typo. 2013-08-28 17:12:07 -04:00
Ryan C. Gordon
2291afc34f Reworked XInput and DirectInput joystick code.
Now multiple XInput controllers map correctly to device indexes instead of grabbing
the first available userid, and are completely separated out from DirectInput.

Also, the hardcoded limitation on number of DirectInput devices is gone. I don't
expect there to really ever be more than eight joysticks plugged into a machine, but
it was a leftover limitation for a static array we didn't actually use anymore.

Fixes Bugzilla #1984. (etc?)
2013-08-28 16:43:47 -04:00
Ryan C. Gordon
358ea2ddfe Better XInput detection code for DirectInput device enumeration.
This code is way faster than the Wbem code, and less ugly.
2013-08-28 16:35:32 -04:00
Gabriel Jacobo
bf23f88256 Fixes typo in EGL code (thanks jmcfarlane!) 2013-08-26 14:23:18 -03:00
Ryan C. Gordon
811051ecaa Removed obvious comment to trigger buildbot. 2013-08-25 21:28:03 -04:00
Edward Rudd
02e78e6604 reworked GetBasePath on OS X to use Contents/Resource by default if bundled, or exedir if not bundled.
- also adds OS X specific magic for bundled apps adding an Info.plist property of name SDL_FILESYSTEM_BASE_DIR_TYPE to the following values will change the bahaviour.
* bundle -- use the bundle directory e.g. "/Applications/MyGame/Blah.app/"
* parent -- use the bundle parent directory e.g. "/Applications/MyGame/"
* resource -- use the bundle resource directory (default) e.g. "/Applications/MyGame/Blah.app/Contents/Resources/"
2013-08-25 11:24:01 -04:00
Gabriel Jacobo
1960a11679 Fixes "error: conflicting types for 'GLintptr'" 2013-08-25 11:48:49 -03:00
Ryan C. Gordon
a9e59a9c1c Minor FreeBSD code cleanup. 2013-08-24 21:15:10 -04:00
Edward Rudd
0d9b3f9116 Fix #2062 Be more diligent about validating trailing "/" existence in HOME and XDG_DATA_HOME env vars 2013-08-24 09:05:18 -04:00
Ryan C. Gordon
dcf1507675 Patched to compile on Solaris. 2013-08-23 23:34:23 -04:00
Ryan C. Gordon
e489ba1b6f Patched to compile on FreeBSD. 2013-08-23 21:48:40 -04:00
Ryan C. Gordon
c25827b1f1 Add support for some BSDs and Solaris to SDL_GetBasePath(). 2013-08-23 21:38:54 -04:00
Gabriel Jacobo
3d70638fcf Fix warning in GL ES2 renderer 2013-08-22 17:26:22 -03:00
Ryan C. Gordon
4db9e1c7a1 XAudio2/DirectSound: Use the usual Windows string convert (thanks, Norfanin!). 2013-08-22 13:32:27 -04:00
Sam Lantinga
c6a11602a3 Fixed compiling on old versions of the DirectX SDK 2013-08-21 12:12:04 -07:00
Sam Lantinga
8685ca6cdd SDL
- detect that you tried to open a gamecontroller in xinput mode and failed, then re-get the mapping for the dinput variant you did open (and most likely now just fail the open)

CR: SamL
2013-08-21 10:32:04 -07:00
Sam Lantinga
a9be917e0f Fix SDL xinput code to work at all when xinput has devices at high indexes but no device connected at lower index, for instance 0->disconnected, 1->wireles, 2->wired. Previously the SDL code assumed the indexes were always used up in order which is not true at all and lead to a bunch of failure cases where controllers would go unrecognized.
This entire function is kind of a mess and more complicated than needed, but I don't want to refactor it too heavily tonight.  May look at improving how the indexes are assigned more significanly later.  The way it handles not finding a valid "gamepad" type device is also super broken, it leaves in place the xinput bindings but opens the controller with dinput and ends up with completely wrong mappings, not solving that now, but fixing the bug where we'd very frequently not find a controller due to gaps in assigned player numbers should mostly avoid it.
2013-08-21 10:31:44 -07:00
Sam Lantinga
113a00b54e Fixed crash if the IC isn't set up for some reason (bad X11 locale?) 2013-08-21 10:07:48 -07:00
Gabriel Jacobo
acff11318d Fix a couple of warnings 2013-08-21 10:34:32 -03:00
Gabriel Jacobo
49f7c02626 Patched to compile on Darwin 2013-08-21 10:27:39 -03:00
Gabriel Jacobo
bb01614557 More fixes for -Wdeclaration-after-statement 2013-08-21 10:13:12 -03:00
Gabriel Jacobo
bc514bada3 Fixes for -Wdeclaration-after-statement 2013-08-21 10:12:16 -03:00
Gabriel Jacobo
8515791f86 OCD fixes: Adds a space after /* (glory to regular expressions!) 2013-08-21 09:47:10 -03:00
Gabriel Jacobo
871473e032 OCD fixes: Adds a space before */ 2013-08-21 09:43:09 -03:00
Ryan C. Gordon
0382f2f764 Actually, this should be a memcpy().
We already know the exact length we just allocated, and we plan to append
 our own null terminator to the end of the copy, so this makes more sense.
2013-08-20 23:20:32 -04:00