Difference between revisions of "Savegame Files"
(→Header) |
(glued everything a bit) |
||
Line 1: | Line 1: | ||
(Feel free to fix or enhance this page) | (Feel free to fix or enhance this page) | ||
− | + | = Format = | |
− | + | A savegame consists of a [[#Header|Header]], followed by a [[#Bk Header|Bk Header]] and a set of files contained in a [[#Files|files]] section. | |
+ | |||
+ | == Header == | ||
+ | |||
+ | The Header is 0xF0C0 bytes long. It is encrypted (AES128-CBC) using the "sd-key" and the "sd-iv" initialization vector. | ||
+ | |||
+ | The plaintext header contents are described in the following table. | ||
− | |||
{| style="border-collapse: collapse; padding: 0.2em 0.2em 0.2em 0.2em;" | {| style="border-collapse: collapse; padding: 0.2em 0.2em 0.2em 0.2em;" | ||
Line 100: | Line 105: | ||
|} | |} | ||
− | |||
− | The Bk Header is 0x80 bytes long. | + | == Bk Header == |
+ | |||
+ | The Bk Header is 0x80 bytes long. It is not encrypted. | ||
{| style="border-collapse: collapse; padding: 0.2em 0.2em 0.2em 0.2em;" | {| style="border-collapse: collapse; padding: 0.2em 0.2em 0.2em 0.2em;" | ||
Line 190: | Line 196: | ||
== Files == | == Files == | ||
− | + | A savegame consists of several files up to the number specified in the [[#Bk Header|Bk Header]]. | |
− | Files are stored immediatelly after the Bk Header using the format described in the next sections. | + | Each file is described using a [[#File Header|File Header]] and a [[#File Data|File Data]] section. Files are stored immediatelly after the [[#Bk Header|Bk Header]] using the format described in the next sections. |
=== File Header === | === File Header === | ||
− | The file header is 0x80 bytes long. | + | The file header is 0x80 bytes long. It is not encrypted. |
{| style="border-collapse: collapse; padding: 0.2em 0.2em 0.2em 0.2em;" | {| style="border-collapse: collapse; padding: 0.2em 0.2em 0.2em 0.2em;" | ||
Line 233: | Line 239: | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | variable | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | variable | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | name (null tereminated) | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | name (null tereminated) | ||
+ | |- style="background-color: #ddd;" | ||
+ | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | ... | ||
+ | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | ... | ||
+ | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | ... | ||
+ | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ... | ||
|- style="background-color: #ddd;" | |- style="background-color: #ddd;" | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x050 | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x050 | ||
Line 238: | Line 249: | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | 16 | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | 16 | ||
| style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | IV for file data decryption | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | IV for file data decryption | ||
+ | |- style="background-color: #ddd;" | ||
+ | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #ded;" | 0x060 | ||
+ | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #dde;" | 0x07F | ||
+ | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #ddd;" | ... | ||
+ | | style="border: 1px solid #ccc; padding: 0.2em; background-color: #edd;" | ?? unknown | ||
|} | |} | ||
− | === File | + | === File Data === |
− | File data comes after the File Header. Each file actually occupies the length specified in the file header rounded up to the next 64 byte boundary. | + | File data comes after the [[#File Header|File Header]]. Each file actually occupies the length specified in the file header rounded up to the next 64 byte boundary. Data is encrypted (AES128-CBC) using the "sd-key" and the initialization vector specified in the File Header. |
Revision as of 22:53, 3 February 2008
(Feel free to fix or enhance this page)
Format
A savegame consists of a Header, followed by a Bk Header and a set of files contained in a files section.
Header
The Header is 0xF0C0 bytes long. It is encrypted (AES128-CBC) using the "sd-key" and the "sd-iv" initialization vector.
The plaintext header contents are described in the following table.
Start | End | Length | Description |
0x0000 | 0x0007 | 8 | Savegame ID |
0x0008 | 0x000B | 4 | size of header (0x72a0 or 0xf0a0) |
0x000C | 0x000C | 1 | permissions |
0x000D | 0x000D | 1 | ?? unknown |
0x000E | 0x001D | 16 | md5 of plaintext header with md5 blanker applied |
0x001E | 0x001F | 2 | ?? unknown |
0x0020 | 0x003F | 16 | ?? unknown |
0x0040 | 0x00BF | 128 | title (?? in utf16) |
0x00C0 | 0x60BF | 24576 | banner (192x64) |
0x60C0 | 0x72BF | 4608 | icon0 (48x48) |
0x72C0 | 0x84BF | 4608 | icon1 (optional, present if size of header is 0xf0a0) |
0x84C0 | 0x96BF | 4608 | icon2 (optional, present if size of header is 0xf0a0) |
0x96C0 | 0xA8BF | 4608 | icon3 (optional, present if size of header is 0xf0a0) |
0xA8C0 | 0xBABF | 4608 | icon4 (optional, present if size of header is 0xf0a0) |
0xBAC0 | 0xCCBF | 4608 | icon5 (optional, present if size of header is 0xf0a0) |
0xCCC0 | 0xDEBF | 4608 | icon6 (optional, present if size of header is 0xf0a0) |
0xDEC0 | 0xF0BF | 4608 | icon7 (optional, present if size of header is 0xf0a0) |
Bk Header
The Bk Header is 0x80 bytes long. It is not encrypted.
Start | End | Length | Description |
0x000 | 0x003 | 4 | magic1 (0x00000070) |
0x004 | 0x005 | 2 | magic2 ('Bk') |
0x006 | 0x007 | 2 | magic3 (0x0001) |
0x008 | 0x00B | 4 | NG id |
0x00C | 0x00F | 4 | number of files |
0x010 | 0x013 | 4 | size of files |
0x014 | 0x017 | 4 | ?? unknown |
0x018 | 0x01B | 4 | ?? unknown |
0x01C | 0x01F | 4 | total size |
0x020 | 0x05F | 64 | ?? unknown |
0x060 | 0x063 | 4 | ?? unknown |
0x064 | 0x067 | 4 | Game ID (ex. 'RMGP' for Super Mario Galaxy) |
0x068 | 0x06B | 4 | ?? unknown |
0x06C | 0x06F | 4 | ?? unknown |
0x070 | 0x07F | 16 | null padded |
Files
A savegame consists of several files up to the number specified in the Bk Header. Each file is described using a File Header and a File Data section. Files are stored immediatelly after the Bk Header using the format described in the next sections.
File Header
The file header is 0x80 bytes long. It is not encrypted.
Start | End | Length | Description |
0x000 | 0x003 | 4 | magic1 (0x03adf17e) |
0x004 | 0x007 | 4 | size of file |
0x008 | 0x008 | 1 | permissions |
0x009 | 0x009 | 1 | attributes |
0x00A | 0x00A | 1 | type (1=file, 2=directory) |
0x00B | variable | variable | name (null tereminated) |
... | ... | ... | ... |
0x050 | 0x05F | 16 | IV for file data decryption |
0x060 | 0x07F | ... | ?? unknown |
File Data
File data comes after the File Header. Each file actually occupies the length specified in the file header rounded up to the next 64 byte boundary. Data is encrypted (AES128-CBC) using the "sd-key" and the initialization vector specified in the File Header.