Compare commits

..

No commits in common. "528a17158c96fad88fa96d8e8e76c2f36a56fbf0" and "dc0300b7da6aa15aa4bdfb5d2eae01338cd3cce0" have entirely different histories.

12 changed files with 5394 additions and 2 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
.direnv/
target/
test_data/

5178
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

4
Cargo.toml Normal file
View file

@ -0,0 +1,4 @@
[workspace]
resolver = "3"
members = [ "parser","player"]

View file

@ -1,2 +0,0 @@
# bmrs

96
flake.lock generated Normal file
View file

@ -0,0 +1,96 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1751271578,
"narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1744536153,
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"utils": "utils"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1751510438,
"narHash": "sha256-m8PjOoyyCR4nhqtHEBP1tB/jF+gJYYguSZmUmVTEAQE=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "7f415261f298656f8164bd636c0dc05af4e95b6b",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

48
flake.nix Normal file
View file

@ -0,0 +1,48 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
utils,
rust-overlay,
}:
utils.lib.eachDefaultSystem (
system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
};
bi = with pkgs; [
libxkbcommon
udev
alsa-lib
xorg.libXcursor
xorg.libXrandr
xorg.libXi
vulkan-tools
vulkan-headers
vulkan-loader
vulkan-validation-layers
pkgs.llvmPackages.bintools
clang
llvm
llvmPackages.libclang
rust-bin.stable.latest.default
rust-analyzer
];
in {
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
pkg-config
# Everything below is a hard bevy dep
];
buildInputs = bi;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath bi;
};
}
);
}

9
parser/Cargo.toml Normal file
View file

@ -0,0 +1,9 @@
[package]
name = "parser"
version = "0.1.0"
edition = "2024"
[dependencies]
strum = "0.27.1"
strum_macros = "0.27.1"
winnow = "0.7.11"

11
parser/README.md Normal file
View file

@ -0,0 +1,11 @@
# Parser library
This is a parser for the BMS file format.
Right now its goal is correctness of behaviour for what our _users_ expect as
opposed to what the informal specs say.
This means we will inherit defaults from the most popular players such as LR2.
## Resources
[BMS command memo by hitkey](https://hitkey.bms.ms/cmds.htm) was invaluable when
writing this. Whilst it's rough around the edges from machine translation it's
one of the most thorough English-language documents detailing the BMS spec.

19
parser/src/header.rs Normal file
View file

@ -0,0 +1,19 @@
struct Header {
player: Player,
}
/// Defines the play side.
#[derive(FromRepr, Debug, PartialEq, Clone)]
#[repr(u8)]
enum Player {
One, // SP
Two, // Couple play
Three, // DP
Four, // Battle Play. This is very, very rare
}
impl Default for Player {
fn default() -> Self {
Self::One
}
}

14
parser/src/lib.rs Normal file
View file

@ -0,0 +1,14 @@
pub fn add(left: u64, right: u64) -> u64 {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}

7
player/Cargo.toml Normal file
View file

@ -0,0 +1,7 @@
[package]
name = "player"
version = "0.1.0"
edition = "2024"
[dependencies]
bevy = { version = "0.16.1", features = ["dynamic_linking"] }

5
player/src/main.rs Normal file
View file

@ -0,0 +1,5 @@
use bevy::prelude::*;
fn main() {
App::new().add_plugins(DefaultPlugins).run();
}