Achievements: Implement the ELF suffix hack from CDVD when hashing

This commit is contained in:
Ty Lamontagne 2023-05-22 15:09:21 -04:00 committed by refractionpcsx2
parent 57581724cd
commit 1fa6614cd5
1 changed files with 12 additions and 1 deletions

View File

@ -1359,8 +1359,19 @@ std::optional<std::vector<u8>> Achievements::ReadELFFromCurrentDisc(const std::s
std::optional<std::vector<u8>> ret;
try
{
// ELF suffix hack. Taken from CDVD::loadElf
// MLB2k6 has an elf whose suffix is actually ;2
std::string filepath(elf_path);
const std::string::size_type semi_pos = filepath.rfind(';');
if (semi_pos != std::string::npos && std::string_view(filepath).substr(semi_pos) != ";1")
{
Console.Warning("(Achievements) Non-conforming version suffix (%s) detected and replaced.", elf_path.c_str());
filepath.erase(semi_pos);
filepath += ";1";
}
IsoFSCDVD isofs;
IsoFile file(isofs, elf_path);
IsoFile file(isofs, filepath);
const u32 size = file.getLength();
ret = std::vector<u8>();