PyLibMS 3.2.4__tar.gz → 3.2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. {pylibms-3.2.4 → pylibms-3.2.6}/PKG-INFO +6 -4
  2. {pylibms-3.2.4 → pylibms-3.2.6}/PyLibMS.egg-info/PKG-INFO +6 -4
  3. {pylibms-3.2.4 → pylibms-3.2.6}/README.md +5 -3
  4. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/msbt.py +21 -2
  5. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/section/atr1.py +6 -1
  6. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/tag/io/param_io.py +5 -4
  7. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/tag/io/tag_io.py +1 -1
  8. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/tag/lms_tag.py +12 -8
  9. {pylibms-3.2.4 → pylibms-3.2.6}/pyproject.toml +1 -1
  10. {pylibms-3.2.4 → pylibms-3.2.6}/LICENSE +0 -0
  11. {pylibms-3.2.4 → pylibms-3.2.6}/MANIFEST.in +0 -0
  12. {pylibms-3.2.4 → pylibms-3.2.6}/PyLibMS.egg-info/SOURCES.txt +0 -0
  13. {pylibms-3.2.4 → pylibms-3.2.6}/PyLibMS.egg-info/dependency_links.txt +0 -0
  14. {pylibms-3.2.4 → pylibms-3.2.6}/PyLibMS.egg-info/requires.txt +0 -0
  15. {pylibms-3.2.4 → pylibms-3.2.6}/PyLibMS.egg-info/top_level.txt +0 -0
  16. {pylibms-3.2.4 → pylibms-3.2.6}/lms/__init__.py +0 -0
  17. {pylibms-3.2.4 → pylibms-3.2.6}/lms/common/__init__.py +0 -0
  18. {pylibms-3.2.4 → pylibms-3.2.6}/lms/common/lms_datatype.py +0 -0
  19. {pylibms-3.2.4 → pylibms-3.2.6}/lms/common/lms_exceptions.py +0 -0
  20. {pylibms-3.2.4 → pylibms-3.2.6}/lms/common/lms_fileinfo.py +0 -0
  21. {pylibms-3.2.4 → pylibms-3.2.6}/lms/common/stream/fileinfo.py +0 -0
  22. {pylibms-3.2.4 → pylibms-3.2.6}/lms/common/stream/hashtable.py +0 -0
  23. {pylibms-3.2.4 → pylibms-3.2.6}/lms/common/stream/section.py +0 -0
  24. {pylibms-3.2.4 → pylibms-3.2.6}/lms/fileio/encoding.py +0 -0
  25. {pylibms-3.2.4 → pylibms-3.2.6}/lms/fileio/io.py +0 -0
  26. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/__init__.py +0 -0
  27. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/definitions/__init__.py +0 -0
  28. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/definitions/field/__init__.py +0 -0
  29. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/definitions/field/io.py +0 -0
  30. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/definitions/field/lms_field.py +0 -0
  31. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/definitions/lms_messagetext.py +0 -0
  32. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/msbtentry.py +0 -0
  33. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/msbtio.py +0 -0
  34. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/section/__init__.py +0 -0
  35. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/section/tsy1.py +0 -0
  36. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/section/txt2.py +0 -0
  37. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/tag/__init__.py +0 -0
  38. {pylibms-3.2.4 → pylibms-3.2.6}/lms/message/tag/lms_tagexceptions.py +0 -0
  39. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/__init__.py +0 -0
  40. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/definitions/__init__.py +0 -0
  41. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/definitions/attribute.py +0 -0
  42. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/definitions/color.py +0 -0
  43. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/definitions/style.py +0 -0
  44. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/definitions/tag.py +0 -0
  45. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/msbp.py +0 -0
  46. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/msbpread.py +0 -0
  47. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/section/ali2.py +0 -0
  48. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/section/ati2.py +0 -0
  49. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/section/clr1.py +0 -0
  50. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/section/string.py +0 -0
  51. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/section/syl3.py +0 -0
  52. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/section/tag2.py +0 -0
  53. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/section/tgg2.py +0 -0
  54. {pylibms-3.2.4 → pylibms-3.2.6}/lms/project/section/tgp2.py +0 -0
  55. {pylibms-3.2.4 → pylibms-3.2.6}/lms/titleconfig/__init__.py +0 -0
  56. {pylibms-3.2.4 → pylibms-3.2.6}/lms/titleconfig/config.py +0 -0
  57. {pylibms-3.2.4 → pylibms-3.2.6}/lms/titleconfig/definitions/__init__.py +0 -0
  58. {pylibms-3.2.4 → pylibms-3.2.6}/lms/titleconfig/definitions/attribute.py +0 -0
  59. {pylibms-3.2.4 → pylibms-3.2.6}/lms/titleconfig/definitions/tags.py +0 -0
  60. {pylibms-3.2.4 → pylibms-3.2.6}/lms/titleconfig/definitions/value.py +0 -0
  61. {pylibms-3.2.4 → pylibms-3.2.6}/lms/titleconfig/presets/Badge Arcade.yaml +0 -0
  62. {pylibms-3.2.4 → pylibms-3.2.6}/lms/titleconfig/presets/Brain Age Concentration Training.yaml +0 -0
  63. {pylibms-3.2.4 → pylibms-3.2.6}/lms/titleconfig/presets/Kirby Planet Robobot.yaml +0 -0
  64. {pylibms-3.2.4 → pylibms-3.2.6}/lms/titleconfig/presets/Super Mario 3D Land.yaml +0 -0
  65. {pylibms-3.2.4 → pylibms-3.2.6}/lms/titleconfig/presets/Super Mario 3D World + Bowsers Fury.yaml +0 -0
  66. {pylibms-3.2.4 → pylibms-3.2.6}/lms/titleconfig/presets/Super Mario Odyssey.yaml +0 -0
  67. {pylibms-3.2.4 → pylibms-3.2.6}/lms/titleconfig/presets/The Legend of Zelda Echos of Wisdom.yaml +0 -0
  68. {pylibms-3.2.4 → pylibms-3.2.6}/lms/titleconfig/presets/The Legend of Zelda a Link Between Worlds.yaml +0 -0
  69. {pylibms-3.2.4 → pylibms-3.2.6}/lms/titleconfig/presets/Tomodachi Life.yaml +0 -0
  70. {pylibms-3.2.4 → pylibms-3.2.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyLibMS
3
- Version: 3.2.4
3
+ Version: 3.2.6
4
4
  Summary: Python library built for the libMessageStudio (LMS) proprietary file formats from Nintendo. Supports MSBT, MSBP, and MSBF.
5
5
  Author: AbdyyEee
6
6
  License: Copyright 2025 AbdyyEee
@@ -25,8 +25,8 @@ PylibMS is a library built in Python 3.10+ for the libMessageStudio (LMS) propri
25
25
  * Full reading and writing of MSBT files.
26
26
  * Full reading of MSBP files.
27
27
  * Supports encoded/decoded attributes
28
- * Supporting encoded/decoded tags 1:1 with Nintendos offical tool and BB code Syntax.
29
- * Additonal tag manipulation.
28
+ * Supporting encoded/decoded tags 1:1 with Nintendo's official tool and BB code Syntax.
29
+ * Additional tag manipulation.
30
30
 
31
31
  This library is designed to support LMS revision 3.0 and above, with the associated file formats used across the following Nintendo platforms:
32
32
  * Wii (Specific titles only)
@@ -35,6 +35,8 @@ This library is designed to support LMS revision 3.0 and above, with the associa
35
35
  * Mobile (Specific titles only)
36
36
  * Nintendo Switch
37
37
 
38
+ MSBF is in current in the works.
39
+
38
40
  # Features and Usage
39
41
  Simple preview of the library is below. See [the wiki](https://github.com/AbdyyEee/PylibMS/wiki) for more explanations and examples.
40
42
  ## Reading
@@ -57,7 +59,7 @@ To add or edit Preset, you may create an issue with the relevant `yaml` file and
57
59
  ```
58
60
  pip install PylibMS
59
61
  ```
60
- [Pip Page](https://pypi.org/project/PyLibMS/0.6/)
62
+ [Pip Page](https://pypi.org/project/PyLibMS/)
61
63
 
62
64
  # Build Instructions
63
65
  Python version must be `>=3.12.`
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyLibMS
3
- Version: 3.2.4
3
+ Version: 3.2.6
4
4
  Summary: Python library built for the libMessageStudio (LMS) proprietary file formats from Nintendo. Supports MSBT, MSBP, and MSBF.
5
5
  Author: AbdyyEee
6
6
  License: Copyright 2025 AbdyyEee
@@ -25,8 +25,8 @@ PylibMS is a library built in Python 3.10+ for the libMessageStudio (LMS) propri
25
25
  * Full reading and writing of MSBT files.
26
26
  * Full reading of MSBP files.
27
27
  * Supports encoded/decoded attributes
28
- * Supporting encoded/decoded tags 1:1 with Nintendos offical tool and BB code Syntax.
29
- * Additonal tag manipulation.
28
+ * Supporting encoded/decoded tags 1:1 with Nintendo's official tool and BB code Syntax.
29
+ * Additional tag manipulation.
30
30
 
31
31
  This library is designed to support LMS revision 3.0 and above, with the associated file formats used across the following Nintendo platforms:
32
32
  * Wii (Specific titles only)
@@ -35,6 +35,8 @@ This library is designed to support LMS revision 3.0 and above, with the associa
35
35
  * Mobile (Specific titles only)
36
36
  * Nintendo Switch
37
37
 
38
+ MSBF is in current in the works.
39
+
38
40
  # Features and Usage
39
41
  Simple preview of the library is below. See [the wiki](https://github.com/AbdyyEee/PylibMS/wiki) for more explanations and examples.
40
42
  ## Reading
@@ -57,7 +59,7 @@ To add or edit Preset, you may create an issue with the relevant `yaml` file and
57
59
  ```
58
60
  pip install PylibMS
59
61
  ```
60
- [Pip Page](https://pypi.org/project/PyLibMS/0.6/)
62
+ [Pip Page](https://pypi.org/project/PyLibMS/)
61
63
 
62
64
  # Build Instructions
63
65
  Python version must be `>=3.12.`
@@ -4,8 +4,8 @@ PylibMS is a library built in Python 3.10+ for the libMessageStudio (LMS) propri
4
4
  * Full reading and writing of MSBT files.
5
5
  * Full reading of MSBP files.
6
6
  * Supports encoded/decoded attributes
7
- * Supporting encoded/decoded tags 1:1 with Nintendos offical tool and BB code Syntax.
8
- * Additonal tag manipulation.
7
+ * Supporting encoded/decoded tags 1:1 with Nintendo's official tool and BB code Syntax.
8
+ * Additional tag manipulation.
9
9
 
10
10
  This library is designed to support LMS revision 3.0 and above, with the associated file formats used across the following Nintendo platforms:
11
11
  * Wii (Specific titles only)
@@ -14,6 +14,8 @@ This library is designed to support LMS revision 3.0 and above, with the associa
14
14
  * Mobile (Specific titles only)
15
15
  * Nintendo Switch
16
16
 
17
+ MSBF is in current in the works.
18
+
17
19
  # Features and Usage
18
20
  Simple preview of the library is below. See [the wiki](https://github.com/AbdyyEee/PylibMS/wiki) for more explanations and examples.
19
21
  ## Reading
@@ -36,7 +38,7 @@ To add or edit Preset, you may create an issue with the relevant `yaml` file and
36
38
  ```
37
39
  pip install PylibMS
38
40
  ```
39
- [Pip Page](https://pypi.org/project/PyLibMS/0.6/)
41
+ [Pip Page](https://pypi.org/project/PyLibMS/)
40
42
 
41
43
  # Build Instructions
42
44
  Python version must be `>=3.12.`
@@ -1,9 +1,8 @@
1
- from typing import Any
2
-
3
1
  from lms.common.lms_fileinfo import LMS_FileInfo
4
2
  from lms.message.msbtentry import MSBTEntry
5
3
  from lms.titleconfig.definitions.attribute import AttributeConfig
6
4
  from lms.titleconfig.definitions.tags import TagConfig
5
+ from lms.fileio.encoding import FileEncoding
7
6
 
8
7
 
9
8
  class MSBT:
@@ -47,6 +46,26 @@ class MSBT:
47
46
  self._attribute_config = attribute_config
48
47
  self._tag_config = tag_config
49
48
 
49
+ @classmethod
50
+ def new(cls,
51
+ attribute_config: AttributeConfig | None = None,
52
+ tag_config: TagConfig | None = None,
53
+ is_big_endian: bool = False,
54
+ encoding: FileEncoding = FileEncoding.UTF16,
55
+ version: int = 3,
56
+ section_count: int = 2):
57
+ """Creates a new MSBT instance.
58
+
59
+ :param attribute_config: The attribute config object
60
+ :param tag_config: The tag config object
61
+ :param is_big_endian: if the file is big endian.
62
+ :param encoding: the file encoding.
63
+ :param version: the file version.
64
+ :param section_count: the number of sections.
65
+ """
66
+ return MSBT(info=LMS_FileInfo(is_big_endian, encoding, version, section_count),
67
+ attribute_config=attribute_config, tag_config=tag_config)
68
+
50
69
  def __len__(self) -> int:
51
70
  return len(self._entries)
52
71
 
@@ -39,6 +39,11 @@ def read_encoded_atr1(reader: FileReader, section_size: int) -> ATR1Data:
39
39
 
40
40
 
41
41
  def read_decoded_atr1(reader: FileReader, config: AttributeConfig) -> ATR1Data:
42
+ # String table as a list is not necessary for decoded attributes
43
+ # It is easier to save all changes from the user by when writing
44
+ # to recreate the table from all the string parameters in every attribute
45
+ string_table = None
46
+
42
47
  section_start = reader.tell()
43
48
 
44
49
  attr_count = reader.read_uint32()
@@ -63,7 +68,7 @@ def read_decoded_atr1(reader: FileReader, config: AttributeConfig) -> ATR1Data:
63
68
 
64
69
  attributes.append(LMS_FieldMap(attribute))
65
70
 
66
- return ATR1Data(attributes, size_per_attribute, None)
71
+ return ATR1Data(attributes, size_per_attribute, string_table)
67
72
 
68
73
 
69
74
  def write_encoded_atr1(
@@ -13,10 +13,11 @@ TAG_PADDING_BYTE = b"\xcd"
13
13
 
14
14
  def read_encoded_parameters(
15
15
  reader: FileReader, parameter_size: int
16
- ) -> list[str] | None:
16
+ ) -> list[int] | None:
17
+
17
18
  hex_parameters = reader.read_bytes(parameter_size).hex().upper()
18
19
  encoded_parameters = [
19
- f"{hex_parameters[i : i + 2]}" for i in range(0, len(hex_parameters), 2)
20
+ int(f"{hex_parameters[i : i + 2]}", 16) for i in range(0, len(hex_parameters), 2)
20
21
  ]
21
22
  return encoded_parameters
22
23
 
@@ -42,10 +43,10 @@ def read_decoded_parameters(
42
43
  return LMS_FieldMap(parameters)
43
44
 
44
45
 
45
- def write_encoded_parameters(writer: FileWriter, parameters: list[str]) -> None:
46
+ def write_encoded_parameters(writer: FileWriter, parameters: list[int]) -> None:
46
47
  writer.write_uint16(len(parameters))
47
48
  for param in parameters:
48
- writer.write_bytes(bytes.fromhex(param))
49
+ writer.write_bytes(int.to_bytes(param, 1))
49
50
 
50
51
 
51
52
  def write_decoded_parameters(
@@ -92,7 +92,7 @@ def _read_decoded_tag(
92
92
  return LMS_DecodedTag(definition, parameters)
93
93
 
94
94
 
95
- def write_tag(writer: FileWriter, tag: LMS_EncodedTag | LMS_DecodedTag) -> None:
95
+ def write_tag(writer: FileWriter, tag: LMS_ControlTag) -> None:
96
96
  start_indicator, close_indicator = get_tag_indicator(
97
97
  writer.encoding, writer.is_big_endian
98
98
  )
@@ -5,7 +5,7 @@ from lms.message.definitions.field.lms_field import LMS_FieldMap
5
5
  from lms.message.tag.lms_tagexceptions import LMS_InvalidTagFormatError
6
6
  from lms.titleconfig.definitions.tags import TagConfig, TagDefinition
7
7
 
8
- TAG_PADDING_CHAR = "CD"
8
+ TAG_PADDING_CHAR = 0xCD
9
9
 
10
10
 
11
11
  class LMS_EncodedTag:
@@ -25,7 +25,7 @@ class LMS_EncodedTag:
25
25
  self,
26
26
  group_id: int,
27
27
  tag_index: int,
28
- parameters: list[str] | None = None,
28
+ parameters: list[int] | None = None,
29
29
  is_fallback: bool = False,
30
30
  is_closing: bool = False,
31
31
  ):
@@ -50,13 +50,13 @@ class LMS_EncodedTag:
50
50
  return self._tag_index
51
51
 
52
52
  @property
53
- def parameters(self) -> list[str] | None:
54
- """The list of hex string parameters."""
53
+ def parameters(self) -> list[int] | None:
54
+ """The list of parameters."""
55
55
  return self._parameters
56
56
 
57
57
  @property
58
58
  def is_fallback(self) -> bool:
59
- """Determines if the tag is a fallback tag."""
59
+ """Determines if the tag is a fallback tag. Fallback tags have a '!' prefix before the group index."""
60
60
  return self._is_fallback
61
61
 
62
62
  @property
@@ -73,7 +73,8 @@ class LMS_EncodedTag:
73
73
  if self._parameters is None:
74
74
  return f"[{self.group_id}:{self.tag_index}]"
75
75
 
76
- parameters = "-".join(self._parameters)
76
+ # 02x format to convert any int to hexadecimal uppercase
77
+ parameters = "-".join(format(param, "02x").upper() for param in self._parameters)
77
78
  return f"[{fallback_prefix}{self.group_id}:{self.tag_index} {parameters}]"
78
79
 
79
80
  @classmethod
@@ -103,10 +104,13 @@ class LMS_EncodedTag:
103
104
 
104
105
  if not cls.PARAMETER_FORMAT.match(param_str):
105
106
  raise LMS_InvalidTagFormatError(
106
- f"Malformed parameters located in tag: '{tag}'"
107
+ f"Parameters located in the tag '{tag}'. Ensure all parameters are separated by dashes."
107
108
  )
108
109
 
109
- parameters = [param.strip().upper() for param in param_str.split("-")]
110
+ try:
111
+ parameters = [int(param.strip().upper()) for param in param_str.split("-")]
112
+ except ValueError:
113
+ raise LMS_InvalidTagFormatError(f"Malformed parameters in tag '{tag}'. Ensure all the parameters are integers.")
110
114
 
111
115
  # Ensure 0xCD padding is added
112
116
  if len(parameters) % 2 == 1:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "PyLibMS"
7
- version = "3.2.4"
7
+ version = "3.2.6"
8
8
  requires-python = ">=3.12"
9
9
  description = "Python library built for the libMessageStudio (LMS) proprietary file formats from Nintendo. Supports MSBT, MSBP, and MSBF."
10
10
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes