From 20e51402b0c0221d63c923d049e6a4c706c5e2ba Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Sat, 26 Jun 2021 02:43:38 -0400 Subject: common: Force defaults for Settings::Setting's Requires a default value when creating each per-game setting. --- src/common/settings.h | 101 ++++++++++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 44 deletions(-) (limited to 'src/common/settings.h') diff --git a/src/common/settings.h b/src/common/settings.h index 82ec18e27..dd2d8d4d8 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -37,8 +37,9 @@ enum class CPUAccuracy : u32 { template class Setting final { public: - Setting() = default; - explicit Setting(Type val) : global{val} {} + explicit Setting(Type val) : global{val} { + default_value = val; + } ~Setting() = default; void SetGlobal(bool to_global) { use_global = to_global; @@ -59,11 +60,15 @@ public: local = value; } } + Type GetDefault() const { + return default_value; + } private: bool use_global = true; Type global{}; Type local{}; + Type default_value{}; }; /** @@ -108,14 +113,14 @@ struct Values { std::string audio_device_id; std::string sink_id; bool audio_muted; - Setting enable_audio_stretching; - Setting volume; + Setting enable_audio_stretching{true}; + Setting volume{1.0f}; // Core - Setting use_multi_core; + Setting use_multi_core{true}; // Cpu - Setting cpu_accuracy; + Setting cpu_accuracy{CPUAccuracy::Accurate}; bool cpuopt_page_tables; bool cpuopt_block_linking; @@ -127,61 +132,69 @@ struct Values { bool cpuopt_reduce_misalign_checks; bool cpuopt_fastmem; - Setting cpuopt_unsafe_unfuse_fma; - Setting cpuopt_unsafe_reduce_fp_error; - Setting cpuopt_unsafe_ignore_standard_fpcr; - Setting cpuopt_unsafe_inaccurate_nan; - Setting cpuopt_unsafe_fastmem_check; + Setting cpuopt_unsafe_unfuse_fma{true}; + Setting cpuopt_unsafe_reduce_fp_error{true}; + Setting cpuopt_unsafe_ignore_standard_fpcr{true}; + Setting cpuopt_unsafe_inaccurate_nan{true}; + Setting cpuopt_unsafe_fastmem_check{true}; // Renderer - Setting renderer_backend; + Setting renderer_backend{RendererBackend::OpenGL}; bool renderer_debug; - Setting vulkan_device; - - Setting resolution_factor{1}; - Setting fullscreen_mode; - Setting aspect_ratio; - Setting max_anisotropy; - Setting use_frame_limit; - Setting frame_limit; - Setting use_disk_shader_cache; - Setting gpu_accuracy; - Setting use_asynchronous_gpu_emulation; - Setting use_nvdec_emulation; - Setting accelerate_astc; - Setting use_vsync; - Setting disable_fps_limit; - Setting use_assembly_shaders; - Setting use_asynchronous_shaders; - Setting use_fast_gpu_time; - Setting use_caches_gc; - - Setting bg_red; - Setting bg_green; - Setting bg_blue; + Setting vulkan_device{0}; + + Setting resolution_factor{0}; + // *nix platforms may have issues with the borderless windowed fullscreen mode. + // Default to exclusive fullscreen on these platforms for now. + Setting fullscreen_mode{ +#ifdef _WIN32 + 0 +#else + 1 +#endif + }; + Setting aspect_ratio{0}; + Setting max_anisotropy{0}; + Setting use_frame_limit{true}; + Setting frame_limit{100}; + Setting use_disk_shader_cache{true}; + Setting gpu_accuracy{GPUAccuracy::High}; + Setting use_asynchronous_gpu_emulation{true}; + Setting use_nvdec_emulation{true}; + Setting accelerate_astc{true}; + Setting use_vsync{true}; + Setting disable_fps_limit{false}; + Setting use_assembly_shaders{false}; + Setting use_asynchronous_shaders{false}; + Setting use_fast_gpu_time{true}; + Setting use_caches_gc{false}; + + Setting bg_red{0.0f}; + Setting bg_green{0.0f}; + Setting bg_blue{0.0f}; // System - Setting> rng_seed; + Setting> rng_seed{std::optional()}; // Measured in seconds since epoch std::optional 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; - Setting language_index; - Setting region_index; - Setting time_zone_index; - Setting sound_index; + Setting language_index{1}; + Setting region_index{1}; + Setting time_zone_index{0}; + Setting sound_index{1}; // Controls InputSetting> players; - Setting use_docked_mode; + Setting use_docked_mode{true}; - Setting vibration_enabled; - Setting enable_accurate_vibrations; + Setting vibration_enabled{true}; + Setting enable_accurate_vibrations{false}; - Setting motion_enabled; + Setting motion_enabled{true}; std::string motion_device; std::string udp_input_servers; -- cgit v1.2.3 From b91b76df4fe27d781bd95ddb89b78ff54df57029 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Mon, 28 Jun 2021 15:58:16 -0400 Subject: general: Make most settings a BasicSetting Creates a new BasicSettings class in common/settings, and forces setting a default and label for each setting that uses it in common/settings. Moves defaults and labels from both frontends into common settings. Creates a helper function in each frontend to facillitate reading the settings now with the new default and label properties. Settings::Setting is also now a subclass of Settings::BasicSetting. Also adds documentation for both Setting and BasicSetting. --- src/common/settings.h | 406 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 287 insertions(+), 119 deletions(-) (limited to 'src/common/settings.h') diff --git a/src/common/settings.h b/src/common/settings.h index dd2d8d4d8..13896debf 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -10,10 +10,12 @@ #include #include #include +#include #include #include "common/common_types.h" #include "common/settings_input.h" +#include "input_common/udp/client.h" namespace Settings { @@ -34,73 +36,236 @@ enum class CPUAccuracy : u32 { DebugMode = 2, }; +/** The BasicSetting 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 + * configurations. Setting a default value and label is required, though subclasses may deviate from + * this requirement. + */ template -class Setting final { +class BasicSetting { +protected: + BasicSetting() = default; + + /** + * Only sets the setting to the given initializer, leaving the other members to their default + * initializers. + * + * @param global_val Initial value of the setting + */ + explicit BasicSetting(const Type& global_val) : global{global_val} {} + public: - explicit Setting(Type val) : global{val} { - default_value = val; + /** + * Sets a default value, label, and setting value. + * + * @param default_val Intial value of the setting, and default value of the setting + * @param name Label for the setting + */ + explicit BasicSetting(const Type& default_val, const std::string& name) + : default_value{default_val}, global{default_val}, label{name} {} + ~BasicSetting() = default; + + /** + * Returns a reference to the setting's value. + * + * @returns A reference to the setting + */ + [[nodiscard]] const Type& GetValue() const { + return global; + } + + /** + * Sets the setting to the given value. + * + * @param value The desired value + */ + void SetValue(const Type& value) { + Type temp{value}; + std::swap(global, temp); } + + /** + * Returns the value that this setting was created with. + * + * @returns A reference to the default value + */ + [[nodiscard]] const Type& GetDefault() const { + return default_value; + } + + /** + * Returns the label this setting was created with. + * + * @returns A reference to the label + */ + [[nodiscard]] const std::string& GetLabel() const { + return label; + } + + /** + * Assigns a value to the setting. + * + * @param value The desired setting value + * + * @returns A reference to the setting + */ + const Type& operator=(const Type& value) { + Type temp{value}; + std::swap(global, temp); + return global; + } + + /** + * Returns a reference to the setting. + * + * @returns A reference to the setting + */ + explicit operator const Type&() const { + return global; + } + +protected: + const Type default_value{}; ///< The default value + Type global{}; ///< The setting + const std::string label{}; ///< The setting's label +}; + +/** + * The Setting class is a slightly more complex version of the BasicSetting class. This adds a + * custom setting to switch to when a guest application specifically requires it. The effect is that + * other components of the emulator can access the setting's intended value without any need for the + * component to ask whether the custom or global setting is needed at the moment. + * + * By default, the global setting is used. + * + * Like the BasicSetting, this requires setting a default value and label to use. + */ +template +class Setting final : public BasicSetting { +public: + /** + * Sets a default value, label, and setting value. + * + * @param default_val Intial value of the setting, and default value of the setting + * @param name Label for the setting + */ + explicit Setting(const Type& default_val, const std::string& name) + : BasicSetting(default_val, name) {} ~Setting() = default; + + /** + * Tells this setting to represent either the global or custom setting when other member + * functions are used. Setting to_global to true means using the global setting, to false + * false for the custom setting. + * + * @param to_global Whether to use the global or custom setting. + */ void SetGlobal(bool to_global) { use_global = to_global; } - bool UsingGlobal() const { + + /** + * Returns whether this setting is using the global setting or not. + * + * @returns The global state + */ + [[nodiscard]] bool UsingGlobal() const { return use_global; } - Type GetValue(bool need_global = false) const { + + /** + * Returns either the global or custom setting depending on the values of this setting's global + * state or if the global value was specifically requested. + * + * @param need_global Request global value regardless of setting's state; defaults to false + * + * @returns The required value of the setting + */ + [[nodiscard]] const Type& GetValue(bool need_global = false) const { if (use_global || need_global) { - return global; + return this->global; } - return local; + return custom; } + + /** + * Sets the current setting value depending on the global state. + * + * @param value The new value + */ void SetValue(const Type& value) { + Type temp{value}; if (use_global) { - global = value; + std::swap(this->global, temp); } else { - local = value; + std::swap(custom, temp); } } - Type GetDefault() const { - return default_value; + + /** + * Assigns the current setting value depending on the global state. + * + * @param value The new value + * + * @returns A reference to the current setting value + */ + const Type& operator=(const Type& value) { + Type temp{value}; + if (use_global) { + std::swap(this->global, temp); + return this->global; + } + std::swap(custom, temp); + return custom; + } + + /** + * Returns the current setting value depending on the global state. + * + * @returns A reference to the current setting value + */ + explicit operator const Type&() const { + if (use_global) { + return this->global; + } + return custom; } private: - bool use_global = true; - Type global{}; - Type local{}; - Type default_value{}; + bool use_global{true}; ///< The setting's global state + Type custom{}; ///< The custom value of the setting }; /** - * The InputSetting class allows for getting a reference to either the global or local members. + * The InputSetting class allows for getting a reference to either the global or custom members. * This is required as we cannot easily modify the values of user-defined types within containers * using the SetValue() member function found in the Setting class. The primary purpose of this - * class is to store an array of 10 PlayerInput structs for both the global and local (per-game) - * setting and allows for easily accessing and modifying both settings. + * class is to store an array of 10 PlayerInput structs for both the global and custom setting and + * allows for easily accessing and modifying both settings. */ template class InputSetting final { public: InputSetting() = default; - explicit InputSetting(Type val) : global{val} {} + explicit InputSetting(Type val) : BasicSetting(val) {} ~InputSetting() = default; void SetGlobal(bool to_global) { use_global = to_global; } - bool UsingGlobal() const { + [[nodiscard]] bool UsingGlobal() const { return use_global; } - Type& GetValue(bool need_global = false) { + [[nodiscard]] Type& GetValue(bool need_global = false) { if (use_global || need_global) { return global; } - return local; + return custom; } private: - bool use_global = true; - Type global{}; - Type local{}; + bool use_global{true}; ///< The setting's global state + Type global{}; ///< The setting + Type custom{}; ///< The custom setting value }; struct TouchFromButtonMap { @@ -110,152 +275,155 @@ struct TouchFromButtonMap { struct Values { // Audio - std::string audio_device_id; - std::string sink_id; - bool audio_muted; - Setting enable_audio_stretching{true}; - Setting volume{1.0f}; + BasicSetting audio_device_id{"auto", "output_device"}; + BasicSetting sink_id{"auto", "output_engine"}; + BasicSetting audio_muted{false, "audio_muted"}; + Setting enable_audio_stretching{true, "enable_audio_stretching"}; + Setting volume{1.0f, "volume"}; // Core - Setting use_multi_core{true}; + Setting use_multi_core{true, "use_multi_core"}; // Cpu - Setting cpu_accuracy{CPUAccuracy::Accurate}; - - 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; - bool cpuopt_fastmem; - - Setting cpuopt_unsafe_unfuse_fma{true}; - Setting cpuopt_unsafe_reduce_fp_error{true}; - Setting cpuopt_unsafe_ignore_standard_fpcr{true}; - Setting cpuopt_unsafe_inaccurate_nan{true}; - Setting cpuopt_unsafe_fastmem_check{true}; + Setting cpu_accuracy{CPUAccuracy::Accurate, "cpu_accuracy"}; + + BasicSetting cpuopt_page_tables{true, "cpuopt_page_tables"}; + BasicSetting cpuopt_block_linking{true, "cpuopt_block_linking"}; + BasicSetting cpuopt_return_stack_buffer{true, "cpuopt_return_stack_buffer"}; + BasicSetting cpuopt_fast_dispatcher{true, "cpuopt_fast_dispatcher"}; + BasicSetting cpuopt_context_elimination{true, "cpuopt_context_elimination"}; + BasicSetting cpuopt_const_prop{true, "cpuopt_const_prop"}; + BasicSetting cpuopt_misc_ir{true, "cpuopt_misc_ir"}; + BasicSetting cpuopt_reduce_misalign_checks{true, "cpuopt_reduce_misalign_checks"}; + BasicSetting cpuopt_fastmem{true, "cpuopt_fastmem"}; + + Setting cpuopt_unsafe_unfuse_fma{true, "cpuopt_unsafe_unfuse_fma"}; + Setting cpuopt_unsafe_reduce_fp_error{true, "cpuopt_unsafe_reduce_fp_error"}; + Setting cpuopt_unsafe_ignore_standard_fpcr{true, "cpuopt_unsafe_ignore_standard_fpcr"}; + Setting cpuopt_unsafe_inaccurate_nan{true, "cpuopt_unsafe_inaccurate_nan"}; + Setting cpuopt_unsafe_fastmem_check{true, "cpuopt_unsafe_fastmem_check"}; // Renderer - Setting renderer_backend{RendererBackend::OpenGL}; - bool renderer_debug; - Setting vulkan_device{0}; + Setting renderer_backend{RendererBackend::OpenGL, "backend"}; + BasicSetting renderer_debug{false, "debug"}; + Setting vulkan_device{0, "vulkan_device"}; - Setting resolution_factor{0}; + Setting resolution_factor{0, "resolution_factor"}; // *nix platforms may have issues with the borderless windowed fullscreen mode. // Default to exclusive fullscreen on these platforms for now. Setting fullscreen_mode{ #ifdef _WIN32 - 0 + 0, #else - 1 + 1, #endif - }; - Setting aspect_ratio{0}; - Setting max_anisotropy{0}; - Setting use_frame_limit{true}; - Setting frame_limit{100}; - Setting use_disk_shader_cache{true}; - Setting gpu_accuracy{GPUAccuracy::High}; - Setting use_asynchronous_gpu_emulation{true}; - Setting use_nvdec_emulation{true}; - Setting accelerate_astc{true}; - Setting use_vsync{true}; - Setting disable_fps_limit{false}; - Setting use_assembly_shaders{false}; - Setting use_asynchronous_shaders{false}; - Setting use_fast_gpu_time{true}; - Setting use_caches_gc{false}; - - Setting bg_red{0.0f}; - Setting bg_green{0.0f}; - Setting bg_blue{0.0f}; + "fullscreen_mode"}; + Setting aspect_ratio{0, "aspect_ratio"}; + Setting max_anisotropy{0, "max_anisotropy"}; + Setting use_frame_limit{true, "use_frame_limit"}; + Setting frame_limit{100, "frame_limit"}; + Setting use_disk_shader_cache{true, "use_disk_shader_cache"}; + Setting gpu_accuracy{GPUAccuracy::High, "gpu_accuracy"}; + Setting use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"}; + Setting use_nvdec_emulation{true, "use_nvdec_emulation"}; + Setting accelerate_astc{true, "accelerate_astc"}; + Setting use_vsync{true, "use_vsync"}; + Setting disable_fps_limit{false, "disable_fps_limit"}; + Setting use_assembly_shaders{false, "use_assembly_shaders"}; + Setting use_asynchronous_shaders{false, "use_asynchronous_shaders"}; + Setting use_fast_gpu_time{true, "use_fast_gpu_time"}; + Setting use_caches_gc{false, "use_caches_gc"}; + + Setting bg_red{0.0f, "bg_red"}; + Setting bg_green{0.0f, "bg_green"}; + Setting bg_blue{0.0f, "bg_blue"}; // System - Setting> rng_seed{std::optional()}; + Setting> rng_seed{std::optional(), "rng_seed"}; // Measured in seconds since epoch std::optional 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; - Setting language_index{1}; - Setting region_index{1}; - Setting time_zone_index{0}; - Setting sound_index{1}; + BasicSetting current_user{0, "current_user"}; + Setting language_index{1, "language_index"}; + Setting region_index{1, "region_index"}; + Setting time_zone_index{0, "time_zone_index"}; + Setting sound_index{1, "sound_index"}; // Controls InputSetting> players; - Setting use_docked_mode{true}; + Setting use_docked_mode{true, "use_docked_mode"}; - Setting vibration_enabled{true}; - Setting enable_accurate_vibrations{false}; + Setting vibration_enabled{true, "vibration_enabled"}; + Setting enable_accurate_vibrations{false, "enable_accurate_vibrations"}; - Setting motion_enabled{true}; - std::string motion_device; - std::string udp_input_servers; + Setting motion_enabled{true, "motion_enabled"}; + BasicSetting motion_device{"engine:motion_emu,update_period:100,sensitivity:0.01", + "motion_device"}; + BasicSetting udp_input_servers{InputCommon::CemuhookUDP::DEFAULT_SRV, + "udp_input_servers"}; - bool mouse_panning; - float mouse_panning_sensitivity; - bool mouse_enabled; + BasicSetting mouse_panning{false, "mouse_panning"}; + BasicSetting mouse_panning_sensitivity{1.0f, "mouse_panning_sensitivity"}; + BasicSetting mouse_enabled{false, "mouse_enabled"}; std::string mouse_device; MouseButtonsRaw mouse_buttons; - bool emulate_analog_keyboard; - bool keyboard_enabled; + BasicSetting emulate_analog_keyboard{false, "emulate_analog_keyboard"}; + BasicSetting keyboard_enabled{false, "keyboard_enabled"}; KeyboardKeysRaw keyboard_keys; KeyboardModsRaw keyboard_mods; - bool debug_pad_enabled; + BasicSetting debug_pad_enabled{false, "debug_pad_enabled"}; ButtonsRaw debug_pad_buttons; AnalogsRaw debug_pad_analogs; TouchscreenInput touchscreen; - bool use_touch_from_button; - std::string touch_device; - int touch_from_button_map_index; + BasicSetting use_touch_from_button{false, "use_touch_from_button"}; + BasicSetting touch_device{"min_x:100,min_y:50,max_x:1800,max_y:850", + "touch_device"}; + BasicSetting touch_from_button_map_index{0, "touch_from_button_map"}; std::vector touch_from_button_maps; std::atomic_bool is_device_reload_pending{true}; // Data Storage - bool use_virtual_sd; - bool gamecard_inserted; - bool gamecard_current_game; - std::string gamecard_path; + BasicSetting use_virtual_sd{true, "use_virtual_sd"}; + BasicSetting gamecard_inserted{false, "gamecard_inserted"}; + BasicSetting gamecard_current_game{false, "gamecard_current_game"}; + BasicSetting gamecard_path{std::string(), "gamecard_path"}; // Debugging bool record_frame_times; - bool use_gdbstub; - u16 gdbstub_port; - std::string program_args; - bool dump_exefs; - bool dump_nso; - bool enable_fs_access_log; - bool reporting_services; - bool quest_flag; - bool disable_macro_jit; - bool extended_logging; - bool use_debug_asserts; - bool use_auto_stub; + BasicSetting use_gdbstub{false, "use_gdbstub"}; + BasicSetting gdbstub_port{0, "gdbstub_port"}; + BasicSetting program_args{std::string(), "program_args"}; + BasicSetting dump_exefs{false, "dump_exefs"}; + BasicSetting dump_nso{false, "dump_nso"}; + BasicSetting enable_fs_access_log{false, "enable_fs_access_log"}; + BasicSetting reporting_services{false, "reporting_services"}; + BasicSetting quest_flag{false, "quest_flag"}; + BasicSetting disable_macro_jit{false, "disable_macro_jit"}; + BasicSetting extended_logging{false, "extended_logging"}; + BasicSetting use_debug_asserts{false, "use_debug_asserts"}; + BasicSetting use_auto_stub{false, "use_auto_stub"}; // Miscellaneous - std::string log_filter; - bool use_dev_keys; + BasicSetting log_filter{"*:Info", "log_filter"}; + BasicSetting use_dev_keys{false, "use_dev_keys"}; // Services - std::string bcat_backend; - bool bcat_boxcat_local; + BasicSetting bcat_backend{"none", "bcat_backend"}; + BasicSetting bcat_boxcat_local{false, "bcat_boxcat_local"}; // WebService - bool enable_telemetry; - std::string web_api_url; - std::string yuzu_username; - std::string yuzu_token; + BasicSetting enable_telemetry{true, "enable_telemetry"}; + BasicSetting web_api_url{"https://api.yuzu-emu.org", "web_api_url"}; + BasicSetting yuzu_username{std::string(), "yuzu_username"}; + BasicSetting yuzu_token{std::string(), "yuzu_token"}; // Add-Ons std::map> disabled_addons; -- cgit v1.2.3 From cf1cd3321d12ef96062c3b59b98542e3155822d4 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Thu, 1 Jul 2021 12:06:12 -0400 Subject: settings: Set resolution_factor default to 1 Fixes Disgaea 6 Demo issues. --- src/common/settings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common/settings.h') diff --git a/src/common/settings.h b/src/common/settings.h index 13896debf..c799e6243 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -308,7 +308,7 @@ struct Values { BasicSetting renderer_debug{false, "debug"}; Setting vulkan_device{0, "vulkan_device"}; - Setting resolution_factor{0, "resolution_factor"}; + Setting resolution_factor{1, "resolution_factor"}; // *nix platforms may have issues with the borderless windowed fullscreen mode. // Default to exclusive fullscreen on these platforms for now. Setting fullscreen_mode{ -- cgit v1.2.3 From a949ee0410fcce9144806d7b64e9ae4bffd4fee9 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Thu, 8 Jul 2021 14:07:10 -0400 Subject: general: Code formatting improvements Slight improvements to readability. Dropped suggestions for string_view (settings.h:101), pass by value (settings.h:82), reverting double to a float (config.cpp:316), and other smaller ones, some out of scope. Addresses review feedback. Co-authored-by: Ameer J <52414509+ameerj@users.noreply.github.com> --- src/common/settings.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/common/settings.h') diff --git a/src/common/settings.h b/src/common/settings.h index c799e6243..bf83186f5 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -155,8 +155,7 @@ public: /** * Tells this setting to represent either the global or custom setting when other member - * functions are used. Setting to_global to true means using the global setting, to false - * false for the custom setting. + * functions are used. * * @param to_global Whether to use the global or custom setting. */ -- cgit v1.2.3