2022-04-23 22:49:07 +04:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2021-04-15 06:05:28 +04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-08-12 03:07:27 +04:00
|
|
|
#include <algorithm>
|
2021-04-15 06:05:28 +04:00
|
|
|
#include <array>
|
|
|
|
#include <map>
|
|
|
|
#include <optional>
|
|
|
|
#include <string>
|
2021-07-03 13:00:06 +04:00
|
|
|
#include <utility>
|
2021-04-15 06:05:28 +04:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "common/common_types.h"
|
|
|
|
#include "common/settings_input.h"
|
|
|
|
|
|
|
|
namespace Settings {
|
|
|
|
|
|
|
|
enum class RendererBackend : u32 {
|
|
|
|
OpenGL = 0,
|
|
|
|
Vulkan = 1,
|
|
|
|
};
|
|
|
|
|
2021-07-10 01:54:15 +04:00
|
|
|
enum class ShaderBackend : u32 {
|
|
|
|
GLSL = 0,
|
|
|
|
GLASM = 1,
|
|
|
|
SPIRV = 2,
|
|
|
|
};
|
|
|
|
|
2021-04-15 06:05:28 +04:00
|
|
|
enum class GPUAccuracy : u32 {
|
|
|
|
Normal = 0,
|
|
|
|
High = 1,
|
|
|
|
Extreme = 2,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class CPUAccuracy : u32 {
|
2021-07-09 05:27:40 +04:00
|
|
|
Auto = 0,
|
|
|
|
Accurate = 1,
|
|
|
|
Unsafe = 2,
|
2022-04-03 05:41:15 +04:00
|
|
|
Paranoid = 3,
|
2021-04-15 06:05:28 +04:00
|
|
|
};
|
|
|
|
|
2021-07-28 23:57:36 +04:00
|
|
|
enum class FullscreenMode : u32 {
|
|
|
|
Borderless = 0,
|
|
|
|
Exclusive = 1,
|
|
|
|
};
|
|
|
|
|
2021-08-12 03:07:27 +04:00
|
|
|
enum class NvdecEmulation : u32 {
|
|
|
|
Off = 0,
|
|
|
|
CPU = 1,
|
|
|
|
GPU = 2,
|
|
|
|
};
|
|
|
|
|
2021-10-24 08:39:01 +04:00
|
|
|
enum class ResolutionSetup : u32 {
|
|
|
|
Res1_2X = 0,
|
|
|
|
Res3_4X = 1,
|
|
|
|
Res1X = 2,
|
|
|
|
Res2X = 3,
|
|
|
|
Res3X = 4,
|
|
|
|
Res4X = 5,
|
|
|
|
Res5X = 6,
|
|
|
|
Res6X = 7,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class ScalingFilter : u32 {
|
|
|
|
NearestNeighbor = 0,
|
|
|
|
Bilinear = 1,
|
|
|
|
Bicubic = 2,
|
|
|
|
Gaussian = 3,
|
|
|
|
ScaleForce = 4,
|
|
|
|
Fsr = 5,
|
|
|
|
LastFilter = Fsr,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class AntiAliasing : u32 {
|
|
|
|
None = 0,
|
|
|
|
Fxaa = 1,
|
|
|
|
LastAA = Fxaa,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ResolutionScalingInfo {
|
|
|
|
u32 up_scale{1};
|
|
|
|
u32 down_shift{0};
|
|
|
|
f32 up_factor{1.0f};
|
|
|
|
f32 down_factor{1.0f};
|
|
|
|
bool active{};
|
|
|
|
bool downscale{};
|
|
|
|
|
|
|
|
s32 ScaleUp(s32 value) const {
|
|
|
|
if (value == 0) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return std::max((value * static_cast<s32>(up_scale)) >> static_cast<s32>(down_shift), 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 ScaleUp(u32 value) const {
|
|
|
|
if (value == 0U) {
|
|
|
|
return 0U;
|
|
|
|
}
|
|
|
|
return std::max((value * up_scale) >> down_shift, 1U);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-07-03 13:00:06 +04:00
|
|
|
/** 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 <typename Type>
|
|
|
|
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:
|
|
|
|
/**
|
|
|
|
* 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} {}
|
2021-08-12 03:07:27 +04:00
|
|
|
virtual ~BasicSetting() = default;
|
2021-07-03 13:00:06 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a reference to the setting's value.
|
|
|
|
*
|
|
|
|
* @returns A reference to the setting
|
|
|
|
*/
|
2021-08-12 03:07:27 +04:00
|
|
|
[[nodiscard]] virtual const Type& GetValue() const {
|
2021-07-03 13:00:06 +04:00
|
|
|
return global;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the setting to the given value.
|
|
|
|
*
|
|
|
|
* @param value The desired value
|
|
|
|
*/
|
2021-08-12 03:07:27 +04:00
|
|
|
virtual void SetValue(const Type& value) {
|
2021-07-03 13:00:06 +04:00
|
|
|
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
|
|
|
|
*/
|
2021-08-12 03:07:27 +04:00
|
|
|
virtual const Type& operator=(const Type& value) {
|
2021-07-03 13:00:06 +04:00
|
|
|
Type temp{value};
|
|
|
|
std::swap(global, temp);
|
|
|
|
return global;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a reference to the setting.
|
|
|
|
*
|
|
|
|
* @returns A reference to the setting
|
|
|
|
*/
|
2021-08-12 03:07:27 +04:00
|
|
|
explicit virtual operator const Type&() const {
|
2021-07-03 13:00:06 +04:00
|
|
|
return global;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
const Type default_value{}; ///< The default value
|
|
|
|
Type global{}; ///< The setting
|
|
|
|
const std::string label{}; ///< The setting's label
|
|
|
|
};
|
|
|
|
|
2021-08-12 03:07:27 +04:00
|
|
|
/**
|
|
|
|
* BasicRangedSetting class is intended for use with quantifiable settings that need a more
|
|
|
|
* restrictive range than implicitly defined by its type. Implements a minimum and maximum that is
|
|
|
|
* simply used to sanitize SetValue and the assignment overload.
|
|
|
|
*/
|
|
|
|
template <typename Type>
|
|
|
|
class BasicRangedSetting : virtual public BasicSetting<Type> {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Sets a default value, minimum value, maximum value, and label.
|
|
|
|
*
|
|
|
|
* @param default_val Intial value of the setting, and default value of the setting
|
|
|
|
* @param min_val Sets the minimum allowed value of the setting
|
|
|
|
* @param max_val Sets the maximum allowed value of the setting
|
|
|
|
* @param name Label for the setting
|
|
|
|
*/
|
|
|
|
explicit BasicRangedSetting(const Type& default_val, const Type& min_val, const Type& max_val,
|
|
|
|
const std::string& name)
|
|
|
|
: BasicSetting<Type>{default_val, name}, minimum{min_val}, maximum{max_val} {}
|
|
|
|
virtual ~BasicRangedSetting() = default;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Like BasicSetting's SetValue, except value is clamped to the range of the setting.
|
|
|
|
*
|
|
|
|
* @param value The desired value
|
|
|
|
*/
|
|
|
|
void SetValue(const Type& value) override {
|
|
|
|
this->global = std::clamp(value, minimum, maximum);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Like BasicSetting's assignment overload, except value is clamped to the range of the setting.
|
|
|
|
*
|
|
|
|
* @param value The desired value
|
|
|
|
* @returns A reference to the setting's value
|
|
|
|
*/
|
|
|
|
const Type& operator=(const Type& value) override {
|
|
|
|
this->global = std::clamp(value, minimum, maximum);
|
|
|
|
return this->global;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Type minimum; ///< Minimum allowed value of the setting
|
|
|
|
const Type maximum; ///< Maximum allowed value of the setting
|
|
|
|
};
|
|
|
|
|
2021-07-03 13:00:06 +04:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2021-04-15 06:05:28 +04:00
|
|
|
template <typename Type>
|
2021-08-12 03:07:27 +04:00
|
|
|
class Setting : virtual public BasicSetting<Type> {
|
2021-04-15 06:05:28 +04:00
|
|
|
public:
|
2021-07-03 13:00:06 +04:00
|
|
|
/**
|
|
|
|
* 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<Type>(default_val, name) {}
|
2021-08-12 03:07:27 +04:00
|
|
|
virtual ~Setting() = default;
|
2021-07-03 13:00:06 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Tells this setting to represent either the global or custom setting when other member
|
2021-07-09 00:42:51 +04:00
|
|
|
* functions are used.
|
2021-07-03 13:00:06 +04:00
|
|
|
*
|
|
|
|
* @param to_global Whether to use the global or custom setting.
|
|
|
|
*/
|
2021-04-15 06:05:28 +04:00
|
|
|
void SetGlobal(bool to_global) {
|
|
|
|
use_global = to_global;
|
|
|
|
}
|
2021-07-03 13:00:06 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether this setting is using the global setting or not.
|
|
|
|
*
|
|
|
|
* @returns The global state
|
|
|
|
*/
|
|
|
|
[[nodiscard]] bool UsingGlobal() const {
|
2021-04-15 06:05:28 +04:00
|
|
|
return use_global;
|
|
|
|
}
|
2021-07-03 13:00:06 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2021-08-12 03:07:27 +04:00
|
|
|
[[nodiscard]] virtual const Type& GetValue() const override {
|
|
|
|
if (use_global) {
|
|
|
|
return this->global;
|
|
|
|
}
|
|
|
|
return custom;
|
|
|
|
}
|
|
|
|
[[nodiscard]] virtual const Type& GetValue(bool need_global) const {
|
2021-04-15 06:05:28 +04:00
|
|
|
if (use_global || need_global) {
|
2021-07-03 13:00:06 +04:00
|
|
|
return this->global;
|
2021-04-15 06:05:28 +04:00
|
|
|
}
|
2021-07-03 13:00:06 +04:00
|
|
|
return custom;
|
2021-04-15 06:05:28 +04:00
|
|
|
}
|
2021-07-03 13:00:06 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the current setting value depending on the global state.
|
|
|
|
*
|
|
|
|
* @param value The new value
|
|
|
|
*/
|
2021-08-12 03:07:27 +04:00
|
|
|
void SetValue(const Type& value) override {
|
2021-07-03 13:00:06 +04:00
|
|
|
Type temp{value};
|
2021-04-15 06:05:28 +04:00
|
|
|
if (use_global) {
|
2021-07-03 13:00:06 +04:00
|
|
|
std::swap(this->global, temp);
|
2021-04-15 06:05:28 +04:00
|
|
|
} else {
|
2021-07-03 13:00:06 +04:00
|
|
|
std::swap(custom, temp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Assigns the current setting value depending on the global state.
|
|
|
|
*
|
|
|
|
* @param value The new value
|
|
|
|
*
|
|
|
|
* @returns A reference to the current setting value
|
|
|
|
*/
|
2021-08-12 03:07:27 +04:00
|
|
|
const Type& operator=(const Type& value) override {
|
2021-07-03 13:00:06 +04:00
|
|
|
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
|
|
|
|
*/
|
2021-08-12 03:07:27 +04:00
|
|
|
virtual explicit operator const Type&() const override {
|
2021-07-03 13:00:06 +04:00
|
|
|
if (use_global) {
|
|
|
|
return this->global;
|
2021-04-15 06:05:28 +04:00
|
|
|
}
|
2021-07-03 13:00:06 +04:00
|
|
|
return custom;
|
2021-04-15 06:05:28 +04:00
|
|
|
}
|
|
|
|
|
2021-08-12 03:07:27 +04:00
|
|
|
protected:
|
2021-07-03 13:00:06 +04:00
|
|
|
bool use_global{true}; ///< The setting's global state
|
|
|
|
Type custom{}; ///< The custom value of the setting
|
2021-04-15 06:05:28 +04:00
|
|
|
};
|
|
|
|
|
2021-08-12 03:07:27 +04:00
|
|
|
/**
|
|
|
|
* RangedSetting is a Setting that implements a maximum and minimum value for its setting. Intended
|
|
|
|
* for use with quantifiable settings.
|
|
|
|
*/
|
|
|
|
template <typename Type>
|
|
|
|
class RangedSetting final : public BasicRangedSetting<Type>, public Setting<Type> {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Sets a default value, minimum value, maximum value, and label.
|
|
|
|
*
|
|
|
|
* @param default_val Intial value of the setting, and default value of the setting
|
|
|
|
* @param min_val Sets the minimum allowed value of the setting
|
|
|
|
* @param max_val Sets the maximum allowed value of the setting
|
|
|
|
* @param name Label for the setting
|
|
|
|
*/
|
|
|
|
explicit RangedSetting(const Type& default_val, const Type& min_val, const Type& max_val,
|
|
|
|
const std::string& name)
|
|
|
|
: BasicSetting<Type>{default_val, name},
|
|
|
|
BasicRangedSetting<Type>{default_val, min_val, max_val, name}, Setting<Type>{default_val,
|
|
|
|
name} {}
|
|
|
|
virtual ~RangedSetting() = default;
|
|
|
|
|
|
|
|
// The following are needed to avoid a MSVC bug
|
|
|
|
// (source: https://stackoverflow.com/questions/469508)
|
|
|
|
[[nodiscard]] const Type& GetValue() const override {
|
|
|
|
return Setting<Type>::GetValue();
|
|
|
|
}
|
|
|
|
[[nodiscard]] const Type& GetValue(bool need_global) const override {
|
|
|
|
return Setting<Type>::GetValue(need_global);
|
|
|
|
}
|
|
|
|
explicit operator const Type&() const override {
|
|
|
|
if (this->use_global) {
|
|
|
|
return this->global;
|
|
|
|
}
|
|
|
|
return this->custom;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Like BasicSetting's SetValue, except value is clamped to the range of the setting. Sets the
|
|
|
|
* appropriate value depending on the global state.
|
|
|
|
*
|
|
|
|
* @param value The desired value
|
|
|
|
*/
|
|
|
|
void SetValue(const Type& value) override {
|
|
|
|
const Type temp = std::clamp(value, this->minimum, this->maximum);
|
|
|
|
if (this->use_global) {
|
|
|
|
this->global = temp;
|
|
|
|
}
|
|
|
|
this->custom = temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Like BasicSetting's assignment overload, except value is clamped to the range of the setting.
|
|
|
|
* Uses the appropriate value depending on the global state.
|
|
|
|
*
|
|
|
|
* @param value The desired value
|
|
|
|
* @returns A reference to the setting's value
|
|
|
|
*/
|
|
|
|
const Type& operator=(const Type& value) override {
|
|
|
|
const Type temp = std::clamp(value, this->minimum, this->maximum);
|
|
|
|
if (this->use_global) {
|
|
|
|
this->global = temp;
|
|
|
|
return this->global;
|
|
|
|
}
|
|
|
|
this->custom = temp;
|
|
|
|
return this->custom;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-04-15 06:05:28 +04:00
|
|
|
/**
|
2021-07-03 13:00:06 +04:00
|
|
|
* The InputSetting class allows for getting a reference to either the global or custom members.
|
2021-04-15 06:05:28 +04:00
|
|
|
* 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
|
2021-07-03 13:00:06 +04:00
|
|
|
* 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.
|
2021-04-15 06:05:28 +04:00
|
|
|
*/
|
|
|
|
template <typename Type>
|
|
|
|
class InputSetting final {
|
|
|
|
public:
|
|
|
|
InputSetting() = default;
|
2021-07-03 13:00:06 +04:00
|
|
|
explicit InputSetting(Type val) : BasicSetting<Type>(val) {}
|
2021-04-15 06:05:28 +04:00
|
|
|
~InputSetting() = default;
|
|
|
|
void SetGlobal(bool to_global) {
|
|
|
|
use_global = to_global;
|
|
|
|
}
|
2021-07-03 13:00:06 +04:00
|
|
|
[[nodiscard]] bool UsingGlobal() const {
|
2021-04-15 06:05:28 +04:00
|
|
|
return use_global;
|
|
|
|
}
|
2021-07-03 13:00:06 +04:00
|
|
|
[[nodiscard]] Type& GetValue(bool need_global = false) {
|
2021-04-15 06:05:28 +04:00
|
|
|
if (use_global || need_global) {
|
|
|
|
return global;
|
|
|
|
}
|
2021-07-03 13:00:06 +04:00
|
|
|
return custom;
|
2021-04-15 06:05:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2021-07-03 13:00:06 +04:00
|
|
|
bool use_global{true}; ///< The setting's global state
|
|
|
|
Type global{}; ///< The setting
|
|
|
|
Type custom{}; ///< The custom setting value
|
2021-04-15 06:05:28 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct TouchFromButtonMap {
|
|
|
|
std::string name;
|
|
|
|
std::vector<std::string> buttons;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Values {
|
|
|
|
// Audio
|
2021-07-03 13:00:06 +04:00
|
|
|
BasicSetting<std::string> audio_device_id{"auto", "output_device"};
|
|
|
|
BasicSetting<std::string> sink_id{"auto", "output_engine"};
|
|
|
|
BasicSetting<bool> audio_muted{false, "audio_muted"};
|
2021-08-12 03:07:27 +04:00
|
|
|
RangedSetting<u8> volume{100, 0, 100, "volume"};
|
2021-04-15 06:05:28 +04:00
|
|
|
|
|
|
|
// Core
|
2021-07-03 13:00:06 +04:00
|
|
|
Setting<bool> use_multi_core{true, "use_multi_core"};
|
2022-02-22 03:50:44 +04:00
|
|
|
Setting<bool> use_extended_memory_layout{false, "use_extended_memory_layout"};
|
2021-04-15 06:05:28 +04:00
|
|
|
|
|
|
|
// Cpu
|
2021-08-12 03:07:27 +04:00
|
|
|
RangedSetting<CPUAccuracy> cpu_accuracy{CPUAccuracy::Auto, CPUAccuracy::Auto,
|
2022-04-03 05:41:15 +04:00
|
|
|
CPUAccuracy::Paranoid, "cpu_accuracy"};
|
2021-07-09 05:27:40 +04:00
|
|
|
// TODO: remove cpu_accuracy_first_time, migration setting added 8 July 2021
|
|
|
|
BasicSetting<bool> cpu_accuracy_first_time{true, "cpu_accuracy_first_time"};
|
|
|
|
BasicSetting<bool> cpu_debug_mode{false, "cpu_debug_mode"};
|
2021-07-03 13:00:06 +04:00
|
|
|
|
|
|
|
BasicSetting<bool> cpuopt_page_tables{true, "cpuopt_page_tables"};
|
|
|
|
BasicSetting<bool> cpuopt_block_linking{true, "cpuopt_block_linking"};
|
|
|
|
BasicSetting<bool> cpuopt_return_stack_buffer{true, "cpuopt_return_stack_buffer"};
|
|
|
|
BasicSetting<bool> cpuopt_fast_dispatcher{true, "cpuopt_fast_dispatcher"};
|
|
|
|
BasicSetting<bool> cpuopt_context_elimination{true, "cpuopt_context_elimination"};
|
|
|
|
BasicSetting<bool> cpuopt_const_prop{true, "cpuopt_const_prop"};
|
|
|
|
BasicSetting<bool> cpuopt_misc_ir{true, "cpuopt_misc_ir"};
|
|
|
|
BasicSetting<bool> cpuopt_reduce_misalign_checks{true, "cpuopt_reduce_misalign_checks"};
|
|
|
|
BasicSetting<bool> cpuopt_fastmem{true, "cpuopt_fastmem"};
|
2022-02-28 02:27:57 +04:00
|
|
|
BasicSetting<bool> cpuopt_fastmem_exclusives{true, "cpuopt_fastmem_exclusives"};
|
|
|
|
BasicSetting<bool> cpuopt_recompile_exclusives{true, "cpuopt_recompile_exclusives"};
|
2021-07-03 13:00:06 +04:00
|
|
|
|
|
|
|
Setting<bool> cpuopt_unsafe_unfuse_fma{true, "cpuopt_unsafe_unfuse_fma"};
|
|
|
|
Setting<bool> cpuopt_unsafe_reduce_fp_error{true, "cpuopt_unsafe_reduce_fp_error"};
|
|
|
|
Setting<bool> cpuopt_unsafe_ignore_standard_fpcr{true, "cpuopt_unsafe_ignore_standard_fpcr"};
|
|
|
|
Setting<bool> cpuopt_unsafe_inaccurate_nan{true, "cpuopt_unsafe_inaccurate_nan"};
|
|
|
|
Setting<bool> cpuopt_unsafe_fastmem_check{true, "cpuopt_unsafe_fastmem_check"};
|
2022-02-28 02:27:57 +04:00
|
|
|
Setting<bool> cpuopt_unsafe_ignore_global_monitor{true, "cpuopt_unsafe_ignore_global_monitor"};
|
2021-04-15 06:05:28 +04:00
|
|
|
|
|
|
|
// Renderer
|
2021-08-12 03:07:27 +04:00
|
|
|
RangedSetting<RendererBackend> renderer_backend{
|
2022-05-30 22:36:13 +04:00
|
|
|
RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Vulkan, "backend"};
|
2021-07-03 13:00:06 +04:00
|
|
|
BasicSetting<bool> renderer_debug{false, "debug"};
|
2021-07-30 23:16:07 +04:00
|
|
|
BasicSetting<bool> renderer_shader_feedback{false, "shader_feedback"};
|
2021-07-10 01:54:15 +04:00
|
|
|
BasicSetting<bool> enable_nsight_aftermath{false, "nsight_aftermath"};
|
|
|
|
BasicSetting<bool> disable_shader_loop_safety_checks{false,
|
|
|
|
"disable_shader_loop_safety_checks"};
|
2021-07-03 13:00:06 +04:00
|
|
|
Setting<int> vulkan_device{0, "vulkan_device"};
|
|
|
|
|
2021-10-24 08:39:01 +04:00
|
|
|
ResolutionScalingInfo resolution_info{};
|
|
|
|
Setting<ResolutionSetup> resolution_setup{ResolutionSetup::Res1X, "resolution_setup"};
|
|
|
|
Setting<ScalingFilter> scaling_filter{ScalingFilter::Bilinear, "scaling_filter"};
|
|
|
|
Setting<AntiAliasing> anti_aliasing{AntiAliasing::None, "anti_aliasing"};
|
2021-07-03 13:00:06 +04:00
|
|
|
// *nix platforms may have issues with the borderless windowed fullscreen mode.
|
|
|
|
// Default to exclusive fullscreen on these platforms for now.
|
2021-08-12 03:07:27 +04:00
|
|
|
RangedSetting<FullscreenMode> fullscreen_mode{
|
2021-07-03 13:00:06 +04:00
|
|
|
#ifdef _WIN32
|
2021-07-28 23:57:36 +04:00
|
|
|
FullscreenMode::Borderless,
|
2021-07-03 13:00:06 +04:00
|
|
|
#else
|
2021-07-28 23:57:36 +04:00
|
|
|
FullscreenMode::Exclusive,
|
2021-07-03 13:00:06 +04:00
|
|
|
#endif
|
2021-08-12 03:07:27 +04:00
|
|
|
FullscreenMode::Borderless, FullscreenMode::Exclusive, "fullscreen_mode"};
|
|
|
|
RangedSetting<int> aspect_ratio{0, 0, 3, "aspect_ratio"};
|
2021-11-17 05:40:33 +04:00
|
|
|
RangedSetting<int> max_anisotropy{0, 0, 5, "max_anisotropy"};
|
2021-07-27 07:04:12 +04:00
|
|
|
Setting<bool> use_speed_limit{true, "use_speed_limit"};
|
2021-08-12 03:07:27 +04:00
|
|
|
RangedSetting<u16> speed_limit{100, 0, 9999, "speed_limit"};
|
2021-07-03 13:00:06 +04:00
|
|
|
Setting<bool> use_disk_shader_cache{true, "use_disk_shader_cache"};
|
2021-08-12 03:07:27 +04:00
|
|
|
RangedSetting<GPUAccuracy> gpu_accuracy{GPUAccuracy::High, GPUAccuracy::Normal,
|
|
|
|
GPUAccuracy::Extreme, "gpu_accuracy"};
|
2021-07-03 13:00:06 +04:00
|
|
|
Setting<bool> use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"};
|
2021-08-12 03:07:27 +04:00
|
|
|
Setting<NvdecEmulation> nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"};
|
2021-07-03 13:00:06 +04:00
|
|
|
Setting<bool> accelerate_astc{true, "accelerate_astc"};
|
|
|
|
Setting<bool> use_vsync{true, "use_vsync"};
|
2021-11-24 15:36:46 +04:00
|
|
|
RangedSetting<u16> fps_cap{1000, 1, 1000, "fps_cap"};
|
2021-07-12 00:43:19 +04:00
|
|
|
BasicSetting<bool> disable_fps_limit{false, "disable_fps_limit"};
|
2021-08-12 03:07:27 +04:00
|
|
|
RangedSetting<ShaderBackend> shader_backend{ShaderBackend::GLASM, ShaderBackend::GLSL,
|
|
|
|
ShaderBackend::SPIRV, "shader_backend"};
|
2021-07-03 13:00:06 +04:00
|
|
|
Setting<bool> use_asynchronous_shaders{false, "use_asynchronous_shaders"};
|
|
|
|
Setting<bool> use_fast_gpu_time{true, "use_fast_gpu_time"};
|
|
|
|
|
2021-07-17 00:17:21 +04:00
|
|
|
Setting<u8> bg_red{0, "bg_red"};
|
|
|
|
Setting<u8> bg_green{0, "bg_green"};
|
|
|
|
Setting<u8> bg_blue{0, "bg_blue"};
|
2021-04-15 06:05:28 +04:00
|
|
|
|
|
|
|
// System
|
2021-07-03 13:00:06 +04:00
|
|
|
Setting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"};
|
2021-04-15 06:05:28 +04:00
|
|
|
// Measured in seconds since epoch
|
2021-10-17 10:30:38 +04:00
|
|
|
std::optional<s64> custom_rtc;
|
2021-04-15 06:05:28 +04:00
|
|
|
// Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc`
|
2021-10-17 10:30:38 +04:00
|
|
|
s64 custom_rtc_differential;
|
2021-04-15 06:05:28 +04:00
|
|
|
|
2021-07-03 13:00:06 +04:00
|
|
|
BasicSetting<s32> current_user{0, "current_user"};
|
2021-08-22 00:39:45 +04:00
|
|
|
RangedSetting<s32> language_index{1, 0, 17, "language_index"};
|
2021-08-12 03:07:27 +04:00
|
|
|
RangedSetting<s32> region_index{1, 0, 6, "region_index"};
|
|
|
|
RangedSetting<s32> time_zone_index{0, 0, 45, "time_zone_index"};
|
|
|
|
RangedSetting<s32> sound_index{1, 0, 2, "sound_index"};
|
2021-04-15 06:05:28 +04:00
|
|
|
|
|
|
|
// Controls
|
|
|
|
InputSetting<std::array<PlayerInput, 10>> players;
|
|
|
|
|
2021-07-03 13:00:06 +04:00
|
|
|
Setting<bool> use_docked_mode{true, "use_docked_mode"};
|
2021-04-15 06:05:28 +04:00
|
|
|
|
2021-09-08 09:37:31 +04:00
|
|
|
BasicSetting<bool> enable_raw_input{false, "enable_raw_input"};
|
2022-01-27 06:52:17 +04:00
|
|
|
BasicSetting<bool> controller_navigation{true, "controller_navigation"};
|
2021-09-08 09:37:31 +04:00
|
|
|
|
2021-07-03 13:00:06 +04:00
|
|
|
Setting<bool> vibration_enabled{true, "vibration_enabled"};
|
|
|
|
Setting<bool> enable_accurate_vibrations{false, "enable_accurate_vibrations"};
|
2021-04-15 06:05:28 +04:00
|
|
|
|
2021-07-03 13:00:06 +04:00
|
|
|
Setting<bool> motion_enabled{true, "motion_enabled"};
|
2021-09-08 09:37:31 +04:00
|
|
|
BasicSetting<std::string> udp_input_servers{"127.0.0.1:26760", "udp_input_servers"};
|
2021-11-27 03:35:19 +04:00
|
|
|
BasicSetting<bool> enable_udp_controller{false, "enable_udp_controller"};
|
2021-04-15 06:05:28 +04:00
|
|
|
|
2021-07-26 05:00:19 +04:00
|
|
|
BasicSetting<bool> pause_tas_on_load{true, "pause_tas_on_load"};
|
|
|
|
BasicSetting<bool> tas_enable{false, "tas_enable"};
|
|
|
|
BasicSetting<bool> tas_loop{false, "tas_loop"};
|
|
|
|
|
2021-07-03 13:00:06 +04:00
|
|
|
BasicSetting<bool> mouse_panning{false, "mouse_panning"};
|
2021-08-12 03:07:27 +04:00
|
|
|
BasicRangedSetting<u8> mouse_panning_sensitivity{10, 1, 100, "mouse_panning_sensitivity"};
|
2021-07-03 13:00:06 +04:00
|
|
|
BasicSetting<bool> mouse_enabled{false, "mouse_enabled"};
|
2021-04-15 06:05:28 +04:00
|
|
|
|
2021-07-03 13:00:06 +04:00
|
|
|
BasicSetting<bool> emulate_analog_keyboard{false, "emulate_analog_keyboard"};
|
|
|
|
BasicSetting<bool> keyboard_enabled{false, "keyboard_enabled"};
|
2021-04-15 06:05:28 +04:00
|
|
|
|
2021-07-03 13:00:06 +04:00
|
|
|
BasicSetting<bool> debug_pad_enabled{false, "debug_pad_enabled"};
|
2021-04-15 06:05:28 +04:00
|
|
|
ButtonsRaw debug_pad_buttons;
|
|
|
|
AnalogsRaw debug_pad_analogs;
|
|
|
|
|
|
|
|
TouchscreenInput touchscreen;
|
|
|
|
|
2021-07-03 13:00:06 +04:00
|
|
|
BasicSetting<std::string> touch_device{"min_x:100,min_y:50,max_x:1800,max_y:850",
|
|
|
|
"touch_device"};
|
|
|
|
BasicSetting<int> touch_from_button_map_index{0, "touch_from_button_map"};
|
2021-04-15 06:05:28 +04:00
|
|
|
std::vector<TouchFromButtonMap> touch_from_button_maps;
|
|
|
|
|
2022-04-16 18:44:44 +04:00
|
|
|
BasicSetting<bool> enable_ring_controller{true, "enable_ring_controller"};
|
|
|
|
RingconRaw ringcon_analogs;
|
|
|
|
|
2021-04-15 06:05:28 +04:00
|
|
|
// Data Storage
|
2021-07-03 13:00:06 +04:00
|
|
|
BasicSetting<bool> use_virtual_sd{true, "use_virtual_sd"};
|
|
|
|
BasicSetting<bool> gamecard_inserted{false, "gamecard_inserted"};
|
|
|
|
BasicSetting<bool> gamecard_current_game{false, "gamecard_current_game"};
|
|
|
|
BasicSetting<std::string> gamecard_path{std::string(), "gamecard_path"};
|
2021-04-15 06:05:28 +04:00
|
|
|
|
|
|
|
// Debugging
|
|
|
|
bool record_frame_times;
|
2021-07-03 13:00:06 +04:00
|
|
|
BasicSetting<bool> use_gdbstub{false, "use_gdbstub"};
|
|
|
|
BasicSetting<u16> gdbstub_port{0, "gdbstub_port"};
|
|
|
|
BasicSetting<std::string> program_args{std::string(), "program_args"};
|
|
|
|
BasicSetting<bool> dump_exefs{false, "dump_exefs"};
|
|
|
|
BasicSetting<bool> dump_nso{false, "dump_nso"};
|
2021-11-17 08:15:54 +04:00
|
|
|
BasicSetting<bool> dump_shaders{false, "dump_shaders"};
|
2022-05-09 08:18:26 +04:00
|
|
|
BasicSetting<bool> dump_macros{false, "dump_macros"};
|
2021-07-03 13:00:06 +04:00
|
|
|
BasicSetting<bool> enable_fs_access_log{false, "enable_fs_access_log"};
|
|
|
|
BasicSetting<bool> reporting_services{false, "reporting_services"};
|
|
|
|
BasicSetting<bool> quest_flag{false, "quest_flag"};
|
|
|
|
BasicSetting<bool> disable_macro_jit{false, "disable_macro_jit"};
|
|
|
|
BasicSetting<bool> extended_logging{false, "extended_logging"};
|
|
|
|
BasicSetting<bool> use_debug_asserts{false, "use_debug_asserts"};
|
|
|
|
BasicSetting<bool> use_auto_stub{false, "use_auto_stub"};
|
2021-11-28 14:31:20 +04:00
|
|
|
BasicSetting<bool> enable_all_controllers{false, "enable_all_controllers"};
|
2021-04-15 06:05:28 +04:00
|
|
|
|
|
|
|
// Miscellaneous
|
2021-07-03 13:00:06 +04:00
|
|
|
BasicSetting<std::string> log_filter{"*:Info", "log_filter"};
|
|
|
|
BasicSetting<bool> use_dev_keys{false, "use_dev_keys"};
|
2021-04-15 06:05:28 +04:00
|
|
|
|
2021-08-13 09:06:50 +04:00
|
|
|
// Network
|
|
|
|
BasicSetting<std::string> network_interface{std::string(), "network_interface"};
|
2021-04-15 06:05:28 +04:00
|
|
|
|
|
|
|
// WebService
|
2021-07-03 13:00:06 +04:00
|
|
|
BasicSetting<bool> enable_telemetry{true, "enable_telemetry"};
|
|
|
|
BasicSetting<std::string> web_api_url{"https://api.yuzu-emu.org", "web_api_url"};
|
|
|
|
BasicSetting<std::string> yuzu_username{std::string(), "yuzu_username"};
|
|
|
|
BasicSetting<std::string> yuzu_token{std::string(), "yuzu_token"};
|
2021-04-15 06:05:28 +04:00
|
|
|
|
|
|
|
// Add-Ons
|
|
|
|
std::map<u64, std::vector<std::string>> disabled_addons;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern Values values;
|
|
|
|
|
|
|
|
bool IsConfiguringGlobal();
|
|
|
|
void SetConfiguringGlobal(bool is_global);
|
|
|
|
|
|
|
|
bool IsGPULevelExtreme();
|
|
|
|
bool IsGPULevelHigh();
|
|
|
|
|
2021-06-07 05:57:28 +04:00
|
|
|
bool IsFastmemEnabled();
|
|
|
|
|
2021-04-15 06:05:28 +04:00
|
|
|
float Volume();
|
|
|
|
|
|
|
|
std::string GetTimeZoneString();
|
|
|
|
|
|
|
|
void LogSettings();
|
|
|
|
|
2021-10-24 08:39:01 +04:00
|
|
|
void UpdateRescalingInfo();
|
|
|
|
|
2021-04-15 06:05:28 +04:00
|
|
|
// Restore the global state of all applicable settings in the Values struct
|
|
|
|
void RestoreGlobalState(bool is_powered_on);
|
|
|
|
|
|
|
|
} // namespace Settings
|