mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-19 00:35:46 -04:00
Achievements: Add option to disable notifications
This commit is contained in:
@ -1020,18 +1020,20 @@ void Achievements::DisplayAchievementSummary()
|
||||
}
|
||||
|
||||
Host::RunOnCPUThread([title = std::move(title), summary = std::move(summary), icon = s_game_icon]() {
|
||||
if (FullscreenUI::IsInitialized())
|
||||
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());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Achievements::DisplayMasteredNotification()
|
||||
{
|
||||
if (!FullscreenUI::IsInitialized())
|
||||
if (!FullscreenUI::IsInitialized() || !g_settings.achievements_notifications)
|
||||
return;
|
||||
|
||||
std::string title(fmt::format("Mastered {}", s_game_title));
|
||||
@ -1757,7 +1759,7 @@ void Achievements::SubmitLeaderboardCallback(s32 status_code, std::string conten
|
||||
return;
|
||||
|
||||
const Leaderboard* lb = GetLeaderboardByID(std::exchange(s_submitting_lboard_id, 0u));
|
||||
if (!lb)
|
||||
if (!lb || !FullscreenUI::IsInitialized() || !g_settings.achievements_notifications)
|
||||
return;
|
||||
|
||||
char submitted_score[128];
|
||||
@ -1797,25 +1799,28 @@ void Achievements::UnlockAchievement(u32 achievement_id, bool add_notification /
|
||||
|
||||
Log_InfoPrintf("Achievement %s (%u) for game %u unlocked", achievement->title.c_str(), achievement_id, s_game_id);
|
||||
|
||||
std::string title;
|
||||
switch (achievement->category)
|
||||
if (FullscreenUI::IsInitialized() && g_settings.achievements_notifications)
|
||||
{
|
||||
case AchievementCategory::Local:
|
||||
title = fmt::format("{} (Local)", achievement->title);
|
||||
break;
|
||||
case AchievementCategory::Unofficial:
|
||||
title = fmt::format("{} (Unofficial)", achievement->title);
|
||||
break;
|
||||
case AchievementCategory::Core:
|
||||
default:
|
||||
title = achievement->title;
|
||||
break;
|
||||
}
|
||||
std::string title;
|
||||
switch (achievement->category)
|
||||
{
|
||||
case AchievementCategory::Local:
|
||||
title = fmt::format("{} (Local)", achievement->title);
|
||||
break;
|
||||
case AchievementCategory::Unofficial:
|
||||
title = fmt::format("{} (Unofficial)", achievement->title);
|
||||
break;
|
||||
case AchievementCategory::Core:
|
||||
default:
|
||||
title = achievement->title;
|
||||
break;
|
||||
}
|
||||
|
||||
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());
|
||||
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 (IsMastered())
|
||||
DisplayMasteredNotification();
|
||||
|
@ -4208,6 +4208,7 @@ 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.",
|
||||
@ -4223,9 +4224,12 @@ void FullscreenUI::DrawAchievementsSettingsPage()
|
||||
DrawToggleSetting(bsi, ICON_FA_LIST_OL " Leaderboards",
|
||||
"Enables tracking and submission of leaderboards in supported games.", "Cheevos", "Leaderboards",
|
||||
true, enabled && challenge);
|
||||
DrawToggleSetting(bsi, ICON_FA_HEADPHONES " Sound Effects",
|
||||
DrawToggleSetting(bsi, ICON_FA_INBOX " Show Notifications",
|
||||
"Displays popup messages on events such as achievement unlocks and leaderboard submissions.",
|
||||
"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);
|
||||
"Cheevos", "SoundEffects", true, enabled && notifications);
|
||||
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",
|
||||
|
@ -460,18 +460,18 @@ bool ImGuiManager::AddIconFonts(float size)
|
||||
{
|
||||
static constexpr ImWchar range_fa[] = {
|
||||
0xf002, 0xf002, 0xf005, 0xf005, 0xf007, 0xf007, 0xf00c, 0xf00e, 0xf011, 0xf011, 0xf013, 0xf013, 0xf017, 0xf017,
|
||||
0xf019, 0xf019, 0xf021, 0xf021, 0xf023, 0xf023, 0xf025, 0xf025, 0xf027, 0xf028, 0xf02d, 0xf02e, 0xf030, 0xf030,
|
||||
0xf03a, 0xf03a, 0xf03d, 0xf03d, 0xf049, 0xf04c, 0xf050, 0xf050, 0xf059, 0xf059, 0xf05e, 0xf05e, 0xf062, 0xf063,
|
||||
0xf065, 0xf065, 0xf067, 0xf067, 0xf071, 0xf071, 0xf075, 0xf075, 0xf077, 0xf078, 0xf07b, 0xf07c, 0xf084, 0xf085,
|
||||
0xf091, 0xf091, 0xf0a0, 0xf0a0, 0xf0ac, 0xf0ad, 0xf0c5, 0xf0c5, 0xf0c7, 0xf0c8, 0xf0cb, 0xf0cb, 0xf0d0, 0xf0d0,
|
||||
0xf0dc, 0xf0dc, 0xf0e2, 0xf0e2, 0xf0eb, 0xf0eb, 0xf0f1, 0xf0f1, 0xf0f3, 0xf0f3, 0xf0fe, 0xf0fe, 0xf110, 0xf110,
|
||||
0xf119, 0xf119, 0xf11b, 0xf11c, 0xf140, 0xf140, 0xf144, 0xf144, 0xf14a, 0xf14a, 0xf15b, 0xf15b, 0xf15d, 0xf15d,
|
||||
0xf188, 0xf188, 0xf191, 0xf192, 0xf1dd, 0xf1de, 0xf1e6, 0xf1e6, 0xf1eb, 0xf1eb, 0xf1f8, 0xf1f8, 0xf1fc, 0xf1fc,
|
||||
0xf242, 0xf242, 0xf245, 0xf245, 0xf26c, 0xf26c, 0xf279, 0xf279, 0xf2d0, 0xf2d0, 0xf2db, 0xf2db, 0xf2f2, 0xf2f2,
|
||||
0xf2f5, 0xf2f5, 0xf3c1, 0xf3c1, 0xf410, 0xf410, 0xf466, 0xf466, 0xf500, 0xf500, 0xf51f, 0xf51f, 0xf545, 0xf545,
|
||||
0xf548, 0xf548, 0xf552, 0xf552, 0xf57a, 0xf57a, 0xf5a2, 0xf5a2, 0xf5aa, 0xf5aa, 0xf5e7, 0xf5e7, 0xf65d, 0xf65e,
|
||||
0xf6a9, 0xf6a9, 0xf7c2, 0xf7c2, 0xf807, 0xf807, 0xf815, 0xf815, 0xf818, 0xf818, 0xf84c, 0xf84c, 0xf8cc, 0xf8cc,
|
||||
0x0, 0x0};
|
||||
0xf019, 0xf019, 0xf01c, 0xf01c, 0xf021, 0xf021, 0xf023, 0xf023, 0xf025, 0xf025, 0xf027, 0xf028, 0xf02d, 0xf02e,
|
||||
0xf030, 0xf030, 0xf03a, 0xf03a, 0xf03d, 0xf03d, 0xf049, 0xf04c, 0xf050, 0xf050, 0xf059, 0xf059, 0xf05e, 0xf05e,
|
||||
0xf062, 0xf063, 0xf065, 0xf065, 0xf067, 0xf067, 0xf071, 0xf071, 0xf075, 0xf075, 0xf077, 0xf078, 0xf07b, 0xf07c,
|
||||
0xf084, 0xf085, 0xf091, 0xf091, 0xf0a0, 0xf0a0, 0xf0ac, 0xf0ad, 0xf0c5, 0xf0c5, 0xf0c7, 0xf0c8, 0xf0cb, 0xf0cb,
|
||||
0xf0d0, 0xf0d0, 0xf0dc, 0xf0dc, 0xf0e2, 0xf0e2, 0xf0eb, 0xf0eb, 0xf0f1, 0xf0f1, 0xf0f3, 0xf0f3, 0xf0fe, 0xf0fe,
|
||||
0xf110, 0xf110, 0xf119, 0xf119, 0xf11b, 0xf11c, 0xf140, 0xf140, 0xf144, 0xf144, 0xf14a, 0xf14a, 0xf15b, 0xf15b,
|
||||
0xf15d, 0xf15d, 0xf188, 0xf188, 0xf191, 0xf192, 0xf1dd, 0xf1de, 0xf1e6, 0xf1e6, 0xf1eb, 0xf1eb, 0xf1f8, 0xf1f8,
|
||||
0xf1fc, 0xf1fc, 0xf242, 0xf242, 0xf245, 0xf245, 0xf26c, 0xf26c, 0xf279, 0xf279, 0xf2d0, 0xf2d0, 0xf2db, 0xf2db,
|
||||
0xf2f2, 0xf2f2, 0xf2f5, 0xf2f5, 0xf3c1, 0xf3c1, 0xf410, 0xf410, 0xf466, 0xf466, 0xf500, 0xf500, 0xf51f, 0xf51f,
|
||||
0xf545, 0xf545, 0xf548, 0xf548, 0xf552, 0xf552, 0xf57a, 0xf57a, 0xf5a2, 0xf5a2, 0xf5aa, 0xf5aa, 0xf5e7, 0xf5e7,
|
||||
0xf65d, 0xf65e, 0xf6a9, 0xf6a9, 0xf7c2, 0xf7c2, 0xf807, 0xf807, 0xf815, 0xf815, 0xf818, 0xf818, 0xf84c, 0xf84c,
|
||||
0xf8cc, 0xf8cc, 0x0, 0x0};
|
||||
|
||||
ImFontConfig cfg;
|
||||
cfg.MergeMode = true;
|
||||
|
Reference in New Issue
Block a user