Commit Graph

75 Commits

Author SHA1 Message Date
sezero
7287068da5 revert the recent typecast assignment changes (see bug #4079)
also change the void* typedefs for the two vulkan function
pointers added in vulkan_internal.h  into generic function
pointer typedefs.
2018-02-12 17:00:00 +03:00
Sam Lantinga
49ae998d51 Fixed ISO C99 compatibility
SDL now builds with gcc 7.2 with the following command line options:
-Wall -pedantic-errors -Wno-deprecated-declarations -Wno-overlength-strings --std=c99
2018-01-30 18:08:34 -08:00
Sam Lantinga
a9072159b2 Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Ryan C. Gordon
f0a894ed28 filesystem: Patched to compile on QNX. 2017-08-17 03:22:44 -04:00
Ryan C. Gordon
166a2284f6 filesystem: QNX should use SDL_LoadFile() instead of rolling it from scratch. 2017-08-17 02:58:46 -04:00
Ryan C. Gordon
bc3d1f34a7 qnx: Implemented SDL_GetBasePath(). 2017-08-17 01:25:48 -04:00
Sam Lantinga
6ec1321e60 Fixed bug 3639 - SDL_GetPrefPath returns a path with two consecutive slashes on Unix if org is omitted
Fabian Greffrath

we use SDL_GetPrefPath() in Chocolate Doom to get a reasonable directory to save and restore config files and savegames:

https://github.com/chocolate-doom/chocolate-doom/blob/sdl2-branch/src/m_config.c#L2162

However, since there is no "organization" behind Chocolate Doom and there is really only one "product" called Chocolate Doom, we pass an empty string for the org parameter and the package string for app.

This leads to two consecutive slashes in the path returned by SDL_GetPrefPath() like this:

/home/user/.local/share//chocolate-doom/

While this is harmless, it sure looks bad.

I believe that it should be possible to either pass a NULL pointer for the org parameter or at least have the function detect an empty string as a means to express "there is no origanization, just a single product". The generation of the path string to be returned by the function will have to get adapted accordingly.
2017-08-11 11:32:00 -07:00
Philipp Wiesemann
c81af887b1 haiku: Changed header paths to be more compatible. 2017-07-29 23:00:14 +02:00
Philipp Wiesemann
a55fad4fd7 haiku: Fixed missing slash in path from SDL_GetPrefPath(). 2017-06-17 22:30:09 +02:00
Philipp Wiesemann
234821d788 android: Fixed missing error message for SDL_GetBasePath(). 2017-06-04 23:15:27 +02:00
Philipp Wiesemann
28aebb4bb8 Removed unused errno includes. 2017-05-27 23:30:07 +02:00
Sam Lantinga
d77ab77a7a Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Philipp Wiesemann
a0fc7ddb2c Fixed compiling if filesystem is disabled (thanks, Elias!).
Fixes Bugzilla #3414.
2016-08-30 21:14:13 +02:00
Sam Lantinga
e6a54327c7 David Carlier implemented SDL_GetBasePath() for OpenBSD 2016-01-31 21:11:15 -08:00
Sam Lantinga
255c182471 Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Ryan C. Gordon
df2fba2fd0 Windows SDL_GetBasePath: free string on failure. 2015-05-28 15:36:27 -04:00
Ryan C. Gordon
e2d87dcdbd Windows GetBasePath: fixed reallocation code. 2015-05-28 15:32:45 -04:00
Ryan C. Gordon
909e52bccd Windows SDL_GetBasePath: Fixed wrong variable when growing the buffer size. 2015-05-28 15:29:43 -04:00
Sam Lantinga
a2df44ecd2 Fixed compiling and tested on Windows 2015-05-28 12:06:48 -07:00
Ryan C. Gordon
e5d9d21ecd Windows GetBasePath should use GetModuleFileNameExW() and check for overflows.
Apparently you might get strange paths from GetModuleFileName(), such as
short path names or UNC filenames, so this avoids that problem. Since you have
to tapdance with linking different libraries and defining macros depending on
what Windows you plan to target, we dynamically load the API we need, which
works on all versions of Windows (on Win7, it'll load a compatibility wrapper
for the newer API location).

What a mess.

This also now does the right thing if there isn't enough space to store the
path, looping with a larger allocated buffer each try.

Fixes Bugzilla #2435.
2015-05-28 01:54:52 -04:00
Sam Lantinga
78f2198e6c Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Philipp Wiesemann
d4bf7188db Emscripten: Fixed memory leak if SDL_GetPrefPath() failed. 2015-04-15 21:25:15 +02:00
Alex Szpakowski
182e206acd Merged default into iOS-improvements
--HG--
branch : iOS-improvements
2015-04-06 15:26:37 -03:00
Alex Szpakowski
d621a93a72 Merged default into iOS-improvements
--HG--
branch : iOS-improvements
2015-01-15 01:15:24 -04:00
Philipp Wiesemann
96dbb24035 Fixed comment in implementation for NaCl. 2015-01-31 21:06:37 +01:00
Ryan C. Gordon
a9626cb76e Initial merge of Emscripten port!
With this commit, you can compile SDL2 with Emscripten
( http://emscripten.org/ ), and make your SDL-based C/C++ program
into a web app.

This port was due to the efforts of several people, including: Charlie Birks,
Sathyanarayanan Gunasekaran, Jukka Jylänki, Alon Zakai, Edward Rudd,
Bruce Mitchener, and Martin Gerhardy. (Thanks, everyone!)
2014-12-18 00:19:52 -05:00
David Ludwig
b4405e7215 WinRT: removed SDL_HINT_WINRT_PREF_PATH_ROOT (introduced post-2.0.3 & pre-2.0.4)
A WinRT app's Roaming folder-path can still be retrieved via calls to
SDL_WinRTGetFSPathUTF8() or SDL_WinRTGetFSPathUNICODE(), if need be.
2014-12-02 21:18:50 -05:00
Alex Szpakowski
cbd3bafc72 Merged default into iOS-improvements
--HG--
branch : iOS-improvements
2014-12-02 02:52:45 -04:00
David Ludwig
fc843814a3 WinRT: bug and data-integrity fixes for SDL_GetPrefPath()
This change does a few things, all with regards to the WinRT implementation of
SDL_GetPrefPath():

1. it fixes a bug whereby SDL_GetPrefPath() did not create the directory it
returned.  On other SDL platforms, SDL_GetPrefPath() will create separate
directories for its 'org' and 'app' folders.  Without this, attempts to create
files in the pref-path would fail, unless those directories were first created
by the app, or by some other library the app used.  This change makes sure
that these directories get created, before SDL_GetPrefPath() returns to its
caller(s).


2. it defaults to having SDL_GetPrefPath() return a WinRT 'Local' folder
on all platforms.  Previously, for Windows Store apps, it would have used a
different, 'Roaming' folder.  Files in Roaming folders can be automatically,
and synchronized across multiple devices by Windows.  This synchronization can
happen while the app runs, with new files being copied into a running app's
pref-path.  Unless an app is specifically designed to handle this scenario,
there is a chance that save-data could be overwritten in unwanted or
unexpected ways.

The default is now to use a Local folder, which does not get synchronized, and
which is arguably a bit safer to use.  Apps that wish to use Roaming folders
can do so by setting SDL_HINT_WINRT_PREF_PATH_ROOT to "roaming", however it
is recommended that one first read Microsoft's documentation for Roaming
files, a link to which is provided in README-winrt.md.

To preserve older pref-path selection behavior (found in SDL 2.0.3, as well as
many pre-2.0.4 versions of SDL from hg.libsdl.org), which uses a Roaming path
in Windows Store apps, and a Local path in Windows Phone, set
SDL_HINT_WINRT_PREF_PATH_ROOT to "old".

Please note that Roaming paths are not supported on Windows Phone 8.0, due to
limitations in the OS itself.  Attempts to use this will fail.
(Windows Phone 8.1 does not have this limitation, however.)


3. It makes SDL_GetPrefPath(), when on Windows Phone 8.0, and when
SDL_HINT_WINRT_PREF_PATH_ROOT is set to "roaming", return NULL, rather than
silently defaulting to a Local path (then switching to a Roaming path if and
when the user upgraded to Windows Phone 8.1).
2014-11-29 10:09:30 -05:00
David Ludwig
1868d6bbf1 WinRT: added SDL_HINT_WINRT_PREF_PATH_ROOT
SDL_HINT_WINRT_PREF_PATH_ROOT allows WinRT apps to alter the path that
SDL_GetPrefPath() returns.  Setting it to "local" uses the app's
OS-defined Local folder, setting it to "roaming" uses the app's OS-defined
Roaming folder.

Roaming folder support is not available in Windows Phone 8.0.  Attempts to
make SDL_GetPrefPath() return a Roaming folder on this OS will be ignored.

Various bits of documentation on this were added to SDL_hints.h, and to
README-winrt.md
2014-11-27 09:55:34 -05:00
David Ludwig
cdd3e3a463 WinRT: removed a completed TODO item from an inline comment 2014-11-27 08:50:11 -05:00
David Ludwig
18ca50d940 WinRT: fixed an invalid comment in SDL_GetPrefPath() (for WinRT) 2014-11-23 08:59:01 -05:00
David Ludwig
24f3efb13c WinRT: allowed 'roaming' and 'temp' folder paths to be retrieved on WinPhone 8.1
Windows Phone 8.0 either did not define, or provide access to, a 'RoamingFolder'
or 'TemporaryFolder' for apps to use.  Windows 8.0 and 8.1 do, as does
Windows Phone 8.1.  This change allows SDL-based Windows Phone 8.1 apps to
access these folders, via either the SDL_WinRTGetFSPathUNICODE() or
SDL_WinRTGetFSPathUTF8() functions.

SDL_GetPrefPath(), which on WinRT, is based on SDL_WinRTGetFSPathUTF8(), will
continue to return the app's 'local' folder, despite Windows 8.x
counterpart apps using the 'roaming' folder, in order to preserve compatibility
when 8.0-based Phone apps upgrade to 8.1-based Phone apps.
2014-11-23 08:52:10 -05:00
Alex Szpakowski
977ef2d6e0 Merged default into iOS-improvements
--HG--
branch : iOS-improvements
2014-08-20 17:20:22 -03:00
Sam Lantinga
a87fc6bc1b Fixed 2680 - OSX: Replace NSAutoreleasePool with @autoreleasepool
Tim McDaniel

This patch replaces all use of NSAutoreleasePool with the Apple recommended @autoreleasepool.  @autoreleasepool is supposedly more efficient, and since it is scope based it can't be accidentally not released.
2014-08-17 15:07:00 -07:00
Sam Lantinga
4b39a2f46b Implemented SDL_GetPrefPath() on Android - it returns the path used by SDL_AndroidGetInternalStoragePath() 2014-08-11 17:25:53 -07:00
Alex Szpakowski
8e811c6753 Misc. iOS code improvements.
- Use @autoreleasepool instead of NSAutoReleasePool.

- Code style fixups.

--HG--
branch : iOS-improvements
2014-07-14 16:50:25 -03:00
Gabriel Jacobo
4f6c842c9b Ooops, code that resists erasure, I've seen that in a movie. 2014-06-20 11:01:05 -03:00
Gabriel Jacobo
bbdd4d52e8 Fix file name typo, thanks Sam Clegg! 2014-06-18 10:04:21 -03:00
Gabriel Jacobo
adce68ed69 Fixes audio for Native Client, and other fixes...
- SDL_NaClMount, SDL_NaClUmount
- Default mounting of https at / in SDL's main function
- More documentation in README-nacl.txt
2014-06-08 18:18:13 -03:00
Brandon Schaefer
aa844a18c6 Fix warnings, only major one being an SDL_SetError not providing enough arguments. 2014-06-05 15:29:23 -07:00
Sam Lantinga
b0e0446659 Added missing copyright notices 2014-03-13 21:21:26 -07:00
David Ludwig
3fe569fba7 build fixes for most WinRT-related files
Still TODO: getting the D3D11 renderer back up and running in VC 2012.
2014-03-10 21:21:35 -04:00
Ryan C. Gordon
0568a0661e Removed unused variable. 2014-03-10 00:48:41 -04:00
Sam Lantinga
0ae88759fb Integrated David Ludwig's support for Windows RT 2014-03-09 11:36:47 -07:00
Sam Lantinga
32547d0c59 Fixed line endings on WinRT source code 2014-03-09 11:06:11 -07:00
Ryan C. Gordon
a2dcb239e0 Force Windows version of SDL_GetPrefPath() to Unicode, create missing dirs.
Fixes Bugzilla #2273.
2014-03-01 20:28:40 -05:00
Sam Lantinga
dba255c1e5 Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00
David Ludwig
c96c4f3dc4 WinRT: merged with latest SDL 2.x/HG code
SDL 2.x recently accepted patches to enable OpenGL ES 2 support via Google's ANGLE library.  The thought is to try to eventually merge SDL/WinRT's OpenGL code with SDL-official's.
2013-11-28 22:09:21 -05:00
Ryan C. Gordon
03d5719413 Make internal SDL sources include SDL_internal.h instead of SDL_config.h
The new header will include SDL_config.h, but allows for other global stuff.
2013-11-24 23:56:17 -05:00