Mercurial > touhou
view formats/src/th06/pos.rs @ 795:2d60a14f4816 default tip
python: Rewrite the main entrypoint in Rust
This lets us progressively replace Python modules with Rust ones.
Currently missing features include:
- Saving replays
- Networking code for cooperative mode
- Reading a configuration file for options
- Maybe more.
But the base game is working, so yay!
| author | Link Mauve <linkmauve@linkmauve.fr> |
|---|---|
| date | Tue, 02 Jun 2026 19:06:16 +0200 |
| parents | ec1e06402a97 |
| children |
line wrap: on
line source
//! POS music track format support. use nom::{IResult, Parser, number::complete::le_u32}; /// A struct describing the loop points of Touhou background music. #[derive(Debug, Clone)] pub struct LoopPoints { /// Time to which the music should loop after reaching end. pub start: u32, /// Time at which to loop back to start. pub end: u32, } impl LoopPoints { /// Parse a slice of bytes into a `LoopPoints` struct. pub fn from_slice(input: &[u8]) -> IResult<&[u8], LoopPoints> { let (i, (start, end)) = (le_u32, le_u32).parse(input)?; Ok((i, LoopPoints { start, end })) } }
