This document contains the format of the Sonic Adventure save file, SONICADV_INT. This file is stored on a Sega Dreamcast Visual Memory Unit when playing the game Sonic Adventure. The file saves the position of the game as well as the high scores. I currently know the format for the high scores and other information, but have not yet discovered the format of most of the saved game data.
Note: This information was obtained using a US version of Sonic Adventure.
Contents of SONICADV_INT
Contents of a file slot
References
SONICADV_INT is 5120 bytes and contains three file slots as follows.
offset | length | content |
---|---|---|
$0000 | 1152 | VM file header |
$0480 | 1184 | File slot - "File 1" |
$0920 | 1184 | File slot - "File 2" |
$0DC0 | 1184 | File slot - "File 3" |
$1260 | 416 | (unknown) |
For information about the VM file header, refer to VMS File Header by Marcus Comstedt.
The file slots contain the information for Files 1, 2, and 3 as listed on the 'Select a File' screen from within the game. The format for a file slot is described below.
Each file slot is 1184 bytes and contains the following information.
offset | length | data type | content |
---|---|---|---|
$000 | 4 | 4-byte integer | CRC (only LS 16 bits used) |
$004 | 4 | 4-byte integer | Play time (in 60ths of a second) |
$008 | 128 | 4-byte integers | Action Stage - Best Scores |
$088 | 84 | 3-byte time codes | Action Stage - Best Times |
$0DC | 24 | 2-byte integers | Action Stage - Best Weights (in tens of grams) |
$0F4 | 16 | 4-byte integers (?) | (unknown) |
$104 | 64 | 2-byte integers | Action Stage - Best Rings |
$144 | 108 | 4-byte integers | Mini Game - Best Scores |
$1B0 | 144 | 3-byte time codes | Mini Game - Best Times |
$240 | 17 | -- | (unknown) |
$251 | 1 | bit-flags | Options |
$252 | 6 | 1-byte integers | Lives |
$258 | 4520 | -- | (unknown) |
All integers are stored in little endian order.
All (?) integers are stored as signed values, but only non-negative values make sense.
offset | length | data type | content |
---|---|---|---|
$000 | 4 | 4-byte integer | CRC (only LS 16 bits used) |
Although the CRC is stored as a 4-byte integer, it is only a 16-bit value.
The CRC is calculated over the remaining bytes of the file slot using the following C code:
unsigned int calcCRC(const unsigned char *buffer, int size) { unsigned int byte, bit, remainder; remainder = 0xFFFF; for (byte = 0; byte < size; ++byte) { remainder ^= buffer[byte]; for (bit = 0; bit < 8; ++bit) { if (remainder & 0x0001) remainder = (remainder >> 1) ^ 0x8408; else remainder = (remainder >> 1); } } remainder ^= 0xFFFF; return remainder & 0xFFFF; }
offset | length | data type | content |
---|---|---|---|
$004 | 4 | 4-byte integer | Play time (in 60ths of a second) |
The total play time (as shown on the 'Select a File' screen) is stored in units of 60ths of a second.
offset | length | data type | content |
---|---|---|---|
$008 | 128 | 4-byte integers | Action Stage - Best Scores |
For each stage, the best score is stored.
The order of the stages is as follows:
player | stage |
---|---|
Sonic | 1 - Emerald Coast |
2 - Windy Valley | |
5 - Twinkle Park | |
6 - Speed Highway | |
7 - Red Mountian | |
8 - Sky Deck | |
9 - Lost World | |
4 - Ice Cap | |
3 - Casinopolis | |
10 - Final Egg | |
Tails | 1 - Windy Valley |
5 - Speed Highway | |
4 - Sky Deck | |
3 - Ice Cap | |
2 - Casinopolis | |
Knuckles | 1 - Speed Highway |
3 - Red Mountain | |
5 - Sky Deck | |
4 - Lost World | |
2 - Casinopolis | |
Amy | 1 - Twinkle Park |
3 - Final Egg | |
2 - Hot Shelter | |
E-102 | 2 - Emerald Coast |
3 - Windy Valley | |
4 - Red Mountain | |
1 - Final Egg | |
5 - Hot Shelter | |
Big | 3 - Emerald Coast |
1 - Twinkle Park | |
2 - Ice Cap | |
4 - Hot Shelter |
offset | length | data type | content |
---|---|---|---|
$088 | 84 | 3-byte time codes | Action Stage - Best Times |
For each stage, the best time is stored.
The order of the stages is the same as listed under the Best Scores section above.
(Note: Big's stages don't have times, but rather weights, see below.)
The times are stored in a 3-byte time code.
The fraction is converted from 60ths of a second to 100ths of a second for display purposes using the following formula [?]
display = (value * 1666) div 1000where div is an integer division.
offset | length | data type | content |
---|---|---|---|
$0DC | 24 | 2-byte integers | Action Stage - Best Weights (in tens of grams) |
For each of Big's stages, the best three weights are stored, highest to lowest.
(Three weights are stored, but only the best weight appears in the Trial menu.)
The order of the stages is the same as listed under the Best Scores section above.
Each weight is stored as a 2-byte integer, but the unit is in tens of grams.
For example, a stored value of 50 corresponds to 500 g.
offset | length | data type | content |
---|---|---|---|
$104 | 64 | 2-byte integers | Action Stage - Best Rings |
For each stage, the best number of rings is stored.
The order of the stages is the same as listed under the Best Scores section above.
offset | length | data type | content |
---|---|---|---|
$144 | 108 | 4-byte integers | Mini Game - Best Scores |
For each of the mini games below, the best three scores are stored, highest to lowest.
The order of the mini games is as follows:
player | mini game |
---|---|
Sonic | Sky Chase 1 |
Tails | Sky Chase 1 |
Sonic | Sky Chase 2 |
Tails | Sky Chase 2 |
Sonic | Ice Cap |
Tails | Ice Cap |
Sonic | Sand Hill |
Tails | Sand Hill |
Amy | Hedgehog Hammer |
offset | length | data type | content |
---|---|---|---|
$1B0 | 144 | 3-byte time codes | Mini Game - Best Times |
The times are stored as a three-byte time code as explained in the Action Stage - Best Times section above.
For each of the Twinkle Circuits, five times are stored.
The first three times are the best three times for this player, shortest to longest.
The last two times are the lap checkpoints for the best time. (See below.)
For each of the Boss stages, the best three times are stored, shortest to longest.
The order of the mini games is as follows:
player | mini game |
---|---|
Sonic | Twinkle Circuit |
Tails | Twinkle Circuit |
Knuckles | Twinkle Circuit |
Amy | Twinkle Circuit |
E-102 | Twinkle Circuit |
Big | Twinkle Circuit |
Sonic | Boss |
Tails | Boss |
Knuckles | Boss |
Amy | Boss |
E-102 | Boss |
Big | Boss |
For each Twinkle Circuit stage, two lap checkpoint times are stored which go along with the
first (best) time stored for that player.
The lap checkpoint times are the times the stopwatch read when the player finished
Lap 1 and Lap 2.
The game uses these to display the elapsed time for each lap using the following
calculations:
(Lap 1 elapsed time) = (checkpoint 1 time) (Lap 2 elapsed time) = (checkpoint 2 time) - (checkpoint 1 time) (Lap 3 elapsed time) = (best total time) - (checkpoint 2 time)
offset | length | data type | content |
---|---|---|---|
$251 | 1 | bit-flags | Options |
The options are stored in a bit-field as follows:
bits | ||||
---|---|---|---|---|
7 | 6, 5, 4 | 3, 2 | 1 | 0 |
zero | Text Language | Voice Language | Message Settings | zero |
Controls the language of the subtitles.
value | language |
---|---|
001 | Japanese Text |
010 | English Text |
011 | French Text |
100 | Spanish Text |
101 | German Text |
Controls the language of the vocal dialog, menus, and instruction screens.
value | language |
---|---|
01 | Japanese Voice |
10 | English Voice |
Turns the subtitles on or off.
value | setting |
---|---|
0 | Voice and Text |
1 | Voice Only |
offset | length | data type | content |
---|---|---|---|
$252 | 6 | 1-byte integers | Lives |
For each player, one byte is stored indicating their number of lives.
The order of the players is:
Sonic, Tails, Knuckles, Amy, E-102, Big.
VMS File Header from Dreamcast Programming by Marcus Comstedt
This document provides the details of the file header present in every Visual Memory file. It also helped by providing me a basic CRC algorithm.
A Painless Guide to CRC Error Detection Algorithms by Ross N. Williams
I used this document to learn enough about CRC algorithms to detect which one the save file was using.
Home >
Articles > Sonic Adventure Save File Format |
Robert Hart |