WinRT: added support for the SDL_loadso APIs, via LoadPackagedLibrary
This commit is contained in:
parent
cc456a7516
commit
1ce8f1c824
4 changed files with 24 additions and 5 deletions
|
@ -53,6 +53,7 @@
|
||||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
|
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
|
||||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
|
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
|
||||||
<ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
|
<ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
|
||||||
<ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
|
<ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
|
||||||
<ClCompile Include="..\..\src\events\SDL_dropevents.c" />
|
<ClCompile Include="..\..\src\events\SDL_dropevents.c" />
|
||||||
|
@ -68,6 +69,7 @@
|
||||||
<ClCompile Include="..\..\src\haptic\SDL_haptic.c" />
|
<ClCompile Include="..\..\src\haptic\SDL_haptic.c" />
|
||||||
<ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c" />
|
<ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c" />
|
||||||
<ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
|
<ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
|
||||||
|
<ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c" />
|
||||||
<ClCompile Include="..\..\src\render\SDL_render.c" />
|
<ClCompile Include="..\..\src\render\SDL_render.c" />
|
||||||
<ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
|
<ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
|
||||||
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
|
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
|
||||||
|
|
|
@ -146,9 +146,7 @@ typedef unsigned int uintptr_t;
|
||||||
#define SDL_JOYSTICK_DISABLED 1
|
#define SDL_JOYSTICK_DISABLED 1
|
||||||
|
|
||||||
/* Enable various shared object loading systems */
|
/* Enable various shared object loading systems */
|
||||||
// TODO, WinRT: adapt the Win32 shared object loading code for WinRT
|
#define SDL_LOADSO_WINDOWS 1
|
||||||
#define SDL_LOADSO_DISABLED 1
|
|
||||||
//#define SDL_LOADSO_WINDOWS 1
|
|
||||||
|
|
||||||
/* Enable various threading systems */
|
/* Enable various threading systems */
|
||||||
#define SDL_THREAD_STDCPP 1
|
#define SDL_THREAD_STDCPP 1
|
||||||
|
|
|
@ -20,12 +20,12 @@
|
||||||
*/
|
*/
|
||||||
#include "SDL_config.h"
|
#include "SDL_config.h"
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#if defined(__WIN32__) || defined(__WINRT__)
|
||||||
|
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
#include "SDL_windows.h"
|
#include "SDL_windows.h"
|
||||||
|
|
||||||
#include <objbase.h> /* for CoInitialize/CoUninitialize */
|
#include <objbase.h> /* for CoInitialize/CoUninitialize (Win32 only) */
|
||||||
|
|
||||||
|
|
||||||
/* Sets an error message based on GetLastError() */
|
/* Sets an error message based on GetLastError() */
|
||||||
|
@ -44,6 +44,14 @@ WIN_SetError(const char *prefix)
|
||||||
HRESULT
|
HRESULT
|
||||||
WIN_CoInitialize(void)
|
WIN_CoInitialize(void)
|
||||||
{
|
{
|
||||||
|
#ifdef __WINRT__
|
||||||
|
/* DLudwig: On WinRT, it is assumed that COM was initialized in main().
|
||||||
|
CoInitializeEx is available (not CoInitialize though), however
|
||||||
|
on WinRT, main() is typically declared with the [MTAThread]
|
||||||
|
attribute, which, AFAIK, should initialize COM.
|
||||||
|
*/
|
||||||
|
return S_OK;
|
||||||
|
#else
|
||||||
const HRESULT hr = CoInitialize(NULL);
|
const HRESULT hr = CoInitialize(NULL);
|
||||||
|
|
||||||
/* S_FALSE means success, but someone else already initialized. */
|
/* S_FALSE means success, but someone else already initialized. */
|
||||||
|
@ -53,12 +61,15 @@ WIN_CoInitialize(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WIN_CoUninitialize(void)
|
WIN_CoUninitialize(void)
|
||||||
{
|
{
|
||||||
|
#ifndef __WINRT__
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __WIN32__ */
|
#endif /* __WIN32__ */
|
||||||
|
|
|
@ -33,7 +33,15 @@ void *
|
||||||
SDL_LoadObject(const char *sofile)
|
SDL_LoadObject(const char *sofile)
|
||||||
{
|
{
|
||||||
LPTSTR tstr = WIN_UTF8ToString(sofile);
|
LPTSTR tstr = WIN_UTF8ToString(sofile);
|
||||||
|
#ifdef __WINRT__
|
||||||
|
/* WinRT only publically supports LoadPackagedLibrary() for loading .dll
|
||||||
|
files. LoadLibrary() is a private API, and not available for apps
|
||||||
|
(that can be published to MS' Windows Store.)
|
||||||
|
*/
|
||||||
|
void *handle = (void *) LoadPackagedLibrary(tstr, 0);
|
||||||
|
#else
|
||||||
void *handle = (void *) LoadLibrary(tstr);
|
void *handle = (void *) LoadLibrary(tstr);
|
||||||
|
#endif
|
||||||
SDL_free(tstr);
|
SDL_free(tstr);
|
||||||
|
|
||||||
/* Generate an error message if all loads failed */
|
/* Generate an error message if all loads failed */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue