mirror of
				https://github.com/hedge-dev/UnleashedRecomp.git
				synced 2025-10-30 07:11:05 +00:00 
			
		
		
		
	Prohibit Channel Configuration changes during gameplay (#1432)
This commit is contained in:
		
							parent
							
								
									2322b75e54
								
							
						
					
					
						commit
						b76a44923d
					
				
					 3 changed files with 4 additions and 21 deletions
				
			
		|  | @ -10,7 +10,6 @@ | |||
| void XAudioInitializeSystem(); | ||||
| void XAudioRegisterClient(PPCFunc* callback, uint32_t param); | ||||
| void XAudioSubmitFrame(void* samples); | ||||
| void XAudioConfigValueChangedCallback(class IConfigDef* configDef); | ||||
| 
 | ||||
| uint32_t XAudioRegisterRenderDriverClient(be<uint32_t>* callback, be<uint32_t>* driver); | ||||
| uint32_t XAudioUnregisterRenderDriverClient(uint32_t driver); | ||||
|  |  | |||
|  | @ -150,18 +150,3 @@ void XAudioSubmitFrame(void* samples) | |||
|         SDL_QueueAudio(g_audioDevice, &audioFrames, sizeof(audioFrames)); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void XAudioConfigValueChangedCallback(IConfigDef* configDef) | ||||
| { | ||||
|     if (configDef == &Config::ChannelConfiguration) | ||||
|     { | ||||
|         if (g_audioThread->joinable()) | ||||
|         { | ||||
|             g_audioThreadShouldExit = true; | ||||
|             g_audioThread->join(); | ||||
|         } | ||||
| 
 | ||||
|         CreateAudioDevice(); | ||||
|         CreateAudioThread(); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -99,6 +99,7 @@ static bool g_isEnterKeyBuffered = false; | |||
| static bool g_canReset = false; | ||||
| static bool g_isLanguageOptionChanged = false; | ||||
| static bool g_titleAnimBegin = true; | ||||
| static EChannelConfiguration g_currentChannelConfig; | ||||
| 
 | ||||
| static double g_appearTime = 0.0; | ||||
| 
 | ||||
|  | @ -803,7 +804,6 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf | |||
|                             config->Callback(config); | ||||
| 
 | ||||
|                         VideoConfigValueChangedCallback(config); | ||||
|                         XAudioConfigValueChangedCallback(config); | ||||
| 
 | ||||
|                         Game_PlaySound("sys_worldmap_finaldecide"); | ||||
|                     } | ||||
|  | @ -836,7 +836,6 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf | |||
|                             if (config->Value != s_oldValue) | ||||
|                             { | ||||
|                                 VideoConfigValueChangedCallback(config); | ||||
|                                 XAudioConfigValueChangedCallback(config); | ||||
| 
 | ||||
|                                 if (config->ApplyCallback) | ||||
|                                     config->ApplyCallback(config); | ||||
|  | @ -865,7 +864,6 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf | |||
|                         config->MakeDefault(); | ||||
| 
 | ||||
|                         VideoConfigValueChangedCallback(config); | ||||
|                         XAudioConfigValueChangedCallback(config); | ||||
| 
 | ||||
|                         if (config->Callback) | ||||
|                             config->Callback(config); | ||||
|  | @ -1250,7 +1248,7 @@ static void DrawConfigOptions() | |||
|             DrawConfigOption(rowCount++, yOffset, &Config::MasterVolume, true); | ||||
|             DrawConfigOption(rowCount++, yOffset, &Config::MusicVolume, true); | ||||
|             DrawConfigOption(rowCount++, yOffset, &Config::EffectsVolume, true); | ||||
|             DrawConfigOption(rowCount++, yOffset, &Config::ChannelConfiguration, true); | ||||
|             DrawConfigOption(rowCount++, yOffset, &Config::ChannelConfiguration, !OptionsMenu::s_isPause, cmnReason); | ||||
|             DrawConfigOption(rowCount++, yOffset, &Config::MusicAttenuation, AudioPatches::CanAttenuate(), &Localise("Options_Desc_OSNotSupported")); | ||||
|             DrawConfigOption(rowCount++, yOffset, &Config::BattleTheme, true); | ||||
|             break; | ||||
|  | @ -1791,7 +1789,7 @@ void OptionsMenu::Draw() | |||
|             DrawFadeTransition(); | ||||
|     } | ||||
| 
 | ||||
|     s_isRestartRequired = Config::Language != App::s_language; | ||||
|     s_isRestartRequired = Config::Language != App::s_language || Config::ChannelConfiguration != g_currentChannelConfig; | ||||
| } | ||||
| 
 | ||||
| void OptionsMenu::Open(bool isPause, SWA::EMenuType pauseMenuType) | ||||
|  | @ -1807,6 +1805,7 @@ void OptionsMenu::Open(bool isPause, SWA::EMenuType pauseMenuType) | |||
|     g_categoryAnimMax = { 0.0f, 0.0f }; | ||||
|     g_selectedItem = nullptr; | ||||
|     g_titleAnimBegin = true; | ||||
|     g_currentChannelConfig = Config::ChannelConfiguration; | ||||
| 
 | ||||
|     /* Store button state so we can track it later
 | ||||
|        and prevent the first item being selected. */ | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Hyper
						Hyper