2025-07-01 01:44:12 +00:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
2022-04-23 04:59:50 -04:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2014-09-12 17:06:13 -07:00
|
|
|
|
2023-06-27 19:13:54 -04:00
|
|
|
#include <version>
|
2023-08-22 21:58:09 -04:00
|
|
|
#include "common/settings_enums.h"
|
2023-05-21 15:43:01 -04:00
|
|
|
#if __cpp_lib_chrono >= 201907L
|
|
|
|
|
#include <chrono>
|
2023-06-27 19:13:54 -04:00
|
|
|
#include <exception>
|
|
|
|
|
#include <stdexcept>
|
2023-05-21 15:43:01 -04:00
|
|
|
#endif
|
2023-06-10 23:40:39 -04:00
|
|
|
#include <compare>
|
|
|
|
|
#include <cstddef>
|
|
|
|
|
#include <filesystem>
|
2023-05-04 03:44:53 -04:00
|
|
|
#include <functional>
|
2020-07-15 13:34:50 -04:00
|
|
|
#include <string_view>
|
2023-06-10 23:40:39 -04:00
|
|
|
#include <type_traits>
|
|
|
|
|
#include <fmt/core.h>
|
2020-07-15 13:34:50 -04:00
|
|
|
|
2020-11-27 10:50:48 -05:00
|
|
|
#include "common/assert.h"
|
2023-06-10 23:40:39 -04:00
|
|
|
#include "common/fs/fs_util.h"
|
2021-05-25 19:32:56 -04:00
|
|
|
#include "common/fs/path_util.h"
|
2020-11-27 10:50:48 -05:00
|
|
|
#include "common/logging/log.h"
|
2021-04-14 16:07:40 -07:00
|
|
|
#include "common/settings.h"
|
2023-05-23 18:32:28 -04:00
|
|
|
#include "common/time_zone.h"
|
2016-04-11 14:38:42 +02:00
|
|
|
|
2014-09-12 17:06:13 -07:00
|
|
|
namespace Settings {
|
|
|
|
|
|
2023-07-18 15:36:20 -04:00
|
|
|
// Clang 14 and earlier have errors when explicitly instantiating these classes
|
2023-06-20 19:26:12 -04:00
|
|
|
#ifndef CANNOT_EXPLICITLY_INSTANTIATE
|
2023-06-10 23:40:39 -04:00
|
|
|
#define SETTING(TYPE, RANGED) template class Setting<TYPE, RANGED>
|
|
|
|
|
#define SWITCHABLE(TYPE, RANGED) template class SwitchableSetting<TYPE, RANGED>
|
|
|
|
|
|
2024-01-26 23:28:24 -05:00
|
|
|
SETTING(AppletMode, false);
|
2023-06-10 23:40:39 -04:00
|
|
|
SETTING(AudioEngine, false);
|
|
|
|
|
SETTING(bool, false);
|
|
|
|
|
SETTING(int, false);
|
|
|
|
|
SETTING(std::string, false);
|
|
|
|
|
SETTING(u16, false);
|
|
|
|
|
SWITCHABLE(AnisotropyMode, true);
|
|
|
|
|
SWITCHABLE(AntiAliasing, false);
|
|
|
|
|
SWITCHABLE(AspectRatio, true);
|
|
|
|
|
SWITCHABLE(AstcDecodeMode, true);
|
|
|
|
|
SWITCHABLE(AstcRecompression, true);
|
|
|
|
|
SWITCHABLE(AudioMode, true);
|
2023-11-17 22:03:42 +02:00
|
|
|
SWITCHABLE(CpuBackend, true);
|
2023-06-10 23:40:39 -04:00
|
|
|
SWITCHABLE(CpuAccuracy, true);
|
|
|
|
|
SWITCHABLE(FullscreenMode, true);
|
|
|
|
|
SWITCHABLE(GpuAccuracy, true);
|
|
|
|
|
SWITCHABLE(Language, true);
|
2023-08-26 21:23:02 +02:00
|
|
|
SWITCHABLE(MemoryLayout, true);
|
2023-06-10 23:40:39 -04:00
|
|
|
SWITCHABLE(NvdecEmulation, false);
|
|
|
|
|
SWITCHABLE(Region, true);
|
|
|
|
|
SWITCHABLE(RendererBackend, true);
|
|
|
|
|
SWITCHABLE(ScalingFilter, false);
|
2025-04-12 00:26:47 +03:00
|
|
|
SWITCHABLE(SpirvOptimizeMode, true);
|
2023-06-10 23:40:39 -04:00
|
|
|
SWITCHABLE(TimeZone, true);
|
|
|
|
|
SETTING(VSyncMode, true);
|
|
|
|
|
SWITCHABLE(bool, false);
|
|
|
|
|
SWITCHABLE(int, false);
|
|
|
|
|
SWITCHABLE(int, true);
|
|
|
|
|
SWITCHABLE(s64, false);
|
|
|
|
|
SWITCHABLE(u16, true);
|
|
|
|
|
SWITCHABLE(u32, false);
|
|
|
|
|
SWITCHABLE(u8, false);
|
|
|
|
|
SWITCHABLE(u8, true);
|
|
|
|
|
|
2023-08-26 21:23:02 +02:00
|
|
|
// Used in UISettings
|
|
|
|
|
// TODO see if we can move this to uisettings.cpp
|
|
|
|
|
SWITCHABLE(ConfirmStop, true);
|
|
|
|
|
|
2023-06-10 23:40:39 -04:00
|
|
|
#undef SETTING
|
|
|
|
|
#undef SWITCHABLE
|
2023-06-18 19:57:14 -04:00
|
|
|
#endif
|
2023-06-10 23:40:39 -04:00
|
|
|
|
2022-04-28 13:22:34 -04:00
|
|
|
Values values;
|
2014-09-12 17:06:13 -07:00
|
|
|
|
2023-07-04 16:48:48 -04:00
|
|
|
std::string GetTimeZoneString(TimeZone time_zone) {
|
|
|
|
|
const auto time_zone_index = static_cast<std::size_t>(time_zone);
|
2023-05-23 18:32:28 -04:00
|
|
|
ASSERT(time_zone_index < Common::TimeZone::GetTimeZoneStrings().size());
|
|
|
|
|
|
2023-05-21 15:43:01 -04:00
|
|
|
std::string location_name;
|
2023-05-23 18:32:28 -04:00
|
|
|
if (time_zone_index == 0) { // Auto
|
2023-07-10 17:52:35 -04:00
|
|
|
#if __cpp_lib_chrono >= 201907L && !defined(MINGW)
|
|
|
|
|
// Disabled for MinGW -- tzdb always returns Etc/UTC
|
2023-06-27 23:34:16 +02:00
|
|
|
try {
|
2023-07-09 02:26:58 -04:00
|
|
|
const struct std::chrono::tzdb& time_zone_data = std::chrono::get_tzdb();
|
2023-06-27 23:34:16 +02:00
|
|
|
const std::chrono::time_zone* current_zone = time_zone_data.current_zone();
|
|
|
|
|
std::string_view current_zone_name = current_zone->name();
|
|
|
|
|
location_name = current_zone_name;
|
|
|
|
|
} catch (std::runtime_error& runtime_error) {
|
|
|
|
|
// VCRUNTIME will throw a runtime_error if the operating system's selected time zone
|
|
|
|
|
// cannot be found
|
|
|
|
|
location_name = Common::TimeZone::FindSystemTimeZone();
|
|
|
|
|
LOG_WARNING(Common,
|
|
|
|
|
"Error occurred when trying to determine system time zone:\n{}\nFalling "
|
|
|
|
|
"back to hour offset \"{}\"",
|
|
|
|
|
runtime_error.what(), location_name);
|
|
|
|
|
}
|
2023-05-21 15:43:01 -04:00
|
|
|
#else
|
2023-05-23 18:32:28 -04:00
|
|
|
location_name = Common::TimeZone::FindSystemTimeZone();
|
2023-05-21 15:43:01 -04:00
|
|
|
#endif
|
2023-05-23 18:32:28 -04:00
|
|
|
} else {
|
|
|
|
|
location_name = Common::TimeZone::GetTimeZoneStrings()[time_zone_index];
|
2023-05-21 15:43:01 -04:00
|
|
|
}
|
|
|
|
|
return location_name;
|
2020-05-11 17:50:07 -04:00
|
|
|
}
|
|
|
|
|
|
2018-07-10 18:02:14 +08:00
|
|
|
void LogSettings() {
|
2020-07-15 13:34:50 -04:00
|
|
|
const auto log_setting = [](std::string_view name, const auto& value) {
|
|
|
|
|
LOG_INFO(Config, "{}: {}", name, value);
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-25 19:32:56 -04:00
|
|
|
const auto log_path = [](std::string_view name, const std::filesystem::path& path) {
|
|
|
|
|
LOG_INFO(Config, "{}: {}", name, Common::FS::PathToUTF8String(path));
|
|
|
|
|
};
|
|
|
|
|
|
2025-07-19 00:12:21 -04:00
|
|
|
LOG_INFO(Config, "Eden Configuration:");
|
2023-06-07 01:53:57 -04:00
|
|
|
for (auto& [category, settings] : values.linkage.by_category) {
|
|
|
|
|
for (const auto& setting : settings) {
|
2025-07-01 01:44:12 +00:00
|
|
|
if (setting->Id() == values.eden_token.Id()) {
|
2023-07-18 15:36:20 -04:00
|
|
|
// Hide the token secret, for security reasons.
|
2023-06-07 01:53:57 -04:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-18 15:36:20 -04:00
|
|
|
const auto name = fmt::format(
|
2023-06-07 01:53:57 -04:00
|
|
|
"{:c}{:c} {}.{}", setting->ToString() == setting->DefaultToString() ? '-' : 'M',
|
|
|
|
|
setting->UsingGlobal() ? '-' : 'C', TranslateCategory(category),
|
|
|
|
|
setting->GetLabel());
|
|
|
|
|
|
|
|
|
|
log_setting(name, setting->Canonicalize());
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-05-08 22:16:07 +00:00
|
|
|
log_path("DataStorage_CacheDir", Common::FS::GetEdenPath(Common::FS::EdenPath::CacheDir));
|
|
|
|
|
log_path("DataStorage_ConfigDir", Common::FS::GetEdenPath(Common::FS::EdenPath::ConfigDir));
|
|
|
|
|
log_path("DataStorage_LoadDir", Common::FS::GetEdenPath(Common::FS::EdenPath::LoadDir));
|
|
|
|
|
log_path("DataStorage_NANDDir", Common::FS::GetEdenPath(Common::FS::EdenPath::NANDDir));
|
2025-12-31 21:20:30 +01:00
|
|
|
log_path("DataStorage_SaveDir", Common::FS::GetEdenPath(Common::FS::EdenPath::SaveDir));
|
2025-05-08 22:16:07 +00:00
|
|
|
log_path("DataStorage_SDMCDir", Common::FS::GetEdenPath(Common::FS::EdenPath::SDMCDir));
|
2020-06-25 21:05:03 +02:00
|
|
|
}
|
|
|
|
|
|
2025-11-25 00:41:45 +01:00
|
|
|
bool getDebugKnobAt(u8 i) {
|
|
|
|
|
return (values.debug_knobs.GetValue() & (1 << (i & 0xF))) != 0;
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-04 03:32:30 +02:00
|
|
|
void UpdateGPUAccuracy() {
|
|
|
|
|
values.current_gpu_accuracy = values.gpu_accuracy.GetValue();
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-09 18:11:05 +01:00
|
|
|
bool IsGPULevelLow() {
|
|
|
|
|
return values.current_gpu_accuracy == GpuAccuracy::Low;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool IsGPULevelMedium() {
|
|
|
|
|
return values.current_gpu_accuracy == GpuAccuracy::Medium;
|
2020-04-15 21:42:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool IsGPULevelHigh() {
|
2025-12-09 18:11:05 +01:00
|
|
|
return values.current_gpu_accuracy == GpuAccuracy::High;
|
2020-07-09 22:42:09 -04:00
|
|
|
}
|
|
|
|
|
|
2025-09-16 18:42:48 +02:00
|
|
|
bool IsDMALevelDefault() {
|
|
|
|
|
return values.dma_accuracy.GetValue() == DmaAccuracy::Default;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool IsDMALevelSafe() {
|
|
|
|
|
return values.dma_accuracy.GetValue() == DmaAccuracy::Safe;
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-06 09:57:24 +02:00
|
|
|
bool IsFastmemEnabled() {
|
2025-10-17 22:09:19 +02:00
|
|
|
if (values.cpu_accuracy.GetValue() == Settings::CpuAccuracy::Debugging) {
|
|
|
|
|
return bool(values.cpuopt_fastmem);
|
2021-06-06 09:57:24 +02:00
|
|
|
}
|
2025-09-16 18:42:48 +02:00
|
|
|
if (values.cpu_accuracy.GetValue() == CpuAccuracy::Unsafe) {
|
2025-10-17 22:09:19 +02:00
|
|
|
return bool(values.cpuopt_unsafe_host_mmu);
|
2025-08-27 23:02:46 +02:00
|
|
|
}
|
2025-11-07 16:50:03 +01:00
|
|
|
#if !defined(__APPLE__) && !defined(__linux__) && !defined(__ANDROID__) && !defined(_WIN32)
|
2025-08-27 23:02:46 +02:00
|
|
|
return false;
|
2025-08-30 15:17:30 +02:00
|
|
|
#else
|
2021-06-06 09:57:24 +02:00
|
|
|
return true;
|
2025-08-30 15:17:30 +02:00
|
|
|
#endif
|
2021-06-06 09:57:24 +02:00
|
|
|
}
|
|
|
|
|
|
2023-11-17 22:23:48 +02:00
|
|
|
static bool is_nce_enabled = false;
|
|
|
|
|
|
2023-11-17 23:44:53 +02:00
|
|
|
void SetNceEnabled(bool is_39bit) {
|
2023-11-18 16:10:39 +02:00
|
|
|
const bool is_nce_selected = values.cpu_backend.GetValue() == CpuBackend::Nce;
|
2023-12-09 23:37:14 +02:00
|
|
|
if (is_nce_selected && !IsFastmemEnabled()) {
|
|
|
|
|
LOG_WARNING(Common, "Fastmem is required to natively execute code in a performant manner, "
|
|
|
|
|
"falling back to Dynarmic");
|
|
|
|
|
}
|
|
|
|
|
if (is_nce_selected && !is_39bit) {
|
2023-11-18 16:10:39 +02:00
|
|
|
LOG_WARNING(
|
|
|
|
|
Common,
|
|
|
|
|
"Program does not utilize 39-bit address space, unable to natively execute code");
|
|
|
|
|
}
|
2023-12-09 23:37:14 +02:00
|
|
|
is_nce_enabled = IsFastmemEnabled() && is_nce_selected && is_39bit;
|
2023-11-17 22:23:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool IsNceEnabled() {
|
|
|
|
|
return is_nce_enabled;
|
2023-11-17 22:03:42 +02:00
|
|
|
}
|
|
|
|
|
|
2023-08-22 21:58:09 -04:00
|
|
|
bool IsDockedMode() {
|
|
|
|
|
return values.use_docked_mode.GetValue() == Settings::ConsoleMode::Docked;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-04 04:16:34 -05:00
|
|
|
float Volume() {
|
|
|
|
|
if (values.audio_muted) {
|
|
|
|
|
return 0.0f;
|
|
|
|
|
}
|
2022-08-12 16:57:29 +01:00
|
|
|
return values.volume.GetValue() / static_cast<f32>(values.volume.GetDefault());
|
2020-11-04 04:16:34 -05:00
|
|
|
}
|
|
|
|
|
|
2023-06-05 21:05:22 -04:00
|
|
|
const char* TranslateCategory(Category category) {
|
|
|
|
|
switch (category) {
|
2023-08-16 02:36:56 -04:00
|
|
|
case Category::Android:
|
|
|
|
|
return "Android";
|
2023-06-05 21:05:22 -04:00
|
|
|
case Category::Audio:
|
|
|
|
|
return "Audio";
|
|
|
|
|
case Category::Core:
|
|
|
|
|
return "Core";
|
|
|
|
|
case Category::Cpu:
|
2023-05-07 10:35:28 -04:00
|
|
|
case Category::CpuDebug:
|
|
|
|
|
case Category::CpuUnsafe:
|
2023-06-05 21:05:22 -04:00
|
|
|
return "Cpu";
|
2023-12-24 15:42:28 -05:00
|
|
|
case Category::Overlay:
|
|
|
|
|
return "Overlay";
|
2023-06-05 21:05:22 -04:00
|
|
|
case Category::Renderer:
|
2023-05-07 10:35:28 -04:00
|
|
|
case Category::RendererAdvanced:
|
2025-12-31 23:45:58 +01:00
|
|
|
case Category::RendererHacks:
|
2023-05-07 10:35:28 -04:00
|
|
|
case Category::RendererDebug:
|
2025-04-23 20:57:53 -04:00
|
|
|
case Category::RendererExtensions:
|
2023-06-05 21:05:22 -04:00
|
|
|
return "Renderer";
|
|
|
|
|
case Category::System:
|
2023-05-10 17:57:25 -04:00
|
|
|
case Category::SystemAudio:
|
2023-06-05 21:05:22 -04:00
|
|
|
return "System";
|
|
|
|
|
case Category::DataStorage:
|
|
|
|
|
return "Data Storage";
|
|
|
|
|
case Category::Debugging:
|
2023-05-07 10:35:28 -04:00
|
|
|
case Category::DebuggingGraphics:
|
2023-06-05 21:05:22 -04:00
|
|
|
return "Debugging";
|
2023-12-10 20:45:02 -05:00
|
|
|
case Category::GpuDriver:
|
|
|
|
|
return "GpuDriver";
|
2024-01-26 23:28:24 -05:00
|
|
|
case Category::LibraryApplet:
|
|
|
|
|
return "LibraryApplet";
|
2023-06-05 21:05:22 -04:00
|
|
|
case Category::Miscellaneous:
|
|
|
|
|
return "Miscellaneous";
|
|
|
|
|
case Category::Network:
|
|
|
|
|
return "Network";
|
|
|
|
|
case Category::WebService:
|
|
|
|
|
return "WebService";
|
|
|
|
|
case Category::AddOns:
|
|
|
|
|
return "DisabledAddOns";
|
|
|
|
|
case Category::Controls:
|
|
|
|
|
return "Controls";
|
|
|
|
|
case Category::Ui:
|
2023-05-09 01:35:25 -04:00
|
|
|
case Category::UiGeneral:
|
2023-06-05 21:05:22 -04:00
|
|
|
return "UI";
|
2023-11-09 20:11:13 -06:00
|
|
|
case Category::UiAudio:
|
|
|
|
|
return "UiAudio";
|
2023-06-05 21:05:22 -04:00
|
|
|
case Category::UiLayout:
|
2023-11-12 02:03:01 -05:00
|
|
|
return "UILayout";
|
2023-06-05 21:05:22 -04:00
|
|
|
case Category::UiGameList:
|
2023-11-12 02:03:01 -05:00
|
|
|
return "UIGameList";
|
2023-06-05 21:05:22 -04:00
|
|
|
case Category::Screenshots:
|
|
|
|
|
return "Screenshots";
|
|
|
|
|
case Category::Shortcuts:
|
|
|
|
|
return "Shortcuts";
|
|
|
|
|
case Category::Multiplayer:
|
|
|
|
|
return "Multiplayer";
|
|
|
|
|
case Category::Services:
|
|
|
|
|
return "Services";
|
|
|
|
|
case Category::Paths:
|
|
|
|
|
return "Paths";
|
|
|
|
|
case Category::MaxEnum:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return "Miscellaneous";
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-15 22:41:50 -04:00
|
|
|
void TranslateResolutionInfo(ResolutionSetup setup, ResolutionScalingInfo& info) {
|
2021-10-15 22:59:16 +02:00
|
|
|
info.downscale = false;
|
2021-07-18 20:33:20 +02:00
|
|
|
switch (setup) {
|
2025-05-31 02:16:36 +00:00
|
|
|
case ResolutionSetup::Res1_4X:
|
|
|
|
|
info.up_scale = 1;
|
|
|
|
|
info.down_shift = 2;
|
|
|
|
|
info.downscale = true;
|
|
|
|
|
break;
|
2021-07-25 21:20:12 -03:00
|
|
|
case ResolutionSetup::Res1_2X:
|
2021-07-18 20:33:20 +02:00
|
|
|
info.up_scale = 1;
|
|
|
|
|
info.down_shift = 1;
|
2021-10-15 22:59:16 +02:00
|
|
|
info.downscale = true;
|
2021-07-18 20:33:20 +02:00
|
|
|
break;
|
2021-10-20 18:56:34 +02:00
|
|
|
case ResolutionSetup::Res3_4X:
|
|
|
|
|
info.up_scale = 3;
|
|
|
|
|
info.down_shift = 2;
|
|
|
|
|
info.downscale = true;
|
|
|
|
|
break;
|
2021-07-25 21:20:12 -03:00
|
|
|
case ResolutionSetup::Res1X:
|
2021-07-18 20:33:20 +02:00
|
|
|
info.up_scale = 1;
|
|
|
|
|
info.down_shift = 0;
|
|
|
|
|
break;
|
2023-01-13 02:34:24 -03:00
|
|
|
case ResolutionSetup::Res3_2X:
|
|
|
|
|
info.up_scale = 3;
|
|
|
|
|
info.down_shift = 1;
|
|
|
|
|
break;
|
2025-10-06 03:08:00 +02:00
|
|
|
case ResolutionSetup::Res5_4X:
|
|
|
|
|
info.up_scale = 5;
|
|
|
|
|
info.down_shift = 2;
|
|
|
|
|
break;
|
2021-07-25 21:20:12 -03:00
|
|
|
case ResolutionSetup::Res2X:
|
2021-07-18 20:33:20 +02:00
|
|
|
info.up_scale = 2;
|
|
|
|
|
info.down_shift = 0;
|
|
|
|
|
break;
|
2021-07-25 21:20:12 -03:00
|
|
|
case ResolutionSetup::Res3X:
|
2021-07-18 20:33:20 +02:00
|
|
|
info.up_scale = 3;
|
|
|
|
|
info.down_shift = 0;
|
|
|
|
|
break;
|
2021-07-25 21:20:12 -03:00
|
|
|
case ResolutionSetup::Res4X:
|
2021-07-18 20:33:20 +02:00
|
|
|
info.up_scale = 4;
|
|
|
|
|
info.down_shift = 0;
|
|
|
|
|
break;
|
2021-10-20 18:56:34 +02:00
|
|
|
case ResolutionSetup::Res5X:
|
|
|
|
|
info.up_scale = 5;
|
|
|
|
|
info.down_shift = 0;
|
|
|
|
|
break;
|
|
|
|
|
case ResolutionSetup::Res6X:
|
|
|
|
|
info.up_scale = 6;
|
|
|
|
|
info.down_shift = 0;
|
|
|
|
|
break;
|
2023-01-13 04:55:26 -03:00
|
|
|
case ResolutionSetup::Res7X:
|
|
|
|
|
info.up_scale = 7;
|
|
|
|
|
info.down_shift = 0;
|
|
|
|
|
break;
|
|
|
|
|
case ResolutionSetup::Res8X:
|
|
|
|
|
info.up_scale = 8;
|
|
|
|
|
info.down_shift = 0;
|
|
|
|
|
break;
|
2021-07-25 21:20:12 -03:00
|
|
|
default:
|
2022-06-07 17:02:29 -04:00
|
|
|
ASSERT(false);
|
2021-07-18 20:33:20 +02:00
|
|
|
info.up_scale = 1;
|
|
|
|
|
info.down_shift = 0;
|
2022-11-09 15:34:26 +01:00
|
|
|
break;
|
2021-07-18 20:33:20 +02:00
|
|
|
}
|
|
|
|
|
info.up_factor = static_cast<f32>(info.up_scale) / (1U << info.down_shift);
|
|
|
|
|
info.down_factor = static_cast<f32>(1U << info.down_shift) / info.up_scale;
|
2021-07-20 18:29:52 +02:00
|
|
|
info.active = info.up_scale != 1 || info.down_shift != 0;
|
2021-07-18 20:33:20 +02:00
|
|
|
}
|
|
|
|
|
|
2023-08-15 22:41:50 -04:00
|
|
|
void UpdateRescalingInfo() {
|
|
|
|
|
const auto setup = values.resolution_setup.GetValue();
|
|
|
|
|
auto& info = values.resolution_info;
|
|
|
|
|
TranslateResolutionInfo(setup, info);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-27 10:50:48 -05:00
|
|
|
void RestoreGlobalState(bool is_powered_on) {
|
2020-07-09 22:42:09 -04:00
|
|
|
// If a game is running, DO NOT restore the global settings state
|
2020-11-27 10:50:48 -05:00
|
|
|
if (is_powered_on) {
|
2020-07-09 22:42:09 -04:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-05 21:05:22 -04:00
|
|
|
for (const auto& reset : values.linkage.restore_functions) {
|
2023-05-04 03:44:53 -04:00
|
|
|
reset();
|
|
|
|
|
}
|
2025-11-13 14:01:32 +01:00
|
|
|
|
|
|
|
|
// Reset per-game flags
|
|
|
|
|
values.use_squashed_iterated_blend = false;
|
2020-04-15 21:42:05 -04:00
|
|
|
}
|
2021-05-15 23:53:36 -04:00
|
|
|
|
2023-07-18 15:49:36 -04:00
|
|
|
static bool configuring_global = true;
|
2020-07-09 22:42:09 -04:00
|
|
|
|
2023-07-18 15:49:36 -04:00
|
|
|
bool IsConfiguringGlobal() {
|
|
|
|
|
return configuring_global;
|
|
|
|
|
}
|
2020-09-28 10:00:15 -04:00
|
|
|
|
2023-07-18 15:49:36 -04:00
|
|
|
void SetConfiguringGlobal(bool is_global) {
|
|
|
|
|
configuring_global = is_global;
|
2020-04-15 21:42:05 -04:00
|
|
|
}
|
|
|
|
|
|
2017-08-25 23:53:07 +02:00
|
|
|
} // namespace Settings
|