aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-06-30 17:21:26 -0700
committerChris Robinson <[email protected]>2017-06-30 17:21:26 -0700
commit77e317609b3a879a8fb3970ecc7d347c09a7a528 (patch)
tree6bd3e29552dcb9205eb888c106a393818517b8e7
parentce9222b68619c3ddd361fd3ea43c3d9a6772694f (diff)
Add special handling for alGerError in the router
-rw-r--r--router/al.c15
1 files changed, 11 insertions, 4 deletions
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*)