aboutsummaryrefslogtreecommitdiffstats
path: root/router
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-06-28 16:48:04 -0700
committerChris Robinson <[email protected]>2017-06-28 17:02:43 -0700
commit9fd7349220223c90e4476030f55a033eb3a37dbd (patch)
tree1763bf91fdd3c2f06e860014a18a5b7e608fb9ee /router
parentcfec20830bca1bdb1bdef5d7429c946fde881d77 (diff)
Add forwarding for the AL functions
Diffstat (limited to 'router')
-rw-r--r--router/al.c20
-rw-r--r--router/router.h4
2 files changed, 18 insertions, 6 deletions
diff --git a/router/al.c b/router/al.c
index 8e179c82..63fca705 100644
--- a/router/al.c
+++ b/router/al.c
@@ -7,12 +7,20 @@
#include "router.h"
-#define DECL_THUNK0(R, n) AL_API R AL_APIENTRY n(void) { return (R)0; }
-#define DECL_THUNK1(R, n, T1) AL_API R AL_APIENTRY n(T1 a) { return (R)0; }
-#define DECL_THUNK2(R, n, T1, T2) AL_API R AL_APIENTRY n(T1 a, T2 b) { return (R)0; }
-#define DECL_THUNK3(R, n, T1, T2, T3) AL_API R AL_APIENTRY n(T1 a, T2 b, T3 c) { return (R)0; }
-#define DECL_THUNK4(R, n, T1, T2, T3, T4) AL_API R AL_APIENTRY n(T1 a, T2 b, T3 c, T4 d) { return (R)0; }
-#define DECL_THUNK5(R, n, T1, T2, T3, T4, T5) AL_API R AL_APIENTRY n(T1 a, T2 b, T3 c, T4 d, T5 e) { return (R)0; }
+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) \
+{ return ATOMIC_LOAD_SEQ(&CurrentCtxDriver)->n(a, b); }
+#define DECL_THUNK3(R, n, T1, T2, T3) AL_API R AL_APIENTRY n(T1 a, T2 b, T3 c)\
+{ return ATOMIC_LOAD_SEQ(&CurrentCtxDriver)->n(a, b, c); }
+#define DECL_THUNK4(R, n, T1, T2, T3, T4) AL_API R AL_APIENTRY n(T1 a, T2 b, T3 c, T4 d) \
+{ return ATOMIC_LOAD_SEQ(&CurrentCtxDriver)->n(a, b, c, d); }
+#define DECL_THUNK5(R, n, T1, T2, T3, T4, T5) AL_API R AL_APIENTRY n(T1 a, T2 b, T3 c, T4 d, T5 e)\
+{ return ATOMIC_LOAD_SEQ(&CurrentCtxDriver)->n(a, b, c, d, e); }
DECL_THUNK1(void, alDopplerFactor, ALfloat)
diff --git a/router/router.h b/router/router.h
index ee20bc17..57a32d9a 100644
--- a/router/router.h
+++ b/router/router.h
@@ -7,6 +7,7 @@
#include "AL/alc.h"
#include "AL/al.h"
+#include "atomic.h"
typedef struct DriverIface {
@@ -112,4 +113,7 @@ typedef struct DriverIface {
extern DriverIface *DriverList;
extern int DriverListSize;
+extern ATOMIC(DriverIface*) CurrentCtxDriver;
+
+
#endif /* ROUTER_ROUTER_H */