Settings: Translate display names in core

Enables the values to show in the Big Picture UI.
This commit is contained in:
Stenzek 2023-08-20 13:25:43 +10:00
parent 8ba04a80af
commit d09e5051ca
14 changed files with 105 additions and 125 deletions

View file

@ -3826,7 +3826,7 @@ void FullscreenUI::DrawDisplaySettingsPage()
DrawEnumSetting(bsi, FSUI_CSTR("Aspect Ratio"),
FSUI_CSTR("Changes the aspect ratio used to display the console's output to the screen."), "Display",
"AspectRatio", Settings::DEFAULT_DISPLAY_ASPECT_RATIO, &Settings::ParseDisplayAspectRatio,
&Settings::GetDisplayAspectRatioName, &Settings::GetDisplayAspectRatioName,
&Settings::GetDisplayAspectRatioName, &Settings::GetDisplayAspectRatioDisplayName,
DisplayAspectRatio::Count);
DrawEnumSetting(bsi, FSUI_CSTR("Crop Mode"),

View file

@ -194,7 +194,7 @@ const char* GameDatabase::GetCompatibilityRatingDisplayName(CompatibilityRating
TRANSLATE_NOOP("GameListCompatibilityRating", "Graphical/Audio Issues"),
TRANSLATE_NOOP("GameListCompatibilityRating", "No Issues")}};
return (rating >= CompatibilityRating::Unknown && rating < CompatibilityRating::Count) ?
names[static_cast<int>(rating)] :
Host::TranslateToCString("GameListCompatibilityRating", names[static_cast<int>(rating)]) :
"";
}
@ -228,8 +228,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (display_osd_messages && settings.cpu_execution_mode != CPUExecutionMode::Interpreter)
{
Host::AddKeyedOSDMessage("gamedb_force_interpreter",
TRANSLATE_STR("OSDMessage", "CPU interpreter forced by game settings."),
osd_duration);
TRANSLATE_STR("OSDMessage", "CPU interpreter forced by game settings."), osd_duration);
}
settings.cpu_execution_mode = CPUExecutionMode::Interpreter;
@ -240,8 +239,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (display_osd_messages && settings.gpu_renderer != GPURenderer::Software)
{
Host::AddKeyedOSDMessage("gamedb_force_software",
TRANSLATE_STR("OSDMessage", "Software renderer forced by game settings."),
osd_duration);
TRANSLATE_STR("OSDMessage", "Software renderer forced by game settings."), osd_duration);
}
settings.gpu_renderer = GPURenderer::Software;
@ -253,8 +251,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
{
Host::AddKeyedOSDMessage(
"gamedb_force_software_rb",
TRANSLATE_STR("OSDMessage", "Using software renderer for readbacks based on game settings."),
osd_duration);
TRANSLATE_STR("OSDMessage", "Using software renderer for readbacks based on game settings."), osd_duration);
}
settings.gpu_use_software_renderer_for_readbacks = true;
@ -265,8 +262,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (display_osd_messages && settings.gpu_disable_interlacing)
{
Host::AddKeyedOSDMessage("gamedb_force_interlacing",
TRANSLATE_STR("OSDMessage", "Interlacing forced by game settings."),
osd_duration);
TRANSLATE_STR("OSDMessage", "Interlacing forced by game settings."), osd_duration);
}
settings.gpu_disable_interlacing = false;
@ -277,8 +273,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (display_osd_messages && settings.gpu_true_color)
{
Host::AddKeyedOSDMessage("gamedb_disable_true_color",
TRANSLATE_STR("OSDMessage", "True color disabled by game settings."),
osd_duration);
TRANSLATE_STR("OSDMessage", "True color disabled by game settings."), osd_duration);
}
settings.gpu_true_color = false;
@ -289,8 +284,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (display_osd_messages && settings.gpu_resolution_scale > 1)
{
Host::AddKeyedOSDMessage("gamedb_disable_upscaling",
TRANSLATE_STR("OSDMessage", "Upscaling disabled by game settings."),
osd_duration);
TRANSLATE_STR("OSDMessage", "Upscaling disabled by game settings."), osd_duration);
}
settings.gpu_resolution_scale = 1;
@ -314,8 +308,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
(settings.display_aspect_ratio == DisplayAspectRatio::R16_9 || settings.gpu_widescreen_hack))
{
Host::AddKeyedOSDMessage("gamedb_disable_widescreen",
TRANSLATE_STR("OSDMessage", "Widescreen disabled by game settings."),
osd_duration);
TRANSLATE_STR("OSDMessage", "Widescreen disabled by game settings."), osd_duration);
}
settings.display_aspect_ratio = DisplayAspectRatio::R4_3;
@ -326,9 +319,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
{
if (display_osd_messages && settings.gpu_force_ntsc_timings)
{
Host::AddKeyedOSDMessage(
"gamedb_disable_force_ntsc_timings",
TRANSLATE_STR("OSDMessage", "Forcing NTSC Timings disallowed by game settings."), osd_duration);
Host::AddKeyedOSDMessage("gamedb_disable_force_ntsc_timings",
TRANSLATE_STR("OSDMessage", "Forcing NTSC Timings disallowed by game settings."),
osd_duration);
}
settings.gpu_force_ntsc_timings = false;
@ -338,9 +331,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
{
if (display_osd_messages && settings.gpu_pgxp_enable)
{
Host::AddKeyedOSDMessage(
"gamedb_disable_pgxp",
TRANSLATE_STR("OSDMessage", "PGXP geometry correction disabled by game settings."), osd_duration);
Host::AddKeyedOSDMessage("gamedb_disable_pgxp",
TRANSLATE_STR("OSDMessage", "PGXP geometry correction disabled by game settings."),
osd_duration);
}
settings.gpu_pgxp_enable = false;
@ -351,8 +344,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (display_osd_messages && settings.gpu_pgxp_enable && settings.gpu_pgxp_culling)
{
Host::AddKeyedOSDMessage("gamedb_disable_pgxp_culling",
TRANSLATE_STR("OSDMessage", "PGXP culling disabled by game settings."),
osd_duration);
TRANSLATE_STR("OSDMessage", "PGXP culling disabled by game settings."), osd_duration);
}
settings.gpu_pgxp_culling = false;
@ -364,8 +356,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
{
Host::AddKeyedOSDMessage(
"gamedb_disable_pgxp_texture",
TRANSLATE_STR("OSDMessage", "PGXP perspective corrected textures disabled by game settings."),
osd_duration);
TRANSLATE_STR("OSDMessage", "PGXP perspective corrected textures disabled by game settings."), osd_duration);
}
settings.gpu_pgxp_texture_correction = false;
@ -378,8 +369,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
{
Host::AddKeyedOSDMessage(
"gamedb_disable_pgxp_texture",
TRANSLATE_STR("OSDMessage", "PGXP perspective corrected colors disabled by game settings."),
osd_duration);
TRANSLATE_STR("OSDMessage", "PGXP perspective corrected colors disabled by game settings."), osd_duration);
}
settings.gpu_pgxp_color_correction = false;
@ -390,8 +380,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (display_osd_messages && settings.gpu_pgxp_enable && !settings.gpu_pgxp_vertex_cache)
{
Host::AddKeyedOSDMessage("gamedb_force_pgxp_vertex_cache",
TRANSLATE_STR("OSDMessage", "PGXP vertex cache forced by game settings."),
osd_duration);
TRANSLATE_STR("OSDMessage", "PGXP vertex cache forced by game settings."), osd_duration);
}
settings.gpu_pgxp_vertex_cache = true;
@ -402,8 +391,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (display_osd_messages && settings.gpu_pgxp_enable && !settings.gpu_pgxp_cpu)
{
Host::AddKeyedOSDMessage("gamedb_force_pgxp_cpu",
TRANSLATE_STR("OSDMessage", "PGXP CPU mode forced by game settings."),
osd_duration);
TRANSLATE_STR("OSDMessage", "PGXP CPU mode forced by game settings."), osd_duration);
}
settings.gpu_pgxp_cpu = true;
@ -472,17 +460,15 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (!supported_controller_string.IsEmpty())
supported_controller_string.AppendString(", ");
supported_controller_string.AppendString(
TRANSLATE("ControllerType", Settings::GetControllerTypeDisplayName(supported_ctype)));
supported_controller_string.AppendString(Settings::GetControllerTypeDisplayName(supported_ctype));
}
Host::AddKeyedFormattedOSDMessage(
"gamedb_controller_unsupported", 30.0f,
TRANSLATE("OSDMessage",
"Controller in port %u (%s) is not supported for %s.\nSupported controllers: "
"%s\nPlease configure a supported controller from the list above."),
i + 1u, TRANSLATE("ControllerType", Settings::GetControllerTypeDisplayName(ctype)),
System::GetGameTitle().c_str(), supported_controller_string.GetCharArray());
TRANSLATE("OSDMessage", "Controller in port %u (%s) is not supported for %s.\nSupported controllers: "
"%s\nPlease configure a supported controller from the list above."),
i + 1u, Settings::GetControllerTypeDisplayName(ctype), System::GetGameTitle().c_str(),
supported_controller_string.GetCharArray());
}
}
}

