diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core.cpp | 20 | ||||
-rw-r--r-- | src/core/file_sys/control_metadata.cpp | 3 | ||||
-rw-r--r-- | src/core/file_sys/patch_manager.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/service/ns/ns.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/service/set/set.cpp | 10 |
5 files changed, 24 insertions, 15 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index da1baa892..e2902a91f 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -145,13 +145,7 @@ struct System::Impl { core_timing.SetMulticore(is_multicore); core_timing.Initialize([&system]() { system.RegisterHostThread(); }); - const auto posix_time = std::chrono::system_clock::now().time_since_epoch(); - const auto current_time = - std::chrono::duration_cast<std::chrono::seconds>(posix_time).count(); - Settings::values.custom_rtc_differential = - (Settings::values.custom_rtc_enabled ? Settings::values.custom_rtc.GetValue() - : current_time) - - current_time; + RefreshTime(); // Create a default fs if one doesn't already exist. if (virtual_filesystem == nullptr) { @@ -188,6 +182,16 @@ struct System::Impl { Initialize(system); } + void RefreshTime() { + const auto posix_time = std::chrono::system_clock::now().time_since_epoch(); + const auto current_time = + std::chrono::duration_cast<std::chrono::seconds>(posix_time).count(); + Settings::values.custom_rtc_differential = + (Settings::values.custom_rtc_enabled ? Settings::values.custom_rtc.GetValue() + : current_time) - + current_time; + } + void Run() { std::unique_lock<std::mutex> lk(suspend_guard); @@ -1022,6 +1026,8 @@ void System::Exit() { } void System::ApplySettings() { + impl->RefreshTime(); + if (IsPoweredOn()) { Renderer().RefreshBaseSettings(); } diff --git a/src/core/file_sys/control_metadata.cpp b/src/core/file_sys/control_metadata.cpp index cd9ac2e75..0697c29ae 100644 --- a/src/core/file_sys/control_metadata.cpp +++ b/src/core/file_sys/control_metadata.cpp @@ -68,7 +68,8 @@ NACP::NACP(VirtualFile file) { NACP::~NACP() = default; const LanguageEntry& NACP::GetLanguageEntry() const { - Language language = language_to_codes[Settings::values.language_index.GetValue()]; + Language language = + language_to_codes[static_cast<s32>(Settings::values.language_index.GetValue())]; { const auto& language_entry = raw.language_entries.at(static_cast<u8>(language)); diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index d3286b352..2ba1b34a4 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp @@ -626,8 +626,8 @@ PatchManager::Metadata PatchManager::ParseControlNCA(const NCA& nca) const { auto nacp = nacp_file == nullptr ? nullptr : std::make_unique<NACP>(nacp_file); // Get language code from settings - const auto language_code = - Service::Set::GetLanguageCodeFromIndex(Settings::values.language_index.GetValue()); + const auto language_code = Service::Set::GetLanguageCodeFromIndex( + static_cast<u32>(Settings::values.language_index.GetValue())); // Convert to application language and get priority list const auto application_language = diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 376067a95..91c5a2182 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -409,7 +409,7 @@ ResultVal<u8> IApplicationManagerInterface::GetApplicationDesiredLanguage( // Get language code from settings const auto language_code = - Set::GetLanguageCodeFromIndex(Settings::values.language_index.GetValue()); + Set::GetLanguageCodeFromIndex(static_cast<s32>(Settings::values.language_index.GetValue())); // Convert to application language, get priority list const auto application_language = ConvertToApplicationLanguage(language_code); diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index f5788b481..83f888c54 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp @@ -93,7 +93,8 @@ void GetAvailableLanguageCodesImpl(HLERequestContext& ctx, std::size_t max_entri } void GetKeyCodeMapImpl(HLERequestContext& ctx) { - const auto language_code = available_language_codes[Settings::values.language_index.GetValue()]; + const auto language_code = + available_language_codes[static_cast<s32>(Settings::values.language_index.GetValue())]; const auto key_code = std::find_if(language_to_layout.cbegin(), language_to_layout.cend(), [=](const auto& element) { return element.first == language_code; }); @@ -162,7 +163,7 @@ void SET::GetQuestFlag(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); - rb.Push(static_cast<u32>(Settings::values.quest_flag.GetValue())); + rb.Push(static_cast<s32>(Settings::values.quest_flag.GetValue())); } void SET::GetLanguageCode(HLERequestContext& ctx) { @@ -170,7 +171,8 @@ void SET::GetLanguageCode(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); - rb.PushEnum(available_language_codes[Settings::values.language_index.GetValue()]); + rb.PushEnum( + available_language_codes[static_cast<s32>(Settings::values.language_index.GetValue())]); } void SET::GetRegionCode(HLERequestContext& ctx) { @@ -178,7 +180,7 @@ void SET::GetRegionCode(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); - rb.Push(Settings::values.region_index.GetValue()); + rb.Push(static_cast<u32>(Settings::values.region_index.GetValue())); } void SET::GetKeyCodeMap(HLERequestContext& ctx) { |