Disable WaitOnAddress SDL_sem implementation on Windows Phone

Apps that use the required APIs do not pass certification.
main
Joel Linn 2020-12-25 17:10:02 +03:00
parent 5b64fdc9bf
commit e7c479414b
1 changed files with 13 additions and 0 deletions

View File

@ -66,6 +66,16 @@ static SDL_sem_impl_t SDL_sem_impl_active = {0};
* Atomic + WaitOnAddress implementation * 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__ #if __WINRT__
/* Functions are guaranteed to be available */ /* Functions are guaranteed to be available */
#define pWaitOnAddress WaitOnAddress #define pWaitOnAddress WaitOnAddress
@ -241,6 +251,7 @@ static const SDL_sem_impl_t SDL_sem_impl_atom =
&SDL_SemValue_atom, &SDL_SemValue_atom,
&SDL_SemPost_atom, &SDL_SemPost_atom,
}; };
#endif /* !SDL_WINAPI_FAMILY_PHONE */
/** /**
@ -392,6 +403,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
/* Default to fallback implementation */ /* Default to fallback implementation */
const SDL_sem_impl_t * impl = &SDL_sem_impl_kern; 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 (!SDL_GetHintBoolean(SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL, SDL_FALSE)) {
#if __WINRT__ #if __WINRT__
/* Link statically on this platform */ /* Link statically on this platform */
@ -415,6 +427,7 @@ SDL_CreateSemaphore(Uint32 initial_value)
} }
#endif #endif
} }
#endif
/* Copy instead of using pointer to save one level of indirection */ /* Copy instead of using pointer to save one level of indirection */
SDL_memcpy(&SDL_sem_impl_active, impl, sizeof(SDL_sem_impl_active)); SDL_memcpy(&SDL_sem_impl_active, impl, sizeof(SDL_sem_impl_active));