View file

@ -107,7 +107,7 @@ const char* GameList::GetEntryTypeDisplayName(EntryType type)
static std::array<const char*, static_cast<int>(EntryType::Count)> names = {
{TRANSLATE_NOOP("GameList", "Disc"), TRANSLATE_NOOP("GameList", "PS-EXE"), TRANSLATE_NOOP("GameList", "Playlist"),
TRANSLATE_NOOP("GameList", "PSF")}};
return names[static_cast<int>(type)];
return Host::TranslateToCString("GameList", names[static_cast<int>(type)]);
}
bool GameList::IsGameListLoaded()

View file

@ -11,9 +11,9 @@
#include "common/string_util.h"
#include "controller.h"
#include "host.h"
#include "util/host_display.h"
#include "host_settings.h"
#include "system.h"
#include "util/host_display.h"
#include <algorithm>
#include <array>
#include <cctype>
@ -644,8 +644,7 @@ void Settings::FixIncompatibleSettings(bool display_osd_messages)
{
Host::AddKeyedOSDMessage(
"pgxp_disabled_sw",
TRANSLATE_STR("OSDMessage", "PGXP is incompatible with the software renderer, disabling PGXP."),
10.0f);
TRANSLATE_STR("OSDMessage", "PGXP is incompatible with the software renderer, disabling PGXP."), 10.0f);
}
g_settings.gpu_pgxp_enable = false;
}
@ -662,16 +661,15 @@ void Settings::FixIncompatibleSettings(bool display_osd_messages)
#if defined(__ANDROID__) && defined(__arm__) && !defined(__aarch64__) && !defined(_M_ARM64)
if (g_settings.rewind_enable)
{
Host::AddKeyedOSDMessage(
"rewind_disabled_android",
TRANSLATE_STR("OSDMessage", "Rewind is not supported on 32-bit ARM for Android."), 30.0f);
Host::AddKeyedOSDMessage("rewind_disabled_android",
TRANSLATE_STR("OSDMessage", "Rewind is not supported on 32-bit ARM for Android."), 30.0f);
g_settings.rewind_enable = false;
}
if (g_settings.IsRunaheadEnabled())
{
Host::AddKeyedOSDMessage(
"rewind_disabled_android",
TRANSLATE_STR("OSDMessage", "Runahead is not supported on 32-bit ARM for Android."), 30.0f);
Host::AddKeyedOSDMessage("rewind_disabled_android",
TRANSLATE_STR("OSDMessage", "Runahead is not supported on 32-bit ARM for Android."),
30.0f);
g_settings.runahead_frames = 0;
}
#endif
@ -679,8 +677,7 @@ void Settings::FixIncompatibleSettings(bool display_osd_messages)
if (g_settings.IsRunaheadEnabled() && g_settings.rewind_enable)
{
Host::AddKeyedOSDMessage("rewind_disabled_android",
TRANSLATE_STR("OSDMessage", "Rewind is disabled because runahead is enabled."),
10.0f);
TRANSLATE_STR("OSDMessage", "Rewind is disabled because runahead is enabled."), 10.0f);
g_settings.rewind_enable = false;
}
@ -728,8 +725,8 @@ static std::array<const char*, LOGLEVEL_COUNT> s_log_level_names = {
static std::array<const char*, LOGLEVEL_COUNT> s_log_level_display_names = {
{TRANSLATE_NOOP("LogLevel", "None"), TRANSLATE_NOOP("LogLevel", "Error"), TRANSLATE_NOOP("LogLevel", "Warning"),
TRANSLATE_NOOP("LogLevel", "Performance"), TRANSLATE_NOOP("LogLevel", "Information"),
TRANSLATE_NOOP("LogLevel", "Verbose"), TRANSLATE_NOOP("LogLevel", "Developer"), TRANSLATE_NOOP("LogLevel", "Profile"),
TRANSLATE_NOOP("LogLevel", "Debug"), TRANSLATE_NOOP("LogLevel", "Trace")}};
TRANSLATE_NOOP("LogLevel", "Verbose"), TRANSLATE_NOOP("LogLevel", "Developer"),
TRANSLATE_NOOP("LogLevel", "Profile"), TRANSLATE_NOOP("LogLevel", "Debug"), TRANSLATE_NOOP("LogLevel", "Trace")}};
std::optional<LOGLEVEL> Settings::ParseLogLevelName(const char* str)
{
@ -752,13 +749,14 @@ const char* Settings::GetLogLevelName(LOGLEVEL level)
const char* Settings::GetLogLevelDisplayName(LOGLEVEL level)
{
return s_log_level_display_names[static_cast<int>(level)];
return Host::TranslateToCString("LogLevel", s_log_level_display_names[static_cast<int>(level)]);
}
static std::array<const char*, 4> s_console_region_names = {{"Auto", "NTSC-J", "NTSC-U", "PAL"}};
static std::array<const char*, 4> s_console_region_display_names = {
{TRANSLATE_NOOP("ConsoleRegion", "Auto-Detect"), TRANSLATE_NOOP("ConsoleRegion", "NTSC-J (Japan)"),
TRANSLATE_NOOP("ConsoleRegion", "NTSC-U/C (US, Canada)"), TRANSLATE_NOOP("ConsoleRegion", "PAL (Europe, Australia)")}};
TRANSLATE_NOOP("ConsoleRegion", "NTSC-U/C (US, Canada)"),
TRANSLATE_NOOP("ConsoleRegion", "PAL (Europe, Australia)")}};
std::optional<ConsoleRegion> Settings::ParseConsoleRegionName(const char* str)
{
@ -781,7 +779,7 @@ const char* Settings::GetConsoleRegionName(ConsoleRegion region)
const char* Settings::GetConsoleRegionDisplayName(ConsoleRegion region)
{
return s_console_region_display_names[static_cast<int>(region)];
return Host::TranslateToCString("ConsoleRegion", s_console_region_display_names[static_cast<int>(region)]);
}
static std::array<const char*, 5> s_disc_region_names = {{"NTSC-J", "NTSC-U", "PAL", "Other", "Non-PS1"}};
@ -811,7 +809,7 @@ const char* Settings::GetDiscRegionName(DiscRegion region)
const char* Settings::GetDiscRegionDisplayName(DiscRegion region)
{
return s_disc_region_display_names[static_cast<int>(region)];
return Host::TranslateToCString("DiscRegion", s_disc_region_display_names[static_cast<int>(region)]);
}
static std::array<const char*, 3> s_cpu_execution_mode_names = {{"Interpreter", "CachedInterpreter", "Recompiler"}};
@ -841,7 +839,7 @@ const char* Settings::GetCPUExecutionModeName(CPUExecutionMode mode)
const char* Settings::GetCPUExecutionModeDisplayName(CPUExecutionMode mode)
{
return s_cpu_execution_mode_display_names[static_cast<u8>(mode)];
return Host::TranslateToCString("CPUExecutionMode", s_cpu_execution_mode_display_names[static_cast<u8>(mode)]);
}
static std::array<const char*, static_cast<u32>(CPUFastmemMode::Count)> s_cpu_fastmem_mode_names = {
@ -872,7 +870,7 @@ const char* Settings::GetCPUFastmemModeName(CPUFastmemMode mode)
const char* Settings::GetCPUFastmemModeDisplayName(CPUFastmemMode mode)
{
return s_cpu_fastmem_mode_display_names[static_cast<u8>(mode)];
return Host::TranslateToCString("CPUFastmemMode", s_cpu_fastmem_mode_display_names[static_cast<u8>(mode)]);
}
static constexpr auto s_gpu_renderer_names = make_array(
@ -919,7 +917,7 @@ const char* Settings::GetRendererName(GPURenderer renderer)
const char* Settings::GetRendererDisplayName(GPURenderer renderer)
{
return s_gpu_renderer_display_names[static_cast<int>(renderer)];
return Host::TranslateToCString("GPURenderer", s_gpu_renderer_display_names[static_cast<int>(renderer)]);
}
RenderAPI Settings::GetRenderAPIForRenderer(GPURenderer renderer)
@ -976,13 +974,14 @@ const char* Settings::GetTextureFilterName(GPUTextureFilter filter)
const char* Settings::GetTextureFilterDisplayName(GPUTextureFilter filter)
{
return s_texture_filter_display_names[static_cast<int>(filter)];
return Host::TranslateToCString("GPUTextureFilter", s_texture_filter_display_names[static_cast<int>(filter)]);
}
static constexpr auto s_downsample_mode_names = make_array("Disabled", "Box", "Adaptive");
static constexpr auto s_downsample_mode_display_names = make_array(
TRANSLATE_NOOP("GPUDownsampleMode", "Disabled"), TRANSLATE_NOOP("GPUDownsampleMode", "Box (Downsample 3D/Smooth All)"),
TRANSLATE_NOOP("GPUDownsampleMode", "Adaptive (Preserve 3D/Smooth 2D)"));
static constexpr auto s_downsample_mode_display_names =
make_array(TRANSLATE_NOOP("GPUDownsampleMode", "Disabled"),
TRANSLATE_NOOP("GPUDownsampleMode", "Box (Downsample 3D/Smooth All)"),
TRANSLATE_NOOP("GPUDownsampleMode", "Adaptive (Preserve 3D/Smooth 2D)"));
std::optional<GPUDownsampleMode> Settings::ParseDownsampleModeName(const char* str)
{
@ -1005,7 +1004,7 @@ const char* Settings::GetDownsampleModeName(GPUDownsampleMode mode)
const char* Settings::GetDownsampleModeDisplayName(GPUDownsampleMode mode)
{
return s_downsample_mode_display_names[static_cast<int>(mode)];
return Host::TranslateToCString("GPUDownsampleMode", s_downsample_mode_display_names[static_cast<int>(mode)]);
}
static std::array<const char*, 3> s_display_crop_mode_names = {{"None", "Overscan", "Borders"}};
@ -1034,12 +1033,13 @@ const char* Settings::GetDisplayCropModeName(DisplayCropMode crop_mode)
const char* Settings::GetDisplayCropModeDisplayName(DisplayCropMode crop_mode)
{
return s_display_crop_mode_display_names[static_cast<int>(crop_mode)];
return Host::TranslateToCString("DisplayCropMode", s_display_crop_mode_display_names[static_cast<int>(crop_mode)]);
}
static std::array<const char*, static_cast<size_t>(DisplayAspectRatio::Count)> s_display_aspect_ratio_names = {
{TRANSLATE_NOOP("DisplayAspectRatio", "Auto (Game Native)"), TRANSLATE_NOOP("DisplayAspectRatio", "Auto (Match Window)"),
TRANSLATE_NOOP("DisplayAspectRatio", "Custom"), "4:3", "16:9", "19:9", "20:9", "PAR 1:1"}};
{TRANSLATE_NOOP("DisplayAspectRatio", "Auto (Game Native)"),
TRANSLATE_NOOP("DisplayAspectRatio", "Auto (Match Window)"), TRANSLATE_NOOP("DisplayAspectRatio", "Custom"), "4:3",
"16:9", "19:9", "20:9", "PAR 1:1"}};
static constexpr std::array<float, static_cast<size_t>(DisplayAspectRatio::Count)> s_display_aspect_ratio_values = {
{-1.0f, -1.0f, -1.0f, 4.0f / 3.0f, 16.0f / 9.0f, 19.0f / 9.0f, 20.0f / 9.0f, -1.0f}};
@ -1062,6 +1062,11 @@ const char* Settings::GetDisplayAspectRatioName(DisplayAspectRatio ar)
return s_display_aspect_ratio_names[static_cast<int>(ar)];
}
const char* Settings::GetDisplayAspectRatioDisplayName(DisplayAspectRatio ar)
{
return Host::TranslateToCString("DisplayAspectRatio", s_display_aspect_ratio_names[static_cast<int>(ar)]);
}
float Settings::GetDisplayAspectRatioValue() const
{
switch (display_aspect_ratio)
@ -1165,16 +1170,16 @@ const char* Settings::GetAudioBackendName(AudioBackend backend)
const char* Settings::GetAudioBackendDisplayName(AudioBackend backend)
{
return s_audio_backend_display_names[static_cast<int>(backend)];
return Host::TranslateToCString("AudioBackend", s_audio_backend_display_names[static_cast<int>(backend)]);
}
static std::array<const char*, 7> s_controller_type_names = {
{"None", "DigitalController", "AnalogController", "AnalogJoystick", "GunCon", "PlayStationMouse", "NeGcon"}};
static std::array<const char*, 7> s_controller_display_names = {
{TRANSLATE_NOOP("ControllerType", "None"), TRANSLATE_NOOP("ControllerType", "Digital Controller"),
TRANSLATE_NOOP("ControllerType", "Analog Controller (DualShock)"), TRANSLATE_NOOP("ControllerType", "Analog Joystick"),
TRANSLATE_NOOP("ControllerType", "GunCon"), TRANSLATE_NOOP("ControllerType", "PlayStation Mouse"),
TRANSLATE_NOOP("ControllerType", "NeGcon")}};
TRANSLATE_NOOP("ControllerType", "Analog Controller (DualShock)"),
TRANSLATE_NOOP("ControllerType", "Analog Joystick"), TRANSLATE_NOOP("ControllerType", "GunCon"),
TRANSLATE_NOOP("ControllerType", "PlayStation Mouse"), TRANSLATE_NOOP("ControllerType", "NeGcon")}};
std::optional<ControllerType> Settings::ParseControllerTypeName(const char* str)
{
@ -1197,7 +1202,7 @@ const char* Settings::GetControllerTypeName(ControllerType type)
const char* Settings::GetControllerTypeDisplayName(ControllerType type)
{
return s_controller_display_names[static_cast<int>(type)];
return Host::TranslateToCString("ControllerType", s_controller_display_names[static_cast<int>(type)]);
}
static std::array<const char*, 6> s_memory_card_type_names = {
@ -1230,7 +1235,7 @@ const char* Settings::GetMemoryCardTypeName(MemoryCardType type)
const char* Settings::GetMemoryCardTypeDisplayName(MemoryCardType type)
{
return s_memory_card_type_display_names[static_cast<int>(type)];
return Host::TranslateToCString("MemoryCardType", s_memory_card_type_display_names[static_cast<int>(type)]);
}
std::string Settings::GetDefaultSharedMemoryCardName(u32 slot)
@ -1283,7 +1288,7 @@ const char* Settings::GetMultitapModeName(MultitapMode mode)
const char* Settings::GetMultitapModeDisplayName(MultitapMode mode)
{
return s_multitap_enable_mode_display_names[static_cast<size_t>(mode)];
return Host::TranslateToCString("MultitapMode", s_multitap_enable_mode_display_names[static_cast<size_t>(mode)]);
}
std::string EmuFolders::AppRoot;

View file

@ -374,6 +374,7 @@ struct Settings
static std::optional<DisplayAspectRatio> ParseDisplayAspectRatio(const char* str);
static const char* GetDisplayAspectRatioName(DisplayAspectRatio ar);
static const char* GetDisplayAspectRatioDisplayName(DisplayAspectRatio ar);
static std::optional<DisplayAlignment> ParseDisplayAlignment(const char* str);
static const char* GetDisplayAlignmentName(DisplayAlignment alignment);

View file

@ -4387,9 +4387,8 @@ void System::ToggleWidescreen()
{
Host::AddKeyedOSDMessage(
"WidescreenHack",
fmt::format(
TRANSLATE_FS("OSDMessage", "Widescreen hack is now enabled, and aspect ratio is set to {}."),
TRANSLATE("DisplayAspectRatio", Settings::GetDisplayAspectRatioName(g_settings.display_aspect_ratio))),
fmt::format(TRANSLATE_FS("OSDMessage", "Widescreen hack is now enabled, and aspect ratio is set to {}."),
Settings::GetDisplayAspectRatioDisplayName(g_settings.display_aspect_ratio)),
5.0f);
}
else
@ -4397,8 +4396,7 @@ void System::ToggleWidescreen()
Host::AddKeyedOSDMessage(
"WidescreenHack",
fmt::format(TRANSLATE_FS("OSDMessage", "Widescreen hack is now disabled, and aspect ratio is set to {}."),
TRANSLATE("DisplayAspectRatio", Settings::GetDisplayAspectRatioName(g_settings.display_aspect_ratio)),
5.0f));
Settings::GetDisplayAspectRatioDisplayName(g_settings.display_aspect_ratio), 5.0f));
}
GTE::UpdateAspectRatio();

