Achievements: Make sound effects not contingent on notifications

This commit is contained in:
Stenzek 2023-01-28 22:35:24 +10:00
parent 14cf865905
commit 9859850925
3 changed files with 7 additions and 11 deletions

View file

@ -100,7 +100,6 @@ void AchievementSettingsWidget::updateEnableState()
{ {
const bool enabled = m_dialog->getEffectiveBoolValue("Cheevos", "Enabled", false); const bool enabled = m_dialog->getEffectiveBoolValue("Cheevos", "Enabled", false);
const bool challenge = m_dialog->getEffectiveBoolValue("Cheevos", "ChallengeMode", false); const bool challenge = m_dialog->getEffectiveBoolValue("Cheevos", "ChallengeMode", false);
const bool notifications = m_dialog->getEffectiveBoolValue("Cheevos", "Notifications", true);
m_ui.testMode->setEnabled(enabled); m_ui.testMode->setEnabled(enabled);
m_ui.useFirstDiscFromPlaylist->setEnabled(enabled); m_ui.useFirstDiscFromPlaylist->setEnabled(enabled);
m_ui.richPresence->setEnabled(enabled); m_ui.richPresence->setEnabled(enabled);
@ -108,7 +107,7 @@ void AchievementSettingsWidget::updateEnableState()
m_ui.leaderboards->setEnabled(enabled && challenge); m_ui.leaderboards->setEnabled(enabled && challenge);
m_ui.unofficialTestMode->setEnabled(enabled); m_ui.unofficialTestMode->setEnabled(enabled);
m_ui.notifications->setEnabled(enabled); m_ui.notifications->setEnabled(enabled);
m_ui.soundEffects->setEnabled(enabled && notifications); m_ui.soundEffects->setEnabled(enabled);
m_ui.primedIndicators->setEnabled(enabled); m_ui.primedIndicators->setEnabled(enabled);
} }

View file

@ -1024,13 +1024,11 @@ void Achievements::DisplayAchievementSummary()
Host::RunOnCPUThread([title = std::move(title), summary = std::move(summary), icon = s_game_icon]() { Host::RunOnCPUThread([title = std::move(title), summary = std::move(summary), icon = s_game_icon]() {
if (FullscreenUI::IsInitialized() && g_settings.achievements_notifications) if (FullscreenUI::IsInitialized() && g_settings.achievements_notifications)
{
ImGuiFullscreen::AddNotification(10.0f, std::move(title), std::move(summary), std::move(icon)); ImGuiFullscreen::AddNotification(10.0f, std::move(title), std::move(summary), std::move(icon));
// Technically not going through the resource API, but since we're passing this to something else, we can't. // Technically not going through the resource API, but since we're passing this to something else, we can't.
if (g_settings.achievements_sound_effects) if (g_settings.achievements_sound_effects)
FrontendCommon::PlaySoundAsync(Path::Combine(EmuFolders::Resources, INFO_SOUND_NAME).c_str()); FrontendCommon::PlaySoundAsync(Path::Combine(EmuFolders::Resources, INFO_SOUND_NAME).c_str());
}
}); });
} }
@ -1821,9 +1819,9 @@ void Achievements::UnlockAchievement(u32 achievement_id, bool add_notification /
ImGuiFullscreen::AddNotification(15.0f, std::move(title), achievement->description, ImGuiFullscreen::AddNotification(15.0f, std::move(title), achievement->description,
GetAchievementBadgePath(*achievement)); GetAchievementBadgePath(*achievement));
}
if (g_settings.achievements_sound_effects) if (g_settings.achievements_sound_effects)
FrontendCommon::PlaySoundAsync(Path::Combine(EmuFolders::Resources, UNLOCK_SOUND_NAME).c_str()); FrontendCommon::PlaySoundAsync(Path::Combine(EmuFolders::Resources, UNLOCK_SOUND_NAME).c_str());
}
if (IsMastered()) if (IsMastered())
DisplayMasteredNotification(); DisplayMasteredNotification();

View file

@ -4278,7 +4278,6 @@ void FullscreenUI::DrawAchievementsSettingsPage()
const bool enabled = bsi->GetBoolValue("Cheevos", "Enabled", false); const bool enabled = bsi->GetBoolValue("Cheevos", "Enabled", false);
const bool challenge = bsi->GetBoolValue("Cheevos", "ChallengeMode", false); const bool challenge = bsi->GetBoolValue("Cheevos", "ChallengeMode", false);
const bool notifications = bsi->GetBoolValue("Cheevos", "Notifications", true);
DrawToggleSetting(bsi, ICON_FA_USER_FRIENDS " Rich Presence", DrawToggleSetting(bsi, ICON_FA_USER_FRIENDS " Rich Presence",
"When enabled, rich presence information will be collected and sent to the server where supported.", "When enabled, rich presence information will be collected and sent to the server where supported.",
@ -4299,7 +4298,7 @@ void FullscreenUI::DrawAchievementsSettingsPage()
"Cheevos", "Notifications", true, enabled); "Cheevos", "Notifications", true, enabled);
DrawToggleSetting(bsi, ICON_FA_HEADPHONES " Enable Sound Effects", DrawToggleSetting(bsi, ICON_FA_HEADPHONES " Enable Sound Effects",
"Plays sound effects for events such as achievement unlocks and leaderboard submissions.", "Plays sound effects for events such as achievement unlocks and leaderboard submissions.",
"Cheevos", "SoundEffects", true, enabled && notifications); "Cheevos", "SoundEffects", true, enabled);
DrawToggleSetting( DrawToggleSetting(
bsi, ICON_FA_MAGIC " Show Challenge Indicators", bsi, ICON_FA_MAGIC " Show Challenge Indicators",
"Shows icons in the lower-right corner of the screen when a challenge/primed achievement is active.", "Cheevos", "Shows icons in the lower-right corner of the screen when a challenge/primed achievement is active.", "Cheevos",