mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-04 14:02:45 +01:00
settings: Pool SetGlobal functions
This commit is contained in:
parent
5cffa34288
commit
5ccfaf0517
2 changed files with 14 additions and 61 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#endif
|
#endif
|
||||||
|
#include <functional>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
@ -210,65 +211,9 @@ void RestoreGlobalState(bool is_powered_on) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Audio
|
for (const auto& reset : global_reset_registry) {
|
||||||
values.volume.SetGlobal(true);
|
reset();
|
||||||
|
}
|
||||||
// Core
|
|
||||||
values.use_multi_core.SetGlobal(true);
|
|
||||||
values.use_unsafe_extended_memory_layout.SetGlobal(true);
|
|
||||||
|
|
||||||
// CPU
|
|
||||||
values.cpu_accuracy.SetGlobal(true);
|
|
||||||
values.cpuopt_unsafe_unfuse_fma.SetGlobal(true);
|
|
||||||
values.cpuopt_unsafe_reduce_fp_error.SetGlobal(true);
|
|
||||||
values.cpuopt_unsafe_ignore_standard_fpcr.SetGlobal(true);
|
|
||||||
values.cpuopt_unsafe_inaccurate_nan.SetGlobal(true);
|
|
||||||
values.cpuopt_unsafe_fastmem_check.SetGlobal(true);
|
|
||||||
values.cpuopt_unsafe_ignore_global_monitor.SetGlobal(true);
|
|
||||||
|
|
||||||
// Renderer
|
|
||||||
values.fsr_sharpening_slider.SetGlobal(true);
|
|
||||||
values.renderer_backend.SetGlobal(true);
|
|
||||||
values.async_presentation.SetGlobal(true);
|
|
||||||
values.renderer_force_max_clock.SetGlobal(true);
|
|
||||||
values.vulkan_device.SetGlobal(true);
|
|
||||||
values.fullscreen_mode.SetGlobal(true);
|
|
||||||
values.aspect_ratio.SetGlobal(true);
|
|
||||||
values.resolution_setup.SetGlobal(true);
|
|
||||||
values.scaling_filter.SetGlobal(true);
|
|
||||||
values.anti_aliasing.SetGlobal(true);
|
|
||||||
values.max_anisotropy.SetGlobal(true);
|
|
||||||
values.use_speed_limit.SetGlobal(true);
|
|
||||||
values.speed_limit.SetGlobal(true);
|
|
||||||
values.use_disk_shader_cache.SetGlobal(true);
|
|
||||||
values.gpu_accuracy.SetGlobal(true);
|
|
||||||
values.use_asynchronous_gpu_emulation.SetGlobal(true);
|
|
||||||
values.nvdec_emulation.SetGlobal(true);
|
|
||||||
values.accelerate_astc.SetGlobal(true);
|
|
||||||
values.astc_recompression.SetGlobal(true);
|
|
||||||
values.use_reactive_flushing.SetGlobal(true);
|
|
||||||
values.shader_backend.SetGlobal(true);
|
|
||||||
values.use_asynchronous_shaders.SetGlobal(true);
|
|
||||||
values.use_fast_gpu_time.SetGlobal(true);
|
|
||||||
values.use_vulkan_driver_pipeline_cache.SetGlobal(true);
|
|
||||||
values.bg_red.SetGlobal(true);
|
|
||||||
values.bg_green.SetGlobal(true);
|
|
||||||
values.bg_blue.SetGlobal(true);
|
|
||||||
values.enable_compute_pipelines.SetGlobal(true);
|
|
||||||
values.use_video_framerate.SetGlobal(true);
|
|
||||||
|
|
||||||
// System
|
|
||||||
values.language_index.SetGlobal(true);
|
|
||||||
values.region_index.SetGlobal(true);
|
|
||||||
values.time_zone_index.SetGlobal(true);
|
|
||||||
values.rng_seed.SetGlobal(true);
|
|
||||||
values.sound_index.SetGlobal(true);
|
|
||||||
|
|
||||||
// Controls
|
|
||||||
values.players.SetGlobal(true);
|
|
||||||
values.use_docked_mode.SetGlobal(true);
|
|
||||||
values.vibration_enabled.SetGlobal(true);
|
|
||||||
values.motion_enabled.SetGlobal(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Settings
|
} // namespace Settings
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <forward_list>
|
||||||
|
#include <functional>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -125,6 +127,8 @@ struct ResolutionScalingInfo {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static std::forward_list<std::function<void()>> global_reset_registry;
|
||||||
|
|
||||||
/** The Setting class is a simple resource manager. It defines a label and default value alongside
|
/** The Setting class is a simple resource manager. It defines a label and default value alongside
|
||||||
* the actual value of the setting for simpler and less-error prone use with frontend
|
* the actual value of the setting for simpler and less-error prone use with frontend
|
||||||
* configurations. Specifying a default value and label is required. A minimum and maximum range can
|
* configurations. Specifying a default value and label is required. A minimum and maximum range can
|
||||||
|
@ -255,7 +259,9 @@ public:
|
||||||
*/
|
*/
|
||||||
explicit SwitchableSetting(const Type& default_val, const std::string& name)
|
explicit SwitchableSetting(const Type& default_val, const std::string& name)
|
||||||
requires(!ranged)
|
requires(!ranged)
|
||||||
: Setting<Type>{default_val, name} {}
|
: Setting<Type>{default_val, name} {
|
||||||
|
global_reset_registry.push_front([this]() { this->SetGlobal(true); });
|
||||||
|
}
|
||||||
virtual ~SwitchableSetting() = default;
|
virtual ~SwitchableSetting() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -269,7 +275,9 @@ public:
|
||||||
explicit SwitchableSetting(const Type& default_val, const Type& min_val, const Type& max_val,
|
explicit SwitchableSetting(const Type& default_val, const Type& min_val, const Type& max_val,
|
||||||
const std::string& name)
|
const std::string& name)
|
||||||
requires(ranged)
|
requires(ranged)
|
||||||
: Setting<Type, true>{default_val, min_val, max_val, name} {}
|
: Setting<Type, true>{default_val, min_val, max_val, name} {
|
||||||
|
global_reset_registry.push_front([this]() { this->SetGlobal(true); });
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells this setting to represent either the global or custom setting when other member
|
* Tells this setting to represent either the global or custom setting when other member
|
||||||
|
|
Loading…
Reference in a new issue