Skip to content

Commit

Permalink
¯\_(ツ)_/¯
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanatosGit committed Jul 12, 2024
1 parent 2cfcfb3 commit c577613
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mercury_engine_data_structures/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
from pathlib import Path
from typing import Optional

import construct

from mercury_engine_data_structures import formats
from mercury_engine_data_structures.construct_extensions.json import convert_to_raw_python
from mercury_engine_data_structures.file_tree_editor import FileTreeEditor
from mercury_engine_data_structures.game_check import Game

construct.setGlobalPrintFullStrings(True)


def game_argument_type(s: str) -> Game:
try:
Expand Down
2 changes: 2 additions & 0 deletions src/mercury_engine_data_structures/formats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from mercury_engine_data_structures.formats.bmsbk import Bmsbk
from mercury_engine_data_structures.formats.bmscc import Bmscc
from mercury_engine_data_structures.formats.bmscu import Bmscu
from mercury_engine_data_structures.formats.bmsem import Bmsem
from mercury_engine_data_structures.formats.bmses import Bmses
from mercury_engine_data_structures.formats.bmsld import Bmsld
from mercury_engine_data_structures.formats.bmslgroup import Bmslgroup
Expand Down Expand Up @@ -58,6 +59,7 @@
"BMSCC": Bmscc,
"BMSCD": Bmscc,
"BMSCU": Bmscu,
"BMSEM": Bmsem,
"BMSLD": Bmsld,
"BMSMSD": Bmsmsd,
"BMSNAV": Bmsnav,
Expand Down
43 changes: 43 additions & 0 deletions src/mercury_engine_data_structures/formats/bmsem.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import construct
from construct import (
Array,
Const,
Construct,
Float32l,
Int16ul,
Int32ul,
Struct,
)

from mercury_engine_data_structures.common_types import StrId, make_vector
from mercury_engine_data_structures.formats import BaseResource
from mercury_engine_data_structures.game_check import Game

VectorArray = Array(3, Float32l)

BMSEM = Struct(
_magic=Const(b"MSEM"),
unk1=Int16ul,
unk2=Int16ul,
things= make_vector(Struct(
"layer_name" / StrId,
"objects" / make_vector(Struct(
"whatever_name" / StrId,
# "unk1" / Int32ul
"inner_things" / make_vector(Struct(
"first_part" / StrId,
"second_part" / StrId,
"unk3" / Int32ul,
"unk4" / Int32ul,
"unk6" / Int32ul,
"unk7" / Int32ul
))
))
)),
rest=construct.GreedyBytes,
)

class Bmsem(BaseResource):
@classmethod
def construct_class(cls, target_game: Game) -> Construct:
return BMSEM
12 changes: 12 additions & 0 deletions tests/formats/test_bmsem.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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.bmsem import Bmsem

all_sr_bmsmsd = [name for name in samus_returns_data.all_name_to_asset_id().keys()
if name.endswith(".bmsem")]

@pytest.mark.parametrize("bmsmsd_path", all_sr_bmsmsd)
def test_bmsem(samus_returns_tree, bmsmsd_path):
parse_build_compare_editor(Bmsem, samus_returns_tree, bmsmsd_path, print_data=True)

0 comments on commit c577613

Please sign in to comment.