Disable WaitOnAddress SDL_sem implementation on Windows Phone Apps that use the required APIs do not pass certification.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
diff --git a/src/thread/windows/SDL_syssem.c b/src/thread/windows/SDL_syssem.c
index 45497fc..753d429 100644
--- a/src/thread/windows/SDL_syssem.c
+++ b/src/thread/windows/SDL_syssem.c
@@ -66,6 +66,16 @@ static SDL_sem_impl_t SDL_sem_impl_active = {0};
* Atomic + WaitOnAddress implementation
*/
+/* APIs not available on WinPhone 8.1 */
+/* https://www.microsoft.com/en-us/download/details.aspx?id=47328 */
+
+#if (HAVE_WINAPIFAMILY_H) && defined(WINAPI_FAMILY_PHONE_APP)
+#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)
+#else
+#define SDL_WINAPI_FAMILY_PHONE 0
+#endif
+
+#if !SDL_WINAPI_FAMILY_PHONE
#if __WINRT__
/* Functions are guaranteed to be available */
#define pWaitOnAddress WaitOnAddress
@@ -241,6 +251,7 @@ static const SDL_sem_impl_t SDL_sem_impl_atom =
&SDL_SemValue_atom,
&SDL_SemPost_atom,
};
+#endif /* !SDL_WINAPI_FAMILY_PHONE */
/**
@@ -392,6 +403,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
/* Default to fallback implementation */
const SDL_sem_impl_t * impl = &SDL_sem_impl_kern;
+#if !SDL_WINAPI_FAMILY_PHONE
if (!SDL_GetHintBoolean(SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL, SDL_FALSE)) {
#if __WINRT__
/* Link statically on this platform */
@@ -415,6 +427,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
}
#endif
}
+#endif
/* Copy instead of using pointer to save one level of indirection */
SDL_memcpy(&SDL_sem_impl_active, impl, sizeof(SDL_sem_impl_active));