summaryrefslogtreecommitdiffstats
path: root/src/core/settings.h
diff options
context:
space:
mode:
authorAmeer <aj662@drexel.edu>2020-07-14 19:04:02 +0200
committerAmeer <aj662@drexel.edu>2020-07-14 19:04:02 +0200
commit93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3 (patch)
treec4ab9e3acff296733b00effd85371bf04db6491f /src/core/settings.h
parentBreak out of scan loop if can't find adapter on first run (diff)
parentMerge pull request #4294 from MerryMage/cpu-opt-settings (diff)
downloadyuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar
yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.gz
yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.bz2
yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.lz
yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.xz
yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.zst
yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.zip
Diffstat (limited to 'src/core/settings.h')
-rw-r--r--src/core/settings.h171
1 files changed, 98 insertions, 73 deletions
diff --git a/src/core/settings.h b/src/core/settings.h
index a598ccbc1..3eb336f75 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -346,31 +346,6 @@ struct TouchscreenInput {
u32 rotation_angle;
};
-enum class NANDTotalSize : u64 {
- S29_1GB = 0x747C00000ULL,
-};
-
-enum class NANDUserSize : u64 {
- S26GB = 0x680000000ULL,
-};
-
-enum class NANDSystemSize : u64 {
- S2_5GB = 0xA0000000,
-};
-
-enum class SDMCSize : u64 {
- S1GB = 0x40000000,
- S2GB = 0x80000000,
- S4GB = 0x100000000ULL,
- S8GB = 0x200000000ULL,
- S16GB = 0x400000000ULL,
- S32GB = 0x800000000ULL,
- S64GB = 0x1000000000ULL,
- S128GB = 0x2000000000ULL,
- S256GB = 0x4000000000ULL,
- S1TB = 0x10000000000ULL,
-};
-
enum class RendererBackend {
OpenGL = 0,
Vulkan = 1,
@@ -382,20 +357,102 @@ enum class GPUAccuracy : u32 {
Extreme = 2,
};
+enum class CPUAccuracy {
+ Accurate = 0,
+ DebugMode = 1,
+};
+
+extern bool configuring_global;
+
+template <typename Type>
+class Setting final {
+public:
+ Setting() = default;
+ explicit Setting(Type val) : global{val} {}
+ ~Setting() = default;
+ void SetGlobal(bool to_global) {
+ use_global = to_global;
+ }
+ bool UsingGlobal() const {
+ return use_global;
+ }
+ Type GetValue(bool need_global = false) const {
+ if (use_global || need_global) {
+ return global;
+ }
+ return local;
+ }
+ void SetValue(const Type& value) {
+ if (use_global) {
+ global = value;
+ } else {
+ local = value;
+ }
+ }
+
+private:
+ bool use_global = true;
+ Type global{};
+ Type local{};
+};
+
struct Values {
+ // Audio
+ std::string audio_device_id;
+ std::string sink_id;
+ bool audio_muted;
+ Setting<bool> enable_audio_stretching;
+ Setting<float> volume;
+
+ // Core
+ Setting<bool> use_multi_core;
+
+ // Cpu
+ CPUAccuracy cpu_accuracy;
+
+ bool cpuopt_page_tables;
+ bool cpuopt_block_linking;
+ bool cpuopt_return_stack_buffer;
+ bool cpuopt_fast_dispatcher;
+ bool cpuopt_context_elimination;
+ bool cpuopt_const_prop;
+ bool cpuopt_misc_ir;
+ bool cpuopt_reduce_misalign_checks;
+
+ // Renderer
+ Setting<RendererBackend> renderer_backend;
+ bool renderer_debug;
+ Setting<int> vulkan_device;
+
+ Setting<u16> resolution_factor = Setting(static_cast<u16>(1));
+ Setting<int> aspect_ratio;
+ Setting<int> max_anisotropy;
+ Setting<bool> use_frame_limit;
+ Setting<u16> frame_limit;
+ Setting<bool> use_disk_shader_cache;
+ Setting<GPUAccuracy> gpu_accuracy;
+ Setting<bool> use_asynchronous_gpu_emulation;
+ Setting<bool> use_vsync;
+ Setting<bool> use_assembly_shaders;
+ Setting<bool> force_30fps_mode;
+ Setting<bool> use_fast_gpu_time;
+
+ Setting<float> bg_red;
+ Setting<float> bg_green;
+ Setting<float> bg_blue;
+
// System
- bool use_docked_mode;
- std::optional<u32> rng_seed;
+ Setting<std::optional<u32>> rng_seed;
// Measured in seconds since epoch
- std::optional<std::chrono::seconds> custom_rtc;
+ Setting<std::optional<std::chrono::seconds>> custom_rtc;
// Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc`
std::chrono::seconds custom_rtc_differential;
s32 current_user;
- s32 language_index;
- s32 region_index;
- s32 time_zone_index;
- s32 sound_index;
+ Setting<s32> language_index;
+ Setting<s32> region_index;
+ Setting<s32> time_zone_index;
+ Setting<s32> sound_index;
// Controls
std::array<PlayerInput, 10> players;
@@ -419,51 +476,13 @@ struct Values {
u16 udp_input_port;
u8 udp_pad_index;
- // Core
- bool use_multi_core;
+ bool use_docked_mode;
// Data Storage
bool use_virtual_sd;
bool gamecard_inserted;
bool gamecard_current_game;
std::string gamecard_path;
- NANDTotalSize nand_total_size;
- NANDSystemSize nand_system_size;
- NANDUserSize nand_user_size;
- SDMCSize sdmc_size;
-
- // Renderer
- RendererBackend renderer_backend;
- bool renderer_debug;
- int vulkan_device;
-
- u16 resolution_factor{1};
- int aspect_ratio;
- int max_anisotropy;
- bool use_frame_limit;
- u16 frame_limit;
- bool use_disk_shader_cache;
- GPUAccuracy gpu_accuracy;
- bool use_asynchronous_gpu_emulation;
- bool use_vsync;
- bool use_assembly_shaders;
- bool force_30fps_mode;
- bool use_fast_gpu_time;
-
- float bg_red;
- float bg_green;
- float bg_blue;
-
- std::string log_filter;
-
- bool use_dev_keys;
-
- // Audio
- bool audio_muted;
- std::string sink_id;
- bool enable_audio_stretching;
- std::string audio_device_id;
- float volume;
// Debugging
bool record_frame_times;
@@ -474,10 +493,13 @@ struct Values {
bool dump_nso;
bool reporting_services;
bool quest_flag;
- bool disable_cpu_opt;
bool disable_macro_jit;
- // BCAT
+ // Misceallaneous
+ std::string log_filter;
+ bool use_dev_keys;
+
+ // Services
std::string bcat_backend;
bool bcat_boxcat_local;
@@ -501,4 +523,7 @@ std::string GetTimeZoneString();
void Apply();
void LogSettings();
+// Restore the global state of all applicable settings in the Values struct
+void RestoreGlobalState();
+
} // namespace Settings