Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into bmsev
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanatosGit committed Feb 17, 2025
2 parents 5024a51 + 7034faa commit 1821d99
Show file tree
Hide file tree
Showing 154 changed files with 190,078 additions and 58,714 deletions.
7 changes: 7 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
changelog:
exclude:
labels:
- ignore-for-release
authors:
- pre-commit-ci
- dependabot
2 changes: 1 addition & 1 deletion .github/workflows/dependency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Automatically approve the PR
uses: hmarr/auto-approve-action@v4
uses: hmarr/auto-approve-action@v4
9 changes: 5 additions & 4 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"

- name: Install Python packages
run: python -m pip install --upgrade build
Expand Down Expand Up @@ -57,7 +57,8 @@ jobs:
python:
- { version: "3.10" }
- { version: "3.11" }
- { version: "3.12.0-beta - 3.12.0" }
- { version: "3.12" }
- { version: "3.13" }

steps:
- name: Checkout
Expand Down Expand Up @@ -145,10 +146,10 @@ jobs:

- name: Run Tests
run:
venv/bin/python -m pytest --cov mercury_engine_data_structures --cov-report=xml --fail-if-missing --durations=100 -n 2
venv/bin/python -m pytest --cov mercury_engine_data_structures --cov-report=xml --fail-if-missing --durations=100 -n 8

- name: codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
env:
Expand Down
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.5
rev: v0.9.3
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
args: [ --fix, --exit-non-zero-on-fix ]
- id: ruff-format
162 changes: 92 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,78 @@
# Mercury Engine Data Structures
Construct type definitions for Mercury Engine

| Format | Samus Returns (Read) | Samus Returns (Write) | Dread (Read) | Dread (Write) |
|-----------|----------------------|-----------------------|--------------|---------------|
| BAPD | Missing | Missing | ✓ | ✓ |
| BCCAM | ✗ | ✗ | ✗ | ✗ |
| BCLGT | ✗ | ✗ | Missing | Missing |
| BCMDL | ✗ | ✗ | ✓ | ✗ |
| BCPTL | ✗ | ✗ | ✗ | ✗ |
| BCSKLA | ✓ | ✓ | ✓ | ✓ |
| BCTEX | ✗ | ✗ | ✓ | ✗ |
| BCURV | Missing | Missing | ✗ | ✗ |
| BCUT | ✗ | ✗ | Missing | Missing |
| BCWAV | ✗ | ✗ | Missing | Missing |
| BFGRP | Missing | Missing | ✗ | ✗ |
| BFONT | ✗ | ✗ | ✗ | ✗ |
| BFSAR | Missing | Missing | ✗ | ✗ |
| BFSTM | Missing | Missing | ✗ | ✗ |
| BGSNDS | Missing | Missing | ✓ | ✓ |
| BLDEF | Missing | Missing | ✓ | ✓ |
| BLSND | ✓ | ✓ | ✓ | ✓ |
| BLUT | Missing | Missing | ✓ | ✓ |
| BMBLS | Missing | Missing | ✓ | ✓ |
| BMDEFS | ✓ | ✓ | ✓ | ✓ |
| BMMAP | Missing | Missing | ✓ | ✓ |
| BMMDEF | Missing | Missing | ✓ | ✓ |
| BMSAD | ✓ | ✓ | ✓ | ✓ |
| BMSAS | Missing | Missing | ✓ | ✓ |
| BMSAT | ✗ | ✗ | ✓ | ✓ |
| BMSBK | ✓ | ✓ | Missing | Missing |
| BMSCC | ✓ | ✓ | ✓ | ✓ |
| BMSCD | ✓ | ✓ | ✓ | ✓ |
| BMSCP | Missing | Missing | ✓ | ✓ |
| BMSCU | ✗ | ✗ | ✓ | ✓ |
| BMSEM | ✓ | ✓ | Missing | Missing |
| BMSES | ✓ | ✓ | Missing | Missing |
| BMSEV | ✓ | ✓ | Missing | Missing |
| BMSLD | ✓ | ✓ | Missing | Missing |
| BMSLGROUP | Missing | Missing | ✓ | ✓ |
| BMSLINK | Missing | Missing | ✓ | ✓ |
| BMSMD | ✓ | ✓ | Missing | Missing |
| BMSMSD | ✓ | ✓ | Missing | Missing |
| BMSNAV | ✓ | ✓ | ✓ | ✓ |
| BMSND | ✗ | ✗ | Missing | Missing |
| BMSSA | ✗ | ✗ | Missing | Missing |
| BMSSD | ✗ | ✗ | ✓ | ✓ |
| BMSSH | Missing | Missing | ✓ | ✓ |
| BMSSK | Missing | Missing | ✓ | ✓ |
| BMSSS | Missing | Missing | ✓ | ✓ |
| BMSSTOC | Missing | Missing | ✗ | ✗ |
| BMTRE | ✗ | ✗ | ✓ | ✓ |
| BMTUN | ✓ | ✓ | Missing | Missing |
| BNVIB | Missing | Missing | ✓ | ✓ |
| BPSI | ✓ | ✓ | ✓ | ✓ |
| BPTDAT | Missing | Missing | ✓ | ✓ |
| BPTDEF | Missing | Missing | ✓ | ✓ |
| BREM | Missing | Missing | ✓ | ✓ |
| BRES | Missing | Missing | ✓ | ✓ |
| BREV | Missing | Missing | ✓ | ✓ |
| BRFLD | Missing | Missing | ✓ | ✓ |
| BRSA | Missing | Missing | ✓ | ✓ |
| BRSPD | Missing | Missing | ✓ | ✓ |
| BSHDAT | ✗ | ✗ | ✗ | ✗ |
| BSMAT | Missing | Missing | ✓ | ✓ |
| BTUNDA | Missing | Missing | ✓ | ✓ |
| BUCT | ✗ | ✗ | ✗ | ✗ |
| INI | Missing | Missing | ✓ | ✓ |
| LC | ✓ | ✓ | ✓ | ✓ |
| PKG | ✓ | ✓ | ✓ | ✓ |
| TOC | ✓ | ✓ | ✓ | ✓ |
| TXT | ✓ | ✓ | ✓ | ✓ |
| WEBM | Missing | Missing | ✗ | ✗ |
## Format Support

