From 67a6ec01e1dc423488043c8e3b36e981c90ee56a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 25 Feb 2018 09:32:05 +0100 Subject: [PATCH] - added a separate section for soundfont search paths. --- src/gameconfigfile.cpp | 24 ++++++++++++++++++++++++ src/sound/i_soundfont.cpp | 8 ++++---- src/win32/critsec.cpp | 3 +++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index 5053fd033..957a2d00c 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -157,6 +157,26 @@ FGameConfigFile::FGameConfigFile () SetValueForKey ("Path", "$DOOMWADDIR", true); } + // Set default search paths if none present + if (!SetSection("SoundfontSearch.Directories")) + { + SetSection("SoundfontSearch.Directories", true); +#ifdef __APPLE__ + SetValueForKey("Path", user_docs + "/soundfonts", true); + SetValueForKey("Path", user_app_support + "/soundfonts", true); + SetValueForKey("Path", "$PROGDIR/soundfonts", true); + SetValueForKey("Path", local_app_support + "/soundfonts", true); +#elif !defined(__unix__) + SetValueForKey("Path", "$PROGDIR/soundfonts", true); +#else + SetValueForKey("Path", "$HOME/" GAME_DIR "/soundfonts", true); + SetValueForKey("Path", "/usr/local/share/doom/soundfonts", true); + SetValueForKey("Path", "/usr/local/share/games/doom/soundfonts", true); + SetValueForKey("Path", "/usr/share/doom/soundfonts", true); + SetValueForKey("Path", "/usr/share/games/doom/soundfonts", true); +#endif + } + // Add some self-documentation. SetSectionNote("IWADSearch.Directories", "# These are the directories to automatically search for IWADs.\n" @@ -165,6 +185,9 @@ FGameConfigFile::FGameConfigFile () "# These are the directories to search for wads added with the -file\n" "# command line parameter, if they cannot be found with the path\n" "# as-is. Layout is the same as for IWADSearch.Directories\n"); + SetSectionNote("SoundfontSearch.Directories", + "# These are the directories to search for soundfonts that let listed in the menu.\n" + "# Layout is the same as for IWADSearch.Directories\n"); } FGameConfigFile::~FGameConfigFile () @@ -234,6 +257,7 @@ void FGameConfigFile::DoAutoloadSetup (FIWadManager *iwad_man) CreateStandardAutoExec("Doom.AutoExec", true); // Move search paths back to the top. + MoveSectionToStart("SoundfontSearch.Directories"); MoveSectionToStart("FileSearch.Directories"); MoveSectionToStart("IWADSearch.Directories"); diff --git a/src/sound/i_soundfont.cpp b/src/sound/i_soundfont.cpp index 8434ced58..c4d88cfa7 100644 --- a/src/sound/i_soundfont.cpp +++ b/src/sound/i_soundfont.cpp @@ -340,7 +340,7 @@ void FSoundFontManager::CollectSoundfonts() void *file; - if (GameConfig != NULL && GameConfig->SetSection ("FileSearch.Directories")) + if (GameConfig != NULL && GameConfig->SetSection ("SoundfontSearch.Directories")) { const char *key; const char *value; @@ -352,18 +352,18 @@ void FSoundFontManager::CollectSoundfonts() FString dir; dir = NicePath(value); + FixPathSeperator(dir); if (dir.IsNotEmpty()) { if (dir.Back() != '/') dir += '/'; - FString path = dir + "soundfonts/"; - FString mask = path + '*'; + FString mask = dir + '*'; if ((file = I_FindFirst(mask, &c_file)) != ((void *)(-1))) { do { if (!(I_FindAttr(&c_file) & FA_DIREC)) { - FStringf name("%s%s", path.GetChars(), I_FindName(&c_file)); + FStringf name("%s%s", dir.GetChars(), I_FindName(&c_file)); ProcessOneFile(name); } } while (I_FindNext(file, &c_file) == 0); diff --git a/src/win32/critsec.cpp b/src/win32/critsec.cpp index 471b19b9f..1e1d50d2b 100644 --- a/src/win32/critsec.cpp +++ b/src/win32/critsec.cpp @@ -86,4 +86,7 @@ void EnterCriticalSection(FInternalCriticalSection *c) void LeaveCriticalSection(FInternalCriticalSection *c) { c->Leave(); + + MemoryBarrier(); + MemoryFence(); }