GameDatabase: Fix compatibility rating localization

This commit is contained in:
Stenzek 2024-11-17 13:04:00 +10:00
parent 7a11b95490
commit 97d8a35108
No known key found for this signature in database
2 changed files with 6 additions and 10 deletions

View File

@ -6790,16 +6790,11 @@ void FullscreenUI::DrawGameList(const ImVec2& heading_size)
// compatibility // compatibility
ImGui::TextUnformatted(FSUI_CSTR("Compatibility: ")); ImGui::TextUnformatted(FSUI_CSTR("Compatibility: "));
ImGui::SameLine(); ImGui::SameLine();
if (selected_entry->dbentry && ImGui::Image(GetCachedTexture(selected_entry->GetCompatibilityIconFileName(), 88, 16), LayoutScale(88.0f, 16.0f));
selected_entry->dbentry->compatibility != GameDatabase::CompatibilityRating::Unknown) ImGui::SameLine();
{
ImGui::Image(GetCachedTexture(selected_entry->GetCompatibilityIconFileName(), 88, 16),
LayoutScale(88.0f, 16.0f));
ImGui::SameLine();
}
ImGui::Text(" (%s)", GameDatabase::GetCompatibilityRatingDisplayName( ImGui::Text(" (%s)", GameDatabase::GetCompatibilityRatingDisplayName(
selected_entry->dbentry ? selected_entry->dbentry->compatibility : (selected_entry && selected_entry->dbentry) ? selected_entry->dbentry->compatibility :
GameDatabase::CompatibilityRating::Unknown)); GameDatabase::CompatibilityRating::Unknown));
// play time // play time
ImGui::Text(FSUI_CSTR("Time Played: %s"), GameList::FormatTimespan(selected_entry->total_played_time).c_str()); ImGui::Text(FSUI_CSTR("Time Played: %s"), GameList::FormatTimespan(selected_entry->total_played_time).c_str());

View File

@ -291,7 +291,8 @@ const char* GameDatabase::GetCompatibilityRatingName(CompatibilityRating rating)
const char* GameDatabase::GetCompatibilityRatingDisplayName(CompatibilityRating rating) const char* GameDatabase::GetCompatibilityRatingDisplayName(CompatibilityRating rating)
{ {
return (rating >= CompatibilityRating::Unknown && rating < CompatibilityRating::Count) ? return (rating >= CompatibilityRating::Unknown && rating < CompatibilityRating::Count) ?
Host::TranslateToCString("GameDatabase", s_compatibility_rating_display_names[static_cast<size_t>(rating)]) : Host::TranslateToCString("GameDatabase", s_compatibility_rating_display_names[static_cast<size_t>(rating)],
"CompatibilityRating") :
""; "";
} }