From 6a7bcf771d32f4d9ac68a0739f7b34b7789fa652 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Tue, 28 Sep 2021 11:41:36 +0800 Subject: [PATCH] Stop sound when patching sound bnp --- ryzom/client/src/init.cpp | 34 ++++++++++++++++++++++++++++++++ ryzom/client/src/login_patch.cpp | 8 ++++++++ 2 files changed, 42 insertions(+) diff --git a/ryzom/client/src/init.cpp b/ryzom/client/src/init.cpp index 751d31793..a90f9af76 100644 --- a/ryzom/client/src/init.cpp +++ b/ryzom/client/src/init.cpp @@ -1589,6 +1589,40 @@ void postlogInit() // set the primitive context CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig; + { + H_AUTO(InitRZSound) + + if (!SoundMngr) + { + // Init the sound manager + nmsg = "Initializing sound manager..."; + ProgressBar.newMessage(ClientCfg.buildLoadingString(nmsg)); + if (ClientCfg.SoundOn) + { + SoundMngr = new CSoundManager(&ProgressBar); + try + { + SoundMngr->init(&ProgressBar); + } + catch (const Exception &e) + { + nlwarning("init : Error when creating 'SoundMngr' : %s", e.what()); + delete SoundMngr; + SoundMngr = NULL; + } + + if (SoundMngr) + { + // init the SoundMngr with backuped volume + SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume); + SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume); + } + } + + CPath::memoryCompress(); // Because sound calls addSearchPath + } + } + { H_AUTO(InitRZShIdI) diff --git a/ryzom/client/src/login_patch.cpp b/ryzom/client/src/login_patch.cpp index 4233a23c2..4e09559a0 100644 --- a/ryzom/client/src/login_patch.cpp +++ b/ryzom/client/src/login_patch.cpp @@ -57,6 +57,7 @@ #include "game_share/bg_downloader_msg.h" +#include "global.h" #include "login_patch.h" #include "login.h" #include "user_agent.h" @@ -2605,6 +2606,13 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) // Destination File Name (in writable directory) string DestinationName; + if (NLMISC::startsWith(rFTP.FileName, "sound") && SoundMngr) + { + // Stop sound playback + delete SoundMngr; + SoundMngr = NULL; + } + if (rFTP.ExtractPath.empty()) { DestinationName = pPM->WritableClientDataPath + rFTP.FileName;