]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_ogg.c
vid_usingvsync now set to false after a vid_restart (so that vsync will be set again...
[xonotic/darkplaces.git] / snd_ogg.c
index fa64393becad0e7ca7deb4962464b34683cfa5ca..6139019832269a53babbb1087d8e012cde2b4b3d 100644 (file)
--- a/snd_ogg.c
+++ b/snd_ogg.c
@@ -23,6 +23,7 @@
 
 
 #include "quakedef.h"
+#include "snd_main.h"
 #include "snd_ogg.h"
 #include "snd_wav.h"
 
@@ -214,7 +215,8 @@ static dllfunction_t oggvorbisfuncs[] =
        {NULL, NULL}
 };
 
-// Handle for the Vorbisfile DLL
+// Handles for the Vorbis and Vorbisfile DLLs
+static dllhandle_t vo_dll = NULL;
 static dllhandle_t vf_dll = NULL;
 
 typedef struct
@@ -292,7 +294,30 @@ Try to load the VorbisFile DLL
 */
 qboolean OGG_OpenLibrary (void)
 {
-       const char* dllname;
+       const char* dllnames_vo [] =
+       {
+#ifdef WIN32
+               "vorbis.dll",
+#elif defined(MACOSX)
+               "libvorbis.dylib",
+#else
+               "libvorbis.so.0",
+               "libvorbis.so",
+#endif
+               NULL
+       };
+       const char* dllnames_vf [] =
+       {
+#ifdef WIN32
+               "vorbisfile.dll",
+#elif defined(MACOSX)
+               "libvorbisfile.dylib",
+#else
+               "libvorbisfile.so.3",
+               "libvorbisfile.so",
+#endif
+               NULL
+       };
 
        // Already loaded?
        if (vf_dll)
@@ -302,15 +327,13 @@ qboolean OGG_OpenLibrary (void)
        if (COM_CheckParm("-novorbis"))
                return false;
 
-#ifdef WIN32
-       dllname = "vorbisfile.dll";
-#else
-       dllname = "libvorbisfile.so";
-#endif
-
-       // Load the DLL
-       if (! Sys_LoadLibrary (dllname, &vf_dll, oggvorbisfuncs))
+       // Load the DLLs
+       // We need to load both by hand because some OSes seem to not load
+       // the vorbis DLL automatically when loading the VorbisFile DLL
+       if (! Sys_LoadLibrary (dllnames_vo, &vo_dll, NULL) ||
+               ! Sys_LoadLibrary (dllnames_vf, &vf_dll, oggvorbisfuncs))
        {
+               Sys_UnloadLibrary (&vo_dll);
                Con_Printf ("Ogg Vorbis support disabled\n");
                return false;
        }
@@ -330,6 +353,7 @@ Unload the VorbisFile DLL
 void OGG_CloseLibrary (void)
 {
        Sys_UnloadLibrary (&vf_dll);
+       Sys_UnloadLibrary (&vo_dll);
 }
 
 
@@ -587,7 +611,7 @@ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *s)
                long ret;
                sfxbuffer_t *sb;
 
-               Con_DPrintf ("\"%s\" will be streamed\n", filename);
+               Con_DPrintf ("\"%s\" will be cached\n", filename);
 
                // Decode it
                buff = Mem_Alloc (s->mempool, (int)len);