From 77e317609b3a879a8fb3970ecc7d347c09a7a528 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 30 Jun 2017 17:21:26 -0700 Subject: Add special handling for alGerError in the router --- router/al.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'router') diff --git a/router/al.c b/router/al.c index 63fca705..d0ded62d 100644 --- a/router/al.c +++ b/router/al.c @@ -9,8 +9,6 @@ ATOMIC(DriverIface*) CurrentCtxDriver = ATOMIC_INIT_STATIC(NULL); -#define DECL_THUNK0(R, n) AL_API R AL_APIENTRY n(void) \ -{ return ATOMIC_LOAD_SEQ(&CurrentCtxDriver)->n(); } #define DECL_THUNK1(R, n, T1) AL_API R AL_APIENTRY n(T1 a) \ { return ATOMIC_LOAD_SEQ(&CurrentCtxDriver)->n(a); } #define DECL_THUNK2(R, n, T1, T2) AL_API R AL_APIENTRY n(T1 a, T2 b) \ @@ -23,6 +21,17 @@ ATOMIC(DriverIface*) CurrentCtxDriver = ATOMIC_INIT_STATIC(NULL); { return ATOMIC_LOAD_SEQ(&CurrentCtxDriver)->n(a, b, c, d, e); } +/* Ugly hack for some apps calling alGetError without a current context, and + * expecting it to be AL_NO_ERROR. + */ +AL_API ALenum AL_APIENTRY alGetError(void) +{ + DriverIface *iface = ATOMIC_LOAD_SEQ(&CurrentCtxDriver); + if(iface) return iface->alGetError(); + return AL_NO_ERROR; +} + + DECL_THUNK1(void, alDopplerFactor, ALfloat) DECL_THUNK1(void, alDopplerVelocity, ALfloat) DECL_THUNK1(void, alSpeedOfSound, ALfloat) @@ -42,8 +51,6 @@ DECL_THUNK1(ALint, alGetInteger, ALenum) DECL_THUNK1(ALfloat, alGetFloat, ALenum) DECL_THUNK1(ALdouble, alGetDouble, ALenum) -DECL_THUNK0(ALenum, alGetError) - DECL_THUNK1(ALboolean, alIsExtensionPresent, const ALchar*) DECL_THUNK1(void*, alGetProcAddress, const ALchar*) DECL_THUNK1(ALenum, alGetEnumValue, const ALchar*) -- cgit v1.2.3