| Format | Samus Returns (Read) | Samus Returns (Write) | Dread (Read) | Dread (Write) | Purpose |
|-----------|----------------------|-----------------------|--------------|---------------|-------------|
| BAPD | Missing | Missing | ✓ | ✓ | Audio Preset (positional audio data) |
| BCCAM | ✗ | ✗ | ✗ | ✗ | Camera Animation (used exclusively for cutscene takes) |
| BCLGT | ✗ | ✗ | Missing | Missing | Lighting (?) |
| BCMDL | ✗ | ✗ | ✓ | ✗ | 3D Models |
| BCPTL | ✗ | ✗ | ✗ | ✗ | Particle Effect |
| BCSKLA | ✓ | ✓ | ✓ | ✓ | Skeleton Animation |
| BCTEX | ✗ | ✗ | ✓ | ✗ | Texture File |
| BCURV | Missing | Missing | ✗ | ✗ | CURV (?) |
| BCUT | ✗ | ✗ | Missing | Missing | Related to cutscene files |
| BCWAV | ✗ | ✗ | Missing | Missing | Cafe/Citra Wave (common AAL audio format) |
| BFGRP | Missing | Missing | ✗ | ✗ | Sound WaveGroup (common AAL audio format) |
| BFONT | ✗ | ✗ | ✗ | ✗ | Font File |
| BFSAR | Missing | Missing | ✗ | ✗ | FSAR (?) |
| BFSTM | Missing | Missing | ✗ | ✗ | Common Switch audio format |
| BGSNDS | Missing | Missing | ✓ | ✓ | BackGround Sounds (?) |
| BLDEF | Missing | Missing | ✓ | ✓ | Actor Lighting Definition |
| BLSND | ✓ | ✓ | ✓ | ✓ | Sounds (?) |
| BLUT | Missing | Missing | ✓ | ✓ | LookUp Table (used for ADAM animation) |
| BMBLS | Missing | Missing | ✓ | ✓ | Blend Space |
| BMDEFS | ✓ | ✓ | ✓ | ✓ | Music Track Definitions & Properties |
| BMMAP | Missing | Missing | ✓ | ✓ | MiniMap |
| BMMDEF | Missing | Missing | ✓ | ✓ | MiniMap Definitions (?) |
| BMSAD | ✓ | ✓ | ✓ | ✓ | Actor Definitions |
| BMSAS | Missing | Missing | ✓ | ✓ | Action Sets |
| BMSAT | ✗ | ✗ | ✓ | ✓ | Animation Tree |
| BMSBK | ✓ | ✓ | Missing | Missing | Blocks, per Scenario |
| BMSCC | ✓ | ✓ | ✓ | ✓ | Collision Cameras |
| BMSCD | ✓ | ✓ | ✓ | ✓ | Collision Data / Geometry |
| BMSCP | Missing | Missing | ✓ | ✓ | GUI Composition |
| BMSCU | ✗ | ✗ | ✓ | ✓ | Cutscene Files |
| BMSEM | ✓ | ✓ | Missing | Missing | Environment Music |
| BMSES | ✓ | ✓ | Missing | Missing | Environment Sound |
| BMSEV | ✓ | ✓ | Missing | Missing | Environment Visuals (fx) |
| BMSLD | ✓ | ✓ | Missing | Missing | Samus Returns scenario entity data |
| BMSLGROUP | Missing | Missing | ✓ | ✓ | SmartLink Group |
| BMSLINK | Missing | Missing | ✓ | ✓ | SmartLink (actor-specific navmesh paths) |
| BMSMD | ✓ | ✓ | Missing | Missing | Menu Data (?) |
| BMSMSD | ✓ | ✓ | Missing | Missing | Map Screen Data (?) |
| BMSNAV | ✓ | ✓ | ✓ | ✓ | Navigation Meshes |
| BMSND | ✗ | ✗ | Missing | Missing | Sound (?) |
| BMSSA | ✓ | ✓ | Missing | Missing | SubArea Setups (MSR) |
| BMSSD | ✓ | ✓ | ✓ | ✓ | Scene Data (scene blocks, objects, msr lighting) |
| BMSSH | Missing | Missing | ✓ | ✓ | GUI Shape |
| BMSSK | Missing | Missing | ✓ | ✓ | GUI Skin |
| BMSSS | Missing | Missing | ✓ | ✓ | GUI SpriteSheet |
| BMSSTOC | Missing | Missing | ✗ | ✗ | Sound Table of Contents (links BFSAR sfx to BFGRP files) |
| BMTRE | ✗ | ✗ | ✓ | ✓ | Behavior Tree; entitity AI)|
| BMTUN | ✓ | ✓ | Missing | Missing | Tunables; exposed variables |
| BNVIB | Missing | Missing | ✓ | ✓ | Vibration Data |
| BPSI | ✓ | ✓ | ✓ | ✓ | PackSet; dev leftovers |
| BPTDAT | Missing | Missing | ✓ | ✓ | PlayThrough Data |
| BPTDEF | Missing | Missing | ✓ | ✓ | PlayThrough Def |
| BREM | Missing | Missing | ✓ | ✓ | Environmental Music Presets |
| BRES | Missing | Missing | ✓ | ✓ | Environmental Sound Presets |
| BREV | Missing | Missing | ✓ | ✓ | Environmental Visual Presets |
| BRFLD | Missing | Missing | ✓ | ✓ | Dread Scenario Entity Data |
| BRSA | Missing | Missing | ✓ | ✓ | SubArea Setups (Dread) |
| BRSPD | Missing | Missing | ✓ | ✓ | Shot Audio Presets |
| BSHDAT | ✗ | ✗ | ✗ | ✗ | Shader Data |
| BSMAT | Missing | Missing | ✓ | ✓ | Mesh Material |
| BTUNDA | Missing | Missing | ✓ | ✓ | Tunable Data |
| BUCT | ✓ | ✓ | ✓ | ✓ | Font Glyph Data (?) |
| INI | Missing | Missing | ✓ | ✓ | Standard INI |
| LC | ✓ | ✓ | ✓ | ✓ | Lua Bytecode |
| PKG | ✓ | ✓ | ✓ | ✓ | Packaged Files |
| TOC | ✓ | ✓ | ✓ | ✓ | Table of Contents |
| TXT | ✓ | ✓ | ✓ | ✓ | UTF-16 Text File (?) |
| WEBM | Missing | Missing | ✗ | ✗ | Standard WEBM |


