From ff6a5031d5ea509375a5dc1ee7b9eeddda6d9ebc Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 4 Jul 2023 16:48:48 -0400 Subject: [PATCH] settings: Require time zone setting value for stirng --- src/common/settings.cpp | 4 ++-- src/common/settings.h | 2 +- src/core/hle/service/time/time_zone_content_manager.cpp | 3 ++- src/yuzu/configuration/shared_translation.cpp | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/common/settings.cpp b/src/common/settings.cpp index d9948dde8..78fa99113 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -66,8 +66,8 @@ SWITCHABLE(u8, true); Values values; -std::string GetTimeZoneString() { - const auto time_zone_index = static_cast(values.time_zone_index.GetValue()); +std::string GetTimeZoneString(TimeZone time_zone) { + const auto time_zone_index = static_cast(time_zone); ASSERT(time_zone_index < Common::TimeZone::GetTimeZoneStrings().size()); std::string location_name; diff --git a/src/common/settings.h b/src/common/settings.h index c4339cb1f..928636c72 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -516,7 +516,7 @@ bool IsFastmemEnabled(); float Volume(); -std::string GetTimeZoneString(); +std::string GetTimeZoneString(TimeZone time_zone); void LogSettings(); diff --git a/src/core/hle/service/time/time_zone_content_manager.cpp b/src/core/hle/service/time/time_zone_content_manager.cpp index 5d60be67a..565f6b39b 100644 --- a/src/core/hle/service/time/time_zone_content_manager.cpp +++ b/src/core/hle/service/time/time_zone_content_manager.cpp @@ -76,7 +76,8 @@ TimeZoneContentManager::TimeZoneContentManager(Core::System& system_) : system{system_}, location_name_cache{BuildLocationNameCache(system)} {} void TimeZoneContentManager::Initialize(TimeManager& time_manager) { - const auto timezone_setting = Settings::GetTimeZoneString(); + const auto timezone_setting = + Settings::GetTimeZoneString(Settings::values.time_zone_index.GetValue()); if (FileSys::VirtualFile vfs_file; GetTimeZoneInfoFile(timezone_setting, vfs_file) == ResultSuccess) { diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp index 05cc942de..fadc8034e 100644 --- a/src/yuzu/configuration/shared_translation.cpp +++ b/src/yuzu/configuration/shared_translation.cpp @@ -318,7 +318,8 @@ std::unique_ptr ComboboxEnumeration(QWidget* parent) { { {static_cast(Settings::TimeZone::Auto), tr("Auto (%1)", "Auto select time zone") - .arg(QString::fromStdString(Settings::GetTimeZoneString()))}, + .arg(QString::fromStdString( + Settings::GetTimeZoneString(Settings::TimeZone::Auto)))}, {static_cast(Settings::TimeZone::Default), tr("Default (%1)", "Default time zone") .arg(QString::fromStdString(Common::TimeZone::GetDefaultTimeZone()))},