Skip to content

Commit

Permalink
Settings: Translate display names in core
Browse files Browse the repository at this point in the history
Enables the values to show in the Big Picture UI.
  • Loading branch information
stenzek committed Aug 20, 2023
1 parent 8ba04a8 commit d09e505
Show file tree
Hide file tree
Showing 14 changed files with 105 additions and 125 deletions.
2 changes: 1 addition & 1 deletion src/core/fullscreen_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
62 changes: 24 additions & 38 deletions src/core/game_database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)]) :
"";
}

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/game_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading

0 comments on commit d09e505

Please sign in to comment.