The current URL is datacrystal.tcrf.net.
F-Zero/SRAM map: Difference between revisions
m (added sram map) |
m (added some 0x template to data values) |
||
Line 2: | Line 2: | ||
The saveram .srm file is 2,048 (0x800) bytes long. It seems only 512 (0x200) bytes are used. A simple sum-of-bytes checksum is used on each of the 3 sections of ''best record'' time data. | The saveram .srm file is 2,048 (0x800) bytes long. It seems only 512 (0x200) bytes are used. A simple sum-of-bytes checksum is used on each of the 3 sections of ''best record'' time data. | ||
== File Format == | == File Format == | ||
Line 31: | Line 30: | ||
== FZERO string bytes == | == FZERO string bytes == | ||
The sram data begins and ends with 5 bytes FZERO ( | The sram data begins and ends with 5 bytes FZERO ({{0x|46}} {{0x|5A}} {{0x|45}} {{0x|52}} {{0x|4F}}). These 5 bytes are compared to the ROM location $00:8869 (PC file location 0x0869) and must match. | ||
Line 39: | Line 38: | ||
== Best Record format == | == Best Record format == | ||
Each ''best record'' uses 3 bytes. The upper 4 bits of the first byte defines which car set the record, and whether or not it was in practice mode. If the upper 4 bits are 0, then the record is ignored. The lower 4 bits of the first byte are the minutes. The second byte is the seconds. The third byte is the milliseconds. The game initializes all records to | Each ''best record'' uses 3 bytes. The upper 4 bits of the first byte defines which car set the record, and whether or not it was in practice mode. If the upper 4 bits are 0, then the record is ignored. The lower 4 bits of the first byte are the minutes. The second byte is the seconds. The third byte is the milliseconds. The game initializes all records to {{0x|09}} {{0x|59}} {{0x|59}}. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 51: | Line 49: | ||
!Milliseconds | !Milliseconds | ||
|- | |- | ||
| | |{{0x|B2}} {{0x|07}} {{0x|45}} | ||
|align="right"| 2 | |align="right"| 2 | ||
|align="right"| 7 | |align="right"| 7 | ||
Line 102: | Line 100: | ||
== League checksum == | == League checksum == | ||
Each League section contains 0xA5 bytes of ''best records'' followed by 2 bytes of checksum (stored little endian). To calculate the checksum, simply add each of the bytes together, and take the lower 16 bits of the total. Then you byte-swap the value and write that to the .srm. So if you add all of the 0xA5 bytes together and get | Each League section contains 0xA5 bytes of ''best records'' followed by 2 bytes of checksum (stored little endian). To calculate the checksum, simply add each of the bytes together, and take the lower 16 bits of the total. Then you byte-swap the value and write that to the .srm. So if you add all of the 0xA5 bytes together and get {{0x|1234}}, then it will be stored as {{0x|34}} {{0x|12}}. There are 3 separate checksums for the 3 Leagues. | ||
== Master Class unlock == | == Master Class unlock == | ||
This is a single byte that unlocks ''Master Class'' for each League. It is not covered by a checksum and can be freely edited, but '''the upper 4 bits must equal the lower 4 bits'''. It is a bitwise value, so | This is a single byte that unlocks ''Master Class'' for each League. It is not covered by a checksum and can be freely edited, but '''the upper 4 bits must equal the lower 4 bits'''. It is a bitwise value, so {{0x|33}} would unlock for Knight and Queen but not King. Setting the upper most bit {{0x|88}} results in an invalid value and gets reset to {{0x|00}}. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 113: | Line 111: | ||
!Unlocks | !Unlocks | ||
|- | |- | ||
| | |{{0x|00}} | ||
|default: none | |default: none | ||
|- | |- | ||
| | |{{0x|11}} | ||
|Knight | |Knight | ||
|- | |- | ||
| | |{{0x|22}} | ||
|Queen | |Queen | ||
|- | |- | ||
| | |{{0x|44}} | ||
|King | |King | ||
|- | |- | ||
| | |{{0x|77}} | ||
|max value: all | |max value: all | ||
|- | |- | ||
| | |{{0x|88}} | ||
|invalid | |invalid | ||
|} | |} |
Revision as of 15:33, 20 March 2021
The saveram .srm file is 2,048 (0x800) bytes long. It seems only 512 (0x200) bytes are used. A simple sum-of-bytes checksum is used on each of the 3 sections of best record time data.
File Format
"FZERO" | 0x05 bytes |
Knight League + checksum | 0xA7 bytes |
Queen League + checksum | 0xA7 bytes |
King League + checksum | 0xA7 bytes |
Master Class enable | 0x01 byte |
"FZERO" | 0x05 bytes |
unused (0xFF filled) | 0x600 bytes |
FZERO string bytes
The sram data begins and ends with 5 bytes FZERO (0x46
0x5A
0x45
0x52
0x4F
). These 5 bytes are compared to the ROM location $00:8869 (PC file location 0x0869) and must match.
League sections
Each League section contains 55 best records, followed by a 2 byte checksum. There are 10 best records plus 1 best lap record per track (in that order). There are 5 tracks per League.
Best Record format
Each best record uses 3 bytes. The upper 4 bits of the first byte defines which car set the record, and whether or not it was in practice mode. If the upper 4 bits are 0, then the record is ignored. The lower 4 bits of the first byte are the minutes. The second byte is the seconds. The third byte is the milliseconds. The game initializes all records to 0x09
0x59
0x59
.
Bytes | Minutes | Seconds | Milliseconds |
---|---|---|---|
0xB2 0x07 0x45
|
2 | 7 | 45 |
Above: the upper 4 bits of the first byte is B, which represents the Fire Stingray set the time in Grand Prix mode.
Value | Car | Mode |
---|---|---|
8 | Blue Falcon | Grand Prix |
9 | Wild Goose | Grand Prix |
A | Golden Fox | Grand Prix |
B | Fire Stingray | Grand Prix |
C | Blue Falcon | Practice |
D | Wild Goose | Practice |
E | Golden Fox | Practice |
F | Fire Stingray | Practice |
League checksum
Each League section contains 0xA5 bytes of best records followed by 2 bytes of checksum (stored little endian). To calculate the checksum, simply add each of the bytes together, and take the lower 16 bits of the total. Then you byte-swap the value and write that to the .srm. So if you add all of the 0xA5 bytes together and get 0x1234
, then it will be stored as 0x34
0x12
. There are 3 separate checksums for the 3 Leagues.
Master Class unlock
This is a single byte that unlocks Master Class for each League. It is not covered by a checksum and can be freely edited, but the upper 4 bits must equal the lower 4 bits. It is a bitwise value, so 0x33
would unlock for Knight and Queen but not King. Setting the upper most bit 0x88
results in an invalid value and gets reset to 0x00
.
Value | Unlocks |
---|---|
0x00
|
default: none |
0x11
|
Knight |
0x22
|
Queen |
0x44
|
King |
0x77
|
max value: all |
0x88
|
invalid |