Expand description
Data structures for reading and writing replays
The main focus of this module is the Replay
struct, which contains functions
for opening and writing *.osr files.
Read more about the *.osr data format on the OSU wiki.
Simple Example
let replay = Replay::parse(&mut reader)?;
let action_data = replay.parse_action_data()?;
for frame in action_data.frames.iter() {
println!("time={} x={} y={} btns={:?}", frame.time, frame.x, frame.y, frame.buttons);
}
println!("seed: {:?}", action_data.rng_seed);
Note that the frames of the actual replay (called action_data
in libosu) is stored in
compressed form at all times, so in order to actually change the action data, you will want to
call Replay::update_action_data
in order to write the changed
action data back into the replay:
// assuming these were declared as mut instead
action_data.frames[0].x = 5.0;
replay.update_action_data(&action_data);
Then you can write this back into a file:
let mut output = File::create("output.osr")?;
replay.write(&mut output)?;
Structs
The buttons being pressed during a frame of a replay
A replay object.
An action by the player while playing the map
A parser for decompressed replay actions
to read compressed replay actions see create_decompressing_replay_action_parser
Enums
Errors that could occur while processing replays
Type Definitions
Result type for Replay processing