Memcard: Fix ECC and spare bytes when converting cards to raw format

Masks the unused bit out of the second line parity byte and leaves the
remaining spare bytes erased (0xff) instead of zeroed.
This commit is contained in:
shawly
2026-10-07 14:10:14 -04:00
committed by Ty
parent e487304308
commit 874b5ab1e1
+4 -3
View File
@@ -78,7 +78,7 @@ static u32 CalculateECC(u8* buf)
} }
} }
return column_parity | (line_parity_0 << 8) | (line_parity_1 << 16); return column_parity | ((line_parity_0 & 0x7F) << 8) | (line_parity_1 << 16);
} }
static bool ConvertNoECCtoRAW(const char* file_in, const char* file_out) static bool ConvertNoECCtoRAW(const char* file_in, const char* file_out)
@@ -109,8 +109,9 @@ static bool ConvertNoECCtoRAW(const char* file_in, const char* file_out)
return false; return false;
} }
u32 nullbytes = 0; // unwritten spare reads back erased
if (std::fwrite(&nullbytes, sizeof(nullbytes), 1, fout.get()) != 1) const u32 unused = 0xffffffff;
if (std::fwrite(&unused, sizeof(unused), 1, fout.get()) != 1)
return false; return false;
} }