aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-09-12 22:32:34 -0700
committerChris Robinson <[email protected]>2023-09-12 22:32:34 -0700
commita7fc952036668d6e6bdf7737cc13e92b4002259c (patch)
tree9a48f5faa59cb9ef82f5e2f746ddb0e04846de71
parent6722ad196145ef7334d7478bdd375308801e7096 (diff)
Add a alcGetProcAddress2 function
This is essentially just a copy of alcGetProcAddress. It's purpose is to bypass Creative's router's alcGetProcAddress implementation, which returns its own functions even if given a device handle. When combined with it also wrapping the drivers' device and context handles, that prevents any extention function that needs a recognizable device or context handle from working, like the *Direct functions, as there's no way for the app to get a device or context handle the driver can know about). An alternate function to get function pointers allows a driver to return its own implementation for standard and extension functions, which an application can use to "bootstrap" audio to use a particular driver directly, enabling use of extensions that the router gets in the way of (and also avoid the overhead of the router, however small that may be).
-rw-r--r--alc/alc.cpp3
-rw-r--r--alc/export_list.h1
-rw-r--r--alc/inprogext.h4
3 files changed, 8 insertions, 0 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index 0c42edbc..baa4788f 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -2564,6 +2564,9 @@ ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent(ALCdevice *device, const A
}
+ALCvoid* ALC_APIENTRY alcGetProcAddress2(ALCdevice *device, const ALCchar *funcName) noexcept
+{ return alcGetProcAddress(device, funcName); }
+
ALC_API ALCvoid* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcName) noexcept
{
if(!funcName)
diff --git a/alc/export_list.h b/alc/export_list.h
index 9e92570e..cefe7a09 100644
--- a/alc/export_list.h
+++ b/alc/export_list.h
@@ -220,6 +220,7 @@ inline const FuncExport alcFunctions[]{
DECL(alGetDebugMessageLogEXT),
/* Direct Context functions */
+ DECL(alcGetProcAddress2),
DECL(alEnableDirect),
DECL(alDisableDirect),
DECL(alIsEnabledDirect),
diff --git a/alc/inprogext.h b/alc/inprogext.h
index fe2a1437..2fa425bb 100644
--- a/alc/inprogext.h
+++ b/alc/inprogext.h
@@ -65,6 +65,8 @@ AL_API void AL_APIENTRY alAuxiliaryEffectSlotStopvSOFT(ALsizei n, const ALuint *
#ifndef AL_EXT_direct_context
#define AL_EXT_direct_context
+typedef ALCvoid* (ALC_APIENTRY *LPALCGETPROCADDRESS2)(ALCdevice *device, const ALCchar *funcname) AL_API_NOEXCEPT17;
+
typedef void (AL_APIENTRY *LPALENABLEDIRECT)(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDISABLEDIRECT)(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISENABLEDDIRECT)(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT17;
@@ -224,6 +226,8 @@ typedef ALenum (AL_APIENTRY *LPEAXGETDIRECT)(ALCcontext *context, const struct _
typedef ALboolean (AL_APIENTRY *LPEAXSETBUFFERMODEDIRECT)(ALCcontext *context, ALsizei n, const ALuint *buffers, ALint value) AL_API_NOEXCEPT17;
typedef ALenum (AL_APIENTRY *LPEAXGETBUFFERMODEDIRECT)(ALCcontext *context, ALuint buffer, ALint *pReserved) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
+ALCvoid* AL_APIENTRY alcGetProcAddress2(ALCdevice *device, const ALchar *funcName) AL_API_NOEXCEPT;
+
void AL_APIENTRY alEnableDirect(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT;
void AL_APIENTRY alDisableDirect(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alIsEnabledDirect(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT;