Commit graph

63 commits

Author SHA1 Message Date
Philipp Wiesemann
74cf2bf6b2 Fixed compiling if filesystem is disabled (thanks, Elias!).
Fixes Bugzilla #3414.
2016-08-30 21:14:13 +02:00
Sam Lantinga
414d85cd8a David Carlier implemented SDL_GetBasePath() for OpenBSD 2016-01-31 21:11:15 -08:00
Sam Lantinga
7ee8dda270 Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Ryan C. Gordon
4fe50008e4 Windows SDL_GetBasePath: free string on failure.
--HG--
extra : rebase_source : c9015ad1e60607cbd3204ba44d9cfaec6f1adad7
2015-05-28 15:36:27 -04:00
Ryan C. Gordon
b22d989ad8 Windows GetBasePath: fixed reallocation code.
--HG--
extra : rebase_source : 3b2cf31f9d42d7925e3200dcae98af36159a5bc0
2015-05-28 15:32:45 -04:00
Ryan C. Gordon
ae904749d0 Windows SDL_GetBasePath: Fixed wrong variable when growing the buffer size.
--HG--
extra : rebase_source : 57286d2f315dbb6b68321326e506d26469651afa
2015-05-28 15:29:43 -04:00
Sam Lantinga
ed2f60d082 Fixed compiling and tested on Windows 2015-05-28 12:06:48 -07:00
Ryan C. Gordon
9f2772eae0 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
56b58afdbe Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Philipp Wiesemann
2a45a031a7 Emscripten: Fixed memory leak if SDL_GetPrefPath() failed. 2015-04-15 21:25:15 +02:00
Alex Szpakowski
0bacddf42e Merged default into iOS-improvements
--HG--
branch : iOS-improvements
2015-04-06 15:26:37 -03:00
Alex Szpakowski
f2452bba77 Merged default into iOS-improvements
--HG--
branch : iOS-improvements
2015-01-15 01:15:24 -04:00
Philipp Wiesemann
af3327018f Fixed comment in implementation for NaCl. 2015-01-31 21:06:37 +01:00
Ryan C. Gordon
de88474dda 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!)

--HG--
extra : rebase_source : 97af74c8a5121e926ebe89f123536b5dd6681695
2014-12-18 00:19:52 -05:00
David Ludwig
594785a021 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
dcfb9a729a Merged default into iOS-improvements
--HG--
branch : iOS-improvements
2014-12-02 02:52:45 -04:00
David Ludwig
cba7a719d8 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
fda1375d4e 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
bca0f114eb WinRT: removed a completed TODO item from an inline comment 2014-11-27 08:50:11 -05:00
David Ludwig
22af98b953 WinRT: fixed an invalid comment in SDL_GetPrefPath() (for WinRT) 2014-11-23 08:59:01 -05:00
David Ludwig
5da7c20541 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.

--HG--
extra : rebase_source : ffd5850a1329cb3e09d06633b18521f17fd82658
2014-11-23 08:52:10 -05:00
Alex Szpakowski
fdce275074 Merged default into iOS-improvements
--HG--
branch : iOS-improvements
2014-08-20 17:20:22 -03:00
Sam Lantinga
cf85a26a30 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
c1d6f15368 Implemented SDL_GetPrefPath() on Android - it returns the path used by SDL_AndroidGetInternalStoragePath() 2014-08-11 17:25:53 -07:00
Alex Szpakowski
c351e27667 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
b9b706f832 Ooops, code that resists erasure, I've seen that in a movie. 2014-06-20 11:01:05 -03:00
Gabriel Jacobo
aa762e77a3 Fix file name typo, thanks Sam Clegg!
--HG--
rename : src/filesystem/nacl/SDL_sysfilesytem.c => src/filesystem/nacl/SDL_sysfilesystem.c
2014-06-18 10:04:21 -03:00
Gabriel Jacobo
37f6d3cb88 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
d5eb114f44 Fix warnings, only major one being an SDL_SetError not providing enough arguments. 2014-06-05 15:29:23 -07:00
Sam Lantinga
82a301e171 Added missing copyright notices 2014-03-13 21:21:26 -07:00
David Ludwig
e6f24f0b7c build fixes for most WinRT-related files
Still TODO: getting the D3D11 renderer back up and running in VC 2012.

--HG--
extra : rebase_source : 16aa0948fea2b8997033ca5a09ddb9692d07edc4
2014-03-10 21:21:35 -04:00
Ryan C. Gordon
5b8f5159f3 Removed unused variable. 2014-03-10 00:48:41 -04:00
Sam Lantinga
a7d2ebb8d6 Integrated David Ludwig's support for Windows RT 2014-03-09 11:36:47 -07:00
Sam Lantinga
211b54deef Fixed line endings on WinRT source code 2014-03-09 11:06:11 -07:00
Ryan C. Gordon
267f8fb155 Force Windows version of SDL_GetPrefPath() to Unicode, create missing dirs.
Fixes Bugzilla #2273.
2014-03-01 20:28:40 -05:00
Sam Lantinga
d7940a513e Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00
David Ludwig
ebfac58560 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
82edee6971 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.

