diff options
author | Chris Robinson <[email protected]> | 2017-07-07 18:33:54 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-07-07 18:33:54 -0700 |
commit | 6be752a9b1a38379b8631c5dcb6c47e099af4f02 (patch) | |
tree | b22d581ed2fd98fbd12526d2af005c6517f110c4 /router/router.c | |
parent | faefa1d55479a5d5a05ddb18f6b9051634adec3d (diff) |
Add methods for thread-local contexts to the router
Diffstat (limited to 'router/router.c')
-rw-r--r-- | router/router.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/router/router.c b/router/router.c index 54f82245..d1c5cfb3 100644 --- a/router/router.c +++ b/router/router.c @@ -16,6 +16,8 @@ DriverIface *DriverList = NULL; int DriverListSize = 0; static int DriverListSizeMax = 0; +altss_t ThreadCtxDriver; + enum LogLevel LogLevel = LogLevel_Error; FILE *LogFile; @@ -54,6 +56,7 @@ BOOL APIENTRY DllMain(HINSTANCE UNUSED(module), DWORD reason, void* UNUSED(reser } LoadDriverList(); + altss_create(&ThreadCtxDriver, NULL); InitALC(); break; @@ -63,6 +66,7 @@ BOOL APIENTRY DllMain(HINSTANCE UNUSED(module), DWORD reason, void* UNUSED(reser case DLL_PROCESS_DETACH: ReleaseALC(); + altss_delete(ThreadCtxDriver); for(i = 0;i < DriverListSize;i++) { @@ -124,6 +128,7 @@ static void AddModule(HMODULE module, const WCHAR *name) } memset(&newdrv, 0, sizeof(newdrv)); + /* Load required functions. */ #define LOAD_PROC(x) do { \ newdrv.x = CAST_FUNC(newdrv.x) GetProcAddress(module, #x); \ if(!newdrv.x) \ @@ -237,10 +242,30 @@ static void AddModule(HMODULE module, const WCHAR *name) newdrv.ALCVer = MAKE_ALC_VER(alc_ver[0], alc_ver[1]); else newdrv.ALCVer = MAKE_ALC_VER(1, 0); + +#undef LOAD_PROC +#define LOAD_PROC(x) do { \ + newdrv.x = CAST_FUNC(newdrv.x) newdrv.alcGetProcAddress(NULL, #x); \ + if(!newdrv.x) \ + { \ + ERR("Failed to find entry point for %s in %ls\n", #x, name); \ + err = 1; \ + } \ +} while(0) + if(newdrv.alcIsExtensionPresent(NULL, "ALC_EXT_thread_local_context")) + { + LOAD_PROC(alcSetThreadContext); + LOAD_PROC(alcGetThreadContext); + } + } + + if(!err) + { TRACE("Loaded module %p, %ls, ALC %d.%d\n", module, name, newdrv.ALCVer>>8, newdrv.ALCVer&255); DriverList[DriverListSize++] = newdrv; } +#undef LOAD_PROC } static void SearchDrivers(WCHAR *path) |