4 releases (stable)

new 2.0.1 Dec 15, 2024
2.0.0 Oct 31, 2023
2.0.0-pre1 Sep 19, 2022
1.0.0 Apr 21, 2022

#1101 in Parser implementations

35 downloads per month

LGPL-3.0

54KB
1K SLoC

flour

Version 2.0 Crates.io Documentation

A crate that serializes and deserializes BCCAD / BRCAD files to and from a JSON format, with a library crate to parse these files

flour uses JSON with added support for // single-line comments and /* multi-line comments */.

Resources

A specification of the BCCAD and BRCAD formats (known revisions from their respective Rhythm Heaven games) can be found in SPECIFICATION.md

Building

To build the flour binary, you'll need to enable the clap feature, like so:

cargo build --features=clap 

lib.rs:

A crate with data types for known BXCAD (BRCAD/BCCAD) formats

Obtaining and working with BXCAD formats

In order to parse a BXCAD file's data, you must use the methods implemented in the [BXCAD] trait.

Example:

use flour::{BCCAD, BXCAD};

// Open a BCCAD file
let mut file = File::open("file.bccad")?;
let mut bccad = BCCAD::from_binary(&mut file)?;

// Delete all animations, and save as a new file
bccad.animations = vec![];
let mut out_file = File::create("file.out.bccad")?;
bccad.to_binary(&mut out_file)?;

Serializing and BXCADWrapper

While BXCAD doesn't require serde::Serialize and serde::Deserialize, implementing those is the main idea behind the trait, since that way the BXCAD can be wrapped inside a bxcad::BXCADWrapper. The function of this struct is to give a common metadata API for all flour-compatible BXCADs.

You can create a BXCADWrapper like so:

use flour::bxcad::BXCADWrapper;

// this could instead be BXCADWrapper::from_bxcad_indexized, to allow indexization
let wrapper = BXCADWrapper::from_bxcad(bccad);

This BXCADWrapper can now be serialized/deserialized without any compatibility issues with other BXCAD types or with future/past versions of flour (post-1.0).

For details on "indexization", see bxcad::qol::Indexizable.

Comments

flour supports the following types of comments:

  • Single-line: // comment
  • Multi-line: /* comment */

Features

  • modder_qol

Dependencies

~4–5.5MB
~161K SLoC