Fixed various build and runtime errors when using WinRT with VS2012.
authorDavid Ludwig <dludwig@pobox.com>
Wed, 12 Mar 2014 11:57:15 -0400
changeset 8611a762dfc67e1a
parent 8608 c5d603f7094e
child 8612 24d36bb9c7af
Fixed various build and runtime errors when using WinRT with VS2012.
VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj
VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj.filters
VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj
VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters
include/SDL_config_winrt.h
src/core/winrt/SDL_winrtapp_xaml.cpp
src/dynapi/SDL_dynapi.h
src/power/SDL_power.c
src/render/direct3d11/SDL_render_d3d11.c
src/render/direct3d11/SDL_render_d3d11_winrthelpers.cpp
src/thread/stdcpp/SDL_sysmutex.cpp
     1.1 --- a/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj	Tue Mar 11 12:40:31 2014 -0400
     1.2 +++ b/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj	Wed Mar 12 11:57:15 2014 -0400
     1.3 @@ -62,7 +62,7 @@
     1.4    </PropertyGroup>
     1.5    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     1.6      <ClCompile>
     1.7 -      <PreprocessorDefinitions>_USRDLL;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     1.8 +      <PreprocessorDefinitions>_USRDLL;UNICODE;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     1.9        <PrecompiledHeader>NotUsing</PrecompiledHeader>
    1.10        <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
    1.11        <CompileAsWinRT>false</CompileAsWinRT>
    1.12 @@ -75,12 +75,12 @@
    1.13        <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
    1.14        <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
    1.15        <GenerateDebugInformation>true</GenerateDebugInformation>
    1.16 -      <AdditionalDependencies>d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
    1.17 +      <AdditionalDependencies>DXGI.lib;d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
    1.18      </Link>
    1.19    </ItemDefinitionGroup>
    1.20    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    1.21      <ClCompile>
    1.22 -      <PreprocessorDefinitions>_USRDLL;UNICODE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.23 +      <PreprocessorDefinitions>_USRDLL;UNICODE;SDL_BUILDING_WINRT=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.24        <PrecompiledHeader>NotUsing</PrecompiledHeader>
    1.25        <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
    1.26        <CompileAsWinRT>false</CompileAsWinRT>
    1.27 @@ -92,12 +92,12 @@
    1.28        <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
    1.29        <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
    1.30        <GenerateDebugInformation>true</GenerateDebugInformation>
    1.31 -      <AdditionalDependencies>d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
    1.32 +      <AdditionalDependencies>DXGI.lib;d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
    1.33      </Link>
    1.34    </ItemDefinitionGroup>
    1.35    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
    1.36      <ClCompile>
    1.37 -      <PreprocessorDefinitions>_USRDLL;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.38 +      <PreprocessorDefinitions>_USRDLL;UNICODE;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.39        <PrecompiledHeader>NotUsing</PrecompiledHeader>
    1.40        <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
    1.41        <CompileAsWinRT>false</CompileAsWinRT>
    1.42 @@ -110,12 +110,12 @@
    1.43        <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
    1.44        <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
    1.45        <GenerateDebugInformation>true</GenerateDebugInformation>
    1.46 -      <AdditionalDependencies>d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
    1.47 +      <AdditionalDependencies>DXGI.lib;d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
    1.48      </Link>
    1.49    </ItemDefinitionGroup>
    1.50    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
    1.51      <ClCompile>
    1.52 -      <PreprocessorDefinitions>_USRDLL;UNICODE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.53 +      <PreprocessorDefinitions>_USRDLL;UNICODE;SDL_BUILDING_WINRT=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.54        <PrecompiledHeader>NotUsing</PrecompiledHeader>
    1.55        <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
    1.56        <CompileAsWinRT>false</CompileAsWinRT>
    1.57 @@ -127,7 +127,7 @@
    1.58        <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
    1.59        <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
    1.60        <GenerateDebugInformation>true</GenerateDebugInformation>
    1.61 -      <AdditionalDependencies>d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
    1.62 +      <AdditionalDependencies>DXGI.lib;d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
    1.63      </Link>
    1.64    </ItemDefinitionGroup>
    1.65    <ItemGroup>
    1.66 @@ -201,6 +201,9 @@
    1.67      <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_common.h" />
    1.68      <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.h" />
    1.69      <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_xaml.h" />
    1.70 +    <ClInclude Include="..\..\src\dynapi\SDL_dynapi.h" />
    1.71 +    <ClInclude Include="..\..\src\dynapi\SDL_dynapi_overrides.h" />
    1.72 +    <ClInclude Include="..\..\src\dynapi\SDL_dynapi_procs.h" />
    1.73      <ClInclude Include="..\..\src\events\blank_cursor.h" />
    1.74      <ClInclude Include="..\..\src\events\default_cursor.h" />
    1.75      <ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h" />
    1.76 @@ -215,7 +218,9 @@
    1.77      <ClInclude Include="..\..\src\haptic\SDL_syshaptic.h" />
    1.78      <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
    1.79      <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
    1.80 +    <ClInclude Include="..\..\src\render\direct3d11\SDL_render_d3d11_winrthelpers_cpp.h" />
    1.81      <ClInclude Include="..\..\src\render\mmx.h" />
    1.82 +    <ClInclude Include="..\..\src\render\SDL_d3dmath.h" />
    1.83      <ClInclude Include="..\..\src\render\SDL_sysrender.h" />
    1.84      <ClInclude Include="..\..\src\render\SDL_yuv_sw_c.h" />
    1.85      <ClInclude Include="..\..\src\render\software\SDL_blendfillrect.h" />
    1.86 @@ -289,6 +294,7 @@
    1.87        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
    1.88      </ClCompile>
    1.89      <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
    1.90 +    <ClCompile Include="..\..\src\dynapi\SDL_dynapi.c" />
    1.91      <ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
    1.92      <ClCompile Include="..\..\src\events\SDL_dropevents.c" />
    1.93      <ClCompile Include="..\..\src\events\SDL_events.c" />
    1.94 @@ -311,12 +317,16 @@
    1.95      <ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" />
    1.96      <ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
    1.97      <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c" />
    1.98 -    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.cpp">
    1.99 +    <ClCompile Include="..\..\src\power\SDL_power.c" />
   1.100 +    <ClCompile Include="..\..\src\power\winrt\SDL_syspower.cpp" />
   1.101 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.c" />
   1.102 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11_winrthelpers.cpp">
   1.103        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   1.104        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   1.105        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   1.106        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   1.107      </ClCompile>
   1.108 +    <ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
   1.109      <ClCompile Include="..\..\src\render\SDL_render.c" />
   1.110      <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
   1.111      <ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
     2.1 --- a/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj.filters	Tue Mar 11 12:40:31 2014 -0400
     2.2 +++ b/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj.filters	Wed Mar 12 11:57:15 2014 -0400
     2.3 @@ -339,6 +339,21 @@
     2.4      <ClInclude Include="..\..\include\SDL_filesystem.h">
     2.5        <Filter>Header Files</Filter>
     2.6      </ClInclude>
     2.7 +    <ClInclude Include="..\..\src\render\direct3d11\SDL_render_d3d11_winrthelpers_cpp.h">
     2.8 +      <Filter>Source Files</Filter>
     2.9 +    </ClInclude>
    2.10 +    <ClInclude Include="..\..\src\render\SDL_d3dmath.h">
    2.11 +      <Filter>Source Files</Filter>
    2.12 +    </ClInclude>
    2.13 +    <ClInclude Include="..\..\src\dynapi\SDL_dynapi.h">
    2.14 +      <Filter>Source Files</Filter>
    2.15 +    </ClInclude>
    2.16 +    <ClInclude Include="..\..\src\dynapi\SDL_dynapi_overrides.h">
    2.17 +      <Filter>Source Files</Filter>
    2.18 +    </ClInclude>
    2.19 +    <ClInclude Include="..\..\src\dynapi\SDL_dynapi_procs.h">
    2.20 +      <Filter>Source Files</Filter>
    2.21 +    </ClInclude>
    2.22    </ItemGroup>
    2.23    <ItemGroup>
    2.24      <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
    2.25 @@ -572,9 +587,6 @@
    2.26      <ClCompile Include="..\..\src\video\SDL_video.c">
    2.27        <Filter>Source Files</Filter>
    2.28      </ClCompile>
    2.29 -    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.cpp">
    2.30 -      <Filter>Source Files</Filter>
    2.31 -    </ClCompile>
    2.32      <ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c">
    2.33        <Filter>Source Files</Filter>
    2.34      </ClCompile>
    2.35 @@ -608,5 +620,23 @@
    2.36      <ClCompile Include="..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp">
    2.37        <Filter>Source Files</Filter>
    2.38      </ClCompile>
    2.39 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.c">
    2.40 +      <Filter>Source Files</Filter>
    2.41 +    </ClCompile>
    2.42 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11_winrthelpers.cpp">
    2.43 +      <Filter>Source Files</Filter>
    2.44 +    </ClCompile>
    2.45 +    <ClCompile Include="..\..\src\render\SDL_d3dmath.c">
    2.46 +      <Filter>Source Files</Filter>
    2.47 +    </ClCompile>
    2.48 +    <ClCompile Include="..\..\src\dynapi\SDL_dynapi.c">
    2.49 +      <Filter>Source Files</Filter>
    2.50 +    </ClCompile>
    2.51 +    <ClCompile Include="..\..\src\power\winrt\SDL_syspower.cpp">
    2.52 +      <Filter>Source Files</Filter>
    2.53 +    </ClCompile>
    2.54 +    <ClCompile Include="..\..\src\power\SDL_power.c">
    2.55 +      <Filter>Source Files</Filter>
    2.56 +    </ClCompile>
    2.57    </ItemGroup>
    2.58  </Project>
    2.59 \ No newline at end of file
     3.1 --- a/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj	Tue Mar 11 12:40:31 2014 -0400
     3.2 +++ b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj	Wed Mar 12 11:57:15 2014 -0400
     3.3 @@ -72,6 +72,7 @@
     3.4        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
     3.5      </ClCompile>
     3.6      <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
     3.7 +    <ClCompile Include="..\..\src\dynapi\SDL_dynapi.c" />
     3.8      <ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
     3.9      <ClCompile Include="..\..\src\events\SDL_dropevents.c" />
    3.10      <ClCompile Include="..\..\src\events\SDL_events.c" />
    3.11 @@ -96,6 +97,8 @@
    3.12      <ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
    3.13      <ClCompile Include="..\..\src\joystick\winrt\SDL_xinputjoystick.c" />
    3.14      <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c" />
    3.15 +    <ClCompile Include="..\..\src\power\SDL_power.c" />
    3.16 +    <ClCompile Include="..\..\src\power\winrt\SDL_syspower.cpp" />
    3.17      <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.c" />
    3.18      <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11_winrthelpers.cpp">
    3.19        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
    3.20 @@ -107,6 +110,7 @@
    3.21      </ClCompile>
    3.22      <ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
    3.23      <ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
    3.24 +    <ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
    3.25      <ClCompile Include="..\..\src\render\SDL_render.c" />
    3.26      <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
    3.27      <ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
    3.28 @@ -270,6 +274,9 @@
    3.29      <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_common.h" />
    3.30      <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.h" />
    3.31      <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_xaml.h" />
    3.32 +    <ClInclude Include="..\..\src\dynapi\SDL_dynapi.h" />
    3.33 +    <ClInclude Include="..\..\src\dynapi\SDL_dynapi_overrides.h" />
    3.34 +    <ClInclude Include="..\..\src\dynapi\SDL_dynapi_procs.h" />
    3.35      <ClInclude Include="..\..\src\events\blank_cursor.h" />
    3.36      <ClInclude Include="..\..\src\events\default_cursor.h" />
    3.37      <ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h" />
    3.38 @@ -289,6 +296,7 @@
    3.39      <ClInclude Include="..\..\src\render\mmx.h" />
    3.40      <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
    3.41      <ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
    3.42 +    <ClInclude Include="..\..\src\render\SDL_d3dmath.h" />
    3.43      <ClInclude Include="..\..\src\render\SDL_sysrender.h" />
    3.44      <ClInclude Include="..\..\src\render\SDL_yuv_sw_c.h" />
    3.45      <ClInclude Include="..\..\src\render\software\SDL_blendfillrect.h" />
    3.46 @@ -426,7 +434,7 @@
    3.47        <PrecompiledHeader>NotUsing</PrecompiledHeader>
    3.48        <CompileAsWinRT>false</CompileAsWinRT>
    3.49        <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    3.50 -      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    3.51 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    3.52      </ClCompile>
    3.53      <Link>
    3.54        <SubSystem>Console</SubSystem>
    3.55 @@ -440,7 +448,7 @@
    3.56        <PrecompiledHeader>NotUsing</PrecompiledHeader>
    3.57        <CompileAsWinRT>false</CompileAsWinRT>
    3.58        <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    3.59 -      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    3.60 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    3.61      </ClCompile>
    3.62      <Link>
    3.63        <SubSystem>Console</SubSystem>
    3.64 @@ -454,7 +462,7 @@
    3.65        <PrecompiledHeader>NotUsing</PrecompiledHeader>
    3.66        <CompileAsWinRT>false</CompileAsWinRT>
    3.67        <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    3.68 -      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    3.69 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    3.70      </ClCompile>
    3.71      <Link>
    3.72        <SubSystem>Console</SubSystem>
    3.73 @@ -468,7 +476,7 @@
    3.74        <PrecompiledHeader>NotUsing</PrecompiledHeader>
    3.75        <CompileAsWinRT>false</CompileAsWinRT>
    3.76        <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    3.77 -      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    3.78 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    3.79      </ClCompile>
    3.80      <Link>
    3.81        <SubSystem>Console</SubSystem>
    3.82 @@ -482,7 +490,7 @@
    3.83        <PrecompiledHeader>NotUsing</PrecompiledHeader>
    3.84        <CompileAsWinRT>false</CompileAsWinRT>
    3.85        <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    3.86 -      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    3.87 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    3.88      </ClCompile>
    3.89      <Link>
    3.90        <SubSystem>Console</SubSystem>
    3.91 @@ -496,7 +504,7 @@
    3.92        <PrecompiledHeader>NotUsing</PrecompiledHeader>
    3.93        <CompileAsWinRT>false</CompileAsWinRT>
    3.94        <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    3.95 -      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    3.96 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    3.97      </ClCompile>
    3.98      <Link>
    3.99        <SubSystem>Console</SubSystem>
     4.1 --- a/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters	Tue Mar 11 12:40:31 2014 -0400
     4.2 +++ b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters	Wed Mar 12 11:57:15 2014 -0400
     4.3 @@ -283,6 +283,18 @@
     4.4      <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11_winrthelpers.cpp">
     4.5        <Filter>Source Files</Filter>
     4.6      </ClCompile>
     4.7 +    <ClCompile Include="..\..\src\render\SDL_d3dmath.c">
     4.8 +      <Filter>Source Files</Filter>
     4.9 +    </ClCompile>
    4.10 +    <ClCompile Include="..\..\src\dynapi\SDL_dynapi.c">
    4.11 +      <Filter>Source Files</Filter>
    4.12 +    </ClCompile>
    4.13 +    <ClCompile Include="..\..\src\power\winrt\SDL_syspower.cpp">
    4.14 +      <Filter>Source Files</Filter>
    4.15 +    </ClCompile>
    4.16 +    <ClCompile Include="..\..\src\power\SDL_power.c">
    4.17 +      <Filter>Source Files</Filter>
    4.18 +    </ClCompile>
    4.19    </ItemGroup>
    4.20    <ItemGroup>
    4.21      <ClInclude Include="..\..\include\begin_code.h">
    4.22 @@ -642,6 +654,18 @@
    4.23      <ClInclude Include="..\..\src\render\direct3d11\SDL_render_d3d11_winrthelpers_cpp.h">
    4.24        <Filter>Source Files</Filter>
    4.25      </ClInclude>
    4.26 +    <ClInclude Include="..\..\src\render\SDL_d3dmath.h">
    4.27 +      <Filter>Source Files</Filter>
    4.28 +    </ClInclude>
    4.29 +    <ClInclude Include="..\..\src\dynapi\SDL_dynapi.h">
    4.30 +      <Filter>Source Files</Filter>
    4.31 +    </ClInclude>
    4.32 +    <ClInclude Include="..\..\src\dynapi\SDL_dynapi_overrides.h">
    4.33 +      <Filter>Source Files</Filter>
    4.34 +    </ClInclude>
    4.35 +    <ClInclude Include="..\..\src\dynapi\SDL_dynapi_procs.h">
    4.36 +      <Filter>Source Files</Filter>
    4.37 +    </ClInclude>
    4.38    </ItemGroup>
    4.39    <ItemGroup>
    4.40      <Filter Include="Header Files">
     5.1 --- a/include/SDL_config_winrt.h	Tue Mar 11 12:40:31 2014 -0400
     5.2 +++ b/include/SDL_config_winrt.h	Wed Mar 12 11:57:15 2014 -0400
     5.3 @@ -180,8 +180,7 @@
     5.4  #endif
     5.5  
     5.6  /* Enable system power support */
     5.7 -// TODO, WinRT: investigate system power support.  The Win32-based APIs don't work on WinRT.
     5.8 -#define SDL_POWER_DISABLED  1
     5.9 +#define SDL_POWER_WINRT 1
    5.10  
    5.11  /* Enable assembly routines (Win64 doesn't have inline asm) */
    5.12  #ifndef _WIN64
     6.1 --- a/src/core/winrt/SDL_winrtapp_xaml.cpp	Tue Mar 11 12:40:31 2014 -0400
     6.2 +++ b/src/core/winrt/SDL_winrtapp_xaml.cpp	Wed Mar 12 11:57:15 2014 -0400
     6.3 @@ -42,7 +42,7 @@
     6.4  SDL_bool WINRT_XAMLWasEnabled = SDL_FALSE;
     6.5  
     6.6  #if WINAPI_FAMILY == WINAPI_FAMILY_APP
     6.7 -ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative = NULL;
     6.8 +extern "C" ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative = NULL;
     6.9  static Windows::Foundation::EventRegistrationToken	WINRT_XAMLAppEventToken;
    6.10  #endif
    6.11  
     7.1 --- a/src/dynapi/SDL_dynapi.h	Tue Mar 11 12:40:31 2014 -0400
     7.2 +++ b/src/dynapi/SDL_dynapi.h	Wed Mar 12 11:57:15 2014 -0400
     7.3 @@ -45,6 +45,8 @@
     7.4  
     7.5  #if TARGET_OS_IPHONE  /* probably not useful on iOS. */
     7.6  #define SDL_DYNAMIC_API 0
     7.7 +#elif SDL_BUILDING_WINRT /* probaly not useful on WinRT, given current .dll loading restrictions */
     7.8 +#define SDL_DYNAMIC_API 0
     7.9  #else   /* everyone else. */
    7.10  #define SDL_DYNAMIC_API 1
    7.11  #endif
     8.1 --- a/src/power/SDL_power.c	Tue Mar 11 12:40:31 2014 -0400
     8.2 +++ b/src/power/SDL_power.c	Wed Mar 12 11:57:15 2014 -0400
     8.3 @@ -37,6 +37,7 @@
     8.4  SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *, int *, int *);
     8.5  SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *);
     8.6  SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *);
     8.7 +SDL_bool SDL_GetPowerInfo_WinRT(SDL_PowerState *, int *, int *);
     8.8  
     8.9  #ifndef SDL_POWER_DISABLED
    8.10  #ifdef SDL_POWER_HARDWIRED
    8.11 @@ -77,6 +78,9 @@
    8.12  #ifdef SDL_POWER_PSP        /* handles PSP. */
    8.13      SDL_GetPowerInfo_PSP,
    8.14  #endif
    8.15 +#ifdef SDL_POWER_WINRT          /* handles WinRT */
    8.16 +    SDL_GetPowerInfo_WinRT,
    8.17 +#endif
    8.18  
    8.19  #ifdef SDL_POWER_HARDWIRED
    8.20      SDL_GetPowerInfo_Hardwired,
     9.1 --- a/src/render/direct3d11/SDL_render_d3d11.c	Tue Mar 11 12:40:31 2014 -0400
     9.2 +++ b/src/render/direct3d11/SDL_render_d3d11.c	Wed Mar 12 11:57:15 2014 -0400
     9.3 @@ -961,11 +961,10 @@
     9.4      D3D11_SAMPLER_DESC samplerDesc;
     9.5      D3D11_RASTERIZER_DESC rasterDesc;
     9.6  
     9.7 -    // TODO, WinRT, Mar 11, 2014: once SDL/WinRT is back up and running, see if D3D11 init functions are loadable (via LoadPackagedLibrary/SDL_LoadObject, etc.)
     9.8 -//#ifdef __WINRT__
     9.9 -//    CreateDXGIFactoryFunc = CreateDXGIFactory;
    9.10 -//    D3D11CreateDeviceFunc = D3D11CreateDevice;
    9.11 -//#else
    9.12 +#ifdef __WINRT__
    9.13 +    CreateDXGIFactoryFunc = CreateDXGIFactory1;
    9.14 +    D3D11CreateDeviceFunc = D3D11CreateDevice;
    9.15 +#else
    9.16      data->hDXGIMod = SDL_LoadObject("dxgi.dll");
    9.17      if (!data->hDXGIMod) {
    9.18          result = E_FAIL;
    9.19 @@ -989,7 +988,7 @@
    9.20          result = E_FAIL;
    9.21          goto done;
    9.22      }
    9.23 -//#endif /* __WINRT__ */
    9.24 +#endif /* __WINRT__ */
    9.25  
    9.26      result = CreateDXGIFactoryFunc(&IID_IDXGIFactory2, &data->dxgiFactory);
    9.27      if (FAILED(result)) {
    9.28 @@ -2833,6 +2832,11 @@
    9.29      HRESULT result;
    9.30      DXGI_PRESENT_PARAMETERS parameters;
    9.31  
    9.32 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
    9.33 +    syncInterval = 1;
    9.34 +    presentFlags = 0;
    9.35 +    result = IDXGISwapChain_Present(data->swapChain, syncInterval, presentFlags);
    9.36 +#else
    9.37      if (renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) {
    9.38          syncInterval = 1;
    9.39          presentFlags = 0;
    9.40 @@ -2841,9 +2845,6 @@
    9.41          presentFlags = DXGI_PRESENT_DO_NOT_WAIT;
    9.42      }
    9.43  
    9.44 -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
    9.45 -    result = IDXGISwapChain_Present(data->swapChain, syncInterval, presentFlags);
    9.46 -#else
    9.47      /* The application may optionally specify "dirty" or "scroll"
    9.48       * rects to improve efficiency in certain scenarios.
    9.49       * This option is not available on Windows Phone 8, to note.
    10.1 --- a/src/render/direct3d11/SDL_render_d3d11_winrthelpers.cpp	Tue Mar 11 12:40:31 2014 -0400
    10.2 +++ b/src/render/direct3d11/SDL_render_d3d11_winrthelpers.cpp	Wed Mar 12 11:57:15 2014 -0400
    10.3 @@ -37,6 +37,8 @@
    10.4  using namespace Windows::UI::Core;
    10.5  using namespace Windows::Graphics::Display;
    10.6  
    10.7 +#include <DXGI.h>
    10.8 +
    10.9  
   10.10  extern "C" void *
   10.11  D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer * renderer)
    11.1 --- a/src/thread/stdcpp/SDL_sysmutex.cpp	Tue Mar 11 12:40:31 2014 -0400
    11.2 +++ b/src/thread/stdcpp/SDL_sysmutex.cpp	Wed Mar 12 11:57:15 2014 -0400
    11.3 @@ -79,6 +79,21 @@
    11.4      }
    11.5  }
    11.6  
    11.7 +/* TryLock the mutex */
    11.8 +int
    11.9 +SDL_TryLockMutex(SDL_mutex * mutex)
   11.10 +{
   11.11 +    int retval = 0;
   11.12 +    if (mutex == NULL) {
   11.13 +        return SDL_SetError("Passed a NULL mutex");
   11.14 +    }
   11.15 +
   11.16 +    if (mutex->cpp_mutex.try_lock() == false) {
   11.17 +        retval = SDL_MUTEX_TIMEDOUT;
   11.18 +    }
   11.19 +    return retval;
   11.20 +}
   11.21 +
   11.22  /* Unlock the mutex */
   11.23  extern "C"
   11.24  int