From 1fa6614cd55e79add99c9ae398d76806abda9d36 Mon Sep 17 00:00:00 2001 From: Ty Lamontagne Date: Mon, 22 May 2023 15:09:21 -0400 Subject: [PATCH] Achievements: Implement the ELF suffix hack from CDVD when hashing --- pcsx2/Achievements.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pcsx2/Achievements.cpp b/pcsx2/Achievements.cpp index 496ece1f0b..43192b964e 100644 --- a/pcsx2/Achievements.cpp +++ b/pcsx2/Achievements.cpp @@ -1359,8 +1359,19 @@ std::optional> Achievements::ReadELFFromCurrentDisc(const std::s std::optional> 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();