diff options
| author | 2023-06-07 01:53:05 -0400 | |
|---|---|---|
| committer | 2023-07-21 10:56:54 -0400 | |
| commit | 8c17a945f71b8532b0a4c3903b00a09d99ff0d6c (patch) | |
| tree | ad1c5fa4b5258a749e819358402df83bfa1ec379 /src | |
| parent | settings,general: Rename non-confirming enums (diff) | |
| download | yuzu-8c17a945f71b8532b0a4c3903b00a09d99ff0d6c.tar.gz yuzu-8c17a945f71b8532b0a4c3903b00a09d99ff0d6c.tar.xz yuzu-8c17a945f71b8532b0a4c3903b00a09d99ff0d6c.zip | |
settings_enums: Cannonicalize settings names
Gives every option of the enums a string literal via a macro.
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/settings_enums.h | 165 |
1 files changed, 163 insertions, 2 deletions
diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h index 6cd2ac28b..d820bc48e 100644 --- a/src/common/settings_enums.h +++ b/src/common/settings_enums.h | |||
| @@ -207,16 +207,177 @@ enum class AspectRatio : u32 { | |||
| 207 | Stretch, | 207 | Stretch, |
| 208 | }; | 208 | }; |
| 209 | 209 | ||
| 210 | static std::map<std::type_index, std::map<std::string, u32>> translations = { | 210 | #define X(ENUM, NAME) \ |
| 211 | { (#NAME), static_cast<u32>(ENUM::NAME) } | ||
| 212 | |||
| 213 | static std::map<std::type_index, std::map<std::string, u32>> canonicalizations = { | ||
| 211 | {typeid(AudioEngine), | 214 | {typeid(AudioEngine), |
| 212 | { | 215 | { |
| 213 | {"auto", static_cast<u32>(AudioEngine::Auto)}, | 216 | {"auto", static_cast<u32>(AudioEngine::Auto)}, |
| 214 | {"cubeb", static_cast<u32>(AudioEngine::Cubeb)}, | 217 | {"cubeb", static_cast<u32>(AudioEngine::Cubeb)}, |
| 215 | {"sdl2", static_cast<u32>(AudioEngine::Sdl2)}, | 218 | {"sdl2", static_cast<u32>(AudioEngine::Sdl2)}, |
| 216 | {"null", static_cast<u32>(AudioEngine::Null)}, | 219 | {"null", static_cast<u32>(AudioEngine::Null)}, |
| 220 | }}, | ||
| 221 | {typeid(AudioMode), | ||
| 222 | { | ||
| 223 | X(AudioMode, Mono), | ||
| 224 | X(AudioMode, Stereo), | ||
| 225 | X(AudioMode, Surround), | ||
| 226 | }}, | ||
| 227 | {typeid(Language), | ||
| 228 | { | ||
| 229 | X(Language, Japanese), | ||
| 230 | X(Language, EnglishAmerican), | ||
| 231 | X(Language, French), | ||
| 232 | X(Language, German), | ||
| 233 | X(Language, Italian), | ||
| 234 | X(Language, Spanish), | ||
| 235 | X(Language, Chinese), | ||
| 236 | X(Language, Korean), | ||
| 237 | X(Language, Dutch), | ||
| 238 | X(Language, Portuguese), | ||
| 239 | X(Language, Russian), | ||
| 240 | X(Language, Taiwanese), | ||
| 241 | X(Language, EnglishBritish), | ||
| 242 | X(Language, FrenchCanadian), | ||
| 243 | X(Language, SpanishLatin), | ||
| 244 | X(Language, ChineseSimplified), | ||
| 245 | X(Language, ChineseTraditional), | ||
| 246 | X(Language, PortugueseBrazilian), | ||
| 247 | }}, | ||
| 248 | {typeid(Region), | ||
| 249 | { | ||
| 250 | X(Region, Japan), | ||
| 251 | X(Region, Usa), | ||
| 252 | X(Region, Europe), | ||
| 253 | X(Region, Australia), | ||
| 254 | X(Region, China), | ||
| 255 | X(Region, Korea), | ||
| 256 | X(Region, Taiwan), | ||
| 257 | }}, | ||
| 258 | {typeid(TimeZone), | ||
| 259 | { | ||
| 260 | X(TimeZone, Auto), X(TimeZone, Default), X(TimeZone, CET), | ||
| 261 | X(TimeZone, CST6CDT), X(TimeZone, Cuba), X(TimeZone, EET), | ||
| 262 | X(TimeZone, Egypt), X(TimeZone, Eire), X(TimeZone, EST5EDT), | ||
| 263 | X(TimeZone, GB), X(TimeZone, GBEire), X(TimeZone, GMT), | ||
| 264 | X(TimeZone, GMTPlusZero), X(TimeZone, GMTMinusZero), X(TimeZone, GMTZero), | ||
| 265 | X(TimeZone, Greenwich), X(TimeZone, Hongkong), X(TimeZone, HST), | ||
| 266 | X(TimeZone, Iceland), X(TimeZone, Iran), X(TimeZone, Israel), | ||
| 267 | X(TimeZone, Jamaica), X(TimeZone, Japan), X(TimeZone, Kwajalein), | ||
| 268 | X(TimeZone, Libya), X(TimeZone, MET), X(TimeZone, MST), | ||
| 269 | X(TimeZone, MST7MDT), X(TimeZone, Navajo), X(TimeZone, NZ), | ||
| 270 | X(TimeZone, NZCHAT), X(TimeZone, Poland), X(TimeZone, Portugal), | ||
| 271 | X(TimeZone, PRC), X(TimeZone, ROC), X(TimeZone, ROK), | ||
| 272 | X(TimeZone, Singapore), X(TimeZone, Turkey), X(TimeZone, UCT), | ||
| 273 | X(TimeZone, Universal), X(TimeZone, UTC), X(TimeZone, W_SU), | ||
| 274 | X(TimeZone, WET), X(TimeZone, Zulu), | ||
| 275 | }}, | ||
| 276 | {typeid(AnisotropyMode), | ||
| 277 | { | ||
| 278 | X(AnisotropyMode, Automatic), | ||
| 279 | X(AnisotropyMode, Default), | ||
| 280 | X(AnisotropyMode, X2), | ||
| 281 | X(AnisotropyMode, X4), | ||
| 282 | X(AnisotropyMode, X8), | ||
| 283 | X(AnisotropyMode, X16), | ||
| 284 | }}, | ||
| 285 | {typeid(AstcDecodeMode), | ||
| 286 | { | ||
| 287 | X(AstcDecodeMode, Cpu), | ||
| 288 | X(AstcDecodeMode, Gpu), | ||
| 289 | X(AstcDecodeMode, CpuAsynchronous), | ||
| 290 | }}, | ||
| 291 | {typeid(AstcRecompression), | ||
| 292 | { | ||
| 293 | X(AstcRecompression, Uncompressed), | ||
| 294 | X(AstcRecompression, Bc1), | ||
| 295 | X(AstcRecompression, Bc3), | ||
| 296 | }}, | ||
| 297 | {typeid(VSyncMode), | ||
| 298 | { | ||
| 299 | X(VSyncMode, Immediate), | ||
| 300 | X(VSyncMode, Mailbox), | ||
| 301 | X(VSyncMode, Fifo), | ||
| 302 | X(VSyncMode, FifoRelaxed), | ||
| 303 | }}, | ||
| 304 | {typeid(RendererBackend), | ||
| 305 | { | ||
| 306 | X(RendererBackend, OpenGL), | ||
| 307 | X(RendererBackend, Vulkan), | ||
| 308 | X(RendererBackend, Null), | ||
| 309 | }}, | ||
| 310 | {typeid(ShaderBackend), | ||
| 311 | { | ||
| 312 | X(ShaderBackend, Glsl), | ||
| 313 | X(ShaderBackend, Glasm), | ||
| 314 | X(ShaderBackend, SpirV), | ||
| 315 | }}, | ||
| 316 | {typeid(GpuAccuracy), | ||
| 317 | { | ||
| 318 | X(GpuAccuracy, Normal), | ||
| 319 | X(GpuAccuracy, High), | ||
| 320 | X(GpuAccuracy, Extreme), | ||
| 321 | }}, | ||
| 322 | {typeid(CpuAccuracy), | ||
| 323 | { | ||
| 324 | X(CpuAccuracy, Auto), | ||
| 325 | X(CpuAccuracy, Accurate), | ||
| 326 | X(CpuAccuracy, Unsafe), | ||
| 327 | X(CpuAccuracy, Paranoid), | ||
| 328 | }}, | ||
| 329 | {typeid(FullscreenMode), | ||
| 330 | { | ||
| 331 | X(FullscreenMode, Borderless), | ||
| 332 | X(FullscreenMode, Exclusive), | ||
| 333 | }}, | ||
| 334 | {typeid(NvdecEmulation), | ||
| 335 | { | ||
| 336 | X(NvdecEmulation, Off), | ||
| 337 | X(NvdecEmulation, Cpu), | ||
| 338 | X(NvdecEmulation, Gpu), | ||
| 339 | }}, | ||
| 340 | {typeid(ResolutionSetup), | ||
| 341 | { | ||
| 342 | X(ResolutionSetup, Res1_2X), | ||
| 343 | X(ResolutionSetup, Res3_4X), | ||
| 344 | X(ResolutionSetup, Res1X), | ||
| 345 | X(ResolutionSetup, Res3_2X), | ||
| 346 | X(ResolutionSetup, Res2X), | ||
| 347 | X(ResolutionSetup, Res3X), | ||
| 348 | X(ResolutionSetup, Res4X), | ||
| 349 | X(ResolutionSetup, Res5X), | ||
| 350 | X(ResolutionSetup, Res6X), | ||
| 351 | X(ResolutionSetup, Res7X), | ||
| 352 | X(ResolutionSetup, Res8X), | ||
| 353 | }}, | ||
| 354 | {typeid(ScalingFilter), | ||
| 355 | { | ||
| 356 | X(ScalingFilter, NearestNeighbor), | ||
| 357 | X(ScalingFilter, Bilinear), | ||
| 358 | X(ScalingFilter, Bicubic), | ||
| 359 | X(ScalingFilter, Gaussian), | ||
| 360 | X(ScalingFilter, ScaleForce), | ||
| 361 | X(ScalingFilter, Fsr), | ||
| 362 | }}, | ||
| 363 | {typeid(AntiAliasing), | ||
| 364 | { | ||
| 365 | X(AntiAliasing, None), | ||
| 366 | X(AntiAliasing, Fxaa), | ||
| 367 | X(AntiAliasing, Smaa), | ||
| 368 | }}, | ||
| 369 | {typeid(AspectRatio), | ||
| 370 | { | ||
| 371 | X(AspectRatio, R16_9), | ||
| 372 | X(AspectRatio, R4_3), | ||
| 373 | X(AspectRatio, R21_9), | ||
| 374 | X(AspectRatio, R16_10), | ||
| 375 | X(AspectRatio, Stretch), | ||
| 217 | }}}; | 376 | }}}; |
| 218 | 377 | ||
| 219 | static std::string empty_string{}; | 378 | #undef X |
| 379 | |||
| 380 | static std::string invalid_string{"(invalid setting)"}; | ||
| 220 | 381 | ||
| 221 | template <typename Type> | 382 | template <typename Type> |
| 222 | const std::string& CanonicalizeEnum(Type id) { | 383 | const std::string& CanonicalizeEnum(Type id) { |