Ticket #4561: snd_detect_openal_complete_wmi_removal.patch
File snd_detect_openal_complete_wmi_removal.patch, 29.6 KB (added by , 7 years ago) |
---|
-
build/premake/premake4.lua
803 803 extern_libs = { 804 804 "boost", 805 805 "sdl", 806 "openal", 806 807 "opengl", 807 808 "libpng", 808 809 "zlib", -
source/lib/snd.cpp
1 /* Copyright (c) 2017 Wildfire Games 2 * 3 * Permission is hereby granted, free of charge, to any person obtaining 4 * a copy of this software and associated documentation files (the 5 * "Software"), to deal in the Software without restriction, including 6 * without limitation the rights to use, copy, modify, merge, publish, 7 * distribute, sublicense, and/or sell copies of the Software, and to 8 * permit persons to whom the Software is furnished to do so, subject to 9 * the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 23 /* 24 * sound card detection. 25 */ 26 27 #include "precompiled.h" 28 #include "lib/snd.h" 29 30 #include <stdio.h> 31 #include <stdlib.h> 32 33 #include "lib/external_libraries/openal.h" 34 35 std::string snd_card; 36 std::string snd_drv_ver; 37 38 void snd_detect() 39 { 40 // OpenAL alGetString might not return anything interesting on certain platforms 41 // (see https://stackoverflow.com/questions/28960638 for an example). 42 // However our previous code supported only Windows, and alGetString does work on 43 // Windows, so this is an improvement. 44 45 // Sound cards 46 47 const ALCchar* devices = NULL; 48 if (alcIsExtensionPresent(NULL, "ALC_enumeration_EXT") == AL_TRUE) 49 { 50 if (alcIsExtensionPresent(NULL, "ALC_enumerate_all_EXT") == AL_TRUE) 51 devices = alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); 52 else 53 devices = alcGetString(NULL, ALC_DEVICE_SPECIFIER); 54 } 55 WARN_IF_FALSE(devices); 56 57 snd_card.clear(); 58 do { 59 snd_card += devices; 60 devices += strlen(devices) + 1; 61 snd_card += "; "; 62 } while (*devices); 63 64 // Driver version 65 snd_drv_ver = alGetString(AL_VERSION); 66 } -
source/lib/snd.h
Property changes on: source/lib/snd.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property
1 /* Copyright (c) 2017 Wildfire Games 2 * 3 * Permission is hereby granted, free of charge, to any person obtaining 4 * a copy of this software and associated documentation files (the 5 * "Software"), to deal in the Software without restriction, including 6 * without limitation the rights to use, copy, modify, merge, publish, 7 * distribute, sublicense, and/or sell copies of the Software, and to 8 * permit persons to whom the Software is furnished to do so, subject to 9 * the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 23 /* 24 * sound card detection. 25 */ 26 27 #ifndef INCLUDED_SND 28 #define INCLUDED_SND 29 30 #include <string> 31 32 /** 33 * description of sound card. 34 **/ 35 extern std::string snd_card; 36 37 /** 38 * sound driver identification and version. 39 **/ 40 extern std::string snd_drv_ver; 41 42 /** 43 * detect sound card and set the above information. 44 **/ 45 extern void snd_detect(); 46 47 #endif // #ifndef INCLUDED_SND -
source/lib/sysdep/gfx.cpp
Property changes on: source/lib/snd.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property
39 39 40 40 std::wstring CardName() 41 41 { 42 // GL_VENDOR+GL_RENDERER are good enough here, so we don't use wgfx_CardName,43 // plus thatcan cause crashes with Nvidia Optimus and some netbooks42 // GL_VENDOR+GL_RENDERER are good enough here, so we don't use WMI to detect the cards. 43 // On top of that WMI can cause crashes with Nvidia Optimus and some netbooks 44 44 // see http://trac.wildfiregames.com/ticket/1952 45 45 // http://trac.wildfiregames.com/ticket/1575 46 46 wchar_t cardName[128]; -
source/lib/sysdep/os/win/wgfx.cpp
1 /* Copyright (c) 201 0Wildfire Games1 /* Copyright (c) 2017 Wildfire Games 2 2 * 3 3 * Permission is hereby granted, free of charge, to any person obtaining 4 4 * a copy of this software and associated documentation files (the … … 30 30 #include "lib/sysdep/gfx.h" 31 31 #include "lib/sysdep/os/win/wdll_ver.h" 32 32 #include "lib/sysdep/os/win/wutil.h" 33 #include "lib/sysdep/os/win/wmi.h"34 33 35 34 #if MSC_VERSION 36 35 #pragma comment(lib, "advapi32.lib") // registry … … 137 136 } 138 137 139 138 140 Status wgfx_CardName(wchar_t* cardName, size_t numChars)141 {142 WmiInstances instances;143 RETURN_STATUS_IF_ERR(wmi_GetClassInstances(L"Win32_VideoController", instances));144 wchar_t* pos = cardName;145 for(WmiInstances::iterator it = instances.begin(); it != instances.end(); ++it)146 {147 if((*it)[L"Availability"].intVal == 8) // offline148 continue;149 const int ret = swprintf_s(pos, numChars-(pos-cardName), L"%ls; ", (*it)[L"Caption"].bstrVal);150 if(ret > 0)151 pos += ret;152 return INFO::OK;153 }154 155 return ERR::FAIL; // no active card found156 }157 158 159 139 std::wstring wgfx_DriverInfo() 160 140 { 161 141 VersionList versionList; -
source/lib/sysdep/os/win/wgfx.h
1 /* Copyright (c) 201 0Wildfire Games1 /* Copyright (c) 2017 Wildfire Games 2 2 * 3 3 * Permission is hereby granted, free of charge, to any person obtaining 4 4 * a copy of this software and associated documentation files (the … … 23 23 #ifndef INCLUDED_WGFX 24 24 #define INCLUDED_WGFX 25 25 26 extern Status wgfx_CardName(wchar_t* cardName, size_t numChars);27 26 extern std::wstring wgfx_DriverInfo(); 28 27 29 28 #endif // #ifndef INCLUDED_WGFX -
source/lib/sysdep/os/win/wmi.cpp
1 /* Copyright (c) 2011 Wildfire Games2 *3 * Permission is hereby granted, free of charge, to any person obtaining4 * a copy of this software and associated documentation files (the5 * "Software"), to deal in the Software without restriction, including6 * without limitation the rights to use, copy, modify, merge, publish,7 * distribute, sublicense, and/or sell copies of the Software, and to8 * permit persons to whom the Software is furnished to do so, subject to9 * the following conditions:10 *11 * The above copyright notice and this permission notice shall be included12 * in all copies or substantial portions of the Software.13 *14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.21 */22 23 /*24 * wrapper for Windows Management Instrumentation25 */26 27 #include "precompiled.h"28 #include "lib/sysdep/os/win/wmi.h"29 30 #include <wbemidl.h>31 32 #include "lib/module_init.h"33 34 #pragma comment(lib, "wbemuuid.lib")35 36 37 static IWbemServices* pSvc;38 39 _COM_SMARTPTR_TYPEDEF(IWbemLocator, __uuidof(IWbemLocator));40 _COM_SMARTPTR_TYPEDEF(IWbemClassObject, __uuidof(IWbemClassObject));41 _COM_SMARTPTR_TYPEDEF(IEnumWbemClassObject, __uuidof(IEnumWbemClassObject));42 43 static ModuleInitState initState;44 45 static bool didInitCOM = false;46 47 static Status Init()48 {49 HRESULT hr;50 51 hr = CoInitialize(0);52 ENSURE(hr == S_OK || hr == S_FALSE); // S_FALSE => already initialized53 54 // balance calls to CoInitialize and CoUninitialize55 if (hr == S_FALSE)56 CoUninitialize();57 else if (hr == S_OK)58 didInitCOM = true;59 60 hr = CoInitializeSecurity(0, -1, 0, 0, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, 0, EOAC_NONE, 0);61 if(FAILED(hr))62 WARN_RETURN(ERR::_2);63 64 {65 IWbemLocatorPtr pLoc = 0;66 hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, IID_IWbemLocator, (void**)&pLoc);67 if(FAILED(hr))68 WARN_RETURN(ERR::_3);69 70 hr = pLoc->ConnectServer(_bstr_t(L"ROOT\\CIMV2"), 0, 0, 0, 0, 0, 0, &pSvc);71 if(FAILED(hr))72 return ERR::_4; // NOWARN (happens if WMI service is disabled)73 }74 75 hr = CoSetProxyBlanket(pSvc, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, 0, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, 0, EOAC_NONE);76 if(FAILED(hr))77 WARN_RETURN(ERR::_5);78 79 return INFO::OK;80 }81 82 static void Shutdown()83 {84 pSvc->Release();85 86 if (didInitCOM)87 {88 /* From MSDN documentation: A thread must call CoUninitialize once for each successful call89 * it has made to the CoInitialize or CoInitializeEx function, including any call that returns90 * S_FALSE. Only the CoUninitialize call corresponding to the CoInitialize or CoInitializeEx91 * call that initialized the library can close it.92 *93 * So it should be perfectly safe to call this, since it balances out the CoInitialize in Init94 */95 CoUninitialize();96 didInitCOM = false;97 }98 }99 100 void wmi_Shutdown()101 {102 ModuleShutdown(&initState, Shutdown);103 }104 105 106 Status wmi_GetClassInstances(const wchar_t* className, WmiInstances& instances)107 {108 RETURN_STATUS_IF_ERR(ModuleInit(&initState, Init));109 110 IEnumWbemClassObjectPtr pEnum = 0;111 wchar_t query[200];112 swprintf_s(query, ARRAY_SIZE(query), L"SELECT * FROM %ls", className);113 HRESULT hr = pSvc->ExecQuery(L"WQL", _bstr_t(query), WBEM_FLAG_FORWARD_ONLY|WBEM_FLAG_RETURN_IMMEDIATELY, 0, &pEnum);114 if(FAILED(hr))115 WARN_RETURN(ERR::FAIL);116 ENSURE(pEnum);117 118 for(;;)119 {120 IWbemClassObjectPtr pObj = 0;121 ULONG numReturned = 0;122 hr = pEnum->Next((LONG)WBEM_INFINITE, 1, &pObj, &numReturned);123 if(FAILED(hr))124 WARN_RETURN(ERR::FAIL);125 if(numReturned == 0)126 break;127 ENSURE(pEnum);128 129 WmiInstance instance;130 pObj->BeginEnumeration(WBEM_FLAG_NONSYSTEM_ONLY);131 for(;;)132 {133 BSTR name = NULL;134 VARIANT value;135 VariantInit(&value);136 if(pObj->Next(0, &name, &value, 0, 0) != WBEM_S_NO_ERROR)137 {138 SysFreeString(name);139 break;140 }141 instance[name] = value;142 SysFreeString(name);143 }144 instances.push_back(instance);145 }146 147 return INFO::OK;148 } -
source/lib/sysdep/os/win/wmi.h
Property changes on: source/lib/sysdep/os/win/wmi.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property
1 /* Copyright (c) 2010 Wildfire Games2 *3 * Permission is hereby granted, free of charge, to any person obtaining4 * a copy of this software and associated documentation files (the5 * "Software"), to deal in the Software without restriction, including6 * without limitation the rights to use, copy, modify, merge, publish,7 * distribute, sublicense, and/or sell copies of the Software, and to8 * permit persons to whom the Software is furnished to do so, subject to9 * the following conditions:10 *11 * The above copyright notice and this permission notice shall be included12 * in all copies or substantial portions of the Software.13 *14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.21 */22 23 /*24 * wrapper for Windows Management Instrumentation25 */26 27 #ifndef INCLUDED_WMI28 #define INCLUDED_WMI29 30 #include <map>31 32 // note: we expose the VARIANT value as returned by WMI. this allows other33 // modules to use the values they want directly, rather than forcing34 // everything to be converted to/parsed from strings. it does drag in35 // OLE headers, but this module is entirely Windows-specific anyway.36 #define _WIN32_DCOM37 #include "lib/sysdep/os/win/win.h"38 #include <comdef.h> // VARIANT39 // contains name and value of all instance properties40 typedef std::map<std::wstring, VARIANT> WmiInstance;41 42 typedef std::vector<WmiInstance> WmiInstances;43 44 /**45 * get all instances of the requested class.46 **/47 extern Status wmi_GetClassInstances(const wchar_t* className, WmiInstances& instances);48 49 extern void wmi_Shutdown();50 51 #endif // #ifndef INCLUDED_WMI -
source/lib/sysdep/os/win/wsnd.cpp
Property changes on: source/lib/sysdep/os/win/wmi.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property
1 /* Copyright (c) 2010 Wildfire Games2 *3 * Permission is hereby granted, free of charge, to any person obtaining4 * a copy of this software and associated documentation files (the5 * "Software"), to deal in the Software without restriction, including6 * without limitation the rights to use, copy, modify, merge, publish,7 * distribute, sublicense, and/or sell copies of the Software, and to8 * permit persons to whom the Software is furnished to do so, subject to9 * the following conditions:10 *11 * The above copyright notice and this permission notice shall be included12 * in all copies or substantial portions of the Software.13 *14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.21 */22 23 /*24 * sound card detection on Windows.25 */26 27 #include "precompiled.h"28 #include "lib/sysdep/snd.h"29 30 #include <stdio.h>31 #include <stdlib.h>32 #include <string>33 #include <set>34 35 #include "lib/file/file_system.h"36 #include "lib/sysdep/os/win/wdll_ver.h"37 #include "lib/sysdep/os/win/wversion.h"38 #include "lib/sysdep/os/win/wutil.h"39 #include "lib/sysdep/os/win/wmi.h"40 41 42 static bool IsOpenAlDllName(const Path::String& name)43 {44 // (matches "*oal.dll" and "*OpenAL*", as with OpenAL router's search)45 return name.find(L"oal.dll") != Path::String::npos || name.find(L"OpenAL") != Path::String::npos;46 }47 48 // ensures each OpenAL DLL is only listed once (even if present in several49 // directories on our search path).50 typedef std::set<Path::String> StringSet;51 52 // find all OpenAL DLLs in a dir.53 // call in library search order (exe dir, then win sys dir); otherwise,54 // DLLs in the executable's starting directory hide those of the55 // same name in the system directory.56 static void add_oal_dlls_in_dir(const OsPath& path, StringSet& dlls, VersionList& versionList)57 {58 CFileInfos files;59 (void)GetDirectoryEntries(path, &files, 0);60 for(size_t i = 0; i < files.size(); i++)61 {62 const Path::String name = files[i].Name().string();63 if(!IsOpenAlDllName(name))64 continue;65 66 // already in StringSet (i.e. has already been wdll_ver_list_add-ed)67 std::pair<StringSet::iterator, bool> ret = dlls.insert(name);68 if(!ret.second) // insert failed - element already there69 continue;70 71 wdll_ver_Append(path / name, versionList);72 }73 }74 75 76 //-----------------------------------------------------------------------------77 // DirectSound driver version78 79 // we've seen audio problems caused by buggy DirectSound drivers (because80 // OpenAL can use them in its implementation), so their version should be81 // retrieved as well. the only way I know of is to enumerate all DS devices.82 //83 // unfortunately this fails with Vista's DS emulation - it returns some84 // GUID crap as the module name. to avoidc crashing when attempting to get85 // the version info for that bogus driver path, we'll skip this code there.86 // (delay-loading dsound.dll eliminates any overhead)87 88 static OsPath directSoundDriverPath;89 90 // store sound card name and path to DirectSound driver.91 // called for each DirectSound driver, but aborts after first valid driver.92 static BOOL CALLBACK DirectSoundCallback(void* guid, const wchar_t* UNUSED(description),93 const wchar_t* module, void* UNUSED(cbData))94 {95 // skip first dummy entry (description == "Primary Sound Driver")96 if(guid == NULL)97 return TRUE; // continue calling98 99 // note: $system\\drivers is not in LoadLibrary's search list,100 // so we have to give the full pathname.101 directSoundDriverPath = wutil_SystemPath()/"drivers" / module;102 103 // we assume the first "driver name" (sound card) is the one we want;104 // stick with that and stop calling.105 return FALSE;106 }107 108 static const OsPath& GetDirectSoundDriverPath()109 {110 #define DS_OK 0111 typedef BOOL (CALLBACK* LPDSENUMCALLBACKW)(void*, const wchar_t*, const wchar_t*, void*);112 HMODULE hDsoundDll = LoadLibraryW(L"dsound.dll");113 WUTIL_FUNC(pDirectSoundEnumerateW, HRESULT, (LPDSENUMCALLBACKW, void*));114 WUTIL_IMPORT(hDsoundDll, DirectSoundEnumerateW, pDirectSoundEnumerateW);115 if(pDirectSoundEnumerateW)116 {117 HRESULT ret = pDirectSoundEnumerateW(DirectSoundCallback, (void*)0);118 ENSURE(ret == DS_OK);119 }120 FreeLibrary(hDsoundDll);121 122 return directSoundDriverPath;123 }124 125 //-----------------------------------------------------------------------------126 127 Status win_get_snd_info()128 {129 WmiInstances instances;130 RETURN_STATUS_IF_ERR(wmi_GetClassInstances(L"Win32_SoundDevice", instances));131 std::set<std::wstring> names; // get rid of duplicate "High Definition Audio Device" entries132 for(WmiInstances::iterator it = instances.begin(); it != instances.end(); ++it)133 {134 if((*it)[L"Availability"].intVal != 8) // not offline135 names.insert(std::wstring((*it)[L"ProductName"].bstrVal));136 }137 wchar_t* pos = snd_card;138 for(std::set<std::wstring>::const_iterator it = names.begin(); it != names.end(); ++it)139 {140 const int ret = swprintf_s(pos, SND_CARD_LEN-(pos-snd_card), L"%ls; ", it->c_str());141 if(ret > 0)142 pos += ret;143 }144 145 // find all DLLs related to OpenAL and retrieve their versions.146 VersionList versionList;147 if(wversion_Number() < WVERSION_VISTA)148 wdll_ver_Append(GetDirectSoundDriverPath(), versionList);149 StringSet dlls; // ensures uniqueness150 (void)add_oal_dlls_in_dir(wutil_ExecutablePath(), dlls, versionList);151 (void)add_oal_dlls_in_dir(wutil_SystemPath(), dlls, versionList);152 wcscpy_s(snd_drv_ver, SND_DRV_VER_LEN, versionList.c_str());153 154 return INFO::OK;155 } -
source/lib/sysdep/os/win/wsnd.h
Property changes on: source/lib/sysdep/os/win/wsnd.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property
1 /* Copyright (c) 2010 Wildfire Games2 *3 * Permission is hereby granted, free of charge, to any person obtaining4 * a copy of this software and associated documentation files (the5 * "Software"), to deal in the Software without restriction, including6 * without limitation the rights to use, copy, modify, merge, publish,7 * distribute, sublicense, and/or sell copies of the Software, and to8 * permit persons to whom the Software is furnished to do so, subject to9 * the following conditions:10 *11 * The above copyright notice and this permission notice shall be included12 * in all copies or substantial portions of the Software.13 *14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.21 */22 23 #ifndef INCLUDED_WSND24 #define INCLUDED_WSND25 26 extern Status win_get_snd_info();27 28 #endif // #ifndef INCLUDED_WSND -
source/lib/sysdep/snd.cpp
Property changes on: source/lib/sysdep/os/win/wsnd.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property
1 /* Copyright (c) 2010 Wildfire Games2 *3 * Permission is hereby granted, free of charge, to any person obtaining4 * a copy of this software and associated documentation files (the5 * "Software"), to deal in the Software without restriction, including6 * without limitation the rights to use, copy, modify, merge, publish,7 * distribute, sublicense, and/or sell copies of the Software, and to8 * permit persons to whom the Software is furnished to do so, subject to9 * the following conditions:10 *11 * The above copyright notice and this permission notice shall be included12 * in all copies or substantial portions of the Software.13 *14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.21 */22 23 /*24 * sound card detection.25 */26 27 #include "precompiled.h"28 #include "lib/sysdep/snd.h"29 30 #if OS_WIN31 # include "lib/sysdep/os/win/wsnd.h"32 #endif33 34 35 wchar_t snd_card[SND_CARD_LEN];36 wchar_t snd_drv_ver[SND_DRV_VER_LEN];37 38 void snd_detect()39 {40 // note: OpenAL alGetString is worthless: it only returns41 // OpenAL API version and renderer (e.g. "Software").42 43 #if OS_WIN44 win_get_snd_info();45 #else46 // At least reset the values for unhandled platforms.47 ENSURE(SND_CARD_LEN >= 8 && SND_DRV_VER_LEN >= 8); // protect strcpy48 wcscpy_s(snd_card, ARRAY_SIZE(snd_card), L"Unknown");49 wcscpy_s(snd_drv_ver, ARRAY_SIZE(snd_drv_ver), L"Unknown");50 #endif51 } -
source/lib/sysdep/snd.h
Property changes on: source/lib/sysdep/snd.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property
1 /* Copyright (c) 2015 Wildfire Games2 *3 * Permission is hereby granted, free of charge, to any person obtaining4 * a copy of this software and associated documentation files (the5 * "Software"), to deal in the Software without restriction, including6 * without limitation the rights to use, copy, modify, merge, publish,7 * distribute, sublicense, and/or sell copies of the Software, and to8 * permit persons to whom the Software is furnished to do so, subject to9 * the following conditions:10 *11 * The above copyright notice and this permission notice shall be included12 * in all copies or substantial portions of the Software.13 *14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.21 */22 23 /*24 * sound card detection.25 */26 27 #ifndef INCLUDED_SND28 #define INCLUDED_SND29 30 const size_t SND_CARD_LEN = 512;31 /**32 * description of sound card.33 **/34 extern wchar_t snd_card[SND_CARD_LEN];35 36 const size_t SND_DRV_VER_LEN = 512;37 /**38 * sound driver identification and version.39 **/40 extern wchar_t snd_drv_ver[SND_DRV_VER_LEN];41 42 /**43 * detect sound card and set the above information.44 **/45 extern void snd_detect();46 47 #endif // #ifndef INCLUDED_SND -
source/ps/GameSetup/GameSetup.cpp
Property changes on: source/lib/sysdep/snd.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property
100 100 #define MUST_INIT_X11 0 101 101 #endif 102 102 103 #if OS_WIN104 extern void wmi_Shutdown();105 #endif106 107 103 extern void restart_engine(); 108 104 109 105 #include <iostream> … … 757 753 758 754 g_Profiler2.ShutdownGPU(); 759 755 760 #if OS_WIN761 TIMER_BEGIN(L"shutdown wmi");762 wmi_Shutdown();763 TIMER_END(L"shutdown wmi");764 #endif765 766 756 // Free cursors before shutting down SDL, as they may depend on SDL. 767 757 cursor_shutdown(); 768 758 -
source/ps/GameSetup/HWDetect.cpp
1 /* Copyright (C) 201 5Wildfire Games.1 /* Copyright (C) 2017 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 20 20 #include "scriptinterface/ScriptInterface.h" 21 21 22 22 #include "lib/ogl.h" 23 #include "lib/snd.h" 23 24 #include "lib/svn_revision.h" 24 25 #include "lib/timer.h" 25 26 #include "lib/utf8.h" … … 30 31 #include "lib/sysdep/gfx.h" 31 32 #include "lib/sysdep/numa.h" 32 33 #include "lib/sysdep/os_cpu.h" 33 #include "lib/sysdep/snd.h"34 34 #if ARCH_X86_X64 35 35 # include "lib/sysdep/arch/x86_x64/cache.h" 36 36 # include "lib/sysdep/arch/x86_x64/topology.h" … … 265 265 scriptInterface.SetProperty(settings, "gfx_card", gfx::CardName()); 266 266 scriptInterface.SetProperty(settings, "gfx_drv_ver", gfx::DriverInfo()); 267 267 268 scriptInterface.SetProperty(settings, "snd_card", s td::wstring(snd_card));269 scriptInterface.SetProperty(settings, "snd_drv_ver", s td::wstring(snd_drv_ver));268 scriptInterface.SetProperty(settings, "snd_card", snd_card); 269 scriptInterface.SetProperty(settings, "snd_drv_ver", snd_drv_ver); 270 270 271 271 ReportGLLimits(scriptInterface, settings); 272 272 -
source/ps/Util.cpp
1 /* Copyright (C) 201 6Wildfire Games.1 /* Copyright (C) 2017 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 21 21 22 22 #include "lib/posix/posix_utsname.h" 23 23 #include "lib/ogl.h" 24 #include "lib/snd.h" 24 25 #include "lib/timer.h" 25 26 #include "lib/bits.h" // round_up 26 27 #include "lib/allocators/shared_ptr.h" 27 28 #include "lib/sysdep/sysdep.h" // sys_OpenFile 28 29 #include "lib/sysdep/gfx.h" 29 #include "lib/sysdep/snd.h"30 30 #include "lib/sysdep/cpu.h" 31 31 #include "lib/sysdep/os_cpu.h" 32 32 #if ARCH_X86_X64 … … 137 137 fprintf(f, "Video Mode : %dx%d:%d\n", g_VideoMode.GetXRes(), g_VideoMode.GetYRes(), g_VideoMode.GetBPP()); 138 138 139 139 // sound 140 fprintf(f, "Sound Card : % ls\n", snd_card);141 fprintf(f, "Sound Drivers : % ls\n", snd_drv_ver);140 fprintf(f, "Sound Card : %s\n", snd_card.c_str()); 141 fprintf(f, "Sound Drivers : %s\n", snd_drv_ver.c_str()); 142 142 143 143 // OpenGL extensions (write them last, since it's a lot of text) 144 144 const char* exts = ogl_ExtensionString();