diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/core.cpp | 6 | ||||
| -rw-r--r-- | src/core/frontend/framebuffer_layout.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/process.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/service/ns/ns.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/set/set.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/service/spl/module.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi.cpp | 20 | ||||
| -rw-r--r-- | src/core/perf_stats.cpp | 5 | ||||
| -rw-r--r-- | src/core/settings.cpp | 84 | ||||
| -rw-r--r-- | src/core/settings.h | 124 | ||||
| -rw-r--r-- | src/core/telemetry_session.cpp | 27 |
12 files changed, 190 insertions, 103 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 1a243c515..69a1aa0a5 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -147,8 +147,8 @@ struct System::Impl { | |||
| 147 | 147 | ||
| 148 | device_memory = std::make_unique<Core::DeviceMemory>(system); | 148 | device_memory = std::make_unique<Core::DeviceMemory>(system); |
| 149 | 149 | ||
| 150 | is_multicore = Settings::values.use_multi_core; | 150 | is_multicore = Settings::values.use_multi_core.GetValue(); |
| 151 | is_async_gpu = is_multicore || Settings::values.use_asynchronous_gpu_emulation; | 151 | is_async_gpu = is_multicore || Settings::values.use_asynchronous_gpu_emulation.GetValue(); |
| 152 | 152 | ||
| 153 | kernel.SetMulticore(is_multicore); | 153 | kernel.SetMulticore(is_multicore); |
| 154 | cpu_manager.SetMulticore(is_multicore); | 154 | cpu_manager.SetMulticore(is_multicore); |
| @@ -162,7 +162,7 @@ struct System::Impl { | |||
| 162 | const auto current_time = std::chrono::duration_cast<std::chrono::seconds>( | 162 | const auto current_time = std::chrono::duration_cast<std::chrono::seconds>( |
| 163 | std::chrono::system_clock::now().time_since_epoch()); | 163 | std::chrono::system_clock::now().time_since_epoch()); |
| 164 | Settings::values.custom_rtc_differential = | 164 | Settings::values.custom_rtc_differential = |
| 165 | Settings::values.custom_rtc.value_or(current_time) - current_time; | 165 | Settings::values.custom_rtc.GetValue().value_or(current_time) - current_time; |
| 166 | 166 | ||
| 167 | // Create a default fs if one doesn't already exist. | 167 | // Create a default fs if one doesn't already exist. |
| 168 | if (virtual_filesystem == nullptr) | 168 | if (virtual_filesystem == nullptr) |
diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index d0c43447c..c1fbc235b 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp | |||
| @@ -29,7 +29,7 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height) { | |||
| 29 | 29 | ||
| 30 | const float window_aspect_ratio = static_cast<float>(height) / width; | 30 | const float window_aspect_ratio = static_cast<float>(height) / width; |
| 31 | const float emulation_aspect_ratio = EmulationAspectRatio( | 31 | const float emulation_aspect_ratio = EmulationAspectRatio( |
| 32 | static_cast<AspectRatio>(Settings::values.aspect_ratio), window_aspect_ratio); | 32 | static_cast<AspectRatio>(Settings::values.aspect_ratio.GetValue()), window_aspect_ratio); |
| 33 | 33 | ||
| 34 | const Common::Rectangle<u32> screen_window_area{0, 0, width, height}; | 34 | const Common::Rectangle<u32> screen_window_area{0, 0, width, height}; |
| 35 | Common::Rectangle<u32> screen = MaxRectangle(screen_window_area, emulation_aspect_ratio); | 35 | Common::Rectangle<u32> screen = MaxRectangle(screen_window_area, emulation_aspect_ratio); |
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index f9d7c024d..c6fcb56ad 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp | |||
| @@ -123,7 +123,7 @@ std::shared_ptr<Process> Process::Create(Core::System& system, std::string name, | |||
| 123 | : kernel.CreateNewUserProcessID(); | 123 | : kernel.CreateNewUserProcessID(); |
| 124 | process->capabilities.InitializeForMetadatalessProcess(); | 124 | process->capabilities.InitializeForMetadatalessProcess(); |
| 125 | 125 | ||
| 126 | std::mt19937 rng(Settings::values.rng_seed.value_or(0)); | 126 | std::mt19937 rng(Settings::values.rng_seed.GetValue().value_or(0)); |
| 127 | std::uniform_int_distribution<u64> distribution; | 127 | std::uniform_int_distribution<u64> distribution; |
| 128 | std::generate(process->random_entropy.begin(), process->random_entropy.end(), | 128 | std::generate(process->random_entropy.begin(), process->random_entropy.end(), |
| 129 | [&] { return distribution(rng); }); | 129 | [&] { return distribution(rng); }); |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index c688d6d98..256449aa7 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -749,14 +749,14 @@ void ICommonStateGetter::GetDefaultDisplayResolution(Kernel::HLERequestContext& | |||
| 749 | 749 | ||
| 750 | if (Settings::values.use_docked_mode) { | 750 | if (Settings::values.use_docked_mode) { |
| 751 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth) * | 751 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth) * |
| 752 | static_cast<u32>(Settings::values.resolution_factor)); | 752 | static_cast<u32>(Settings::values.resolution_factor.GetValue())); |
| 753 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight) * | 753 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight) * |
| 754 | static_cast<u32>(Settings::values.resolution_factor)); | 754 | static_cast<u32>(Settings::values.resolution_factor.GetValue())); |
| 755 | } else { | 755 | } else { |
| 756 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedWidth) * | 756 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedWidth) * |
| 757 | static_cast<u32>(Settings::values.resolution_factor)); | 757 | static_cast<u32>(Settings::values.resolution_factor.GetValue())); |
| 758 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedHeight) * | 758 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedHeight) * |
| 759 | static_cast<u32>(Settings::values.resolution_factor)); | 759 | static_cast<u32>(Settings::values.resolution_factor.GetValue())); |
| 760 | } | 760 | } |
| 761 | } | 761 | } |
| 762 | 762 | ||
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 7e5ceccdb..6cfa9666d 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp | |||
| @@ -366,7 +366,8 @@ ResultVal<u8> IApplicationManagerInterface::GetApplicationDesiredLanguage( | |||
| 366 | LOG_DEBUG(Service_NS, "called with supported_languages={:08X}", supported_languages); | 366 | LOG_DEBUG(Service_NS, "called with supported_languages={:08X}", supported_languages); |
| 367 | 367 | ||
| 368 | // Get language code from settings | 368 | // Get language code from settings |
| 369 | const auto language_code = Set::GetLanguageCodeFromIndex(Settings::values.language_index); | 369 | const auto language_code = |
| 370 | Set::GetLanguageCodeFromIndex(Settings::values.language_index.GetValue()); | ||
| 370 | 371 | ||
| 371 | // Convert to application language, get priority list | 372 | // Convert to application language, get priority list |
| 372 | const auto application_language = ConvertToApplicationLanguage(language_code); | 373 | 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 e5cfd2101..34fe2fd82 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp | |||
| @@ -91,7 +91,7 @@ void GetAvailableLanguageCodesImpl(Kernel::HLERequestContext& ctx, std::size_t m | |||
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | void GetKeyCodeMapImpl(Kernel::HLERequestContext& ctx) { | 93 | void GetKeyCodeMapImpl(Kernel::HLERequestContext& ctx) { |
| 94 | const auto language_code = available_language_codes[Settings::values.language_index]; | 94 | const auto language_code = available_language_codes[Settings::values.language_index.GetValue()]; |
| 95 | const auto key_code = | 95 | const auto key_code = |
| 96 | std::find_if(language_to_layout.cbegin(), language_to_layout.cend(), | 96 | std::find_if(language_to_layout.cbegin(), language_to_layout.cend(), |
| 97 | [=](const auto& element) { return element.first == language_code; }); | 97 | [=](const auto& element) { return element.first == language_code; }); |
| @@ -99,7 +99,7 @@ void GetKeyCodeMapImpl(Kernel::HLERequestContext& ctx) { | |||
| 99 | if (key_code == language_to_layout.cend()) { | 99 | if (key_code == language_to_layout.cend()) { |
| 100 | LOG_ERROR(Service_SET, | 100 | LOG_ERROR(Service_SET, |
| 101 | "Could not find keyboard layout for language index {}, defaulting to English us", | 101 | "Could not find keyboard layout for language index {}, defaulting to English us", |
| 102 | Settings::values.language_index); | 102 | Settings::values.language_index.GetValue()); |
| 103 | } else { | 103 | } else { |
| 104 | layout = key_code->second; | 104 | layout = key_code->second; |
| 105 | } | 105 | } |
| @@ -163,11 +163,11 @@ void SET::GetQuestFlag(Kernel::HLERequestContext& ctx) { | |||
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | void SET::GetLanguageCode(Kernel::HLERequestContext& ctx) { | 165 | void SET::GetLanguageCode(Kernel::HLERequestContext& ctx) { |
| 166 | LOG_DEBUG(Service_SET, "called {}", Settings::values.language_index); | 166 | LOG_DEBUG(Service_SET, "called {}", Settings::values.language_index.GetValue()); |
| 167 | 167 | ||
| 168 | IPC::ResponseBuilder rb{ctx, 4}; | 168 | IPC::ResponseBuilder rb{ctx, 4}; |
| 169 | rb.Push(RESULT_SUCCESS); | 169 | rb.Push(RESULT_SUCCESS); |
| 170 | rb.PushEnum(available_language_codes[Settings::values.language_index]); | 170 | rb.PushEnum(available_language_codes[Settings::values.language_index.GetValue()]); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | void SET::GetRegionCode(Kernel::HLERequestContext& ctx) { | 173 | void SET::GetRegionCode(Kernel::HLERequestContext& ctx) { |
| @@ -175,7 +175,7 @@ void SET::GetRegionCode(Kernel::HLERequestContext& ctx) { | |||
| 175 | 175 | ||
| 176 | IPC::ResponseBuilder rb{ctx, 3}; | 176 | IPC::ResponseBuilder rb{ctx, 3}; |
| 177 | rb.Push(RESULT_SUCCESS); | 177 | rb.Push(RESULT_SUCCESS); |
| 178 | rb.Push(Settings::values.region_index); | 178 | rb.Push(Settings::values.region_index.GetValue()); |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | void SET::GetKeyCodeMap(Kernel::HLERequestContext& ctx) { | 181 | void SET::GetKeyCodeMap(Kernel::HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp index e724d4ab8..865ed3b91 100644 --- a/src/core/hle/service/spl/module.cpp +++ b/src/core/hle/service/spl/module.cpp | |||
| @@ -19,7 +19,7 @@ namespace Service::SPL { | |||
| 19 | 19 | ||
| 20 | Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) | 20 | Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) |
| 21 | : ServiceFramework(name), module(std::move(module)), | 21 | : ServiceFramework(name), module(std::move(module)), |
| 22 | rng(Settings::values.rng_seed.value_or(std::time(nullptr))) {} | 22 | rng(Settings::values.rng_seed.GetValue().value_or(std::time(nullptr))) {} |
| 23 | 23 | ||
| 24 | Module::Interface::~Interface() = default; | 24 | Module::Interface::~Interface() = default; |
| 25 | 25 | ||
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 157092074..552a5e4ef 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -519,9 +519,9 @@ private: | |||
| 519 | IGBPConnectRequestParcel request{ctx.ReadBuffer()}; | 519 | IGBPConnectRequestParcel request{ctx.ReadBuffer()}; |
| 520 | IGBPConnectResponseParcel response{ | 520 | IGBPConnectResponseParcel response{ |
| 521 | static_cast<u32>(static_cast<u32>(DisplayResolution::UndockedWidth) * | 521 | static_cast<u32>(static_cast<u32>(DisplayResolution::UndockedWidth) * |
| 522 | Settings::values.resolution_factor), | 522 | Settings::values.resolution_factor.GetValue()), |
| 523 | static_cast<u32>(static_cast<u32>(DisplayResolution::UndockedHeight) * | 523 | static_cast<u32>(static_cast<u32>(DisplayResolution::UndockedHeight) * |
| 524 | Settings::values.resolution_factor)}; | 524 | Settings::values.resolution_factor.GetValue())}; |
| 525 | ctx.WriteBuffer(response.Serialize()); | 525 | ctx.WriteBuffer(response.Serialize()); |
| 526 | break; | 526 | break; |
| 527 | } | 527 | } |
| @@ -748,14 +748,14 @@ private: | |||
| 748 | 748 | ||
| 749 | if (Settings::values.use_docked_mode) { | 749 | if (Settings::values.use_docked_mode) { |
| 750 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth) * | 750 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth) * |
| 751 | static_cast<u32>(Settings::values.resolution_factor)); | 751 | static_cast<u32>(Settings::values.resolution_factor.GetValue())); |
| 752 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight) * | 752 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight) * |
| 753 | static_cast<u32>(Settings::values.resolution_factor)); | 753 | static_cast<u32>(Settings::values.resolution_factor.GetValue())); |
| 754 | } else { | 754 | } else { |
| 755 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedWidth) * | 755 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedWidth) * |
| 756 | static_cast<u32>(Settings::values.resolution_factor)); | 756 | static_cast<u32>(Settings::values.resolution_factor.GetValue())); |
| 757 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedHeight) * | 757 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedHeight) * |
| 758 | static_cast<u32>(Settings::values.resolution_factor)); | 758 | static_cast<u32>(Settings::values.resolution_factor.GetValue())); |
| 759 | } | 759 | } |
| 760 | 760 | ||
| 761 | rb.PushRaw<float>(60.0f); // This wouldn't seem to be correct for 30 fps games. | 761 | rb.PushRaw<float>(60.0f); // This wouldn't seem to be correct for 30 fps games. |
| @@ -1029,9 +1029,9 @@ private: | |||
| 1029 | // between docked and undocked dimensions. We take the liberty of applying | 1029 | // between docked and undocked dimensions. We take the liberty of applying |
| 1030 | // the resolution scaling factor here. | 1030 | // the resolution scaling factor here. |
| 1031 | rb.Push(static_cast<u64>(DisplayResolution::UndockedWidth) * | 1031 | rb.Push(static_cast<u64>(DisplayResolution::UndockedWidth) * |
| 1032 | static_cast<u32>(Settings::values.resolution_factor)); | 1032 | static_cast<u32>(Settings::values.resolution_factor.GetValue())); |
| 1033 | rb.Push(static_cast<u64>(DisplayResolution::UndockedHeight) * | 1033 | rb.Push(static_cast<u64>(DisplayResolution::UndockedHeight) * |
| 1034 | static_cast<u32>(Settings::values.resolution_factor)); | 1034 | static_cast<u32>(Settings::values.resolution_factor.GetValue())); |
| 1035 | } | 1035 | } |
| 1036 | 1036 | ||
| 1037 | void SetLayerScalingMode(Kernel::HLERequestContext& ctx) { | 1037 | void SetLayerScalingMode(Kernel::HLERequestContext& ctx) { |
| @@ -1064,8 +1064,8 @@ private: | |||
| 1064 | LOG_WARNING(Service_VI, "(STUBBED) called"); | 1064 | LOG_WARNING(Service_VI, "(STUBBED) called"); |
| 1065 | 1065 | ||
| 1066 | DisplayInfo display_info; | 1066 | DisplayInfo display_info; |
| 1067 | display_info.width *= static_cast<u64>(Settings::values.resolution_factor); | 1067 | display_info.width *= static_cast<u64>(Settings::values.resolution_factor.GetValue()); |
| 1068 | display_info.height *= static_cast<u64>(Settings::values.resolution_factor); | 1068 | display_info.height *= static_cast<u64>(Settings::values.resolution_factor.GetValue()); |
| 1069 | ctx.WriteBuffer(&display_info, sizeof(DisplayInfo)); | 1069 | ctx.WriteBuffer(&display_info, sizeof(DisplayInfo)); |
| 1070 | IPC::ResponseBuilder rb{ctx, 4}; | 1070 | IPC::ResponseBuilder rb{ctx, 4}; |
| 1071 | rb.Push(RESULT_SUCCESS); | 1071 | rb.Push(RESULT_SUCCESS); |
diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp index 9f3a6b811..29339ead7 100644 --- a/src/core/perf_stats.cpp +++ b/src/core/perf_stats.cpp | |||
| @@ -119,13 +119,14 @@ double PerfStats::GetLastFrameTimeScale() { | |||
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) { | 121 | void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) { |
| 122 | if (!Settings::values.use_frame_limit || Settings::values.use_multi_core) { | 122 | if (!Settings::values.use_frame_limit.GetValue() || |
| 123 | Settings::values.use_multi_core.GetValue()) { | ||
| 123 | return; | 124 | return; |
| 124 | } | 125 | } |
| 125 | 126 | ||
| 126 | auto now = Clock::now(); | 127 | auto now = Clock::now(); |
| 127 | 128 | ||
| 128 | const double sleep_scale = Settings::values.frame_limit / 100.0; | 129 | const double sleep_scale = Settings::values.frame_limit.GetValue() / 100.0; |
| 129 | 130 | ||
| 130 | // Max lag caused by slow frames. Shouldn't be more than the length of a frame at the current | 131 | // Max lag caused by slow frames. Shouldn't be more than the length of a frame at the current |
| 131 | // speed percent or it will clamp too much and prevent this from properly limiting to that | 132 | // speed percent or it will clamp too much and prevent this from properly limiting to that |
diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 56df5e925..d3886c4ec 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp | |||
| @@ -62,6 +62,7 @@ const std::array<const char*, NumMouseButtons> mapping = {{ | |||
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | Values values = {}; | 64 | Values values = {}; |
| 65 | bool configuring_global = true; | ||
| 65 | 66 | ||
| 66 | std::string GetTimeZoneString() { | 67 | std::string GetTimeZoneString() { |
| 67 | static constexpr std::array<const char*, 46> timezones{{ | 68 | static constexpr std::array<const char*, 46> timezones{{ |
| @@ -73,9 +74,9 @@ std::string GetTimeZoneString() { | |||
| 73 | "UCT", "Universal", "UTC", "W-SU", "WET", "Zulu", | 74 | "UCT", "Universal", "UTC", "W-SU", "WET", "Zulu", |
| 74 | }}; | 75 | }}; |
| 75 | 76 | ||
| 76 | ASSERT(Settings::values.time_zone_index < timezones.size()); | 77 | ASSERT(Settings::values.time_zone_index.GetValue() < timezones.size()); |
| 77 | 78 | ||
| 78 | return timezones[Settings::values.time_zone_index]; | 79 | return timezones[Settings::values.time_zone_index.GetValue()]; |
| 79 | } | 80 | } |
| 80 | 81 | ||
| 81 | void Apply() { | 82 | void Apply() { |
| @@ -97,25 +98,25 @@ void LogSetting(const std::string& name, const T& value) { | |||
| 97 | 98 | ||
| 98 | void LogSettings() { | 99 | void LogSettings() { |
| 99 | LOG_INFO(Config, "yuzu Configuration:"); | 100 | LOG_INFO(Config, "yuzu Configuration:"); |
| 100 | LogSetting("System_UseDockedMode", Settings::values.use_docked_mode); | 101 | LogSetting("Controls_UseDockedMode", Settings::values.use_docked_mode); |
| 101 | LogSetting("System_RngSeed", Settings::values.rng_seed.value_or(0)); | 102 | LogSetting("System_RngSeed", Settings::values.rng_seed.GetValue().value_or(0)); |
| 102 | LogSetting("System_CurrentUser", Settings::values.current_user); | 103 | LogSetting("System_CurrentUser", Settings::values.current_user); |
| 103 | LogSetting("System_LanguageIndex", Settings::values.language_index); | 104 | LogSetting("System_LanguageIndex", Settings::values.language_index.GetValue()); |
| 104 | LogSetting("System_RegionIndex", Settings::values.region_index); | 105 | LogSetting("System_RegionIndex", Settings::values.region_index.GetValue()); |
| 105 | LogSetting("System_TimeZoneIndex", Settings::values.time_zone_index); | 106 | LogSetting("System_TimeZoneIndex", Settings::values.time_zone_index.GetValue()); |
| 106 | LogSetting("Core_UseMultiCore", Settings::values.use_multi_core); | 107 | LogSetting("Core_UseMultiCore", Settings::values.use_multi_core.GetValue()); |
| 107 | LogSetting("Renderer_UseResolutionFactor", Settings::values.resolution_factor); | 108 | LogSetting("Renderer_UseResolutionFactor", Settings::values.resolution_factor.GetValue()); |
| 108 | LogSetting("Renderer_UseFrameLimit", Settings::values.use_frame_limit); | 109 | LogSetting("Renderer_UseFrameLimit", Settings::values.use_frame_limit.GetValue()); |
| 109 | LogSetting("Renderer_FrameLimit", Settings::values.frame_limit); | 110 | LogSetting("Renderer_FrameLimit", Settings::values.frame_limit.GetValue()); |
| 110 | LogSetting("Renderer_UseDiskShaderCache", Settings::values.use_disk_shader_cache); | 111 | LogSetting("Renderer_UseDiskShaderCache", Settings::values.use_disk_shader_cache.GetValue()); |
| 111 | LogSetting("Renderer_GPUAccuracyLevel", Settings::values.gpu_accuracy); | 112 | LogSetting("Renderer_GPUAccuracyLevel", Settings::values.gpu_accuracy.GetValue()); |
| 112 | LogSetting("Renderer_UseAsynchronousGpuEmulation", | 113 | LogSetting("Renderer_UseAsynchronousGpuEmulation", |
| 113 | Settings::values.use_asynchronous_gpu_emulation); | 114 | Settings::values.use_asynchronous_gpu_emulation.GetValue()); |
| 114 | LogSetting("Renderer_UseVsync", Settings::values.use_vsync); | 115 | LogSetting("Renderer_UseVsync", Settings::values.use_vsync.GetValue()); |
| 115 | LogSetting("Renderer_UseAssemblyShaders", Settings::values.use_assembly_shaders); | 116 | LogSetting("Renderer_UseAssemblyShaders", Settings::values.use_assembly_shaders.GetValue()); |
| 116 | LogSetting("Renderer_AnisotropicFilteringLevel", Settings::values.max_anisotropy); | 117 | LogSetting("Renderer_AnisotropicFilteringLevel", Settings::values.max_anisotropy.GetValue()); |
| 117 | LogSetting("Audio_OutputEngine", Settings::values.sink_id); | 118 | LogSetting("Audio_OutputEngine", Settings::values.sink_id); |
| 118 | LogSetting("Audio_EnableAudioStretching", Settings::values.enable_audio_stretching); | 119 | LogSetting("Audio_EnableAudioStretching", Settings::values.enable_audio_stretching.GetValue()); |
| 119 | LogSetting("Audio_OutputDevice", Settings::values.audio_device_id); | 120 | LogSetting("Audio_OutputDevice", Settings::values.audio_device_id); |
| 120 | LogSetting("DataStorage_UseVirtualSd", Settings::values.use_virtual_sd); | 121 | LogSetting("DataStorage_UseVirtualSd", Settings::values.use_virtual_sd); |
| 121 | LogSetting("DataStorage_NandDir", FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)); | 122 | LogSetting("DataStorage_NandDir", FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)); |
| @@ -131,15 +132,56 @@ float Volume() { | |||
| 131 | if (values.audio_muted) { | 132 | if (values.audio_muted) { |
| 132 | return 0.0f; | 133 | return 0.0f; |
| 133 | } | 134 | } |
| 134 | return values.volume; | 135 | return values.volume.GetValue(); |
| 135 | } | 136 | } |
| 136 | 137 | ||
| 137 | bool IsGPULevelExtreme() { | 138 | bool IsGPULevelExtreme() { |
| 138 | return values.gpu_accuracy == GPUAccuracy::Extreme; | 139 | return values.gpu_accuracy.GetValue() == GPUAccuracy::Extreme; |
| 139 | } | 140 | } |
| 140 | 141 | ||
| 141 | bool IsGPULevelHigh() { | 142 | bool IsGPULevelHigh() { |
| 142 | return values.gpu_accuracy == GPUAccuracy::Extreme || values.gpu_accuracy == GPUAccuracy::High; | 143 | return values.gpu_accuracy.GetValue() == GPUAccuracy::Extreme || |
| 144 | values.gpu_accuracy.GetValue() == GPUAccuracy::High; | ||
| 145 | } | ||
| 146 | |||
| 147 | void RestoreGlobalState() { | ||
| 148 | // If a game is running, DO NOT restore the global settings state | ||
| 149 | if (Core::System::GetInstance().IsPoweredOn()) { | ||
| 150 | return; | ||
| 151 | } | ||
| 152 | |||
| 153 | // Audio | ||
| 154 | values.enable_audio_stretching.SetGlobal(true); | ||
| 155 | values.volume.SetGlobal(true); | ||
| 156 | |||
| 157 | // Core | ||
| 158 | values.use_multi_core.SetGlobal(true); | ||
| 159 | |||
| 160 | // Renderer | ||
| 161 | values.renderer_backend.SetGlobal(true); | ||
| 162 | values.vulkan_device.SetGlobal(true); | ||
| 163 | values.aspect_ratio.SetGlobal(true); | ||
| 164 | values.max_anisotropy.SetGlobal(true); | ||
| 165 | values.use_frame_limit.SetGlobal(true); | ||
| 166 | values.frame_limit.SetGlobal(true); | ||
| 167 | values.use_disk_shader_cache.SetGlobal(true); | ||
| 168 | values.gpu_accuracy.SetGlobal(true); | ||
| 169 | values.use_asynchronous_gpu_emulation.SetGlobal(true); | ||
| 170 | values.use_vsync.SetGlobal(true); | ||
| 171 | values.use_assembly_shaders.SetGlobal(true); | ||
| 172 | values.use_fast_gpu_time.SetGlobal(true); | ||
| 173 | values.force_30fps_mode.SetGlobal(true); | ||
| 174 | values.bg_red.SetGlobal(true); | ||
| 175 | values.bg_green.SetGlobal(true); | ||
| 176 | values.bg_blue.SetGlobal(true); | ||
| 177 | |||
| 178 | // System | ||
| 179 | values.language_index.SetGlobal(true); | ||
| 180 | values.region_index.SetGlobal(true); | ||
| 181 | values.time_zone_index.SetGlobal(true); | ||
| 182 | values.rng_seed.SetGlobal(true); | ||
| 183 | values.custom_rtc.SetGlobal(true); | ||
| 184 | values.sound_index.SetGlobal(true); | ||
| 143 | } | 185 | } |
| 144 | 186 | ||
| 145 | } // namespace Settings | 187 | } // namespace Settings |
diff --git a/src/core/settings.h b/src/core/settings.h index a598ccbc1..850ca4072 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -382,20 +382,85 @@ enum class GPUAccuracy : u32 { | |||
| 382 | Extreme = 2, | 382 | Extreme = 2, |
| 383 | }; | 383 | }; |
| 384 | 384 | ||
| 385 | extern bool configuring_global; | ||
| 386 | |||
| 387 | template <typename Type> | ||
| 388 | class Setting final { | ||
| 389 | public: | ||
| 390 | Setting() = default; | ||
| 391 | explicit Setting(Type val) : global{val} {} | ||
| 392 | ~Setting() = default; | ||
| 393 | void SetGlobal(bool to_global) { | ||
| 394 | use_global = to_global; | ||
| 395 | } | ||
| 396 | bool UsingGlobal() const { | ||
| 397 | return use_global; | ||
| 398 | } | ||
| 399 | Type GetValue(bool need_global = false) const { | ||
| 400 | if (use_global || need_global) { | ||
| 401 | return global; | ||
| 402 | } | ||
| 403 | return local; | ||
| 404 | } | ||
| 405 | void SetValue(const Type& value) { | ||
| 406 | if (use_global) { | ||
| 407 | global = value; | ||
| 408 | } else { | ||
| 409 | local = value; | ||
| 410 | } | ||
| 411 | } | ||
| 412 | |||
| 413 | private: | ||
| 414 | bool use_global = true; | ||
| 415 | Type global{}; | ||
| 416 | Type local{}; | ||
| 417 | }; | ||
| 418 | |||
| 385 | struct Values { | 419 | struct Values { |
| 420 | // Audio | ||
| 421 | std::string audio_device_id; | ||
| 422 | std::string sink_id; | ||
| 423 | bool audio_muted; | ||
| 424 | Setting<bool> enable_audio_stretching; | ||
| 425 | Setting<float> volume; | ||
| 426 | |||
| 427 | // Core | ||
| 428 | Setting<bool> use_multi_core; | ||
| 429 | |||
| 430 | // Renderer | ||
| 431 | Setting<RendererBackend> renderer_backend; | ||
| 432 | bool renderer_debug; | ||
| 433 | Setting<int> vulkan_device; | ||
| 434 | |||
| 435 | Setting<u16> resolution_factor = Setting(static_cast<u16>(1)); | ||
| 436 | Setting<int> aspect_ratio; | ||
| 437 | Setting<int> max_anisotropy; | ||
| 438 | Setting<bool> use_frame_limit; | ||
| 439 | Setting<u16> frame_limit; | ||
| 440 | Setting<bool> use_disk_shader_cache; | ||
| 441 | Setting<GPUAccuracy> gpu_accuracy; | ||
| 442 | Setting<bool> use_asynchronous_gpu_emulation; | ||
| 443 | Setting<bool> use_vsync; | ||
| 444 | Setting<bool> use_assembly_shaders; | ||
| 445 | Setting<bool> force_30fps_mode; | ||
| 446 | Setting<bool> use_fast_gpu_time; | ||
| 447 | |||
| 448 | Setting<float> bg_red; | ||
| 449 | Setting<float> bg_green; | ||
| 450 | Setting<float> bg_blue; | ||
| 451 | |||
| 386 | // System | 452 | // System |
| 387 | bool use_docked_mode; | 453 | Setting<std::optional<u32>> rng_seed; |
| 388 | std::optional<u32> rng_seed; | ||
| 389 | // Measured in seconds since epoch | 454 | // Measured in seconds since epoch |
| 390 | std::optional<std::chrono::seconds> custom_rtc; | 455 | Setting<std::optional<std::chrono::seconds>> custom_rtc; |
| 391 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` | 456 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` |
| 392 | std::chrono::seconds custom_rtc_differential; | 457 | std::chrono::seconds custom_rtc_differential; |
| 393 | 458 | ||
| 394 | s32 current_user; | 459 | s32 current_user; |
| 395 | s32 language_index; | 460 | Setting<s32> language_index; |
| 396 | s32 region_index; | 461 | Setting<s32> region_index; |
| 397 | s32 time_zone_index; | 462 | Setting<s32> time_zone_index; |
| 398 | s32 sound_index; | 463 | Setting<s32> sound_index; |
| 399 | 464 | ||
| 400 | // Controls | 465 | // Controls |
| 401 | std::array<PlayerInput, 10> players; | 466 | std::array<PlayerInput, 10> players; |
| @@ -419,8 +484,7 @@ struct Values { | |||
| 419 | u16 udp_input_port; | 484 | u16 udp_input_port; |
| 420 | u8 udp_pad_index; | 485 | u8 udp_pad_index; |
| 421 | 486 | ||
| 422 | // Core | 487 | bool use_docked_mode; |
| 423 | bool use_multi_core; | ||
| 424 | 488 | ||
| 425 | // Data Storage | 489 | // Data Storage |
| 426 | bool use_virtual_sd; | 490 | bool use_virtual_sd; |
| @@ -432,39 +496,6 @@ struct Values { | |||
| 432 | NANDUserSize nand_user_size; | 496 | NANDUserSize nand_user_size; |
| 433 | SDMCSize sdmc_size; | 497 | SDMCSize sdmc_size; |
| 434 | 498 | ||
| 435 | // Renderer | ||
| 436 | RendererBackend renderer_backend; | ||
| 437 | bool renderer_debug; | ||
| 438 | int vulkan_device; | ||
| 439 | |||
| 440 | u16 resolution_factor{1}; | ||
| 441 | int aspect_ratio; | ||
| 442 | int max_anisotropy; | ||
| 443 | bool use_frame_limit; | ||
| 444 | u16 frame_limit; | ||
| 445 | bool use_disk_shader_cache; | ||
| 446 | GPUAccuracy gpu_accuracy; | ||
| 447 | bool use_asynchronous_gpu_emulation; | ||
| 448 | bool use_vsync; | ||
| 449 | bool use_assembly_shaders; | ||
| 450 | bool force_30fps_mode; | ||
| 451 | bool use_fast_gpu_time; | ||
| 452 | |||
| 453 | float bg_red; | ||
| 454 | float bg_green; | ||
| 455 | float bg_blue; | ||
| 456 | |||
| 457 | std::string log_filter; | ||
| 458 | |||
| 459 | bool use_dev_keys; | ||
| 460 | |||
| 461 | // Audio | ||
| 462 | bool audio_muted; | ||
| 463 | std::string sink_id; | ||
| 464 | bool enable_audio_stretching; | ||
| 465 | std::string audio_device_id; | ||
| 466 | float volume; | ||
| 467 | |||
| 468 | // Debugging | 499 | // Debugging |
| 469 | bool record_frame_times; | 500 | bool record_frame_times; |
| 470 | bool use_gdbstub; | 501 | bool use_gdbstub; |
| @@ -477,7 +508,11 @@ struct Values { | |||
| 477 | bool disable_cpu_opt; | 508 | bool disable_cpu_opt; |
| 478 | bool disable_macro_jit; | 509 | bool disable_macro_jit; |
| 479 | 510 | ||
| 480 | // BCAT | 511 | // Misceallaneous |
| 512 | std::string log_filter; | ||
| 513 | bool use_dev_keys; | ||
| 514 | |||
| 515 | // Services | ||
| 481 | std::string bcat_backend; | 516 | std::string bcat_backend; |
| 482 | bool bcat_boxcat_local; | 517 | bool bcat_boxcat_local; |
| 483 | 518 | ||
| @@ -501,4 +536,7 @@ std::string GetTimeZoneString(); | |||
| 501 | void Apply(); | 536 | void Apply(); |
| 502 | void LogSettings(); | 537 | void LogSettings(); |
| 503 | 538 | ||
| 539 | // Restore the global state of all applicable settings in the Values struct | ||
| 540 | void RestoreGlobalState(); | ||
| 541 | |||
| 504 | } // namespace Settings | 542 | } // namespace Settings |
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index c781b3cfc..78915e6db 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp | |||
| @@ -189,19 +189,24 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader) { | |||
| 189 | // Log user configuration information | 189 | // Log user configuration information |
| 190 | constexpr auto field_type = Telemetry::FieldType::UserConfig; | 190 | constexpr auto field_type = Telemetry::FieldType::UserConfig; |
| 191 | AddField(field_type, "Audio_SinkId", Settings::values.sink_id); | 191 | AddField(field_type, "Audio_SinkId", Settings::values.sink_id); |
| 192 | AddField(field_type, "Audio_EnableAudioStretching", Settings::values.enable_audio_stretching); | 192 | AddField(field_type, "Audio_EnableAudioStretching", |
| 193 | AddField(field_type, "Core_UseMultiCore", Settings::values.use_multi_core); | 193 | Settings::values.enable_audio_stretching.GetValue()); |
| 194 | AddField(field_type, "Renderer_Backend", TranslateRenderer(Settings::values.renderer_backend)); | 194 | AddField(field_type, "Core_UseMultiCore", Settings::values.use_multi_core.GetValue()); |
| 195 | AddField(field_type, "Renderer_ResolutionFactor", Settings::values.resolution_factor); | 195 | AddField(field_type, "Renderer_Backend", |
| 196 | AddField(field_type, "Renderer_UseFrameLimit", Settings::values.use_frame_limit); | 196 | TranslateRenderer(Settings::values.renderer_backend.GetValue())); |
| 197 | AddField(field_type, "Renderer_FrameLimit", Settings::values.frame_limit); | 197 | AddField(field_type, "Renderer_ResolutionFactor", |
| 198 | AddField(field_type, "Renderer_UseDiskShaderCache", Settings::values.use_disk_shader_cache); | 198 | Settings::values.resolution_factor.GetValue()); |
| 199 | AddField(field_type, "Renderer_UseFrameLimit", Settings::values.use_frame_limit.GetValue()); | ||
| 200 | AddField(field_type, "Renderer_FrameLimit", Settings::values.frame_limit.GetValue()); | ||
| 201 | AddField(field_type, "Renderer_UseDiskShaderCache", | ||
| 202 | Settings::values.use_disk_shader_cache.GetValue()); | ||
| 199 | AddField(field_type, "Renderer_GPUAccuracyLevel", | 203 | AddField(field_type, "Renderer_GPUAccuracyLevel", |
| 200 | TranslateGPUAccuracyLevel(Settings::values.gpu_accuracy)); | 204 | TranslateGPUAccuracyLevel(Settings::values.gpu_accuracy.GetValue())); |
| 201 | AddField(field_type, "Renderer_UseAsynchronousGpuEmulation", | 205 | AddField(field_type, "Renderer_UseAsynchronousGpuEmulation", |
| 202 | Settings::values.use_asynchronous_gpu_emulation); | 206 | Settings::values.use_asynchronous_gpu_emulation.GetValue()); |
| 203 | AddField(field_type, "Renderer_UseVsync", Settings::values.use_vsync); | 207 | AddField(field_type, "Renderer_UseVsync", Settings::values.use_vsync.GetValue()); |
| 204 | AddField(field_type, "Renderer_UseAssemblyShaders", Settings::values.use_assembly_shaders); | 208 | AddField(field_type, "Renderer_UseAssemblyShaders", |
| 209 | Settings::values.use_assembly_shaders.GetValue()); | ||
| 205 | AddField(field_type, "System_UseDockedMode", Settings::values.use_docked_mode); | 210 | AddField(field_type, "System_UseDockedMode", Settings::values.use_docked_mode); |
| 206 | } | 211 | } |
| 207 | 212 | ||