-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsphinx_gci_gamecube.1sc
29 lines (22 loc) · 1.15 KB
/
sphinx_gci_gamecube.1sc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//------------------------------------------------
//--- 010 Editor v12.0.1 Script File
//
// File: Sphinx and the Cursed Mummy - GameCube save data (CRC32 regen script)
// Authors: Swyter
// Version: 2022.08.04
// Purpose: Recompute the CRC32 checksum that the Sphinx GameCube savedata seems to use for error correction.
// This will probably work for any other GCI saves, I think.
// Category: Game
//------------------------------------------------
Printf("\n\n--\n[+] Checksumming «%s»\n", GetFileName());
BigEndian();
uint64 data_end_offset = FileSize();
int64 old_checksum = ReadUInt(0x40); /* swy: the checksum is at offset 0x40, right at the end of the main header, there's some padding afterwards */
int64 new_checksum = Checksum(CHECKSUM_CRC32, 0x1c0, data_end_offset); /* swy: right after the header padding starts the verified chunk, right until the end */
Printf(
"\n[i] Old: %06X,\n New: %6X (%smatch)\n", old_checksum, new_checksum,
(old_checksum == new_checksum) ? "" : "didn't "
);
if (old_checksum != new_checksum)
WriteUInt(0x40, new_checksum); /* swy: overwrite it in place */
Printf("\n[+] Done\n");