1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

High-Resolution Game Background for loading

This commit is contained in:
Elad 2024-11-04 09:43:52 +02:00
parent 7858053bb9
commit c782b45b97

View File

@ -732,37 +732,56 @@ std::string Emulator::GetBackgroundPicturePath() const
return path; return path;
} }
path = m_sfo_dir + "/PIC1.PNG"; std::string disc_dir = vfs::get("/dev_bdvd/PS3_GAME");
if (!fs::is_file(path)) if (m_sfo_dir == disc_dir)
{ {
const std::string disc_dir = vfs::get("/dev_bdvd/PS3_GAME"); disc_dir.clear();
if (disc_dir.empty())
{
// Fallback to ICON0.PNG
path = m_sfo_dir + "/ICON0.PNG";
} }
else
{
// Fallback to PIC1.PNG in disc dir
path = disc_dir + "/PIC1.PNG";
if (!fs::is_file(path)) std::initializer_list<std::string> testees =
{ {
// Fallback to ICON0.PNG in update dir m_sfo_dir + "/ICON0.PNG",
path = m_sfo_dir + "/ICON0.PNG"; m_sfo_dir + "/PIC0.PNG",
m_sfo_dir + "/PIC1.PNG",
m_sfo_dir + "/PIC2.PNG",
m_sfo_dir + "/PIC3.PNG",
disc_dir.empty() ? (disc_dir + "/ICON0.PNG") : disc_dir,
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,
};
if (!fs::is_file(path)) // Try to return the picture with the highest resultion
// 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;
for (usz index = 0; index < testees.size(); index++)
{ {
// Fallback to ICON0.PNG in disc dir const std::string& path = testees.begin()[index];
path = disc_dir + "/ICON0.PNG";
} fs::stat_t file_stat{};
if (path.empty() || !fs::get_stat(path, file_stat))
{
continue;
} }
if (max_file_size < file_stat.size)
{
max_file_size = file_stat.size;
index_of_largest_file = index;
} }
} }
return path; if (index_of_largest_file == umax)
{
return {};
}
return testees.begin()[index_of_largest_file];
} }
bool Emulator::BootRsxCapture(const std::string& path) bool Emulator::BootRsxCapture(const std::string& path)