mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-11 09:18:40 +12:00
Qt: Use localized game icons and titles
This commit is contained in:
parent
a1fa8dd701
commit
42ba0b6271
11 changed files with 197 additions and 49 deletions
|
@ -771,25 +771,40 @@ std::string Emulator::GetBackgroundPicturePath() const
|
|||
}
|
||||
|
||||
constexpr auto search_barrier = "barrier";
|
||||
const std::string locale_suffix = fmt::format("_%02d", static_cast<s32>(g_cfg.sys.language.get()));
|
||||
|
||||
std::initializer_list<std::string> testees =
|
||||
{
|
||||
m_sfo_dir + fmt::format("/PIC0%s.PNG", locale_suffix),
|
||||
m_sfo_dir + fmt::format("/PIC1%s.PNG", locale_suffix),
|
||||
m_sfo_dir + fmt::format("/PIC2%s.PNG", locale_suffix),
|
||||
m_sfo_dir + fmt::format("/PIC3%s.PNG", locale_suffix),
|
||||
search_barrier,
|
||||
m_sfo_dir + "/PIC0.PNG",
|
||||
m_sfo_dir + "/PIC1.PNG",
|
||||
m_sfo_dir + "/PIC2.PNG",
|
||||
m_sfo_dir + "/PIC3.PNG",
|
||||
search_barrier,
|
||||
!disc_dir.empty() ? (disc_dir + fmt::format("/PIC0%s.PNG", locale_suffix)) : disc_dir,
|
||||
!disc_dir.empty() ? (disc_dir + fmt::format("/PIC1%s.PNG", locale_suffix)) : disc_dir,
|
||||
!disc_dir.empty() ? (disc_dir + fmt::format("/PIC2%s.PNG", locale_suffix)) : disc_dir,
|
||||
!disc_dir.empty() ? (disc_dir + fmt::format("/PIC3%s.PNG", locale_suffix)) : disc_dir,
|
||||
search_barrier,
|
||||
!disc_dir.empty() ? (disc_dir + "/PIC0.PNG") : disc_dir,
|
||||
!disc_dir.empty() ? (disc_dir + "/PIC1.PNG") : disc_dir,
|
||||
!disc_dir.empty() ? (disc_dir + "/PIC2.PNG") : disc_dir,
|
||||
!disc_dir.empty() ? (disc_dir + "/PIC3.PNG") : disc_dir,
|
||||
search_barrier,
|
||||
m_sfo_dir + fmt::format("/ICON0%s.PNG", locale_suffix),
|
||||
search_barrier,
|
||||
m_sfo_dir + "/ICON0.PNG",
|
||||
search_barrier,
|
||||
!disc_dir.empty() ? (disc_dir + fmt::format("/ICON0%s.PNG", locale_suffix)) : disc_dir,
|
||||
search_barrier,
|
||||
!disc_dir.empty() ? (disc_dir + "/ICON0.PNG") : disc_dir,
|
||||
};
|
||||
|
||||
// Try to return the picture with the highest resultion
|
||||
// Try to return the picture with the highest resolution
|
||||
// Be naive and assume that its the one that spans over the most bytes
|
||||
usz max_file_size = 0;
|
||||
usz index_of_largest_file = umax;
|
||||
|
@ -1600,6 +1615,10 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch,
|
|||
g_backup_cfg.from_string(g_cfg.to_string());
|
||||
}
|
||||
|
||||
// Get localized title
|
||||
m_localized_title = std::string(psf::get_string(_psf, fmt::format("TITLE_%02d", static_cast<s32>(g_cfg.sys.language.get())), m_title));
|
||||
sys_log.notice("Localized Title: %s", GetLocalizedTitle());
|
||||
|
||||
// Set RTM usage
|
||||
g_use_rtm = utils::has_rtm() && (((utils::has_mpx() && !utils::has_tsx_force_abort()) && g_cfg.core.enable_TSX == tsx_usage::enabled) || g_cfg.core.enable_TSX == tsx_usage::forced);
|
||||
|
||||
|
@ -2176,15 +2195,19 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch,
|
|||
{
|
||||
sys_log.notice("Title was set from %s to %s", m_title, bdvd_title);
|
||||
m_title = bdvd_title;
|
||||
|
||||
const auto localized_title = psf::get_string(disc_psf_obj, fmt::format("TITLE_%02d", static_cast<s32>(g_cfg.sys.language.get())), m_title);
|
||||
if (m_localized_title != localized_title)
|
||||
{
|
||||
sys_log.notice("Localized Title was set from %s to %s", m_localized_title, localized_title);
|
||||
m_localized_title = std::move(localized_title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& c : m_title)
|
||||
{
|
||||
// Replace newlines with spaces
|
||||
if (c == '\n')
|
||||
c = ' ';
|
||||
}
|
||||
// Replace newlines with spaces
|
||||
std::replace(m_title.begin(), m_title.end(), '\n', ' ');
|
||||
std::replace(m_localized_title.begin(), m_localized_title.end(), '\n', ' ');
|
||||
|
||||
// Mount /host_root/ if necessary (special value)
|
||||
if (g_cfg.vfs.host_root)
|
||||
|
@ -3899,7 +3922,7 @@ std::string Emulator::GetFormattedTitle(double fps) const
|
|||
{
|
||||
rpcs3::title_format_data title_data;
|
||||
title_data.format = g_cfg.misc.title_format.to_string();
|
||||
title_data.title = GetTitle();
|
||||
title_data.title = GetLocalizedTitle();
|
||||
title_data.title_id = GetTitleID();
|
||||
title_data.renderer = g_cfg.video.renderer.to_string();
|
||||
title_data.vulkan_adapter = g_cfg.video.vk.adapter.to_string();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue