-
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 #123 from dyceron/parse-blsnd
MSR - Add .blsnd support
- Loading branch information
Showing
3 changed files
with
47 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,32 @@ | ||
import functools | ||
|
||
import construct | ||
from construct.core import ( | ||
Const, | ||
Construct, | ||
Hex, | ||
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 | ||
|
||
BLSND = Struct( | ||
"_magic" / Const(b"LSND"), | ||
"version" / Const(0x000B0001, Hex(Int32ul)), | ||
"unk" / Int32ul, | ||
"sound_limits" / make_vector(Struct( | ||
"name" / StrId, | ||
"value" / Int32ul, | ||
)), | ||
construct.Terminated, | ||
) | ||
|
||
|
||
class Blsnd(BaseResource): | ||
@classmethod | ||
@functools.lru_cache | ||
def construct_class(cls, target_game: Game) -> Construct: | ||
return BLSND |
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.blsnd import Blsnd | ||
|
||
all_sr_blsnd = [name for name in samus_returns_data.all_name_to_asset_id().keys() | ||
if name.endswith(".blsnd")] | ||
|
||
|
||
@pytest.mark.parametrize("blsnd_path", all_sr_blsnd) | ||
def test_blsnd(samus_returns_tree, blsnd_path): | ||
parse_build_compare_editor(Blsnd, samus_returns_tree, blsnd_path) |