## Example Usage
Expand All @@ -93,3 +95,23 @@ Metroid Dread uses the following annotations in text to change color:
| {c5} | Blue | |
| {c6} | UI Active | (Light blue) |
| {c7} | UI Inactive | (Dim blue) |


## Tests

For running the full test suite, the following environment variables must be set.

| Variable | Purpose |
|--------------------|------------------------------------------------|
| SAMUS_RETURNS_PATH | Path to a Samus Returns extracted RomFS |
| DREAD_1_0_0_PATH | Path to a Metroid Dread v1.0.0 extracted RomFS |
| DREAD_2_1_0_PATH | Path to a Metroid Dread v2.1.0 extracted RomFS |

If any of these variables are not set, the associated tests are skipped.

### Running

```bash
export SAMUS_RETURNS_PATH=D:/RomFS/Samus Returns
python -m pytest
```
38 changes: 31 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ requires = [
"setuptools_scm[toml]>=3.4.3",
"construct>=2.10.0",
"randovania-lupa>=2.0.1",
"zstd",
"zstandard",
]
build-backend = "setuptools.build_meta"

Expand All @@ -17,17 +17,18 @@ classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = ">=3.10"
dynamic = ["version"]

dependencies = [
"construct>=2.10.70", # 2.10.70 includes a fix for compiled structs building
"randovania-lupa>=2.0.1",
"zstd",
"zstandard",
]


