Use 32-bit sizes independent of platform (32 or 64 bits)
size_t can be either 32 or 64 bits, which means you couldn't mix replay files across platforms.
Added magic number 0x50 0x31 0x52 ("P1R")
Removed version strings, replaced with a format version number and deprecation number that may be incremented in the future
Added the time of the recording (Unix time) to the format
Restructured the code for saving/loading replay options. Organized it into sections.
Skip incompatible replay files (warn about unexpected format and don't put them in the replay cycle order)
Other/related fixes:
Ignore replay options in SDLPoP.ini if USE_REPLAY is not defined
Added -std=gnu99 to CMakeLists.txt
Fixed replays running out of sync
Fixed unable to unpause while replaying
The replay format is now:
HEADER
magic number (3 bytes) = 0x50 0x31 0x52 (ASCII: "P1R")
replay format version number (1 byte) = 100
(current version number of the replay format)
replay format deprecation number (1 byte) = 1
(can be incremented to break backwards compatibility gracefully in the future)
creation time (8 bytes): Unix time (seconds since 1970) at capture
length of the custom levelset name (1 byte) (if zero, the replay uses the original levels)
levelset name: name of the custom levelset (i.e. the folder from which to load custom assets)
SAVESTATE
savestate size (4 bytes)
savestate: currently 0xA87 bytes
REPLAY OPTIONS
(this is split into 5 sections)
size of the options section 'features' (4 bytes)
options section 'features'
size of the options section 'enhancements' (4 bytes)
options section 'enhancements'
size of the options section 'fixes' (4 bytes)
options section 'fixes'
size of the options section 'custom_general' (4 bytes)
options section 'custom_general'
size of the options section 'custom_per_level' (4 bytes)
options section 'custom_per_level'
REPLAY DATA
start level (2 bytes): level number where the replay starts
saved random seed (2 bytes)
number of replay ticks (2 bytes): length of the replay in ticks
moves (1 byte per tick)
Moves are encoded as follows:
struct {
sbyte x : 2;
sbyte y : 2;
byte shift : 1;
byte special : 3;
};
Replay format changes:
size_t
can be either 32 or 64 bits, which means you couldn't mix replay files across platforms.Other/related fixes:
The replay format is now: