Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for MemCardPro2/.mc2 files #12157

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions pcsx2/SIO/Memcard/MemoryCardFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ void FileMemoryCard::Open()
}
}

if (fname.ends_with(".bin"))
if (fname.ends_with(".bin") || fname.ends_with(".mc2"))
{
std::string newname(fname + "x");
if (!ConvertNoECCtoRAW(fname.c_str(), newname.c_str()))
Expand Down Expand Up @@ -346,7 +346,7 @@ void FileMemoryCard::Close()
std::fclose(m_file[slot]);
m_file[slot] = nullptr;

if (m_filenames[slot].ends_with(".bin"))
if (m_filenames[slot].ends_with(".bin") || m_filenames[slot].ends_with(".mc2"))
{
const std::string name_in(m_filenames[slot] + 'x');
if (ConvertRAWtoNoECC(name_in.c_str(), m_filenames[slot].c_str()))
Expand Down Expand Up @@ -786,13 +786,14 @@ int FileMcd_ReIndex(uint port, uint slot, const std::string& filter)

static MemoryCardFileType GetMemoryCardFileTypeFromSize(s64 size)
{
if (size == (8 * MC2_MBSIZE))
// Handle both ecc and non ecc versions
if (size == (8 * MC2_MBSIZE) || size == _8mb)
return MemoryCardFileType::PS2_8MB;
else if (size == (16 * MC2_MBSIZE))
else if (size == (16 * MC2_MBSIZE) || size == _16mb)
return MemoryCardFileType::PS2_16MB;
else if (size == (32 * MC2_MBSIZE))
else if (size == (32 * MC2_MBSIZE) || size == _32mb)
return MemoryCardFileType::PS2_32MB;
else if (size == (64 * MC2_MBSIZE))
else if (size == (64 * MC2_MBSIZE) || size == _64mb)
return MemoryCardFileType::PS2_64MB;
else if (size == MCD_SIZE)
return MemoryCardFileType::PS1;
Expand Down Expand Up @@ -862,7 +863,8 @@ std::vector<AvailableMcdInfo> FileMcd_GetAvailableCards(bool include_in_use_card

// We only want relevant file types.
if (!(fd.FileName.ends_with(".ps2") || fd.FileName.ends_with(".mcr") ||
fd.FileName.ends_with(".mcd") || fd.FileName.ends_with(".bin")))
fd.FileName.ends_with(".mcd") || fd.FileName.ends_with(".bin") ||
fd.FileName.ends_with(".mc2")))
continue;

if (fd.Attributes & FILESYSTEM_FILE_ATTRIBUTE_DIRECTORY)
Expand Down
Loading