-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import functools | ||
import construct | ||
from construct.core import ( | ||
Const, | ||
Construct, | ||
Float32l, | ||
Hex, | ||
Int32ul, | ||
Int32sl, | ||
Struct, | ||
) | ||
|
||
from mercury_engine_data_structures.common_types import CVector3D, StrId, make_vector | ||
from mercury_engine_data_structures.formats import BaseResource | ||
from mercury_engine_data_structures.game_check import Game | ||
|
||
|
||
BMSES = Struct( | ||
"magic" / Const(b"MSES"), | ||
"version" / Hex(Int32ul), | ||
"sounds" / make_vector(Struct( | ||
"name" / StrId, | ||
"sound_file" / StrId, | ||
"properties" / Struct( | ||
"fade_in" / Float32l, | ||
"fade_out" / Float32l, | ||
"start_delay" / Float32l, | ||
"volume" / Float32l, | ||
"unk1" / Int32sl, | ||
"sub_sound" / make_vector(Struct( | ||
"name" / StrId, | ||
"properties" / Struct( | ||
"unk2" / Float32l, | ||
"unk3" / CVector3D, | ||
"unk4" / Int32sl, | ||
))), | ||
))), | ||
construct.Terminated, | ||
) | ||
|
||
|
||
class Bmses(BaseResource): | ||
@classmethod | ||
@functools.lru_cache | ||
def construct_class(cls, target_game: Game) -> Construct: | ||
return BMSES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import pytest | ||
from tests.test_lib import parse_build_compare_editor | ||
|
||
from mercury_engine_data_structures import samus_returns_data | ||
from mercury_engine_data_structures.formats.bmses import Bmses | ||
|
||
all_sr_bmses = [name for name in samus_returns_data.all_name_to_asset_id().keys() | ||
if name.endswith(".bmses")] | ||
|
||
|
||
@pytest.mark.parametrize("bmses_path", all_sr_bmses) | ||
def test_bmses(samus_returns_tree, bmses_path): | ||
parse_build_compare_editor(Bmses, samus_returns_tree, bmses_path) |