diff --git a/src/mercury_engine_data_structures/formats/txt.py b/src/mercury_engine_data_structures/formats/txt.py index f63f7368..7add65bb 100644 --- a/src/mercury_engine_data_structures/formats/txt.py +++ b/src/mercury_engine_data_structures/formats/txt.py @@ -7,7 +7,7 @@ from mercury_engine_data_structures.common_types import DictAdapter, DictElement from mercury_engine_data_structures.construct_extensions.strings import CStringRobust from mercury_engine_data_structures.formats import BaseResource -from mercury_engine_data_structures.game_check import Game +from mercury_engine_data_structures.game_check import Game, is_sr_or_else _string_range = GreedyRange(DictElement(CStringRobust("utf-16-le"))) @@ -38,7 +38,10 @@ def _parse_{n}(io, this): TXT = Struct( "magic" / Const(b'BTXT'), - "version" / Const(b'\x01\x00\x0a\x00'), + "version" / is_sr_or_else( + Const(b'\x01\x00\x08\x00'), + Const(b'\x01\x00\x0a\x00'), + ), "strings" / DictAdapter(_string_range), "_end" / construct.Terminated, ) diff --git a/tests/formats/test_txt.py b/tests/formats/test_txt.py index 9c6d46d3..14d37c5e 100644 --- a/tests/formats/test_txt.py +++ b/tests/formats/test_txt.py @@ -9,3 +9,9 @@ def test_compare_dread(dread_path): parse_and_build_compare( TXT, Game.DREAD, file_path ) + +def test_compare_sr(samus_returns_path): + file_path = samus_returns_path.joinpath("system/localization/us_english.txt") + parse_and_build_compare( + TXT, Game.SAMUS_RETURNS, file_path + )