diff --git a/doomsday/engine/portable/src/audiodriver.c b/doomsday/engine/portable/src/audiodriver.c index 0f539cf40b..2af0dc646b 100644 --- a/doomsday/engine/portable/src/audiodriver.c +++ b/doomsday/engine/portable/src/audiodriver.c @@ -122,35 +122,48 @@ static void importInterfaces(driver_t* d) #undef Imp } +static int audioPluginFinder(const char* fileName, const char* absPath, void* ptr) +{ + Str* path = (Str*) ptr; + if(!strncmp(fileName, Str_Text(path), Str_Length(path)) /* matching name? */ && + (strlen(fileName) == Str_Length(path) /* no extension? */ + || fileName[Str_Length(path)] == '.' /* extension follows right away? */)) + { + Str_Set(path, absPath); + return true; // Found it! + } + return false; // Keep looking... +} + +static AutoStr* findAudioPluginPath(const char* name) +{ + AutoStr* path = Str_Appendf(AutoStr_New(), "audio_%s", name); + if(Library_IterateAvailableLibraries(audioPluginFinder, path)) + { + // The full path of the library was returned in @a path. + return path; + } + return 0; +} + static boolean loadAudioDriver(driver_t* driver, const char* name) { boolean ok = false; if(name && name[0]) { - Str libPath; - - // Compose the name using the prefix "ds". - Str_InitStd(&libPath); -#ifdef WIN32 - Str_Appendf(&libPath, "%sds%s.dll", ddBinPath, name); -#elif defined(MACOSX) - Str_Appendf(&libPath, "ds%s.bundle", name); -#else - Str_Appendf(&libPath, "libds%s.so", name); -#endif + AutoStr* libPath = findAudioPluginPath(name); // Load the audio driver library and import symbols. - if((driver->library = Library_New(Str_Text(&libPath))) != 0) + if(libPath && (driver->library = Library_New(Str_Text(libPath))) != 0) { importInterfaces(driver); ok = true; } else { - Con_Message("Warning: loadAudioDriver: Loading of \"%s\" failed.\n", Str_Text(&libPath)); + Con_Message("Warning: loadAudioDriver: Loading of \"%s\" failed.\n", name); } - Str_Free(&libPath); } return ok; } @@ -222,22 +235,6 @@ static boolean initDriver(audiodriverid_t id) break; #endif -#ifdef MACOSX - case AUDIOD_OPENAL: - if(!loadAudioDriver(d, "OpenAL")) - return false; - break; - - case AUDIOD_FMOD: - if(!loadAudioDriver(d, "FMOD")) - return false; - break; - - case AUDIOD_FLUIDSYNTH: - if(!loadAudioDriver(d, "FluidSynth")) - return false; - break; -#else case AUDIOD_OPENAL: if(!loadAudioDriver(d, "openal")) return false; @@ -252,7 +249,6 @@ static boolean initDriver(audiodriverid_t id) if(!loadAudioDriver(d, "fluidsynth")) return false; break; -#endif #ifdef WIN32 case AUDIOD_DSOUND: diff --git a/doomsday/engine/portable/src/dd_plugin.c b/doomsday/engine/portable/src/dd_plugin.c index edecf2e112..16e628fcb4 100644 --- a/doomsday/engine/portable/src/dd_plugin.c +++ b/doomsday/engine/portable/src/dd_plugin.c @@ -105,7 +105,7 @@ static int loadPlugin(const char* fileName, const char* pluginPath, void* param) // This seems to be a Doomsday plugin. _splitpath(pluginPath, NULL, NULL, name, NULL); - Con_Message(" %s (id:%i)\n", name, plugId); + Con_Message(" (id:%i) %s\n", plugId, name); *handle = plugin; diff --git a/doomsday/engine/portable/src/library.cpp b/doomsday/engine/portable/src/library.cpp index d5f809e2c8..834a39f59d 100644 --- a/doomsday/engine/portable/src/library.cpp +++ b/doomsday/engine/portable/src/library.cpp @@ -223,7 +223,7 @@ Library* Library_New(const char *filePath) if(!handle) { Str_Set(lastError, dlerror()); - printf("Library_New: Error opening \"%s\" (%s).\n", filePath, Library_LastError()); + LOG_WARNING("Library_New: Error opening \"%s\" (%s).") << filePath << Library_LastError(); return 0; } #endif @@ -233,7 +233,7 @@ Library* Library_New(const char *filePath) if(!handle) { Str_Set(lastError, DD_Win32_GetLastErrorMessage()); - printf("Library_New: Error opening \"%s\" (%s).\n", filePath, Library_LastError()); + LOG_WARNING("Library_New: Error opening \"%s\" (%s).") << filePath << Library_LastError(); return 0; } #endif diff --git a/doomsday/plugins/fmod/fmod.pro b/doomsday/plugins/fmod/fmod.pro index 7da6e9ef2f..c8d8e6730e 100644 --- a/doomsday/plugins/fmod/fmod.pro +++ b/doomsday/plugins/fmod/fmod.pro @@ -39,8 +39,8 @@ win32 { else:macx { # Bundle the FMOD shared library in dsFMOD.bundle. doPostLink("cp -f \"$$FMOD_DIR/api/lib/libfmodex.dylib\" audio_fmod.bundle/") - doPostLink("install_name_tool -id @executable_path/../../../audio_fmod.bundle/libfmodex.dylib audio_fmod.bundle/libfmodex.dylib") - doPostLink("install_name_tool -change ./libfmodex.dylib @executable_path/../../../audio_fmod.bundle/libfmodex.dylib audio_fmod.bundle/audio_fmod") + doPostLink("install_name_tool -id @executable_path/../DengPlugins/audio_fmod.bundle/libfmodex.dylib audio_fmod.bundle/libfmodex.dylib") + doPostLink("install_name_tool -change ./libfmodex.dylib @executable_path/../DengPlugins/audio_fmod.bundle/libfmodex.dylib audio_fmod.bundle/audio_fmod") } else { INSTALLS += target