View file

@ -112,7 +112,7 @@ template<typename T>
static QComboBox* addChoiceTweakOption(SettingsDialog* dialog, QTableWidget* table, QString name, std::string section,
std::string key, std::optional<T> (*parse_callback)(const char*),
const char* (*get_value_callback)(T), const char* (*get_display_callback)(T),
const char* tr_context, u32 num_values, T default_value)
u32 num_values, T default_value)
{
const int row = table->rowCount();
@ -124,7 +124,7 @@ static QComboBox* addChoiceTweakOption(SettingsDialog* dialog, QTableWidget* tab
QComboBox* cb = new QComboBox(table);
for (u32 i = 0; i < num_values; i++)
cb->addItem(qApp->translate(tr_context, get_display_callback(static_cast<T>(i))));
cb->addItem(QString::fromUtf8(get_display_callback(static_cast<T>(i))));
if (!section.empty() || !key.empty())
{
@ -229,7 +229,7 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(SettingsDialog* dialog, QWidget*
m_ui.setupUi(this);
for (u32 i = 0; i < static_cast<u32>(LOGLEVEL_COUNT); i++)
m_ui.logLevel->addItem(qApp->translate("LogLevel", Settings::GetLogLevelDisplayName(static_cast<LOGLEVEL>(i))));
m_ui.logLevel->addItem(QString::fromUtf8(Settings::GetLogLevelDisplayName(static_cast<LOGLEVEL>(i))));
SettingWidgetBinder::BindWidgetToEnumSetting(sif, m_ui.logLevel, "Logging", "LogLevel", &Settings::ParseLogLevelName,
&Settings::GetLogLevelName, Settings::DEFAULT_LOG_LEVEL);
@ -303,8 +303,8 @@ void AdvancedSettingsWidget::addTweakOptions()
"RecompilerBlockLinking", true);
addChoiceTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Enable Recompiler Fast Memory Access"), "CPU",
"FastmemMode", Settings::ParseCPUFastmemMode, Settings::GetCPUFastmemModeName,
Settings::GetCPUFastmemModeDisplayName, "CPUFastmemMode",
static_cast<u32>(CPUFastmemMode::Count), Settings::DEFAULT_CPU_FASTMEM_MODE);
Settings::GetCPUFastmemModeDisplayName, static_cast<u32>(CPUFastmemMode::Count),
Settings::DEFAULT_CPU_FASTMEM_MODE);
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Use Old MDEC Routines"), "Hacks", "UseOldMDECRoutines",
false);

