diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/settings_enums.h | 500 |
1 files changed, 149 insertions, 351 deletions
diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h index f3d76b927..71515257a 100644 --- a/src/common/settings_enums.h +++ b/src/common/settings_enums.h | |||
| @@ -3,15 +3,72 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <map> | ||
| 7 | #include <string> | 6 | #include <string> |
| 8 | #include <type_traits> | 7 | #include <utility> |
| 9 | #include <typeindex> | 8 | #include <vector> |
| 10 | #include <typeinfo> | ||
| 11 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 12 | 10 | ||
| 13 | namespace Settings { | 11 | namespace Settings { |
| 14 | 12 | ||
| 13 | template <typename T> | ||
| 14 | struct Canonicalization { | ||
| 15 | static constexpr std::vector<std::pair<std::string, u32>> Get(); | ||
| 16 | }; | ||
| 17 | |||
| 18 | #define PAIR_45(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_46(N, __VA_ARGS__)) | ||
| 19 | #define PAIR_44(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_45(N, __VA_ARGS__)) | ||
| 20 | #define PAIR_43(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_44(N, __VA_ARGS__)) | ||
| 21 | #define PAIR_42(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_43(N, __VA_ARGS__)) | ||
| 22 | #define PAIR_41(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_42(N, __VA_ARGS__)) | ||
| 23 | #define PAIR_40(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_41(N, __VA_ARGS__)) | ||
| 24 | #define PAIR_39(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_40(N, __VA_ARGS__)) | ||
| 25 | #define PAIR_38(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_39(N, __VA_ARGS__)) | ||
| 26 | #define PAIR_37(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_38(N, __VA_ARGS__)) | ||
| 27 | #define PAIR_36(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_37(N, __VA_ARGS__)) | ||
| 28 | #define PAIR_35(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_36(N, __VA_ARGS__)) | ||
| 29 | #define PAIR_34(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_35(N, __VA_ARGS__)) | ||
| 30 | #define PAIR_33(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_34(N, __VA_ARGS__)) | ||
| 31 | #define PAIR_32(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_33(N, __VA_ARGS__)) | ||
| 32 | #define PAIR_31(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_32(N, __VA_ARGS__)) | ||
| 33 | #define PAIR_30(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_31(N, __VA_ARGS__)) | ||
| 34 | #define PAIR_29(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_30(N, __VA_ARGS__)) | ||
| 35 | #define PAIR_28(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_29(N, __VA_ARGS__)) | ||
| 36 | #define PAIR_27(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_28(N, __VA_ARGS__)) | ||
| 37 | #define PAIR_26(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_27(N, __VA_ARGS__)) | ||
| 38 | #define PAIR_25(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_26(N, __VA_ARGS__)) | ||
| 39 | #define PAIR_24(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_25(N, __VA_ARGS__)) | ||
| 40 | #define PAIR_23(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_24(N, __VA_ARGS__)) | ||
| 41 | #define PAIR_22(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_23(N, __VA_ARGS__)) | ||
| 42 | #define PAIR_21(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_22(N, __VA_ARGS__)) | ||
| 43 | #define PAIR_20(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_21(N, __VA_ARGS__)) | ||
| 44 | #define PAIR_19(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_20(N, __VA_ARGS__)) | ||
| 45 | #define PAIR_18(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_19(N, __VA_ARGS__)) | ||
| 46 | #define PAIR_17(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_18(N, __VA_ARGS__)) | ||
| 47 | #define PAIR_16(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_17(N, __VA_ARGS__)) | ||
| 48 | #define PAIR_15(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_16(N, __VA_ARGS__)) | ||
| 49 | #define PAIR_14(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_15(N, __VA_ARGS__)) | ||
| 50 | #define PAIR_13(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_14(N, __VA_ARGS__)) | ||
| 51 | #define PAIR_12(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_13(N, __VA_ARGS__)) | ||
| 52 | #define PAIR_11(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_12(N, __VA_ARGS__)) | ||
| 53 | #define PAIR_10(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_11(N, __VA_ARGS__)) | ||
| 54 | #define PAIR_9(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_10(N, __VA_ARGS__)) | ||
| 55 | #define PAIR_8(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_9(N, __VA_ARGS__)) | ||
| 56 | #define PAIR_7(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_8(N, __VA_ARGS__)) | ||
| 57 | #define PAIR_6(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_7(N, __VA_ARGS__)) | ||
| 58 | #define PAIR_5(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_6(N, __VA_ARGS__)) | ||
| 59 | #define PAIR_4(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_5(N, __VA_ARGS__)) | ||
| 60 | #define PAIR_3(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_4(N, __VA_ARGS__)) | ||
| 61 | #define PAIR_2(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_3(N, __VA_ARGS__)) | ||
| 62 | #define PAIR_1(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_2(N, __VA_ARGS__)) | ||
| 63 | #define PAIR(N, X, ...) {#X, static_cast<u32>(N::X)} __VA_OPT__(, PAIR_1(N, __VA_ARGS__)) | ||
| 64 | |||
| 65 | #define ENUM(NAME, ...) \ | ||
| 66 | enum class NAME : u32 { __VA_ARGS__ }; \ | ||
| 67 | template <> \ | ||
| 68 | constexpr std::vector<std::pair<std::string, u32>> Canonicalization<NAME>::Get() { \ | ||
| 69 | return {PAIR(NAME, __VA_ARGS__)}; \ | ||
| 70 | } | ||
| 71 | |||
| 15 | enum class AudioEngine : u32 { | 72 | enum class AudioEngine : u32 { |
| 16 | Auto, | 73 | Auto, |
| 17 | Cubeb, | 74 | Cubeb, |
| @@ -19,380 +76,121 @@ enum class AudioEngine : u32 { | |||
| 19 | Null, | 76 | Null, |
| 20 | }; | 77 | }; |
| 21 | 78 | ||
| 22 | enum class AudioMode : u32 { | 79 | template <> |
| 23 | Mono, | 80 | constexpr std::vector<std::pair<std::string, u32>> Canonicalization<AudioEngine>::Get() { |
| 24 | Stereo, | 81 | return { |
| 25 | Surround, | 82 | {"auto", static_cast<u32>(AudioEngine::Auto)}, |
| 26 | }; | 83 | {"cubeb", static_cast<u32>(AudioEngine::Cubeb)}, |
| 84 | {"sdl2", static_cast<u32>(AudioEngine::Sdl2)}, | ||
| 85 | {"null", static_cast<u32>(AudioEngine::Null)}, | ||
| 86 | }; | ||
| 87 | } | ||
| 27 | 88 | ||
| 28 | enum class Language : u32 { | 89 | ENUM(AudioMode, Mono, Stereo, Surround); |
| 29 | Japanese, | ||
| 30 | EnglishAmerican, | ||
| 31 | French, | ||
| 32 | German, | ||
| 33 | Italian, | ||
| 34 | Spanish, | ||
| 35 | Chinese, | ||
| 36 | Korean, | ||
| 37 | Dutch, | ||
| 38 | Portuguese, | ||
| 39 | Russian, | ||
| 40 | Taiwanese, | ||
| 41 | EnglishBritish, | ||
| 42 | FrenchCanadian, | ||
| 43 | SpanishLatin, | ||
| 44 | ChineseSimplified, | ||
| 45 | ChineseTraditional, | ||
| 46 | PortugueseBrazilian, | ||
| 47 | }; | ||
| 48 | 90 | ||
| 49 | enum class Region : u32 { | 91 | ENUM(Language, Japanese, EnglishAmerican, French, German, Italian, Spanish, Chinese, Korean, Dutch, |
| 50 | Japan, | 92 | Portuguese, Russian, Taiwanese, EnglishBritish, FrenchCanadian, SpanishLatin, |
| 51 | Usa, | 93 | ChineseSimplified, ChineseTraditional, PortugueseBrazilian); |
| 52 | Europe, | ||
| 53 | Australia, | ||
| 54 | China, | ||
| 55 | Korea, | ||
| 56 | Taiwan, | ||
| 57 | }; | ||
| 58 | 94 | ||
| 59 | enum class TimeZone : u32 { | 95 | ENUM(Region, Japan, Usa, Europe, Australia, China, Korea, Taiwan); |
| 60 | Auto, | ||
| 61 | Default, | ||
| 62 | CET, | ||
| 63 | CST6CDT, | ||
| 64 | Cuba, | ||
| 65 | EET, | ||
| 66 | Egypt, | ||
| 67 | Eire, | ||
| 68 | EST, | ||
| 69 | EST5EDT, | ||
| 70 | GB, | ||
| 71 | GBEire, | ||
| 72 | GMT, | ||
| 73 | GMTPlusZero, | ||
| 74 | GMTMinusZero, | ||
| 75 | GMTZero, | ||
| 76 | Greenwich, | ||
| 77 | Hongkong, | ||
| 78 | HST, | ||
| 79 | Iceland, | ||
| 80 | Iran, | ||
| 81 | Israel, | ||
| 82 | Jamaica, | ||
| 83 | Japan, | ||
| 84 | Kwajalein, | ||
| 85 | Libya, | ||
| 86 | MET, | ||
| 87 | MST, | ||
| 88 | MST7MDT, | ||
| 89 | Navajo, | ||
| 90 | NZ, | ||
| 91 | NZCHAT, | ||
| 92 | Poland, | ||
| 93 | Portugal, | ||
| 94 | PRC, | ||
| 95 | PST8PDT, | ||
| 96 | ROC, | ||
| 97 | ROK, | ||
| 98 | Singapore, | ||
| 99 | Turkey, | ||
| 100 | UCT, | ||
| 101 | Universal, | ||
| 102 | UTC, | ||
| 103 | W_SU, | ||
| 104 | WET, | ||
| 105 | Zulu, | ||
| 106 | }; | ||
| 107 | 96 | ||
| 108 | enum class AnisotropyMode : u32 { | 97 | ENUM(TimeZone, Auto, Default, CET, CST6CDT, Cuba, EET, Egypt, Eire, EST, EST5EDT, GB, GBEire, GMT, |
| 109 | Automatic = 0, | 98 | GMTPlusZero, GMTMinusZero, GMTZero, Greenwich, Hongkong, HST, Iceland, Iran, Israel, Jamaica, |
| 110 | Default = 1, | 99 | Japan, Kwajalein, Libya, MET, MST, MST7MDT, Navajo, NZ, NZCHAT, Poland, Portugal, PRC, PST8PDT, |
| 111 | X2 = 2, | 100 | ROC, ROK, Singapore, Turkey, UCT, Universal, UTC, W_SU, WET, Zulu); |
| 112 | X4 = 3, | ||
| 113 | X8 = 4, | ||
| 114 | X16 = 5, | ||
| 115 | }; | ||
| 116 | 101 | ||
| 117 | enum class AstcDecodeMode : u32 { | 102 | ENUM(AnisotropyMode, Automatic, Default, X2, X4, X8, X16); |
| 118 | Cpu = 0, | ||
| 119 | Gpu = 1, | ||
| 120 | CpuAsynchronous = 2, | ||
| 121 | }; | ||
| 122 | 103 | ||
| 123 | enum class AstcRecompression : u32 { | 104 | ENUM(AstcDecodeMode, Cpu, Gpu, CpuAsynchronous); |
| 124 | Uncompressed = 0, | ||
| 125 | Bc1 = 1, | ||
| 126 | Bc3 = 2, | ||
| 127 | }; | ||
| 128 | 105 | ||
| 129 | enum class VSyncMode : u32 { | 106 | ENUM(AstcRecompression, Uncompressed, Bc1, Bc3); |
| 130 | Immediate = 0, | ||
| 131 | Mailbox = 1, | ||
| 132 | Fifo = 2, | ||
| 133 | FifoRelaxed = 3, | ||
| 134 | }; | ||
| 135 | 107 | ||
| 136 | enum class RendererBackend : u32 { | 108 | ENUM(VSyncMode, Immediate, Mailbox, Fifo, FifoRelaxed); |
| 137 | OpenGL = 0, | ||
| 138 | Vulkan = 1, | ||
| 139 | Null = 2, | ||
| 140 | }; | ||
| 141 | 109 | ||
| 142 | enum class ShaderBackend : u32 { | 110 | ENUM(RendererBackend, OpenGL, Vulkan, Null); |
| 143 | Glsl = 0, | ||
| 144 | Glasm = 1, | ||
| 145 | SpirV = 2, | ||
| 146 | }; | ||
| 147 | 111 | ||
| 148 | enum class GpuAccuracy : u32 { | 112 | ENUM(ShaderBackend, Glsl, Glasm, SpirV); |
| 149 | Normal = 0, | ||
| 150 | High = 1, | ||
| 151 | Extreme = 2, | ||
| 152 | }; | ||
| 153 | 113 | ||
| 154 | enum class CpuAccuracy : u32 { | 114 | ENUM(GpuAccuracy, Normal, High, Extreme); |
| 155 | Auto = 0, | ||
| 156 | Accurate = 1, | ||
| 157 | Unsafe = 2, | ||
| 158 | Paranoid = 3, | ||
| 159 | }; | ||
| 160 | |||
| 161 | enum class FullscreenMode : u32 { | ||
| 162 | Borderless = 0, | ||
| 163 | Exclusive = 1, | ||
| 164 | }; | ||
| 165 | |||
| 166 | enum class NvdecEmulation : u32 { | ||
| 167 | Off = 0, | ||
| 168 | Cpu = 1, | ||
| 169 | Gpu = 2, | ||
| 170 | }; | ||
| 171 | |||
| 172 | enum class ResolutionSetup : u32 { | ||
| 173 | Res1_2X = 0, | ||
| 174 | Res3_4X = 1, | ||
| 175 | Res1X = 2, | ||
| 176 | Res3_2X = 3, | ||
| 177 | Res2X = 4, | ||
| 178 | Res3X = 5, | ||
| 179 | Res4X = 6, | ||
| 180 | Res5X = 7, | ||
| 181 | Res6X = 8, | ||
| 182 | Res7X = 9, | ||
| 183 | Res8X = 10, | ||
| 184 | }; | ||
| 185 | 115 | ||
| 186 | enum class ScalingFilter : u32 { | 116 | ENUM(CpuAccuracy, Auto, Accurate, Unsafe, Paranoid); |
| 187 | NearestNeighbor = 0, | ||
| 188 | Bilinear = 1, | ||
| 189 | Bicubic = 2, | ||
| 190 | Gaussian = 3, | ||
| 191 | ScaleForce = 4, | ||
| 192 | Fsr = 5, | ||
| 193 | LastFilter = Fsr, | ||
| 194 | }; | ||
| 195 | 117 | ||
| 196 | enum class AntiAliasing : u32 { | 118 | ENUM(FullscreenMode, Borderless, Exclusive); |
| 197 | None = 0, | ||
| 198 | Fxaa = 1, | ||
| 199 | Smaa = 2, | ||
| 200 | LastAA = Smaa, | ||
| 201 | }; | ||
| 202 | 119 | ||
| 203 | enum class AspectRatio : u32 { | 120 | ENUM(NvdecEmulation, Off, Cpu, Gpu); |
| 204 | R16_9, | ||
| 205 | R4_3, | ||
| 206 | R21_9, | ||
| 207 | R16_10, | ||
| 208 | Stretch, | ||
| 209 | }; | ||
| 210 | 121 | ||
| 211 | #define X(ENUM, NAME) \ | 122 | ENUM(ResolutionSetup, Res1_2X, Res3_4X, Res1X, Res3_2X, Res2X, Res3X, Res4X, Res5X, Res6X, Res7X, |
| 212 | { (#NAME), static_cast<u32>(ENUM::NAME) } | 123 | Res8X); |
| 213 | 124 | ||
| 214 | static const std::map<std::type_index, std::map<std::string, u32>> canonicalizations = { | 125 | ENUM(ScalingFilter, NearestNeighbor, Bilinear, Bicubic, Gaussian, ScaleForce, Fsr, LastFilter); |
| 215 | {typeid(AudioEngine), | ||
| 216 | { | ||
| 217 | {"auto", static_cast<u32>(AudioEngine::Auto)}, | ||
| 218 | {"cubeb", static_cast<u32>(AudioEngine::Cubeb)}, | ||
| 219 | {"sdl2", static_cast<u32>(AudioEngine::Sdl2)}, | ||
| 220 | {"null", static_cast<u32>(AudioEngine::Null)}, | ||
| 221 | }}, | ||
| 222 | {typeid(AudioMode), | ||
| 223 | { | ||
| 224 | X(AudioMode, Mono), | ||
| 225 | X(AudioMode, Stereo), | ||
| 226 | X(AudioMode, Surround), | ||
| 227 | }}, | ||
| 228 | {typeid(Language), | ||
| 229 | { | ||
| 230 | X(Language, Japanese), | ||
| 231 | X(Language, EnglishAmerican), | ||
| 232 | X(Language, French), | ||
| 233 | X(Language, German), | ||
| 234 | X(Language, Italian), | ||
| 235 | X(Language, Spanish), | ||
| 236 | X(Language, Chinese), | ||
| 237 | X(Language, Korean), | ||
| 238 | X(Language, Dutch), | ||
| 239 | X(Language, Portuguese), | ||
| 240 | X(Language, Russian), | ||
| 241 | X(Language, Taiwanese), | ||
| 242 | X(Language, EnglishBritish), | ||
| 243 | X(Language, FrenchCanadian), | ||
| 244 | X(Language, SpanishLatin), | ||
| 245 | X(Language, ChineseSimplified), | ||
| 246 | X(Language, ChineseTraditional), | ||
| 247 | X(Language, PortugueseBrazilian), | ||
| 248 | }}, | ||
| 249 | {typeid(Region), | ||
| 250 | { | ||
| 251 | X(Region, Japan), | ||
| 252 | X(Region, Usa), | ||
| 253 | X(Region, Europe), | ||
| 254 | X(Region, Australia), | ||
| 255 | X(Region, China), | ||
| 256 | X(Region, Korea), | ||
| 257 | X(Region, Taiwan), | ||
| 258 | }}, | ||
| 259 | {typeid(TimeZone), | ||
| 260 | { | ||
| 261 | X(TimeZone, Auto), X(TimeZone, Default), X(TimeZone, CET), | ||
| 262 | X(TimeZone, CST6CDT), X(TimeZone, Cuba), X(TimeZone, EET), | ||
| 263 | X(TimeZone, Egypt), X(TimeZone, Eire), X(TimeZone, EST5EDT), | ||
| 264 | X(TimeZone, GB), X(TimeZone, GBEire), X(TimeZone, GMT), | ||
| 265 | X(TimeZone, GMTPlusZero), X(TimeZone, GMTMinusZero), X(TimeZone, GMTZero), | ||
| 266 | X(TimeZone, Greenwich), X(TimeZone, Hongkong), X(TimeZone, HST), | ||
| 267 | X(TimeZone, Iceland), X(TimeZone, Iran), X(TimeZone, Israel), | ||
| 268 | X(TimeZone, Jamaica), X(TimeZone, Japan), X(TimeZone, Kwajalein), | ||
| 269 | X(TimeZone, Libya), X(TimeZone, MET), X(TimeZone, MST), | ||
| 270 | X(TimeZone, MST7MDT), X(TimeZone, Navajo), X(TimeZone, NZ), | ||
| 271 | X(TimeZone, NZCHAT), X(TimeZone, Poland), X(TimeZone, Portugal), | ||
| 272 | X(TimeZone, PRC), X(TimeZone, ROC), X(TimeZone, ROK), | ||
| 273 | X(TimeZone, Singapore), X(TimeZone, Turkey), X(TimeZone, UCT), | ||
| 274 | X(TimeZone, Universal), X(TimeZone, UTC), X(TimeZone, W_SU), | ||
| 275 | X(TimeZone, WET), X(TimeZone, Zulu), | ||
| 276 | }}, | ||
| 277 | {typeid(AnisotropyMode), | ||
| 278 | { | ||
| 279 | X(AnisotropyMode, Automatic), | ||
| 280 | X(AnisotropyMode, Default), | ||
| 281 | X(AnisotropyMode, X2), | ||
| 282 | X(AnisotropyMode, X4), | ||
| 283 | X(AnisotropyMode, X8), | ||
| 284 | X(AnisotropyMode, X16), | ||
| 285 | }}, | ||
| 286 | {typeid(AstcDecodeMode), | ||
| 287 | { | ||
| 288 | X(AstcDecodeMode, Cpu), | ||
| 289 | X(AstcDecodeMode, Gpu), | ||
| 290 | X(AstcDecodeMode, CpuAsynchronous), | ||
| 291 | }}, | ||
| 292 | {typeid(AstcRecompression), | ||
| 293 | { | ||
| 294 | X(AstcRecompression, Uncompressed), | ||
| 295 | X(AstcRecompression, Bc1), | ||
| 296 | X(AstcRecompression, Bc3), | ||
| 297 | }}, | ||
| 298 | {typeid(VSyncMode), | ||
| 299 | { | ||
| 300 | X(VSyncMode, Immediate), | ||
| 301 | X(VSyncMode, Mailbox), | ||
| 302 | X(VSyncMode, Fifo), | ||
| 303 | X(VSyncMode, FifoRelaxed), | ||
| 304 | }}, | ||
| 305 | {typeid(RendererBackend), | ||
| 306 | { | ||
| 307 | X(RendererBackend, OpenGL), | ||
| 308 | X(RendererBackend, Vulkan), | ||
| 309 | X(RendererBackend, Null), | ||
| 310 | }}, | ||
| 311 | {typeid(ShaderBackend), | ||
| 312 | { | ||
| 313 | X(ShaderBackend, Glsl), | ||
| 314 | X(ShaderBackend, Glasm), | ||
| 315 | X(ShaderBackend, SpirV), | ||
| 316 | }}, | ||
| 317 | {typeid(GpuAccuracy), | ||
| 318 | { | ||
| 319 | X(GpuAccuracy, Normal), | ||
| 320 | X(GpuAccuracy, High), | ||
| 321 | X(GpuAccuracy, Extreme), | ||
| 322 | }}, | ||
| 323 | {typeid(CpuAccuracy), | ||
| 324 | { | ||
| 325 | X(CpuAccuracy, Auto), | ||
| 326 | X(CpuAccuracy, Accurate), | ||
| 327 | X(CpuAccuracy, Unsafe), | ||
| 328 | X(CpuAccuracy, Paranoid), | ||
| 329 | }}, | ||
| 330 | {typeid(FullscreenMode), | ||
| 331 | { | ||
| 332 | X(FullscreenMode, Borderless), | ||
| 333 | X(FullscreenMode, Exclusive), | ||
| 334 | }}, | ||
| 335 | {typeid(NvdecEmulation), | ||
| 336 | { | ||
| 337 | X(NvdecEmulation, Off), | ||
| 338 | X(NvdecEmulation, Cpu), | ||
| 339 | X(NvdecEmulation, Gpu), | ||
| 340 | }}, | ||
| 341 | {typeid(ResolutionSetup), | ||
| 342 | { | ||
| 343 | X(ResolutionSetup, Res1_2X), | ||
| 344 | X(ResolutionSetup, Res3_4X), | ||
| 345 | X(ResolutionSetup, Res1X), | ||
| 346 | X(ResolutionSetup, Res3_2X), | ||
| 347 | X(ResolutionSetup, Res2X), | ||
| 348 | X(ResolutionSetup, Res3X), | ||
| 349 | X(ResolutionSetup, Res4X), | ||
| 350 | X(ResolutionSetup, Res5X), | ||
| 351 | X(ResolutionSetup, Res6X), | ||
| 352 | X(ResolutionSetup, Res7X), | ||
| 353 | X(ResolutionSetup, Res8X), | ||
| 354 | }}, | ||
| 355 | {typeid(ScalingFilter), | ||
| 356 | { | ||
| 357 | X(ScalingFilter, NearestNeighbor), | ||
| 358 | X(ScalingFilter, Bilinear), | ||
| 359 | X(ScalingFilter, Bicubic), | ||
| 360 | X(ScalingFilter, Gaussian), | ||
| 361 | X(ScalingFilter, ScaleForce), | ||
| 362 | X(ScalingFilter, Fsr), | ||
| 363 | }}, | ||
| 364 | {typeid(AntiAliasing), | ||
| 365 | { | ||
| 366 | X(AntiAliasing, None), | ||
| 367 | X(AntiAliasing, Fxaa), | ||
| 368 | X(AntiAliasing, Smaa), | ||
| 369 | }}, | ||
| 370 | {typeid(AspectRatio), | ||
| 371 | { | ||
| 372 | X(AspectRatio, R16_9), | ||
| 373 | X(AspectRatio, R4_3), | ||
| 374 | X(AspectRatio, R21_9), | ||
| 375 | X(AspectRatio, R16_10), | ||
| 376 | X(AspectRatio, Stretch), | ||
| 377 | }}}; | ||
| 378 | 126 | ||
| 379 | #undef X | 127 | ENUM(AntiAliasing, None, Fxaa, Smaa, LastAA); |
| 380 | 128 | ||
| 381 | static const std::string invalid_string{"(invalid setting)"}; | 129 | ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch); |
| 382 | 130 | ||
| 383 | template <typename Type> | 131 | template <typename Type> |
| 384 | const std::string& CanonicalizeEnum(Type id) { | 132 | constexpr std::string CanonicalizeEnum(Type id) { |
| 385 | auto& group = canonicalizations.at(typeid(Type)); | 133 | const auto group = Canonicalization<Type>::Get(); |
| 386 | for (auto& [name, value] : group) { | 134 | for (auto& [name, value] : group) { |
| 387 | if (static_cast<Type>(value) == id) { | 135 | if (static_cast<Type>(value) == id) { |
| 388 | return name; | 136 | return name; |
| 389 | } | 137 | } |
| 390 | } | 138 | } |
| 391 | return invalid_string; | 139 | return "unknown"; |
| 392 | } | 140 | } |
| 393 | 141 | ||
| 394 | template <typename Type> | 142 | template <typename Type> |
| 395 | static Type ToEnum(const std::string& canonicalization) { | 143 | constexpr Type ToEnum(const std::string& canonicalization) { |
| 396 | return static_cast<Type>(canonicalizations.at(typeid(Type)).at(canonicalization)); | 144 | const auto group = Canonicalization<Type>::Get(); |
| 145 | for (auto& [name, value] : group) { | ||
| 146 | if (name == canonicalization) { | ||
| 147 | return static_cast<Type>(value); | ||
| 148 | } | ||
| 149 | } | ||
| 150 | return {}; | ||
| 397 | } | 151 | } |
| 398 | } // namespace Settings | 152 | } // namespace Settings |
| 153 | |||
| 154 | #undef ENUM | ||
| 155 | #undef PAIR | ||
| 156 | #undef PAIR_1 | ||
| 157 | #undef PAIR_2 | ||
| 158 | #undef PAIR_3 | ||
| 159 | #undef PAIR_4 | ||
| 160 | #undef PAIR_5 | ||
| 161 | #undef PAIR_6 | ||
| 162 | #undef PAIR_7 | ||
| 163 | #undef PAIR_8 | ||
| 164 | #undef PAIR_9 | ||
| 165 | #undef PAIR_10 | ||
| 166 | #undef PAIR_12 | ||
| 167 | #undef PAIR_13 | ||
| 168 | #undef PAIR_14 | ||
| 169 | #undef PAIR_15 | ||
| 170 | #undef PAIR_16 | ||
| 171 | #undef PAIR_17 | ||
| 172 | #undef PAIR_18 | ||
| 173 | #undef PAIR_19 | ||
| 174 | #undef PAIR_20 | ||
| 175 | #undef PAIR_22 | ||
| 176 | #undef PAIR_23 | ||
| 177 | #undef PAIR_24 | ||
| 178 | #undef PAIR_25 | ||
| 179 | #undef PAIR_26 | ||
| 180 | #undef PAIR_27 | ||
| 181 | #undef PAIR_28 | ||
| 182 | #undef PAIR_29 | ||
| 183 | #undef PAIR_30 | ||
| 184 | #undef PAIR_32 | ||
| 185 | #undef PAIR_33 | ||
| 186 | #undef PAIR_34 | ||
| 187 | #undef PAIR_35 | ||
| 188 | #undef PAIR_36 | ||
| 189 | #undef PAIR_37 | ||
| 190 | #undef PAIR_38 | ||
| 191 | #undef PAIR_39 | ||
| 192 | #undef PAIR_40 | ||
| 193 | #undef PAIR_42 | ||
| 194 | #undef PAIR_43 | ||
| 195 | #undef PAIR_44 | ||
| 196 | #undef PAIR_45 | ||