author David Ludwig <dludwig@pobox.com>
Sat, 29 Nov 2014 10:09:30 -0500
changeset 9247 eddb899239fe
parent 8833 ae720d61d14d
child 9732 586417de8897
permissions -rw-r--r--
WinRT: bug and data-integrity fixes for SDL_GetPrefPath()

This change does a few things, all with regards to the WinRT implementation of

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

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

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).
     2 This is a list of major changes in SDL's version history.
     4 ---------------------------------------------------------------------------
     5 2.0.4:
     6 ---------------------------------------------------------------------------
     8 General:
     9 * Added an event SDL_RENDER_DEVICE_RESET that is sent from the D3D renderers 
    10   when the D3D device is lost, and from Android's event loop when the GLES
    11   context had to be re created.
    12 * Native Client backend
    14 ---------------------------------------------------------------------------
    15 2.0.3:
    16 ---------------------------------------------------------------------------
    18 Mac OS X:
    19 * Fixed creating an OpenGL context by default on Mac OS X 10.6
    22 ---------------------------------------------------------------------------
    23 2.0.2:
    24 ---------------------------------------------------------------------------
    25 General:
    26 * Added SDL_GL_ResetAttributes() to reset OpenGL attributes to default values
    27 * Added an API to load a database of game controller mappings from a file:
    28     SDL_GameControllerAddMappingsFromFile(), SDL_GameControllerAddMappingsFromRW()
    29 * Added game controller mappings for the PS4 and OUYA controllers
    30 * Added SDL_GetDefaultAssertionHandler() and SDL_GetAssertionHandler()
    31 * Added SDL_DetachThread()
    32 * Added SDL_HasAVX() to determine if the CPU has AVX features
    33 * Added SDL_vsscanf(), SDL_acos(), and SDL_asin() to the stdlib routines
    34 * EGL can now create/manage OpenGL and OpenGL ES 1.x/2.x contexts, and share
    36 * Added a field "clicks" to the mouse button event which records whether the event is a single click, double click, etc.
    37 * The screensaver is now disabled by default, and there is a hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER that can change that behavior.
    38 * Added a hint SDL_HINT_MOUSE_RELATIVE_MODE_WARP to specify whether mouse relative mode should be emulated using mouse warping.
    39 * testgl2 does not need to link with libGL anymore
    40 * Added testgles2 test program to demonstrate working with OpenGL ES 2.0
    41 * Added controllermap test program to visually map a game controller
    43 Windows:
    44 * Support for OpenGL ES 2.x contexts using either WGL or EGL (natively via
    45   the driver or emulated through ANGLE)
    46 * Added a hint SDL_HINT_VIDEO_WIN_D3DCOMPILER to specify which D3D shader compiler to use for OpenGL ES 2 support through ANGLE
    47 * Added a hint SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT that is useful when creating multiple windows that should share the same OpenGL context.
    48 * Added an event SDL_RENDER_TARGETS_RESET that is sent when D3D9 render targets are reset after the device has been restored.
    50 Mac OS X:
    51 * Added a hint SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK to control whether Ctrl+click should be treated as a right click on Mac OS X. This is off by default.
    53 Linux:
    54 * Fixed fullscreen and focused behavior when receiving NotifyGrab events
    55 * Added experimental Wayland and Mir support, disabled by default
    57 Android:
    58 * Joystick support (minimum SDK version required to build SDL is now 12, 
    59   the required runtime version remains at 10, but on such devices joystick 
    60   support won't be available).
    61 * Hotplugging support for joysticks
    62 * Added a hint SDL_HINT_ACCELEROMETER_AS_JOYSTICK to control whether the accelerometer should be listed as a 3 axis joystick, which it will by default.
    65 ---------------------------------------------------------------------------
    66 2.0.1:
    67 ---------------------------------------------------------------------------
    69 General:
    70 * Added an API to get common filesystem paths in SDL_filesystem.h:
    71     SDL_GetBasePath(), SDL_GetPrefPath()
    72 * Added an API to do optimized YV12 and IYUV texture updates:
    73     SDL_UpdateYUVTexture()
    74 * Added an API to get the amount of RAM on the system:
    75     SDL_GetSystemRAM()
    76 * Added a macro to perform timestamp comparisons with SDL_GetTicks():
    77     SDL_TICKS_PASSED()
    78 * Dramatically improved OpenGL ES 2.0 rendering performance
    79 * Added OpenGL attribute SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
    81 Windows:
    82 * Created a static library configuration for the Visual Studio 2010 project
    83 * Added a hint to create the Direct3D device with support for multi-threading:
    85 * Added a function to get the D3D9 adapter index for a display:
    86     SDL_Direct3D9GetAdapterIndex()
    87 * Added a function to get the D3D9 device for a D3D9 renderer:
    88     SDL_RenderGetD3D9Device()
    89 * Fixed building SDL with the mingw32 toolchain (mingw-w64 is preferred)
    90 * Fixed crash when using two XInput controllers at the same time
    91 * Fixed detecting a mixture of XInput and DirectInput controllers
    92 * Fixed clearing a D3D render target larger than the window
    93 * Improved support for format specifiers in SDL_snprintf()
    95 Mac OS X:
    96 * Added support for retina displays:
    97   Create your window with the SDL_WINDOW_ALLOW_HIGHDPI flag, and then use SDL_GL_GetDrawableSize() to find the actual drawable size. You are responsible for scaling mouse and drawing coordinates appropriately.
    98 * Fixed mouse warping in fullscreen mode
    99 * Right mouse click is emulated by holding the Ctrl key while left clicking
   101 Linux:
   102 * Fixed float audio support with the PulseAudio driver
   103 * Fixed missing line endpoints in the OpenGL renderer on some drivers
   104 * X11 symbols are no longer defined to avoid collisions when linking statically
   106 iOS:
   107 * Fixed status bar visibility on iOS 7
   108 * Flipped the accelerometer Y axis to match expected values
   110 Android:
   111 IMPORTANT: You MUST get the updated SDLActivity.java to match C code
   112 * Moved EGL initialization to native code 
   113 * Fixed the accelerometer axis rotation relative to the device rotation
   114 * Fixed race conditions when handling the EGL context on pause/resume
   115 * Touch devices are available for enumeration immediately after init
   117 Raspberry Pi:
   118 * Added support for the Raspberry Pi, see README-raspberrypi.txt for details