View file

@ -19,10 +19,7 @@ AudioSettingsWidget::AudioSettingsWidget(SettingsDialog* dialog, QWidget* parent
m_ui.setupUi(this);
for (u32 i = 0; i < static_cast<u32>(AudioBackend::Count); i++)
{
m_ui.audioBackend->addItem(
qApp->translate("AudioBackend", Settings::GetAudioBackendDisplayName(static_cast<AudioBackend>(i))));
}
m_ui.audioBackend->addItem(QString::fromUtf8(Settings::GetAudioBackendDisplayName(static_cast<AudioBackend>(i))));
SettingWidgetBinder::BindWidgetToEnumSetting(sif, m_ui.audioBackend, "Audio", "Backend", &Settings::ParseAudioBackend,
&Settings::GetAudioBackendName, Settings::DEFAULT_AUDIO_BACKEND);

View file

@ -18,15 +18,12 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(SettingsDialog* dialog, QWidget* pa
m_ui.setupUi(this);
for (u32 i = 0; i < static_cast<u32>(ConsoleRegion::Count); i++)
{
m_ui.region->addItem(
qApp->translate("ConsoleRegion", Settings::GetConsoleRegionDisplayName(static_cast<ConsoleRegion>(i))));
}
m_ui.region->addItem(QString::fromUtf8(Settings::GetConsoleRegionDisplayName(static_cast<ConsoleRegion>(i))));
for (u32 i = 0; i < static_cast<u32>(CPUExecutionMode::Count); i++)
{
m_ui.cpuExecutionMode->addItem(
qApp->translate("CPUExecutionMode", Settings::GetCPUExecutionModeDisplayName(static_cast<CPUExecutionMode>(i))));
QString::fromUtf8(Settings::GetCPUExecutionModeDisplayName(static_cast<CPUExecutionMode>(i))));
}
static constexpr float TIME_PER_SECTOR_DOUBLE_SPEED = 1000.0f / 150.0f;

View file

@ -74,8 +74,7 @@ DisplaySettingsWidget::DisplaySettingsWidget(SettingsDialog* dialog, QWidget* pa
onAspectRatioChanged();
dialog->registerWidgetHelp(
m_ui.renderer, tr("Renderer"),
qApp->translate("GPURenderer", Settings::GetRendererDisplayName(Settings::DEFAULT_GPU_RENDERER)),
m_ui.renderer, tr("Renderer"), QString::fromUtf8(Settings::GetRendererDisplayName(Settings::DEFAULT_GPU_RENDERER)),
tr("Chooses the backend to use for rendering the console/game visuals. <br>Depending on your system and hardware, "
"Direct3D 11 and OpenGL hardware backends may be available. <br>The software renderer offers the best "
"compatibility, but is the slowest and does not offer any enhancements."));
@ -88,19 +87,19 @@ DisplaySettingsWidget::DisplaySettingsWidget(SettingsDialog* dialog, QWidget* pa
tr("Chooses the fullscreen resolution and frequency."));
dialog->registerWidgetHelp(
m_ui.displayAspectRatio, tr("Aspect Ratio"),
qApp->translate("DisplayAspectRatio", Settings::GetDisplayAspectRatioName(Settings::DEFAULT_DISPLAY_ASPECT_RATIO)),
QString::fromUtf8(Settings::GetDisplayAspectRatioDisplayName(Settings::DEFAULT_DISPLAY_ASPECT_RATIO)),
tr("Changes the aspect ratio used to display the console's output to the screen. The default is Auto (Game Native) "
"which automatically adjusts the aspect ratio to match how a game would be shown on a typical TV of the era."));
dialog->registerWidgetHelp(
m_ui.displayCropMode, tr("Crop Mode"),
qApp->translate("DisplayCropMode", Settings::GetDisplayCropModeDisplayName(Settings::DEFAULT_DISPLAY_CROP_MODE)),
QString::fromUtf8(Settings::GetDisplayCropModeDisplayName(Settings::DEFAULT_DISPLAY_CROP_MODE)),
tr("Determines how much of the area typically not visible on a consumer TV set to crop/hide. <br>"
"Some games display content in the overscan area, or use it for screen effects. <br>May "
"not display correctly with the \"All Borders\" setting. \"Only Overscan\" offers a good "
"compromise between stability and hiding black borders."));
dialog->registerWidgetHelp(
m_ui.displayAlignment, tr("Position"),
qApp->translate("DisplayCropMode", Settings::GetDisplayAlignmentDisplayName(Settings::DEFAULT_DISPLAY_ALIGNMENT)),
QString::fromUtf8(Settings::GetDisplayAlignmentDisplayName(Settings::DEFAULT_DISPLAY_ALIGNMENT)),
tr("Determines the position on the screen when black borders must be added."));
dialog->registerWidgetHelp(m_ui.displayLinearFiltering, tr("Linear Upscaling"), tr("Checked"),
tr("Uses bilinear texture filtering when displaying the console's framebuffer to the "
@ -164,26 +163,25 @@ void DisplaySettingsWidget::setupAdditionalUi()
{
for (u32 i = 0; i < static_cast<u32>(GPURenderer::Count); i++)
{
m_ui.renderer->addItem(
qApp->translate("GPURenderer", Settings::GetRendererDisplayName(static_cast<GPURenderer>(i))));
m_ui.renderer->addItem(QString::fromUtf8(Settings::GetRendererDisplayName(static_cast<GPURenderer>(i))));
}
for (u32 i = 0; i < static_cast<u32>(DisplayAspectRatio::Count); i++)
{
m_ui.displayAspectRatio->addItem(
qApp->translate("DisplayAspectRatio", Settings::GetDisplayAspectRatioName(static_cast<DisplayAspectRatio>(i))));
QString::fromUtf8(Settings::GetDisplayAspectRatioDisplayName(static_cast<DisplayAspectRatio>(i))));
}
for (u32 i = 0; i < static_cast<u32>(DisplayCropMode::Count); i++)
{
m_ui.displayCropMode->addItem(
qApp->translate("DisplayCropMode", Settings::GetDisplayCropModeDisplayName(static_cast<DisplayCropMode>(i))));
QString::fromUtf8(Settings::GetDisplayCropModeDisplayName(static_cast<DisplayCropMode>(i))));
}
for (u32 i = 0; i < static_cast<u32>(DisplayAlignment::Count); i++)
{
m_ui.displayAlignment->addItem(
qApp->translate("DisplayAlignment", Settings::GetDisplayAlignmentDisplayName(static_cast<DisplayAlignment>(i))));
QString::fromUtf8(Settings::GetDisplayAlignmentDisplayName(static_cast<DisplayAlignment>(i))));
}
}

View file

@ -91,7 +91,7 @@ EnhancementSettingsWidget::EnhancementSettingsWidget(SettingsDialog* dialog, QWi
"Only applies to the hardware renderers."));
dialog->registerWidgetHelp(
m_ui.textureFiltering, tr("Texture Filtering"),
qApp->translate("GPUTextureFilter", Settings::GetTextureFilterDisplayName(GPUTextureFilter::Nearest)),
QString::fromUtf8(Settings::GetTextureFilterDisplayName(GPUTextureFilter::Nearest)),
tr("Smooths out the blockiness of magnified textures on 3D object by using filtering. <br>Will have a "
"greater effect on higher resolution scales. Only applies to the hardware renderers. <br>The JINC2 and "
"especially xBR filtering modes are very demanding, and may not be worth the speed penalty."));
@ -148,13 +148,13 @@ void EnhancementSettingsWidget::setupAdditionalUi()
for (u32 i = 0; i < static_cast<u32>(GPUTextureFilter::Count); i++)
{
m_ui.textureFiltering->addItem(
qApp->translate("GPUTextureFilter", Settings::GetTextureFilterDisplayName(static_cast<GPUTextureFilter>(i))));
QString::fromUtf8(Settings::GetTextureFilterDisplayName(static_cast<GPUTextureFilter>(i))));
}
for (u32 i = 0; i < static_cast<u32>(GPUDownsampleMode::Count); i++)
{
m_ui.gpuDownsampleMode->addItem(
qApp->translate("GPUDownsampleMode", Settings::GetDownsampleModeDisplayName(static_cast<GPUDownsampleMode>(i))));
QString::fromUtf8(Settings::GetDownsampleModeDisplayName(static_cast<GPUDownsampleMode>(i))));
}
}

