# HG changeset patch # User Emmanuel Gil Peyrot # Date 1314193237 -7200 # Node ID 9f0e37b7eeaba04b422492ae1818ea774cab64e3 # Parent d0e992b282a0fc31f1ee15544eabc078d169a218 Some fixes in the replay format. diff --git a/06/t6rp.xhtml b/06/t6rp.xhtml --- a/06/t6rp.xhtml +++ b/06/t6rp.xhtml @@ -21,14 +21,14 @@ typedef struct { uint8_t player; // 0 = ReimuA, 1 = ReimuB, 2 = MarisaA, 3 = MarisaB uint8_t rank; // 0 = Easy, 3 = Lunatic, 4 = Extra uint32_t checksum; // (0x3f000318 + key + sum(c for c in decrypted_data)) % (2 ** 32) - uint16_t unknown2; //TODO: seems to be ignored by the game + uint16_t unknown2; //TODO: seems to be ignored by the game. uint8_t key; char crypted_data[]; // crypted(a, i) = (a + key + 7*i) % 256 // decrypted(c, i) = (c - key - 7*i) % 256 } thrpy6_header_t; -

Decrypting the data section.

+

Decrypting the data section

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):

 def decrypt(key, data):
@@ -41,14 +41,14 @@ def encrypt(key, data):
 		

Encrypted header

 typedef struct {
-    uint8_t unknown; //TODO: seems to be ignored by the game
+    uint8_t unknown; //TODO: seems to be ignored by the game. Padding?
     char date[9]; // null-terminated string
     char name[9]; // null-terminated string
-    uint16_t unknown2; //TODO: seems to be ignored by the game
-    uint32_t score; //TODO: Total score. seems to be ignored by the game
-    uint32_t unknown3; //TODO: seems to be ignored by the game
+    uint16_t unknown2; //TODO: seems to be ignored by the game. Padding?
+    uint32_t score; //TODO: Total score. seems to be ignored by the game.
+    uint32_t unknown3; //TODO: seems to be ignored by the game.
     float slowdown_rate; // As a percentage, not a proper rate
-    uint8_t unknwon[4]; //TODO: seems to have no effect
+    uint32_t unknown4; //TODO: seems to be ignored by the game.
     uint32_t stage1_offset; // Offset of a thrpy6_stage_t from the start of the file (including the unencrypted header)
     uint32_t stage2_offset;
     uint32_t stage3_offset;
@@ -64,7 +64,7 @@ typedef struct {
 typedef struct {
     uint32_t score;
     uint16_t random_seed;
-    uint16_t unknown1; //TODO: seems to be ignored by the game
+    uint16_t unknown1; //TODO: seems to be ignored by the game.
     uint8_t power;
     int8_t lives;
     int8_t bombs;
@@ -79,9 +79,9 @@ typedef struct {
 		

Keystates

 struct {
-    uint32_t time; // Time of the event, most probably exprimed in frames
-    uint16_t keys; // 1 = shoot, 2 = bomb, 4 = focus, 8 = ?, 16 = up, 32 = down, 64 = left, 128 = right
-    uint16_t unknown; //TODO: seems to be ignored by the game
+    uint32_t time; // Time of the event, most probably exprimed in frames.
+    uint16_t keys; // 1 = shoot, 2 = bomb, 4 = focus, 8 = ?, 16 = up, 32 = down, 64 = left, 128 = right, 256 = skip dialogs
+    uint16_t unknown; //TODO: seems to be ignored by the game.
 } thrpy6_keystate_t;