shared_translation.cpp 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include <forward_list>
  4. #include <map>
  5. #include <memory>
  6. #include <string>
  7. #include <typeindex>
  8. #include <utility>
  9. #include <QString>
  10. #include <QWidget>
  11. #include "common/settings.h"
  12. #include "yuzu/configuration/shared_translation.h"
  13. namespace ConfigurationShared {
  14. std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) {
  15. std::unique_ptr<TranslationMap> translations = std::make_unique<TranslationMap>();
  16. const auto& tr = [parent](const char* text) -> QString { return parent->tr(text); };
  17. #define INSERT(ID, NAME, TOOLTIP) \
  18. translations->insert(std::pair{Settings::values.ID.Id(), std::pair{tr((NAME)), tr((TOOLTIP))}})
  19. // A setting can be ignored by giving it a blank name
  20. // Audio
  21. INSERT(sink_id, "Output Engine:", "");
  22. INSERT(audio_output_device_id, "Output Device:", "");
  23. INSERT(audio_input_device_id, "Input Device:", "");
  24. INSERT(audio_muted, "Mute audio when in background", "");
  25. INSERT(volume, "Volume:", "");
  26. // Core
  27. INSERT(use_multi_core, "Multicore CPU Emulation", "");
  28. INSERT(use_unsafe_extended_memory_layout, "Unsafe extended memory layout (8GB DRAM)", "");
  29. // Cpu
  30. INSERT(cpu_accuracy, "Accuracy:", "");
  31. INSERT(cpu_accuracy_first_time, "", "");
  32. // Cpu Debug
  33. // Cpu Unsafe
  34. INSERT(cpuopt_unsafe_unfuse_fma, "Unfuse FMA (improve performance on CPUs without FMA)", "");
  35. INSERT(cpuopt_unsafe_reduce_fp_error, "Faster FRSQRTE and FRECPE", "");
  36. INSERT(cpuopt_unsafe_ignore_standard_fpcr, "Faster ASIMD instructions (32 bits only)", "");
  37. INSERT(cpuopt_unsafe_inaccurate_nan, "Inaccurate NaN handling", "");
  38. INSERT(cpuopt_unsafe_fastmem_check, "Disable address space checks", "");
  39. INSERT(cpuopt_unsafe_ignore_global_monitor, "Ignore global monitor", "");
  40. // Renderer
  41. INSERT(renderer_backend, "API:", "");
  42. INSERT(vulkan_device, "Device:", "");
  43. INSERT(shader_backend, "Shader Backend:", "");
  44. INSERT(resolution_setup, "Resolution:", "");
  45. INSERT(scaling_filter, "Window Adapting Filter:", "");
  46. INSERT(fsr_sharpening_slider, "AMD FidelityFX™ Super Resolution Sharpness:", "");
  47. INSERT(anti_aliasing, "Anti-Aliasing Method:", "");
  48. INSERT(fullscreen_mode, "Fullscreen Mode:", "");
  49. INSERT(aspect_ratio, "Aspect Ratio:", "");
  50. INSERT(use_disk_shader_cache, "Use disk pipeline cache", "");
  51. INSERT(use_asynchronous_gpu_emulation, "Use asynchronous GPU emulation", "");
  52. INSERT(nvdec_emulation, "NVDEC emulation:", "");
  53. INSERT(accelerate_astc, "ASTC Decoding Method:", "");
  54. INSERT(
  55. vsync_mode, "VSync Mode:",
  56. "FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen refresh "
  57. "rate. FIFO Relaxed is similar to FIFO but allows tearing as it recovers from a slow down. "
  58. "Mailbox can have lower latency than FIFO and does not tear but may drop frames. Immediate "
  59. "(no synchronization) just presents whatever is available and can exhibit tearing.");
  60. INSERT(bg_red, "", "");
  61. INSERT(bg_green, "", "");
  62. INSERT(bg_blue, "", "");
  63. // Renderer (Advanced Graphics)
  64. INSERT(async_presentation, "Enable asynchronous presentation (Vulkan only)", "");
  65. INSERT(renderer_force_max_clock, "Force maximum clocks (Vulkan only)",
  66. "Runs work in the background while waiting for graphics commands to keep the GPU from "
  67. "lowering its clock speed.");
  68. INSERT(max_anisotropy, "Anisotropic Filtering:", "");
  69. INSERT(gpu_accuracy, "Accuracy Level:", "");
  70. INSERT(use_asynchronous_shaders, "Use asynchronous shader building (Hack)",
  71. "Enables asynchronous shader compilation, which may reduce shader stutter. This feature "
  72. "is experimental.");
  73. INSERT(use_fast_gpu_time, "Use Fast GPU Time (Hack)",
  74. "Enables Fast GPU Time. This option will force most games to run at their highest "
  75. "native resolution.");
  76. INSERT(use_vulkan_driver_pipeline_cache, "Use Vulkan pipeline cache",
  77. "Enables GPU vendor-specific pipeline cache. This option can improve shader loading "
  78. "time significantly in cases where the Vulkan driver does not store pipeline cache "
  79. "files internally.");
  80. INSERT(enable_compute_pipelines, "Enable Compute Pipelines (Intel Vulkan Only)",
  81. "Enable compute pipelines, required by some games.\nThis setting only exists for Intel "
  82. "proprietary drivers, and may crash if enabled.\nCompute pipelines are always enabled "
  83. "on all other drivers.");
  84. // Renderer (Debug)
  85. // Renderer (General)
  86. INSERT(use_speed_limit, "Limit Speed Percent", "");
  87. INSERT(speed_limit, "Limit Speed Percent", "");
  88. // System
  89. INSERT(rng_seed_enabled, "RNG Seed", "");
  90. INSERT(rng_seed, "RNG Seed", "");
  91. INSERT(device_name, "Device Name", "");
  92. INSERT(custom_rtc_enabled, "Custom RTC", "");
  93. INSERT(custom_rtc, "Custom RTC", "");
  94. INSERT(language_index, "Language:", "");
  95. INSERT(region_index, "Region:", "");
  96. INSERT(time_zone_index, "Time Zone:", "");
  97. INSERT(sound_index, "Sound Output Mode:", "");
  98. INSERT(use_docked_mode, "", "");
  99. // Controls
  100. // Data Storage
  101. // Debugging
  102. // Debugging Graphics
  103. // Network
  104. // Web Service
  105. #undef INSERT
  106. return translations;
  107. }
  108. std::forward_list<QString> ComboboxEnumeration(std::type_index type, QWidget* parent) {
  109. const auto& tr = [&](const char* text) { return parent->tr(text); };
  110. if (type == typeid(Settings::AstcDecodeMode)) {
  111. return {
  112. tr("CPU"),
  113. tr("GPU"),
  114. tr("CPU Asynchronous"),
  115. };
  116. } else if (type == typeid(Settings::RendererBackend)) {
  117. return {
  118. tr("OpenGL"),
  119. tr("Vulkan"),
  120. tr("Null"),
  121. };
  122. } else if (type == typeid(Settings::ShaderBackend)) {
  123. return {
  124. tr("GLSL"),
  125. tr("GLASM (Assembly Shaders, NVIDIA Only)"),
  126. tr("SPIR-V (Experimental, Mesa Only)"),
  127. };
  128. } else if (type == typeid(Settings::GPUAccuracy)) {
  129. return {
  130. tr("Normal"),
  131. tr("High"),
  132. tr("Extreme"),
  133. };
  134. } else if (type == typeid(Settings::CPUAccuracy)) {
  135. return {
  136. tr("Auto"),
  137. tr("Accurate"),
  138. tr("Unsafe"),
  139. tr("Paranoid (disables most optimizations)"),
  140. };
  141. } else if (type == typeid(Settings::FullscreenMode)) {
  142. return {
  143. tr("Borderless Windowed"),
  144. tr("Exclusive Fullscreen"),
  145. };
  146. } else if (type == typeid(Settings::NvdecEmulation)) {
  147. return {
  148. tr("No Video Output"),
  149. tr("CPU Video Decoding"),
  150. tr("GPU Video Decoding (Default)"),
  151. };
  152. } else if (type == typeid(Settings::ResolutionSetup)) {
  153. return {
  154. tr("0.5X (360p/540p) [EXPERIMENTAL]"),
  155. tr("0.75X (540p/810p) [EXPERIMENTAL]"),
  156. tr("1X (720p/1080p)"),
  157. tr("1.5X (1080p/1620p) [EXPERIMENTAL]"),
  158. tr("2X (1440p/2160p)"),
  159. tr("3X (2160p/3240p)"),
  160. tr("4X (2880p/4320p)"),
  161. tr("5X (3600p/5400p)"),
  162. tr("6X (4320p/6480p)"),
  163. tr("7X (5040p/7560p)"),
  164. tr("8X (5760p/8640p)"),
  165. };
  166. } else if (type == typeid(Settings::ScalingFilter)) {
  167. return {
  168. tr("Nearest Neighbor"), tr("Bilinear"), tr("Bicubic"),
  169. tr("Gaussian"), tr("ScaleForce"), tr("AMD FidelityFX™️ Super Resolution"),
  170. };
  171. } else if (type == typeid(Settings::AntiAliasing)) {
  172. return {
  173. tr("None"),
  174. tr("FXAA"),
  175. tr("SMAA"),
  176. };
  177. } else if (type == typeid(Settings::AnisotropyMode)) {
  178. return {
  179. tr("Automatic"), tr("Default"), tr("2x"), tr("4x"), tr("8x"), tr("16x"),
  180. };
  181. }
  182. return {};
  183. }
  184. } // namespace ConfigurationShared