[project.readme]
file = "README.md"
content-type = "text/markdown"
Expand All @@ -37,7 +38,7 @@ Homepage = "https://github.com/randovania/mercury-engine-data-structures"

[project.optional-dependencies]
test = [
"pytest<8.0.0", # see https://github.com/pytest-dev/pytest/issues/12608
"pytest>=8.3.1", # see https://github.com/pytest-dev/pytest/issues/12608
"pytest-cov",
]

Expand All @@ -63,11 +64,34 @@ filterwarnings = [

[tool.ruff]
line-length = 120
lint.select = ["E", "F", "W", "C90", "I", "UP"]
src = ["src"]

# Version to target for generated code.
target-version = "py38"
[tool.ruff.lint]
select = [
"E", "F", "W", "C90", "I", "UP", "C4",
"RSE",
"TCH",
# "PTH",
"COM818", "COM819",
"ISC",
"PIE",
# "PT",

"PLC",
"PLC0208", # iterating over set is also not deterministic, so we shouldn't do that!

"PLE",
"PLR0402", "PLR1711", "PLR1722", "PLR0206", "PLR0133", "PLR0124",
"PLW",
"SIM101",
]
extend-ignore = [
"ISC001", # may cause conflicts with formatter
"PLW2901", # `for` loop variable `key` overwritten by assignment target
]

[tool.ruff.lint.isort]
required-imports = ["from __future__ import annotations"]

[tool.ruff.lint.mccabe]
# Flag errors (`C901`) whenever the complexity level exceeds 25.
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ packaging==24.1
# via pytest
pluggy==1.5.0
# via pytest
pytest==7.4.3
pytest==8.3.1
# via
# mercury-engine-data-structures (setup.py)
# pytest-cov
pytest-cov==5.0.0
# via mercury-engine-data-structures (setup.py)
randovania-lupa==2.0.1
# via mercury-engine-data-structures (setup.py)
zstd==1.5.5.1
zstandard==0.23.0
# via mercury-engine-data-structures (setup.py)
Loading

0 comments on commit 1821d99

Please sign in to comment.