Add forwarding for the AL functions

This commit is contained in:
Chris Robinson 2017-06-28 16:48:04 -07:00
parent cfec20830b
commit 9fd7349220
3 changed files with 19 additions and 7 deletions

View File

@ -1284,7 +1284,7 @@ SET(EX_TARGET OpenAL)
if(WIN32 AND ALSOFT_BUILD_ROUTER)
SET_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME soft_oal)
ADD_LIBRARY(Router SHARED router/router.c router/alc.c router/al.c)
ADD_LIBRARY(Router SHARED router/router.c router/alc.c router/al.c ${COMMON_OBJS})
SET_PROPERTY(TARGET Router APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS ${EXTRA_LDFLAGS})
IF(MSVC)

View File

@ -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)

View File

@ -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 */