| Crates.io | tcm |
| lib.rs | tcm |
| version | 0.1.0 |
| created_at | 2025-09-07 16:09:48.163777+00 |
| updated_at | 2025-09-07 16:09:48.163777+00 |
| description | Rust library for parsing and serializing TCM (tcbot macro) format for Geometry Dash |
| homepage | https://tcbot.pro |
| repository | https://github.com/tcbot-gd/tcm-rs |
| max_upload_size | |
| id | 1828280 |
| size | 121,294 |
A Rust library for parsing and serializing TCM (TCBot Macro) format files used by the tcbot.pro Geometry Dash bot.
Add this to your Cargo.toml:
[dependencies]
tcm = "0.1"
The easiest way to work with TCM files is to use auto-detection, which automatically determines the format version:
use tcm::{DynamicReplay, meta::Meta};
use std::fs::File;
use std::io::BufReader;
// Open and parse any TCM file automatically
let file = File::open("replay.tcm")?;
let mut reader = BufReader::new(file);
let replay = DynamicReplay::from_reader(&mut reader)?;
// Work with the replay directly without matching on enum variants!
println!("TCM v{} - TPS: {}", replay.meta.version_instance(), replay.meta.tps());
println!("Input count: {}", replay.inputs.len());
// V2-specific features are available through trait methods
if let Some(seed) = replay.meta.rng_seed() {
println!("RNG seed: {}", seed);
}
If you know the format version in advance, you can use the typed API:
use tcm::{meta::MetaV2, replay::{Replay, ReplayDeserializer}};
use std::fs::File;
// Open a TCM file
let mut file = File::open("replay.tcm")?;
// Create a replay template (the type determines the format version)
let replay = Replay::<MetaV2>::deserialize(&mut file)?;
println!("TPS: {}", replay.meta.tps());
println!("Input count: {}", replay.inputs.len());
use tcm::{
input::{Input, InputCommand, VanillaInput, PlayerButton},
meta::MetaV2,
replay::{Replay, ReplaySerializer}
};
use std::fs::File;
// Create metadata
let meta = MetaV2::new(240.0, 0, None);
// Create some inputs
let inputs = vec![
InputCommand::new(100, Input::Vanilla(VanillaInput {
button: PlayerButton::Jump,
push: true,
player2: false,
})),
InputCommand::new(150, Input::Vanilla(VanillaInput {
button: PlayerButton::Jump,
push: false,
player2: false,
})),
];
// Create replay
let replay = Replay::new(meta, inputs);
// Serialize to file
let mut file = File::create("output.tcm")?;
replay.serialize(&mut file)?;
This library supports both TCM format versions:
The library supports various input types:
For detailed API documentation, visit docs.rs/tcm.
Check out the examples/ directory for more comprehensive usage examples:
auto_detection.rs - Auto-detect format version and parse any TCM filebasic_usage.rs - Basic reading and writing operationsinput_types.rs - Working with different input typesformat_conversion.rs - Converting between v1 and v2 formatsContributions regarding this rust port are welcome. Format design choices are not a part of this repository.
This project is licensed under the MIT License - see the LICENSE file for details.