View file

@ -34,14 +34,14 @@ GameSummaryWidget::GameSummaryWidget(const std::string& path, const std::string&
for (u32 i = 0; i < static_cast<u32>(DiscRegion::Count); i++)
{
m_ui.region->addItem(QtUtils::GetIconForRegion(static_cast<DiscRegion>(i)),
qApp->translate("DiscRegion", Settings::GetDiscRegionDisplayName(static_cast<DiscRegion>(i))));
QString::fromUtf8(Settings::GetDiscRegionDisplayName(static_cast<DiscRegion>(i))));
}
for (u32 i = 0; i < static_cast<u32>(GameDatabase::CompatibilityRating::Count); i++)
{
m_ui.compatibility->addItem(QtUtils::GetIconForCompatibility(static_cast<GameDatabase::CompatibilityRating>(i)),
qApp->translate("GameListCompatibilityRating", GameDatabase::GetCompatibilityRatingDisplayName(
static_cast<GameDatabase::CompatibilityRating>(i))));
QString::fromUtf8(GameDatabase::GetCompatibilityRatingDisplayName(
static_cast<GameDatabase::CompatibilityRating>(i))));
}
populateUi(path, serial, region, entry);
@ -113,8 +113,7 @@ void GameSummaryWidget::populateUi(const std::string& path, const std::string& s
{
if (!controllers.isEmpty())
controllers.append(", ");
controllers.append(
qApp->translate("ControllerType", Settings::GetControllerTypeDisplayName(static_cast<ControllerType>(i))));
controllers.append(Settings::GetControllerTypeDisplayName(static_cast<ControllerType>(i)));
}
}
}

