Mercurial > touhou-doc
comparison 06/t6rp.xhtml @ 11:9f0e37b7eeab
Some fixes in the replay format.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 24 Aug 2011 15:40:37 +0200 |
parents | c5b074b0abbd |
children | 2925b0e246c6 |
comparison
equal
deleted
inserted
replaced
10:d0e992b282a0 | 11:9f0e37b7eeab |
---|---|
19 uint16_t unknown; //TODO: always 0x0102 | 19 uint16_t unknown; //TODO: always 0x0102 |
20 // Seems to be a switch, if 0x0102 do something, else (whatever the value is), do something else | 20 // Seems to be a switch, if 0x0102 do something, else (whatever the value is), do something else |
21 uint8_t player; // 0 = ReimuA, 1 = ReimuB, 2 = MarisaA, 3 = MarisaB | 21 uint8_t player; // 0 = ReimuA, 1 = ReimuB, 2 = MarisaA, 3 = MarisaB |
22 uint8_t rank; // 0 = Easy, 3 = Lunatic, 4 = Extra | 22 uint8_t rank; // 0 = Easy, 3 = Lunatic, 4 = Extra |
23 uint32_t checksum; // (0x3f000318 + key + sum(c for c in decrypted_data)) % (2 ** 32) | 23 uint32_t checksum; // (0x3f000318 + key + sum(c for c in decrypted_data)) % (2 ** 32) |
24 uint16_t unknown2; //TODO: seems to be ignored by the game | 24 uint16_t unknown2; //TODO: seems to be ignored by the game. |
25 uint8_t key; | 25 uint8_t key; |
26 char crypted_data[]; // crypted(a, i) = (a + key + 7*i) % 256 | 26 char crypted_data[]; // crypted(a, i) = (a + key + 7*i) % 256 |
27 // decrypted(c, i) = (c - key - 7*i) % 256 | 27 // decrypted(c, i) = (c - key - 7*i) % 256 |
28 } thrpy6_header_t; | 28 } thrpy6_header_t; |
29 </pre> | 29 </pre> |
30 | 30 |
31 <h2>Decrypting the data section.</h2> | 31 <h2>Decrypting the data section</h2> |
32 <p>As stated earlier, the data section is encrypted. Luckily, this encryption is quite simplistic, and encrypting/decrypting it is easy (see this snippet of python3 code):</p> | 32 <p>As stated earlier, the data section is encrypted. Luckily, this encryption is quite simplistic, and encrypting/decrypting it is easy (see this snippet of python3 code):</p> |
33 <pre> | 33 <pre> |
34 def decrypt(key, data): | 34 def decrypt(key, data): |
35 return bytes((c - key - 7 * i) % 256 for i, c in enumerate(data)) | 35 return bytes((c - key - 7 * i) % 256 for i, c in enumerate(data)) |
36 | 36 |
39 </pre> | 39 </pre> |
40 | 40 |
41 <h2>Encrypted header</h2> | 41 <h2>Encrypted header</h2> |
42 <pre> | 42 <pre> |
43 typedef struct { | 43 typedef struct { |
44 uint8_t unknown; //TODO: seems to be ignored by the game | 44 uint8_t unknown; //TODO: seems to be ignored by the game. Padding? |
45 char date[9]; // null-terminated string | 45 char date[9]; // null-terminated string |
46 char name[9]; // null-terminated string | 46 char name[9]; // null-terminated string |
47 uint16_t unknown2; //TODO: seems to be ignored by the game | 47 uint16_t unknown2; //TODO: seems to be ignored by the game. Padding? |
48 uint32_t score; //TODO: Total score. seems to be ignored by the game | 48 uint32_t score; //TODO: Total score. seems to be ignored by the game. |
49 uint32_t unknown3; //TODO: seems to be ignored by the game | 49 uint32_t unknown3; //TODO: seems to be ignored by the game. |
50 float slowdown_rate; // As a percentage, not a proper rate | 50 float slowdown_rate; // As a percentage, not a proper rate |
51 uint8_t unknwon[4]; //TODO: seems to have no effect | 51 uint32_t unknown4; //TODO: seems to be ignored by the game. |
52 uint32_t stage1_offset; // Offset of a thrpy6_stage_t from the start of the file (including the unencrypted header) | 52 uint32_t stage1_offset; // Offset of a thrpy6_stage_t from the start of the file (including the unencrypted header) |
53 uint32_t stage2_offset; | 53 uint32_t stage2_offset; |
54 uint32_t stage3_offset; | 54 uint32_t stage3_offset; |
55 uint32_t stage4_offset; | 55 uint32_t stage4_offset; |
56 uint32_t stage5_offset; | 56 uint32_t stage5_offset; |
62 <h2>Stage entry</h2> | 62 <h2>Stage entry</h2> |
63 <pre> | 63 <pre> |
64 typedef struct { | 64 typedef struct { |
65 uint32_t score; | 65 uint32_t score; |
66 uint16_t random_seed; | 66 uint16_t random_seed; |
67 uint16_t unknown1; //TODO: seems to be ignored by the game | 67 uint16_t unknown1; //TODO: seems to be ignored by the game. |
68 uint8_t power; | 68 uint8_t power; |
69 int8_t lives; | 69 int8_t lives; |
70 int8_t bombs; | 70 int8_t bombs; |
71 uint8_t difficulty; //TODO: WARNING: This has a huge effect on the game! | 71 uint8_t difficulty; //TODO: WARNING: This has a huge effect on the game! |
72 // It is also called rank (but we use the term "difficulty" because "rank" is the official name for Easy/Normal/Hard/Lunatic/Extra) | 72 // It is also called rank (but we use the term "difficulty" because "rank" is the official name for Easy/Normal/Hard/Lunatic/Extra) |
77 </pre> | 77 </pre> |
78 | 78 |
79 <h2>Keystates</h2> | 79 <h2>Keystates</h2> |
80 <pre> | 80 <pre> |
81 struct { | 81 struct { |
82 uint32_t time; // Time of the event, most probably exprimed in frames | 82 uint32_t time; // Time of the event, most probably exprimed in frames. |
83 uint16_t keys; // 1 = shoot, 2 = bomb, 4 = focus, 8 = ?, 16 = up, 32 = down, 64 = left, 128 = right | 83 uint16_t keys; // 1 = shoot, 2 = bomb, 4 = focus, 8 = ?, 16 = up, 32 = down, 64 = left, 128 = right, 256 = skip dialogs |
84 uint16_t unknown; //TODO: seems to be ignored by the game | 84 uint16_t unknown; //TODO: seems to be ignored by the game. |
85 } thrpy6_keystate_t; | 85 } thrpy6_keystate_t; |
86 </pre> | 86 </pre> |
87 </body> | 87 </body> |
88 </html> | 88 </html> |