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:
parent
cf7178b4c2
commit
78903884e5
|
@ -116,6 +116,7 @@ CEXIIPL::CEXIIPL() :
|
|||
|
||||
// We Overwrite language selection here since it's possible on the GC to change the language as you please
|
||||
g_SRAM.lang = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage;
|
||||
FixSRAMChecksums();
|
||||
|
||||
WriteProtectMemory(m_pIPL, ROM_SIZE);
|
||||
m_uAddress = 0;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ union SRAM
|
|||
#pragma pack(pop)
|
||||
void InitSRAM();
|
||||
void SetCardFlashID(u8* buffer, u8 card_index);
|
||||
void FixSRAMChecksums();
|
||||
|
||||
extern SRAM sram_dump;
|
||||
extern SRAM g_SRAM;
|
||||
|
|
Loading…
Reference in New Issue