Achievements: Don't read g_settings on video thread

This commit is contained in:
Stenzek
2026-02-12 19:17:03 +10:00
parent 913aaf6023
commit 7962b9fa06
3 changed files with 25 additions and 19 deletions

View File

@@ -227,14 +227,14 @@ void FullscreenUI::DrawAchievementsOverlays()
const auto lock = Achievements::GetLock();
NotificationLayout layout(g_settings.achievements_notification_location);
NotificationLayout layout(g_gpu_settings.achievements_notification_location);
DrawNotifications(layout);
if (Achievements::HasActiveGame())
{
// need to group them together if they're in the same location
if (g_settings.achievements_indicator_location != layout.GetLocation())
layout = NotificationLayout(g_settings.achievements_indicator_location);
if (g_gpu_settings.achievements_indicator_location != layout.GetLocation())
layout = NotificationLayout(g_gpu_settings.achievements_indicator_location);
DrawIndicators(layout);
}
@@ -545,11 +545,11 @@ void FullscreenUI::DrawIndicators(NotificationLayout& layout)
if (std::vector<Achievements::ActiveChallengeIndicator>& indicators = Achievements::GetActiveChallengeIndicators();
!indicators.empty() &&
(g_settings.achievements_challenge_indicator_mode == AchievementChallengeIndicatorMode::PersistentIcon ||
g_settings.achievements_challenge_indicator_mode == AchievementChallengeIndicatorMode::TemporaryIcon))
(g_gpu_settings.achievements_challenge_indicator_mode == AchievementChallengeIndicatorMode::PersistentIcon ||
g_gpu_settings.achievements_challenge_indicator_mode == AchievementChallengeIndicatorMode::TemporaryIcon))
{
const bool use_time_remaining =
(g_settings.achievements_challenge_indicator_mode == AchievementChallengeIndicatorMode::TemporaryIcon);
(g_gpu_settings.achievements_challenge_indicator_mode == AchievementChallengeIndicatorMode::TemporaryIcon);
const float x_advance = image_size.x + spacing;
const float total_width = image_size.x + (static_cast<float>(indicators.size() - 1) * x_advance);
ImVec2 current_position = layout.GetFixedPosition(total_width, image_size.y);

View File

@@ -130,6 +130,12 @@ struct GPUSettings
std::array<float, 4> display_osd_message_duration = DEFAULT_DISPLAY_OSD_MESSAGE_DURATIONS;
NotificationLocation display_osd_message_location = DEFAULT_OSD_MESSAGE_LOCATION;
// achievements
NotificationLocation achievements_notification_location = DEFAULT_ACHIEVEMENT_NOTIFICATION_LOCATION;
NotificationLocation achievements_indicator_location = DEFAULT_ACHIEVEMENT_INDICATOR_LOCATION;
AchievementChallengeIndicatorMode achievements_challenge_indicator_mode =
DEFAULT_ACHIEVEMENT_CHALLENGE_INDICATOR_MODE;
// texture replacements
struct TextureReplacementSettings
{
@@ -239,6 +245,11 @@ struct GPUSettings
static const std::array<float, 4> DEFAULT_DISPLAY_OSD_MESSAGE_DURATIONS;
static constexpr AchievementChallengeIndicatorMode DEFAULT_ACHIEVEMENT_CHALLENGE_INDICATOR_MODE =
AchievementChallengeIndicatorMode::Notification;
static constexpr NotificationLocation DEFAULT_ACHIEVEMENT_NOTIFICATION_LOCATION = NotificationLocation::TopLeft;
static constexpr NotificationLocation DEFAULT_ACHIEVEMENT_INDICATOR_LOCATION = NotificationLocation::BottomRight;
#ifndef __ANDROID__
static constexpr u8 DEFAULT_GPU_MAX_QUEUED_FRAMES = 2;
static constexpr bool DEFAULT_GPU_PREFER_GLES_CONTEXT = false;
@@ -354,10 +365,6 @@ struct Settings : public GPUSettings
bool achievements_leaderboard_trackers : 1 = true;
bool achievements_sound_effects : 1 = true;
bool achievements_progress_indicators : 1 = true;
NotificationLocation achievements_notification_location = DEFAULT_ACHIEVEMENT_NOTIFICATION_LOCATION;
NotificationLocation achievements_indicator_location = DEFAULT_ACHIEVEMENT_INDICATOR_LOCATION;
AchievementChallengeIndicatorMode achievements_challenge_indicator_mode =
DEFAULT_ACHIEVEMENT_CHALLENGE_INDICATOR_MODE;
u8 achievements_notification_duration = DEFAULT_ACHIEVEMENT_NOTIFICATION_TIME;
u8 achievements_leaderboard_duration = DEFAULT_LEADERBOARD_NOTIFICATION_TIME;
@@ -622,10 +629,6 @@ struct Settings : public GPUSettings
static constexpr MultitapMode DEFAULT_MULTITAP_MODE = MultitapMode::Disabled;
static constexpr PIODeviceType DEFAULT_PIO_DEVICE_TYPE = PIODeviceType::None;
static constexpr AchievementChallengeIndicatorMode DEFAULT_ACHIEVEMENT_CHALLENGE_INDICATOR_MODE =
AchievementChallengeIndicatorMode::Notification;
static constexpr NotificationLocation DEFAULT_ACHIEVEMENT_NOTIFICATION_LOCATION = NotificationLocation::TopLeft;
static constexpr NotificationLocation DEFAULT_ACHIEVEMENT_INDICATOR_LOCATION = NotificationLocation::BottomRight;
static constexpr u8 DEFAULT_ACHIEVEMENT_NOTIFICATION_TIME = 5;
static constexpr u8 DEFAULT_LEADERBOARD_NOTIFICATION_TIME = 10;

View File

@@ -4773,15 +4773,12 @@ void System::CheckForSettingsChanges(const Settings& old_settings)
g_settings.display_alignment != old_settings.display_alignment ||
g_settings.display_rotation != old_settings.display_rotation ||
g_settings.display_deinterlacing_mode != old_settings.display_deinterlacing_mode ||
g_settings.display_osd_scale != old_settings.display_osd_scale ||
g_settings.display_osd_margin != old_settings.display_osd_margin ||
g_settings.display_osd_message_duration != old_settings.display_osd_message_duration ||
g_settings.display_osd_message_location != old_settings.display_osd_message_location ||
g_settings.gpu_pgxp_enable != old_settings.gpu_pgxp_enable ||
g_settings.gpu_pgxp_texture_correction != old_settings.gpu_pgxp_texture_correction ||
g_settings.gpu_pgxp_color_correction != old_settings.gpu_pgxp_color_correction ||
g_settings.gpu_pgxp_depth_buffer != old_settings.gpu_pgxp_depth_buffer ||
g_settings.gpu_pgxp_vertex_cache != old_settings.gpu_pgxp_vertex_cache ||
g_settings.gpu_pgxp_depth_clear_threshold != old_settings.gpu_pgxp_depth_clear_threshold ||
g_settings.display_active_start_offset != old_settings.display_active_start_offset ||
g_settings.display_active_end_offset != old_settings.display_active_end_offset ||
g_settings.display_line_start_offset != old_settings.display_line_start_offset ||
@@ -4833,7 +4830,13 @@ void System::CheckForSettingsChanges(const Settings& old_settings)
g_settings.display_screenshot_mode != old_settings.display_screenshot_mode ||
g_settings.display_screenshot_format != old_settings.display_screenshot_format ||
g_settings.display_screenshot_quality != old_settings.display_screenshot_quality ||
g_settings.gpu_pgxp_depth_clear_threshold != old_settings.gpu_pgxp_depth_clear_threshold)
g_settings.display_osd_scale != old_settings.display_osd_scale ||
g_settings.display_osd_margin != old_settings.display_osd_margin ||
g_settings.display_osd_message_duration != old_settings.display_osd_message_duration ||
g_settings.display_osd_message_location != old_settings.display_osd_message_location ||
g_settings.achievements_notification_location != old_settings.achievements_notification_location ||
g_settings.achievements_indicator_location != old_settings.achievements_indicator_location ||
g_settings.achievements_challenge_indicator_mode != old_settings.achievements_challenge_indicator_mode)
{
if (device_settings_changed)
{