-
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.
Merge pull request #97 from dyceron/bmsmd
MSR - Support .bmsmd
- Loading branch information
Showing
3 changed files
with
60 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,49 @@ | ||
import functools | ||
|
||
from construct.core import ( | ||
Array, | ||
Const, | ||
Construct, | ||
Float32l, | ||
Hex, | ||
Int32sl, | ||
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 | ||
|
||
BMSMD = Struct( | ||
"_magic" / Const(b"MSMD"), | ||
"version" / Const(0x000D0001, Hex(Int32ul)), | ||
"map_data" / make_vector(Struct( | ||
"icon" / StrId, | ||
"scenarios" / make_vector(Struct( | ||
"name" / StrId, | ||
"unk1" / Hex(Int32ul), | ||
"unk2" / Hex(Int32ul), | ||
"unk3" / Hex(Int32ul), | ||
"unk4" / Hex(Int32ul), | ||
"unk5" / Hex(Int32ul), | ||
"unk6" / Hex(Int32ul), | ||
"number_of_tiles" / Int32ul, | ||
"unk7" / Hex(Int32ul), | ||
"unk8" / Hex(Int32ul), | ||
"coordinates" / Array(2, Int32ul), | ||
"sub_scenarios" / make_vector(Struct( | ||
"name" / StrId, | ||
"unk1" / Float32l, | ||
"unk2" / Float32l, | ||
"coordinates" / Array(2, Int32sl), | ||
)), | ||
)), | ||
)), | ||
) | ||
|
||
class Bmsmd(BaseResource): | ||
@classmethod | ||
@functools.lru_cache | ||
def construct_class(cls, target_game: Game) -> Construct: | ||
return BMSMD |
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,9 @@ | ||
from tests.test_lib import parse_build_compare_editor | ||
|
||
from mercury_engine_data_structures.formats.bmsmd import Bmsmd | ||
|
||
|
||
def test_bmsmd(samus_returns_tree): | ||
parse_build_compare_editor( | ||
Bmsmd, samus_returns_tree, r"gui/minimaps/c10_samus.bmsmd" | ||
) |