mirror of
https://github.com/love2d/megasource.git
synced 2026-08-20 04:30:45 +02:00
Update OpenAL Soft to commit 414b56edec5441211dc924fef365c54267c04f1c
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#include "router.h"
|
||||
|
||||
|
||||
ATOMIC(DriverIface*) CurrentCtxDriver = ATOMIC_INIT_STATIC(NULL);
|
||||
atomic_DriverIfacePtr CurrentCtxDriver = ATOMIC_INIT_STATIC(NULL);
|
||||
|
||||
#define DECL_THUNK1(R,n,T1) AL_API R AL_APIENTRY n(T1 a) \
|
||||
{ \
|
||||
|
||||
@@ -64,7 +64,9 @@ BOOL APIENTRY DllMain(HINSTANCE UNUSED(module), DWORD reason, void* UNUSED(reser
|
||||
break;
|
||||
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
althrd_thread_detach();
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
@@ -84,6 +86,8 @@ BOOL APIENTRY DllMain(HINSTANCE UNUSED(module), DWORD reason, void* UNUSED(reser
|
||||
if(LogFile && LogFile != stderr)
|
||||
fclose(LogFile);
|
||||
LogFile = NULL;
|
||||
|
||||
althrd_deinit();
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
@@ -340,26 +344,47 @@ static int GetLoadedModuleDirectory(const WCHAR *name, WCHAR *moddir, DWORD leng
|
||||
|
||||
void LoadDriverList(void)
|
||||
{
|
||||
WCHAR path[MAX_PATH+1] = L"";
|
||||
WCHAR dll_path[MAX_PATH+1] = L"";
|
||||
WCHAR cwd_path[MAX_PATH+1] = L"";
|
||||
WCHAR proc_path[MAX_PATH+1] = L"";
|
||||
WCHAR sys_path[MAX_PATH+1] = L"";
|
||||
int len;
|
||||
|
||||
if(GetLoadedModuleDirectory(L"OpenAL32.dll", path, MAX_PATH))
|
||||
SearchDrivers(path);
|
||||
if(GetLoadedModuleDirectory(L"OpenAL32.dll", dll_path, MAX_PATH))
|
||||
TRACE("Got DLL path %ls\n", dll_path);
|
||||
|
||||
GetCurrentDirectoryW(MAX_PATH, path);
|
||||
len = lstrlenW(path);
|
||||
if(len > 0 && (path[len-1] == '\\' || path[len-1] == '/'))
|
||||
path[len-1] = '\0';
|
||||
SearchDrivers(path);
|
||||
GetCurrentDirectoryW(MAX_PATH, cwd_path);
|
||||
len = lstrlenW(cwd_path);
|
||||
if(len > 0 && (cwd_path[len-1] == '\\' || cwd_path[len-1] == '/'))
|
||||
cwd_path[len-1] = '\0';
|
||||
TRACE("Got current working directory %ls\n", cwd_path);
|
||||
|
||||
if(GetLoadedModuleDirectory(NULL, path, MAX_PATH))
|
||||
SearchDrivers(path);
|
||||
if(GetLoadedModuleDirectory(NULL, proc_path, MAX_PATH))
|
||||
TRACE("Got proc path %ls\n", proc_path);
|
||||
|
||||
GetSystemDirectoryW(path, MAX_PATH);
|
||||
len = lstrlenW(path);
|
||||
if(len > 0 && (path[len-1] == '\\' || path[len-1] == '/'))
|
||||
path[len-1] = '\0';
|
||||
SearchDrivers(path);
|
||||
GetSystemDirectoryW(sys_path, MAX_PATH);
|
||||
len = lstrlenW(sys_path);
|
||||
if(len > 0 && (sys_path[len-1] == '\\' || sys_path[len-1] == '/'))
|
||||
sys_path[len-1] = '\0';
|
||||
TRACE("Got system path %ls\n", sys_path);
|
||||
|
||||
/* Don't search the DLL's path if it is the same as the current working
|
||||
* directory, app's path, or system path (don't want to do duplicate
|
||||
* searches, or increase the priority of the app or system path).
|
||||
*/
|
||||
if(dll_path[0] &&
|
||||
(!cwd_path[0] || wcscmp(dll_path, cwd_path) != 0) &&
|
||||
(!proc_path[0] || wcscmp(dll_path, proc_path) != 0) &&
|
||||
(!sys_path[0] || wcscmp(dll_path, sys_path) != 0))
|
||||
SearchDrivers(dll_path);
|
||||
if(cwd_path[0] &&
|
||||
(!proc_path[0] || wcscmp(cwd_path, proc_path) != 0) &&
|
||||
(!sys_path[0] || wcscmp(cwd_path, sys_path) != 0))
|
||||
SearchDrivers(cwd_path);
|
||||
if(proc_path[0] && (!sys_path[0] || wcscmp(proc_path, sys_path) != 0))
|
||||
SearchDrivers(proc_path);
|
||||
if(sys_path[0])
|
||||
SearchDrivers(sys_path);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -137,7 +137,8 @@ extern DriverIface *DriverList;
|
||||
extern int DriverListSize;
|
||||
|
||||
extern altss_t ThreadCtxDriver;
|
||||
extern ATOMIC(DriverIface*) CurrentCtxDriver;
|
||||
typedef ATOMIC(DriverIface*) atomic_DriverIfacePtr;
|
||||
extern atomic_DriverIfacePtr CurrentCtxDriver;
|
||||
|
||||
|
||||
typedef struct PtrIntMap {
|
||||
|
||||
Reference in New Issue
Block a user