From bfd2a43dfb9aed0865eec40cabd87bf6248574db Mon Sep 17 00:00:00 2001 From: janwas Date: Sun, 21 Nov 2004 08:41:40 +0000 Subject: [PATCH] sound code: now uses DX5 (instead of default of DX8), more error checking vs. bug #33 This was SVN commit r1371. --- source/lib/sysdep/win/wdetect.cpp | 32 +++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/source/lib/sysdep/win/wdetect.cpp b/source/lib/sysdep/win/wdetect.cpp index a45dce7696..4a775d635c 100755 --- a/source/lib/sysdep/win/wdetect.cpp +++ b/source/lib/sysdep/win/wdetect.cpp @@ -250,6 +250,8 @@ int win_get_gfx_info() #define MMNOMMIO // Multimedia file I/O support #define MMNOMMSYSTEM // General MMSYSTEM functions #include + +#define DIRECTSOUND_VERSION 0x0500 #include @@ -297,28 +299,30 @@ static void add_drv(const char* module) int win_get_snd_info() { - DirectSoundEnumerate((LPDSENUMCALLBACK)ds_enum, (void*)0); + if(DirectSoundEnumerate((LPDSENUMCALLBACK)ds_enum, (void*)0) != DS_OK) + debug_warn("DirectSoundEnumerate failed"); // find all DLLs related to OpenAL and retrieve their versions. // (search system dir for *oal.dll and *OpenAL*, // which is also how the router finds implementations). add_drv(ds_drv_name); DIR* dir = opendir(win_sys_dir); - if(dir) + if(!dir) { - while(dirent* ent = readdir(dir)) - { - const char* fn = ent->d_name; - const size_t len = strlen(fn); - - const bool oal = len > 7 && !stricmp(fn+len-7, "oal.dll"); - const bool openal = strstr(fn, "OpenAL") != 0; - if(oal || openal) - add_drv(fn); - } - - closedir(dir); + assert(0); + return -1; } + while(dirent* ent = readdir(dir)) + { + const char* fn = ent->d_name; + const size_t len = strlen(fn); + + const bool oal = len > 7 && !stricmp(fn+len-7, "oal.dll"); + const bool openal = strstr(fn, "OpenAL") != 0; + if(oal || openal) + add_drv(fn); + } + closedir(dir); return 0; }