--HG--
extra : rebase_source : ddf4a4c0dc2c554b98c82700798f343cd91b16e3
2013-11-24 23:56:17 -05:00
Ryan C. Gordon
30c46bacc8 Renamed things named after BeOS to be named after Haiku instead.
--HG--
rename : src/audio/baudio/SDL_beaudio.cc => src/audio/haiku/SDL_haikuaudio.cc
rename : src/audio/baudio/SDL_beaudio.h => src/audio/haiku/SDL_haikuaudio.h
rename : src/filesystem/beos/SDL_sysfilesystem.cc => src/filesystem/haiku/SDL_sysfilesystem.cc
rename : src/joystick/beos/SDL_bejoystick.cc => src/joystick/haiku/SDL_haikujoystick.cc
rename : src/loadso/beos/SDL_sysloadso.c => src/loadso/haiku/SDL_sysloadso.c
rename : src/main/beos/SDL_BApp.h => src/main/haiku/SDL_BApp.h
rename : src/main/beos/SDL_BeApp.cc => src/main/haiku/SDL_BeApp.cc
rename : src/main/beos/SDL_BeApp.h => src/main/haiku/SDL_BeApp.h
rename : src/power/beos/SDL_syspower.c => src/power/haiku/SDL_syspower.c
rename : src/timer/beos/SDL_systimer.c => src/timer/haiku/SDL_systimer.c
rename : src/video/bwindow/SDL_BWin.h => src/video/haiku/SDL_BWin.h
rename : src/video/bwindow/SDL_bclipboard.cc => src/video/haiku/SDL_bclipboard.cc
rename : src/video/bwindow/SDL_bclipboard.h => src/video/haiku/SDL_bclipboard.h
rename : src/video/bwindow/SDL_bevents.cc => src/video/haiku/SDL_bevents.cc
rename : src/video/bwindow/SDL_bevents.h => src/video/haiku/SDL_bevents.h
rename : src/video/bwindow/SDL_bframebuffer.cc => src/video/haiku/SDL_bframebuffer.cc
rename : src/video/bwindow/SDL_bframebuffer.h => src/video/haiku/SDL_bframebuffer.h
rename : src/video/bwindow/SDL_bkeyboard.cc => src/video/haiku/SDL_bkeyboard.cc
rename : src/video/bwindow/SDL_bkeyboard.h => src/video/haiku/SDL_bkeyboard.h
rename : src/video/bwindow/SDL_bmodes.cc => src/video/haiku/SDL_bmodes.cc
rename : src/video/bwindow/SDL_bmodes.h => src/video/haiku/SDL_bmodes.h
rename : src/video/bwindow/SDL_bopengl.cc => src/video/haiku/SDL_bopengl.cc
rename : src/video/bwindow/SDL_bopengl.h => src/video/haiku/SDL_bopengl.h
rename : src/video/bwindow/SDL_bvideo.cc => src/video/haiku/SDL_bvideo.cc
rename : src/video/bwindow/SDL_bvideo.h => src/video/haiku/SDL_bvideo.h
rename : src/video/bwindow/SDL_bwindow.cc => src/video/haiku/SDL_bwindow.cc
rename : src/video/bwindow/SDL_bwindow.h => src/video/haiku/SDL_bwindow.h
extra : rebase_source : afd5a42647878e283dbee3a666cef2214f0e7941
2013-11-14 11:51:24 -05:00
David Ludwig
f6e52c362a WinRT: added a comment regarding the lack of SHGetFolderPath on WinRT 2013-10-28 15:52:04 -04:00
David Ludwig
e918745db0 WinRT: implemented SDL_GetBasePath and SDL_GetPrefPath
--HG--
rename : src/core/winrt/SDL_winrtpaths.cpp => src/filesystem/winrt/SDL_sysfilesystem.cpp
2013-10-28 15:41:22 -04:00
Ryan C. Gordon
84929c222e Fixed buffer overflow. 2013-10-24 00:00:10 -04:00
Ryan C. Gordon
10fee37476 SDL_GetPrefPath() now uses the organization on all platforms.
Even if that's not the general convention for a given platform.

--HG--
extra : rebase_source : f3a8035be94bd416fca5bda09d1d93101bc4b688
2013-10-23 00:58:20 -04:00
Sam Lantinga
9eaceb18a0 Fixed bug 2072 - Make OS X's filesystem calls use -[NSString fileSystemRepresentation]
C.W. Betts

The recommended way of getting a file name that POSIX file APIs can open in OS X when using an NSString is -[NSString fileSystemRepresentation]. However, the current filesystem API in hg uses -[NSString UTF8String].
2013-10-21 00:20:27 -07:00
Sam Lantinga
414ff3106c Fixed bug 2121 - GCC throws error on SDL_FORCE_INLINE when compiling with -ansi 2013-09-30 22:35:32 -07:00
Sam Lantinga
08dfaaa2e6 Christoph Mallon: Remove pointless if (x) before SDL_free(x) 2013-08-29 08:29:21 -07:00
Sam Lantinga
edc88be724 Christoph Mallon: Correct indendation. 2013-08-29 08:27:25 -07:00
Sam Lantinga
79dab26796 Christoph Mallon: Use SDL_arraysize() 2013-08-29 08:26:55 -07:00
Sam Lantinga
aca1b3acc7 Christoph Mallon: Report an error, if creating the directories in SDL_GetPrefPath() failed. 2013-08-29 08:25:54 -07:00
Sam Lantinga
911e984c36 Christoph Mallon: Remove lone /* if */ comment. 2013-08-29 08:25:24 -07:00