]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_ogg.c
changed the flat bump texture (for no bumpmap textures) to have a 128 height instead...
[xonotic/darkplaces.git] / snd_ogg.c
index 17fc7dff64105615a3ec4f65c20a6940d866d5a1..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,21 +294,46 @@ 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)
                return true;
 
-#ifdef WIN32
-       dllname = "vorbisfile.dll";
-#else
-       dllname = "libvorbisfile.so";
-#endif
+// COMMANDLINEOPTION: Sound: -novorbis disables ogg vorbis sound support
+       if (COM_CheckParm("-novorbis"))
+               return false;
 
-       // 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;
        }
@@ -326,6 +353,7 @@ Unload the VorbisFile DLL
 void OGG_CloseLibrary (void)
 {
        Sys_UnloadLibrary (&vf_dll);
+       Sys_UnloadLibrary (&vo_dll);
 }
 
 
@@ -515,7 +543,7 @@ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *s)
                return false;
 
        Mem_FreePool (&s->mempool);
-       s->mempool = Mem_AllocPool (s->name);
+       s->mempool = Mem_AllocPool (s->name, 0, NULL);
 
        // Load the file
        data = FS_LoadFile (filename, s->mempool, false);
@@ -583,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);