Skip to content

Commit

Permalink
Achievements: Make sound effects not contingent on notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Jan 30, 2023
1 parent 14cf865 commit 9859850
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/duckstation-qt/achievementsettingswidget.cpp
Expand Up @@ -100,15 +100,14 @@ void AchievementSettingsWidget::updateEnableState()
{
const bool enabled = m_dialog->getEffectiveBoolValue("Cheevos", "Enabled", 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.useFirstDiscFromPlaylist->setEnabled(enabled);
m_ui.richPresence->setEnabled(enabled);
m_ui.challengeMode->setEnabled(enabled);
m_ui.leaderboards->setEnabled(enabled && challenge);
m_ui.unofficialTestMode->setEnabled(enabled);
m_ui.notifications->setEnabled(enabled);
m_ui.soundEffects->setEnabled(enabled && notifications);
m_ui.soundEffects->setEnabled(enabled);
m_ui.primedIndicators->setEnabled(enabled);
}

Expand Down
12 changes: 5 additions & 7 deletions src/frontend-common/achievements.cpp
Expand Up @@ -1024,13 +1024,11 @@ void Achievements::DisplayAchievementSummary()

Host::RunOnCPUThread([title = std::move(title), summary = std::move(summary), icon = s_game_icon]() {
if (FullscreenUI::IsInitialized() && g_settings.achievements_notifications)
{
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.
if (g_settings.achievements_sound_effects)
FrontendCommon::PlaySoundAsync(Path::Combine(EmuFolders::Resources, INFO_SOUND_NAME).c_str());
}
// 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)
FrontendCommon::PlaySoundAsync(Path::Combine(EmuFolders::Resources, INFO_SOUND_NAME).c_str());
});
}

Expand Down Expand Up @@ -1821,9 +1819,9 @@ void Achievements::UnlockAchievement(u32 achievement_id, bool add_notification /

ImGuiFullscreen::AddNotification(15.0f, std::move(title), achievement->description,
GetAchievementBadgePath(*achievement));
if (g_settings.achievements_sound_effects)
FrontendCommon::PlaySoundAsync(Path::Combine(EmuFolders::Resources, UNLOCK_SOUND_NAME).c_str());
}
if (g_settings.achievements_sound_effects)
FrontendCommon::PlaySoundAsync(Path::Combine(EmuFolders::Resources, UNLOCK_SOUND_NAME).c_str());

if (IsMastered())
DisplayMasteredNotification();
Expand Down
3 changes: 1 addition & 2 deletions src/frontend-common/fullscreen_ui.cpp
Expand Up @@ -4278,7 +4278,6 @@ void FullscreenUI::DrawAchievementsSettingsPage()

const bool enabled = bsi->GetBoolValue("Cheevos", "Enabled", 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",
"When enabled, rich presence information will be collected and sent to the server where supported.",
Expand All @@ -4299,7 +4298,7 @@ void FullscreenUI::DrawAchievementsSettingsPage()
"Cheevos", "Notifications", true, enabled);
DrawToggleSetting(bsi, ICON_FA_HEADPHONES " Enable Sound Effects",
"Plays sound effects for events such as achievement unlocks and leaderboard submissions.",
"Cheevos", "SoundEffects", true, enabled && notifications);
"Cheevos", "SoundEffects", true, enabled);
DrawToggleSetting(
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",
Expand Down

0 comments on commit 9859850

Please sign in to comment.