Stop sound when patching sound bnp

merge/2021-11-19
kaetemi 3 years ago
parent bdbd12c625
commit 6a7bcf771d
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -1589,6 +1589,40 @@ void postlogInit()
// set the primitive context // set the primitive context
CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig; 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) H_AUTO(InitRZShIdI)

@ -57,6 +57,7 @@
#include "game_share/bg_downloader_msg.h" #include "game_share/bg_downloader_msg.h"
#include "global.h"
#include "login_patch.h" #include "login_patch.h"
#include "login.h" #include "login.h"
#include "user_agent.h" #include "user_agent.h"
@ -2605,6 +2606,13 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP)
// Destination File Name (in writable directory) // Destination File Name (in writable directory)
string DestinationName; string DestinationName;
if (NLMISC::startsWith(rFTP.FileName, "sound") && SoundMngr)
{
// Stop sound playback
delete SoundMngr;
SoundMngr = NULL;
}
if (rFTP.ExtractPath.empty()) if (rFTP.ExtractPath.empty())
{ {
DestinationName = pPM->WritableClientDataPath + rFTP.FileName; DestinationName = pPM->WritableClientDataPath + rFTP.FileName;

Loading…
Cancel
Save