View file

@ -1567,8 +1567,8 @@ void MainWindow::setupAdditionalUi()
for (u32 i = 0; i < static_cast<u32>(CPUExecutionMode::Count); i++)
{
const CPUExecutionMode mode = static_cast<CPUExecutionMode>(i);
QAction* action = m_ui.menuCPUExecutionMode->addAction(
qApp->translate("CPUExecutionMode", Settings::GetCPUExecutionModeDisplayName(mode)));
QAction* action =
m_ui.menuCPUExecutionMode->addAction(QString::fromUtf8(Settings::GetCPUExecutionModeDisplayName(mode)));
action->setCheckable(true);
connect(action, &QAction::triggered, [this, mode]() {
Host::SetBaseStringSettingValue("CPU", "ExecutionMode", Settings::GetCPUExecutionModeName(mode));
@ -1582,8 +1582,7 @@ void MainWindow::setupAdditionalUi()
for (u32 i = 0; i < static_cast<u32>(GPURenderer::Count); i++)
{
const GPURenderer renderer = static_cast<GPURenderer>(i);
QAction* action =
m_ui.menuRenderer->addAction(qApp->translate("GPURenderer", Settings::GetRendererDisplayName(renderer)));
QAction* action = m_ui.menuRenderer->addAction(QString::fromUtf8(Settings::GetRendererDisplayName(renderer)));
action->setCheckable(true);
connect(action, &QAction::triggered, [this, renderer]() {
Host::SetBaseStringSettingValue("GPU", "Renderer", Settings::GetRendererName(renderer));
@ -1597,8 +1596,8 @@ void MainWindow::setupAdditionalUi()
for (u32 i = 0; i < static_cast<u32>(DisplayCropMode::Count); i++)
{
const DisplayCropMode crop_mode = static_cast<DisplayCropMode>(i);
QAction* action = m_ui.menuCropMode->addAction(
qApp->translate("DisplayCropMode", Settings::GetDisplayCropModeDisplayName(crop_mode)));
QAction* action =
m_ui.menuCropMode->addAction(QString::fromUtf8(Settings::GetDisplayCropModeDisplayName(crop_mode)));
action->setCheckable(true);
connect(action, &QAction::triggered, [this, crop_mode]() {
Host::SetBaseStringSettingValue("Display", "CropMode", Settings::GetDisplayCropModeName(crop_mode));
@ -2335,8 +2334,8 @@ void MainWindow::updateDebugMenuCPUExecutionMode()
if (!current_mode.has_value())
return;
const QString current_mode_display_name(
qApp->translate("CPUExecutionMode", Settings::GetCPUExecutionModeDisplayName(current_mode.value())));
const QString current_mode_display_name =
QString::fromUtf8(Settings::GetCPUExecutionModeDisplayName(current_mode.value()));
for (QObject* obj : m_ui.menuCPUExecutionMode->children())
{
QAction* action = qobject_cast<QAction*>(obj);
@ -2353,8 +2352,8 @@ void MainWindow::updateDebugMenuGPURenderer()
if (!current_renderer.has_value())
return;
const QString current_renderer_display_name(
qApp->translate("GPURenderer", Settings::GetRendererDisplayName(current_renderer.value())));
const QString current_renderer_display_name =
QString::fromUtf8(Settings::GetRendererDisplayName(current_renderer.value()));
for (QObject* obj : m_ui.menuRenderer->children())
{
QAction* action = qobject_cast<QAction*>(obj);
@ -2370,8 +2369,8 @@ void MainWindow::updateDebugMenuCropMode()
if (!current_crop_mode.has_value())
return;
const QString current_crop_mode_display_name(
qApp->translate("DisplayCropMode", Settings::GetDisplayCropModeDisplayName(current_crop_mode.value())));
const QString current_crop_mode_display_name =
QString::fromUtf8(Settings::GetDisplayCropModeDisplayName(current_crop_mode.value()));
for (QObject* obj : m_ui.menuCropMode->children())
{
QAction* action = qobject_cast<QAction*>(obj);

View file

@ -118,7 +118,7 @@ void MemoryCardSettingsWidget::createPortSettingsUi(SettingsDialog* dialog, int
for (int i = 0; i < static_cast<int>(MemoryCardType::Count); i++)
{
ui->memory_card_type->addItem(
qApp->translate("MemoryCardType", Settings::GetMemoryCardTypeDisplayName(static_cast<MemoryCardType>(i))));
QString::fromUtf8(Settings::GetMemoryCardTypeDisplayName(static_cast<MemoryCardType>(i))));
}
const MemoryCardType default_value = (index == 0) ? MemoryCardType::PerGameTitle : MemoryCardType::None;