Fixed sound looping when power cycling VS games with option to show config dialog on power on

This commit is contained in:
Sour 2017-12-28 20:07:32 -05:00
parent 7f71773dd0
commit 5dc656624a

View file

@ -73,8 +73,6 @@ void Console::SaveBatteries()
bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile) bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
{ {
SoundMixer::StopAudio();
if(!_romFilepath.empty() && _mapper) { if(!_romFilepath.empty() && _mapper) {
//Ensure we save any battery file before loading a new game //Ensure we save any battery file before loading a new game
SaveBatteries(); SaveBatteries();
@ -82,7 +80,7 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
//Save current game state before loading another one //Save current game state before loading another one
SaveStateManager::SaveRecentGame(_mapper->GetRomName(), _romFilepath, _patchFilename); SaveStateManager::SaveRecentGame(_mapper->GetRomName(), _romFilepath, _patchFilename);
} }
if(romFile.IsValid()) { if(romFile.IsValid()) {
VideoDecoder::GetInstance()->StopThread(); VideoDecoder::GetInstance()->StopThread();
@ -100,6 +98,8 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
BatteryManager::Initialize(FolderUtilities::GetFilename(romFile.GetFileName(), false)); BatteryManager::Initialize(FolderUtilities::GetFilename(romFile.GetFileName(), false));
shared_ptr<BaseMapper> mapper = MapperFactory::InitializeFromFile(romFile.GetFileName(), fileData); shared_ptr<BaseMapper> mapper = MapperFactory::InitializeFromFile(romFile.GetFileName(), fileData);
if(mapper) { if(mapper) {
SoundMixer::StopAudio();
if(_mapper) { if(_mapper) {
//Send notification only if a game was already running and we successfully loaded the new one //Send notification only if a game was already running and we successfully loaded the new one
MessageManager::SendNotification(ConsoleNotificationType::GameStopped, (void*)1); MessageManager::SendNotification(ConsoleNotificationType::GameStopped, (void*)1);