-
Notifications
You must be signed in to change notification settings - Fork 12
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 #197 from steven11sjf/bpsi
BPSI (pack set?)
- Loading branch information
Showing
4 changed files
with
42 additions
and
1 deletion.
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
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,25 @@ | ||
from construct.core import Const, Construct, IfThenElse, Int32ul, PrefixedArray, Struct, Terminated | ||
|
||
from mercury_engine_data_structures import game_check | ||
from mercury_engine_data_structures.common_types import VersionAdapter | ||
from mercury_engine_data_structures.construct_extensions.strings import PascalStringRobust | ||
from mercury_engine_data_structures.formats.base_resource import BaseResource | ||
|
||
BPSI = Struct( | ||
_magic = Const(b"MPSI"), | ||
version = IfThenElse( | ||
game_check.current_game_at_most(game_check.Game.SAMUS_RETURNS), | ||
VersionAdapter("1.2.0"), | ||
VersionAdapter("1.3.0") | ||
), | ||
files = PrefixedArray(Int32ul, Struct( | ||
file = PascalStringRobust(Int32ul, "utf-8"), | ||
in_packages = PrefixedArray(Int32ul, PascalStringRobust(Int32ul, "utf-8")) | ||
)), | ||
_eof=Terminated | ||
) | ||
|
||
class Bpsi(BaseResource): | ||
@classmethod | ||
def construct_class(cls, target_game: game_check.Game) -> Construct: | ||
return BPSI |
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,14 @@ | ||
import pytest | ||
from tests.test_lib import parse_build_compare_editor | ||
|
||
from mercury_engine_data_structures import dread_data, samus_returns_data | ||
from mercury_engine_data_structures.formats.bpsi import Bpsi | ||
|
||
|
||
@pytest.mark.parametrize("bpsi_path", dread_data.all_files_ending_with(".bpsi")) | ||
def test_bmtre_dread(dread_file_tree, bpsi_path): | ||
parse_build_compare_editor(Bpsi, dread_file_tree, bpsi_path) | ||
|
||
@pytest.mark.parametrize("bpsi_path", samus_returns_data.all_files_ending_with(".bpsi")) | ||
def test_bmtre_sr(dread_file_tree, bpsi_path): | ||
parse_build_compare_editor(Bpsi, dread_file_tree, bpsi_path) |