GameCube SRAM: Recalculate checksums after setting language.
This fixes a minor bug where the IPL thinks the SRAM has been corrupted and forces you to re-set date/time and settings when you change language in Config -> GameCube while not skipping the IPL on boot.
This commit is contained in:
1 parent
cf7178b4c2
commit
78903884e5
3 files changed
+15
No files matched your search
@@ -89,3 +89,16 @@ void SetCardFlashID(u8* buffer, u8 card_index)
|
||||
g_SRAM.flashID_chksum[card_index] = csum^0xFF;
|
||||
}
|
||||
|
||||
void FixSRAMChecksums()
|
||||
{
|
||||
u16 checksum = 0;
|
||||
u16 checksum_inv = 0;
|
||||
for (int i = 0x0C; i < 0x14; i += 2)
|
||||
{
|
||||
int value = (g_SRAM.p_SRAM[i] << 8) + g_SRAM.p_SRAM[i+1];
|
||||
checksum += value;
|
||||
checksum_inv += value ^ 0xFFFF;
|
||||
}
|
||||
g_SRAM.checksum = Common::swap16(checksum);
|
||||
g_SRAM.checksum_inv = Common::swap16(checksum_inv);
|
||||
}
|
||||
Reference in new issue
Block a user