|
| 1 | +--- |
| 2 | +parent: Save Docs! |
| 3 | +layout: default |
| 4 | +nav_order: 999 |
| 5 | +title: Header Files |
| 6 | +--- |
| 7 | +This page documents Header files (also known as `head.yw`). Note that each game has 3 save files (`game*.yw`) but ONE `head.yw` which has data for all three |
| 8 | + |
| 9 | +<sup>Disclaimer: **Most** changes to the `head.yw` only affect the preview you see before you enter the save file, NOT the actual save file (This is very important, dont forget :P). Exceptions to this rule include the save file names, and decryption seed.</sup> |
| 10 | +Most (known) parts of the `head.yw` are duplicated, with 3 versions corresponding to the 3 save files. An exception to this is the seed located in the head file. |
| 11 | + |
| 12 | +Here are some of the known elements |
| 13 | + |
| 14 | + |
| 15 | +## Fixed Elements (1 per head) |
| 16 | + |
| 17 | +| Offset | Length | Description | |
| 18 | +| ------ | ------- | ------------------------------------------------------------------------------------ | |
| 19 | +| `0x0C` | 0x04 | (Uint32) - A seed ran through a Xorshift-based pseudorandom number generator (PRNG) to derive an AES-128 encryption key, used in part of the decryption process for V2 save files. | |
| 20 | + |
| 21 | + |
| 22 | +## Save File Dependant (3 per head) |
| 23 | +Note that the `Offset` in this table assumes the Player name is at `0x00` instead of providing all 3 possible positions. A list of player name positions can be found below for reference. |
| 24 | + |
| 25 | +| Offset | Length | Description | |
| 26 | +| ------ | ------- | ------------------------------------------------------------------------------------ | |
| 27 | +| `0x00` | 0x08 | Player name (UTF-8 LE, fixed length 8 bytes, padded if shorter) | |
| 28 | +| `0x09` | 0x1A | Unknown (18 bytes) | |
| 29 | +| `0x1B` | 0x01 | Boolean Main Story Completion? (1 bytes, unverified) | |
| 30 | +| `0x1C` | 0x24 | Unknown (10 bytes) | |
| 31 | +| `0x25` | 0x01 | **Watch Rank** (`0x05 = S`, `0x04 = A`, `0x03 = B`, etc.) | |
| 32 | +| `0x26` | 0x43 | Unknown (67 bytes) — **still part of the 0x60 block total from 0x08–0x68** | |
| 33 | +| `0x67` | 0x02 | Year (`UInt16`) | |
| 34 | +| `0x6B` | 0x01 | Day (`LEB128` or `UInt8`) | |
| 35 | +| `0x6C` | 0x01 | Month (`LEB128` or `UInt8`) | |
| 36 | +| `0x6D` | 0x01 | Hour (`LEB128` or `UInt8`) | |
| 37 | +| `0x6E` | 0x01 | Minute (`LEB128` or `UInt8`) | |
| 38 | +| `0x6F` | 0x01`?` | (Optional) Seconds? (`LEB128` or `UInt8`, Not displayed but may be internally used) | |
| 39 | + |
| 40 | +## Player Name Positions |
| 41 | + |
| 42 | + |
| 43 | +| Block # | Start Addr | End Addr | Size | |
| 44 | +| ------- | ---------- | -------- | --------- | |
| 45 | +| 1 | `0x5390` | `0x5417` | 136 bytes | |
| 46 | +| 2 | `0x5418` | `0x549F` | 136 bytes | |
| 47 | +| 3 | `0x54A0` | `0x5527` | 136 bytes | |
| 48 | + |
| 49 | +## Notes (IGNORE) |
| 50 | +The `head.yw` is especially tolerant of illegal values, it allows things like illegal names (disallowed unicode characters appear as a black-box), an hour value of 25 etc |
| 51 | +SECTIONID parse????????????????????????? |
| 52 | +TO;DO document save file play time, save file location, save file party, save file gender, save file version |
| 53 | + |
| 54 | +legacy: |
| 55 | +1-8 = Name (Length: 0x8 or 8) in UTF8-LE |
| 56 | +9-36 = Unknown |
| 57 | +37 = Save File Rank 05 = S, 04 = A etc |
| 58 | +38 - 104 Unknown (Length: 0x60 or 96) |
| 59 | +Then Int/Uint16 Year followed by LEB/ULEB128 Day, LEB/ULEB128 OR INT8/UINT8 Month (Identical in this case), then LEB/ULEB128 OR INT8/UINT8 Hour (Again, identical in this case), then LEB/ULEB128 OR INT8/UINT8 Minute (Again, identical in this case), then (this isn't shown, but is internally used) then LEB/ULEB128 OR INT8/UINT8 Seconds? |
| 60 | + |
| 61 | +53B8-53D2 |
| 62 | + |
| 63 | +53C0-53D0 |
0 commit comments