PyLibMS 4.3.4__tar.gz → 5.0.1__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 (92) hide show
  1. {pylibms-4.3.4 → pylibms-5.0.1}/PKG-INFO +26 -28
  2. {pylibms-4.3.4 → pylibms-5.0.1}/PyLibMS.egg-info/PKG-INFO +26 -28
  3. {pylibms-4.3.4 → pylibms-5.0.1}/PyLibMS.egg-info/SOURCES.txt +2 -2
  4. {pylibms-4.3.4 → pylibms-5.0.1}/README.md +23 -24
  5. {pylibms-4.3.4 → pylibms-5.0.1}/lms/common/field/io.py +13 -15
  6. {pylibms-4.3.4 → pylibms-5.0.1}/lms/common/field/lms_datatype.py +35 -42
  7. {pylibms-4.3.4 → pylibms-5.0.1}/lms/common/field/lms_field.py +34 -30
  8. {pylibms-4.3.4 → pylibms-5.0.1}/lms/common/lms_constants.py +1 -0
  9. {pylibms-4.3.4 → pylibms-5.0.1}/lms/common/stream/section.py +9 -13
  10. {pylibms-4.3.4 → pylibms-5.0.1}/lms/fileio/io.py +62 -63
  11. {pylibms-4.3.4 → pylibms-5.0.1}/lms/flowchart/definitions/node.py +53 -21
  12. {pylibms-4.3.4 → pylibms-5.0.1}/lms/flowchart/flw3.py +26 -8
  13. {pylibms-4.3.4 → pylibms-5.0.1}/lms/flowchart/msbf.py +65 -51
  14. {pylibms-4.3.4 → pylibms-5.0.1}/lms/flowchart/msbfio.py +22 -15
  15. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/lms_messagetext.py +15 -13
  16. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/msbt.py +39 -21
  17. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/msbtio.py +51 -18
  18. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/tag/io/param_io.py +11 -8
  19. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/tag/io/tag_io.py +12 -12
  20. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/tag/lms_tag.py +19 -20
  21. pylibms-5.0.1/lms/project/definitions/attribute.py +32 -0
  22. pylibms-5.0.1/lms/project/definitions/tag.py +137 -0
  23. {pylibms-4.3.4 → pylibms-5.0.1}/lms/project/msbp.py +12 -12
  24. {pylibms-4.3.4 → pylibms-5.0.1}/lms/project/msbpread.py +26 -28
  25. pylibms-5.0.1/lms/project/section/ali2.py +22 -0
  26. {pylibms-4.3.4 → pylibms-5.0.1}/lms/project/section/ati2.py +5 -6
  27. {pylibms-4.3.4 → pylibms-5.0.1}/lms/project/section/clr1.py +1 -1
  28. pylibms-5.0.1/lms/project/section/string.py +16 -0
  29. {pylibms-4.3.4 → pylibms-5.0.1}/lms/project/section/syl3.py +4 -4
  30. {pylibms-4.3.4 → pylibms-5.0.1}/lms/project/section/tag2.py +4 -4
  31. {pylibms-4.3.4 → pylibms-5.0.1}/lms/project/section/tgg2.py +3 -3
  32. {pylibms-4.3.4 → pylibms-5.0.1}/lms/project/section/tgp2.py +7 -7
  33. {pylibms-4.3.4 → pylibms-5.0.1}/lms/titleconfig/config.py +31 -88
  34. pylibms-5.0.1/lms/titleconfig/definitions/__init__.py +0 -0
  35. pylibms-5.0.1/lms/titleconfig/definitions/attribute.py +28 -0
  36. pylibms-5.0.1/lms/titleconfig/definitions/field.py +32 -0
  37. pylibms-5.0.1/lms/titleconfig/definitions/nodes.py +151 -0
  38. pylibms-5.0.1/lms/titleconfig/definitions/tags.py +90 -0
  39. {pylibms-4.3.4 → pylibms-5.0.1}/pyproject.toml +3 -4
  40. pylibms-4.3.4/lms/flowchart/definitions/flowchart.py +0 -100
  41. pylibms-4.3.4/lms/project/definitions/attribute.py +0 -24
  42. pylibms-4.3.4/lms/project/definitions/tag.py +0 -93
  43. pylibms-4.3.4/lms/project/section/ali2.py +0 -19
  44. pylibms-4.3.4/lms/project/section/string.py +0 -18
  45. pylibms-4.3.4/lms/titleconfig/definitions/attribute.py +0 -12
  46. pylibms-4.3.4/lms/titleconfig/definitions/nodes.py +0 -147
  47. pylibms-4.3.4/lms/titleconfig/definitions/tags.py +0 -93
  48. pylibms-4.3.4/lms/titleconfig/definitions/value.py +0 -18
  49. {pylibms-4.3.4 → pylibms-5.0.1}/LICENSE +0 -0
  50. {pylibms-4.3.4 → pylibms-5.0.1}/MANIFEST.in +0 -0
  51. {pylibms-4.3.4 → pylibms-5.0.1}/PyLibMS.egg-info/dependency_links.txt +0 -0
  52. {pylibms-4.3.4 → pylibms-5.0.1}/PyLibMS.egg-info/requires.txt +0 -0
  53. {pylibms-4.3.4 → pylibms-5.0.1}/PyLibMS.egg-info/top_level.txt +0 -0
  54. {pylibms-4.3.4 → pylibms-5.0.1}/lms/__init__.py +0 -0
  55. {pylibms-4.3.4 → pylibms-5.0.1}/lms/common/__init__.py +0 -0
  56. {pylibms-4.3.4 → pylibms-5.0.1}/lms/common/field/__init__.py +0 -0
  57. {pylibms-4.3.4 → pylibms-5.0.1}/lms/common/lms_exceptions.py +0 -0
  58. {pylibms-4.3.4 → pylibms-5.0.1}/lms/common/lms_fileinfo.py +0 -0
  59. {pylibms-4.3.4 → pylibms-5.0.1}/lms/common/stream/fileinfo.py +0 -0
  60. {pylibms-4.3.4 → pylibms-5.0.1}/lms/common/stream/hashtable.py +0 -0
  61. {pylibms-4.3.4 → pylibms-5.0.1}/lms/fileio/encoding.py +0 -0
  62. {pylibms-4.3.4 → pylibms-5.0.1}/lms/flowchart/__init__.py +0 -0
  63. {pylibms-4.3.4 → pylibms-5.0.1}/lms/flowchart/definitions/__init__.py +0 -0
  64. {pylibms-4.3.4 → pylibms-5.0.1}/lms/flowchart/definitions/lms_nodeexceptions.py +0 -0
  65. {pylibms-4.3.4 → pylibms-5.0.1}/lms/flowchart/definitions/node_type.py +0 -0
  66. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/__init__.py +0 -0
  67. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/definitions/__init__.py +0 -0
  68. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/definitions/field/__init__.py +0 -0
  69. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/msbtentry.py +0 -0
  70. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/section/__init__.py +0 -0
  71. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/section/atr1.py +0 -0
  72. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/section/nli1.py +0 -0
  73. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/section/tsy1.py +0 -0
  74. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/section/txt2.py +0 -0
  75. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/tag/__init__.py +0 -0
  76. {pylibms-4.3.4 → pylibms-5.0.1}/lms/message/tag/lms_tagexceptions.py +0 -0
  77. {pylibms-4.3.4 → pylibms-5.0.1}/lms/project/__init__.py +0 -0
  78. {pylibms-4.3.4 → pylibms-5.0.1}/lms/project/definitions/__init__.py +0 -0
  79. {pylibms-4.3.4 → pylibms-5.0.1}/lms/project/definitions/color.py +0 -0
  80. {pylibms-4.3.4 → pylibms-5.0.1}/lms/project/definitions/style.py +0 -0
  81. /pylibms-4.3.4/lms/titleconfig/__init__.py → /pylibms-5.0.1/lms/py.typed +0 -0
  82. {pylibms-4.3.4/lms/titleconfig/definitions → pylibms-5.0.1/lms/titleconfig}/__init__.py +0 -0
  83. {pylibms-4.3.4 → pylibms-5.0.1}/lms/titleconfig/presets/Badge Arcade.yaml +0 -0
  84. {pylibms-4.3.4 → pylibms-5.0.1}/lms/titleconfig/presets/Brain Age Concentration Training.yaml +0 -0
  85. {pylibms-4.3.4 → pylibms-5.0.1}/lms/titleconfig/presets/Kirby Planet Robobot.yaml +0 -0
  86. {pylibms-4.3.4 → pylibms-5.0.1}/lms/titleconfig/presets/Super Mario 3D Land.yaml +0 -0
  87. {pylibms-4.3.4 → pylibms-5.0.1}/lms/titleconfig/presets/Super Mario 3D World + Bowsers Fury.yaml +0 -0
  88. {pylibms-4.3.4 → pylibms-5.0.1}/lms/titleconfig/presets/Super Mario Odyssey.yaml +0 -0
  89. {pylibms-4.3.4 → pylibms-5.0.1}/lms/titleconfig/presets/The Legend of Zelda Echos of Wisdom.yaml +0 -0
  90. {pylibms-4.3.4 → pylibms-5.0.1}/lms/titleconfig/presets/The Legend of Zelda a Link Between Worlds.yaml +0 -0
  91. {pylibms-4.3.4 → pylibms-5.0.1}/lms/titleconfig/presets/Tomodachi Life Living The Dream.yaml +0 -0
  92. {pylibms-4.3.4 → pylibms-5.0.1}/setup.cfg +0 -0
@@ -1,18 +1,17 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyLibMS
3
- Version: 4.3.4
3
+ Version: 5.0.1
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-Expression: MIT
7
- Project-URL: Documentation, https://github.com/AbdyyEee/PylibMS/wiki
8
7
  Project-URL: Repository, https://github.com/AbdyyEee/PylibMS
8
+ Project-URL: Documentation, https://github.com/AbdyyEee/PylibMS/wiki
9
9
  Keywords: nintendo,msbt,message text,msbp,message project,msbf,message flowchart,flw3,modding,libmessagestudio
10
- Classifier: Programming Language :: Python :: 3.10
11
10
  Classifier: Programming Language :: Python :: 3.11
12
11
  Classifier: Programming Language :: Python :: 3.12
13
12
  Classifier: Programming Language :: Python :: 3.13
14
13
  Classifier: Programming Language :: Python :: 3.14
15
- Requires-Python: >=3.10
14
+ Requires-Python: >=3.11
16
15
  Description-Content-Type: text/markdown
17
16
  License-File: LICENSE
18
17
  Requires-Dist: PyYAML>=6.0.1
@@ -25,16 +24,16 @@ Dynamic: license-file
25
24
  ![LICENSE](https://img.shields.io/badge/license-MIT-blue)
26
25
  [![PyPI version](https://badge.fury.io/py/PyLibMS.svg)](https://badge.fury.io/py/PyLibMS)
27
26
 
28
- PyLibMS is a library built in Python 3.10 and above for reading and writing of libMessageStudio (LMS) proprietary file
27
+ PyLibMS is a library built in Python 3.11 and above for reading and writing of libMessageStudio (LMS) proprietary file
29
28
  formats from Nintendo.
30
29
 
31
30
  The following is supported:
32
31
 
33
- | Format | Read | Write | Configuration Support |
34
- |--------|------|-------|---------------------------------------------------------------------------------------------------------------------------------------------|
35
- | `MSBT` | ✅ | ✅ | Support for full attribute (`ATR1`) decoding. Tag decoding 1:1 matching with official Nintendo `.mstxt` file format. |
36
- | `MSBF` | ✅ | ✅ | Support for custom node definitions, attaching names and descriptions to nodes. Altering parameter datatypes for flexibility between games. |
37
- | `MSBP` | ✅ | ❌ | Generating configuration files for use with `MSBT` files. |
32
+ | Format | Read | Write | Support |
33
+ |--------|------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
34
+ | `MSBT` | ✅ | ✅ | 1:1 Reading and writing Support for majority of sections. Full attribute (`ATR1`) decoding with configurations. Tag decoding 1:1 with the official Nintendo `.mstxt` file format. |
35
+ | `MSBF` | ✅ | ✅ | 1:1 Reading and writing flowcharts (`FLW3`). Support for custom node definitions, attaching names and descriptions to nodes. Altering parameter datatypes for flexibility between games. |
36
+ | `MSBP` | ✅ | ❌ | Viewing all MSBP relevant metadata and generating configuration files for use with `MSBT` files. |
38
37
 
39
38
  This library is designed to support LMS revision >=3.0. These include files generated for late **Wii** titles,
40
39
  **Nintendo 3DS**, **Wii U**, **Mobile**, **Nintendo Switch** and **Nintendo Switch 2** games.
@@ -46,25 +45,18 @@ and examples.
46
45
 
47
46
  ## Reading
48
47
 
49
- ### MSBT
50
-
51
48
  ```py
49
+ # MSBT
52
50
  from lms.message.msbtio import read_msbt_path
53
51
 
54
52
  msbt = read_msbt_path("Text.msbt")
55
- ```
56
-
57
- ### MSBP
58
53
 
59
- ```py
54
+ # MSBP
60
55
  from lms.project.msbpread import read_msbp_path
61
56
 
62
57
  msbp = read_msbp_path("Project.msbp")
63
- ```
64
-
65
- ### MSBF
66
58
 
67
- ```py
59
+ # MSBF
68
60
  from lms.flowchart.msbfio import read_msbf_path
69
61
 
70
62
  msbf = read_msbf_path("Flowchart.msbf")
@@ -72,19 +64,13 @@ msbf = read_msbf_path("Flowchart.msbf")
72
64
 
73
65
  ## Writing
74
66
 
75
- There is no writing for `MSBP` files as most of the time it acts as leftover metadata and not actually loaded by games.
76
-
77
- ### MSBT
78
-
79
67
  ```py
68
+ # MSBT
80
69
  from lms.message.msbtio import write_msbt_path
81
70
 
82
71
  write_msbt_path("Out_text.msbt")
83
- ```
84
-
85
- ### MSBF
86
72
 
87
- ```py
73
+ # MSBF
88
74
  from lms.flowchart.msbfio import write_msbf_path
89
75
 
90
76
  write_msbf_path("Out_Flowchart.msbf")
@@ -114,6 +100,18 @@ cd PyLibMS
114
100
  pip install -e .
115
101
  ```
116
102
 
103
+ # AI Disclaimer
104
+
105
+ Code in this library was written by me. AI was utilized occasionally when fit and always reviewed by me.
106
+
107
+ `MSBT`: Only usage of AI was for control tag regex formats and for understanding implementing string importing with
108
+ `re`.
109
+
110
+ `MSBP`: AI was not utilized anywhere.
111
+
112
+ `MSBF`: AI was only utilized for the `LMS_BaseNode.get_descendents` function and for consultation for ways to improve
113
+ the API.
114
+
117
115
  # Credits & Sources
118
116
 
119
117
  * [SS-Decomp](https://github.com/zeldaret/ss): Referenced some parts of their MSBF decomp when adding the format
@@ -1,18 +1,17 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyLibMS
3
- Version: 4.3.4
3
+ Version: 5.0.1
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-Expression: MIT
7
- Project-URL: Documentation, https://github.com/AbdyyEee/PylibMS/wiki
8
7
  Project-URL: Repository, https://github.com/AbdyyEee/PylibMS
8
+ Project-URL: Documentation, https://github.com/AbdyyEee/PylibMS/wiki
9
9
  Keywords: nintendo,msbt,message text,msbp,message project,msbf,message flowchart,flw3,modding,libmessagestudio
10
- Classifier: Programming Language :: Python :: 3.10
11
10
  Classifier: Programming Language :: Python :: 3.11
12
11
  Classifier: Programming Language :: Python :: 3.12
13
12
  Classifier: Programming Language :: Python :: 3.13
14
13
  Classifier: Programming Language :: Python :: 3.14
15
- Requires-Python: >=3.10
14
+ Requires-Python: >=3.11
16
15
  Description-Content-Type: text/markdown
17
16
  License-File: LICENSE
18
17
  Requires-Dist: PyYAML>=6.0.1
@@ -25,16 +24,16 @@ Dynamic: license-file
25
24
  ![LICENSE](https://img.shields.io/badge/license-MIT-blue)
26
25
  [![PyPI version](https://badge.fury.io/py/PyLibMS.svg)](https://badge.fury.io/py/PyLibMS)
27
26
 
28
- PyLibMS is a library built in Python 3.10 and above for reading and writing of libMessageStudio (LMS) proprietary file
27
+ PyLibMS is a library built in Python 3.11 and above for reading and writing of libMessageStudio (LMS) proprietary file
29
28
  formats from Nintendo.
30
29
 
31
30
  The following is supported:
32
31
 
33
- | Format | Read | Write | Configuration Support |
34
- |--------|------|-------|---------------------------------------------------------------------------------------------------------------------------------------------|
35
- | `MSBT` | ✅ | ✅ | Support for full attribute (`ATR1`) decoding. Tag decoding 1:1 matching with official Nintendo `.mstxt` file format. |
36
- | `MSBF` | ✅ | ✅ | Support for custom node definitions, attaching names and descriptions to nodes. Altering parameter datatypes for flexibility between games. |
37
- | `MSBP` | ✅ | ❌ | Generating configuration files for use with `MSBT` files. |
32
+ | Format | Read | Write | Support |
33
+ |--------|------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
34
+ | `MSBT` | ✅ | ✅ | 1:1 Reading and writing Support for majority of sections. Full attribute (`ATR1`) decoding with configurations. Tag decoding 1:1 with the official Nintendo `.mstxt` file format. |
35
+ | `MSBF` | ✅ | ✅ | 1:1 Reading and writing flowcharts (`FLW3`). Support for custom node definitions, attaching names and descriptions to nodes. Altering parameter datatypes for flexibility between games. |
36
+ | `MSBP` | ✅ | ❌ | Viewing all MSBP relevant metadata and generating configuration files for use with `MSBT` files. |
38
37
 
39
38
  This library is designed to support LMS revision >=3.0. These include files generated for late **Wii** titles,
40
39
  **Nintendo 3DS**, **Wii U**, **Mobile**, **Nintendo Switch** and **Nintendo Switch 2** games.
@@ -46,25 +45,18 @@ and examples.
46
45
 
47
46
  ## Reading
48
47
 
49
- ### MSBT
50
-
51
48
  ```py
49
+ # MSBT
52
50
  from lms.message.msbtio import read_msbt_path
53
51
 
54
52
  msbt = read_msbt_path("Text.msbt")
55
- ```
56
-
57
- ### MSBP
58
53
 
59
- ```py
54
+ # MSBP
60
55
  from lms.project.msbpread import read_msbp_path
61
56
 
62
57
  msbp = read_msbp_path("Project.msbp")
63
- ```
64
-
65
- ### MSBF
66
58
 
67
- ```py
59
+ # MSBF
68
60
  from lms.flowchart.msbfio import read_msbf_path
69
61
 
70
62
  msbf = read_msbf_path("Flowchart.msbf")
@@ -72,19 +64,13 @@ msbf = read_msbf_path("Flowchart.msbf")
72
64
 
73
65
  ## Writing
74
66
 
75
- There is no writing for `MSBP` files as most of the time it acts as leftover metadata and not actually loaded by games.
76
-
77
- ### MSBT
78
-
79
67
  ```py
68
+ # MSBT
80
69
  from lms.message.msbtio import write_msbt_path
81
70
 
82
71
  write_msbt_path("Out_text.msbt")
83
- ```
84
-
85
- ### MSBF
86
72
 
87
- ```py
73
+ # MSBF
88
74
  from lms.flowchart.msbfio import write_msbf_path
89
75
 
90
76
  write_msbf_path("Out_Flowchart.msbf")
@@ -114,6 +100,18 @@ cd PyLibMS
114
100
  pip install -e .
115
101
  ```
116
102
 
103
+ # AI Disclaimer
104
+
105
+ Code in this library was written by me. AI was utilized occasionally when fit and always reviewed by me.
106
+
107
+ `MSBT`: Only usage of AI was for control tag regex formats and for understanding implementing string importing with
108
+ `re`.
109
+
110
+ `MSBP`: AI was not utilized anywhere.
111
+
112
+ `MSBF`: AI was only utilized for the `LMS_BaseNode.get_descendents` function and for consultation for ways to improve
113
+ the API.
114
+
117
115
  # Credits & Sources
118
116
 
119
117
  * [SS-Decomp](https://github.com/zeldaret/ss): Referenced some parts of their MSBF decomp when adding the format
@@ -8,6 +8,7 @@ PyLibMS.egg-info/dependency_links.txt
8
8
  PyLibMS.egg-info/requires.txt
9
9
  PyLibMS.egg-info/top_level.txt
10
10
  lms/__init__.py
11
+ lms/py.typed
11
12
  lms/common/__init__.py
12
13
  lms/common/lms_constants.py
13
14
  lms/common/lms_exceptions.py
@@ -26,7 +27,6 @@ lms/flowchart/flw3.py
26
27
  lms/flowchart/msbf.py
27
28
  lms/flowchart/msbfio.py
28
29
  lms/flowchart/definitions/__init__.py
29
- lms/flowchart/definitions/flowchart.py
30
30
  lms/flowchart/definitions/lms_nodeexceptions.py
31
31
  lms/flowchart/definitions/node.py
32
32
  lms/flowchart/definitions/node_type.py
@@ -67,9 +67,9 @@ lms/titleconfig/__init__.py
67
67
  lms/titleconfig/config.py
68
68
  lms/titleconfig/definitions/__init__.py
69
69
  lms/titleconfig/definitions/attribute.py
70
+ lms/titleconfig/definitions/field.py
70
71
  lms/titleconfig/definitions/nodes.py
71
72
  lms/titleconfig/definitions/tags.py
72
- lms/titleconfig/definitions/value.py
73
73
  lms/titleconfig/presets/Badge Arcade.yaml
74
74
  lms/titleconfig/presets/Brain Age Concentration Training.yaml
75
75
  lms/titleconfig/presets/Kirby Planet Robobot.yaml
@@ -4,16 +4,16 @@
4
4
  ![LICENSE](https://img.shields.io/badge/license-MIT-blue)
5
5
  [![PyPI version](https://badge.fury.io/py/PyLibMS.svg)](https://badge.fury.io/py/PyLibMS)
6
6
 
7
- PyLibMS is a library built in Python 3.10 and above for reading and writing of libMessageStudio (LMS) proprietary file
7
+ PyLibMS is a library built in Python 3.11 and above for reading and writing of libMessageStudio (LMS) proprietary file
8
8
  formats from Nintendo.
9
9
 
10
10
  The following is supported:
11
11
 
12
- | Format | Read | Write | Configuration Support |
13
- |--------|------|-------|---------------------------------------------------------------------------------------------------------------------------------------------|
14
- | `MSBT` | ✅ | ✅ | Support for full attribute (`ATR1`) decoding. Tag decoding 1:1 matching with official Nintendo `.mstxt` file format. |
15
- | `MSBF` | ✅ | ✅ | Support for custom node definitions, attaching names and descriptions to nodes. Altering parameter datatypes for flexibility between games. |
16
- | `MSBP` | ✅ | ❌ | Generating configuration files for use with `MSBT` files. |
12
+ | Format | Read | Write | Support |
13
+ |--------|------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
14
+ | `MSBT` | ✅ | ✅ | 1:1 Reading and writing Support for majority of sections. Full attribute (`ATR1`) decoding with configurations. Tag decoding 1:1 with the official Nintendo `.mstxt` file format. |
15
+ | `MSBF` | ✅ | ✅ | 1:1 Reading and writing flowcharts (`FLW3`). Support for custom node definitions, attaching names and descriptions to nodes. Altering parameter datatypes for flexibility between games. |
16
+ | `MSBP` | ✅ | ❌ | Viewing all MSBP relevant metadata and generating configuration files for use with `MSBT` files. |
17
17
 
18
18
  This library is designed to support LMS revision >=3.0. These include files generated for late **Wii** titles,
19
19
  **Nintendo 3DS**, **Wii U**, **Mobile**, **Nintendo Switch** and **Nintendo Switch 2** games.
@@ -25,25 +25,18 @@ and examples.
25
25
 
26
26
  ## Reading
27
27
 
28
- ### MSBT
29
-
30
28
  ```py
29
+ # MSBT
31
30
  from lms.message.msbtio import read_msbt_path
32
31
 
33
32
  msbt = read_msbt_path("Text.msbt")
34
- ```
35
-
36
- ### MSBP
37
33
 
38
- ```py
34
+ # MSBP
39
35
  from lms.project.msbpread import read_msbp_path
40
36
 
41
37
  msbp = read_msbp_path("Project.msbp")
42
- ```
43
38
 
44
- ### MSBF
45
-
46
- ```py
39
+ # MSBF
47
40
  from lms.flowchart.msbfio import read_msbf_path
48
41
 
49
42
  msbf = read_msbf_path("Flowchart.msbf")
@@ -51,19 +44,13 @@ msbf = read_msbf_path("Flowchart.msbf")
51
44
 
52
45
  ## Writing
53
46
 
54
- There is no writing for `MSBP` files as most of the time it acts as leftover metadata and not actually loaded by games.
55
-
56
- ### MSBT
57
-
58
47
  ```py
48
+ # MSBT
59
49
  from lms.message.msbtio import write_msbt_path
60
50
 
61
51
  write_msbt_path("Out_text.msbt")
62
- ```
63
-
64
- ### MSBF
65
52
 
66
- ```py
53
+ # MSBF
67
54
  from lms.flowchart.msbfio import write_msbf_path
68
55
 
69
56
  write_msbf_path("Out_Flowchart.msbf")
@@ -93,6 +80,18 @@ cd PyLibMS
93
80
  pip install -e .
94
81
  ```
95
82
 
83
+ # AI Disclaimer
84
+
85
+ Code in this library was written by me. AI was utilized occasionally when fit and always reviewed by me.
86
+
87
+ `MSBT`: Only usage of AI was for control tag regex formats and for understanding implementing string importing with
88
+ `re`.
89
+
90
+ `MSBP`: AI was not utilized anywhere.
91
+
92
+ `MSBF`: AI was only utilized for the `LMS_BaseNode.get_descendents` function and for consultation for ways to improve
93
+ the API.
94
+
96
95
  # Credits & Sources
97
96
 
98
97
  * [SS-Decomp](https://github.com/zeldaret/ss): Referenced some parts of their MSBF decomp when adding the format
@@ -4,18 +4,18 @@ from lms.common.field.lms_datatype import (
4
4
  LMS_DataType,
5
5
  is_bool_datatype,
6
6
  is_bytes_datatype,
7
- is_list_datatype,
7
+ is_enum_datatype,
8
8
  is_number_datatype,
9
9
  )
10
10
  from lms.common.field.lms_field import LMS_Field
11
11
  from lms.fileio.io import FileReader, FileWriter
12
- from lms.titleconfig.definitions.value import ValueDefinition
12
+ from lms.titleconfig.definitions.field import FieldDefinition
13
13
 
14
14
 
15
15
  def read_field(
16
- reader: FileReader,
17
- definition: ValueDefinition,
18
- read_variable_width_value: Callable | None = None,
16
+ reader: FileReader,
17
+ definition: FieldDefinition,
18
+ read_variable_width_value: Callable | None = None,
19
19
  ) -> LMS_Field:
20
20
  # String is excluded as their reading varies between MSBT/MSBF
21
21
  match definition.datatype:
@@ -33,27 +33,25 @@ def read_field(
33
33
  value = reader.read_int32()
34
34
  case LMS_DataType.FLOAT32:
35
35
  value = reader.read_float32()
36
- case LMS_DataType.LIST:
36
+ case LMS_DataType.ENUM:
37
37
  if read_variable_width_value is not None:
38
38
  index = read_variable_width_value()
39
39
  else:
40
40
  index = reader.read_uint8()
41
- value = definition.list_items[index]
41
+ value = definition.enum_members[index]
42
42
  case LMS_DataType.BOOL:
43
43
  if read_variable_width_value is not None:
44
44
  value = bool(read_variable_width_value())
45
45
  else:
46
46
  value = bool(reader.read_uint8())
47
- case LMS_DataType.BYTES:
48
- value = reader.read_bytes(1)
49
47
 
50
- return LMS_Field(value, definition) # type: ignore
48
+ return LMS_Field(value, definition)
51
49
 
52
50
 
53
51
  def write_field(
54
- writer: FileWriter,
55
- field: LMS_Field,
56
- write_variable_width_value: Callable | None = None,
52
+ writer: FileWriter,
53
+ field: LMS_Field,
54
+ write_variable_width_value: Callable | None = None,
57
55
  ) -> None:
58
56
  if is_number_datatype(field.value, field.datatype):
59
57
  write_functions: dict[LMS_DataType, Callable] = {
@@ -68,8 +66,8 @@ def write_field(
68
66
  write_functions[field.datatype](field.value)
69
67
  return
70
68
 
71
- if is_list_datatype(field.value, field.datatype):
72
- value = field.list_items.index(field.value)
69
+ if is_enum_datatype(field.value, field.datatype):
70
+ value = list(field.enum_members.values()).index(field.value)
73
71
  if write_variable_width_value is not None:
74
72
  write_variable_width_value(value)
75
73
  else:
@@ -1,6 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
- from enum import Enum
3
+ from enum import IntEnum, auto
4
4
  from typing import Type, TypeGuard
5
5
 
6
6
  FLOAT32_MIN = -3.4028235e38
@@ -15,8 +15,9 @@ ALIAS_MAP = {
15
15
  "i32": "INT32",
16
16
  "f32": "FLOAT32",
17
17
  "str": "STRING",
18
+ # LIST fallback for ENUM datatype
19
+ "list": "ENUM",
18
20
  "bool": "BOOL",
19
- "byte": "BYTES",
20
21
  }
21
22
 
22
23
 
@@ -32,8 +33,8 @@ def is_number_datatype(value: object, datatype: LMS_DataType) -> TypeGuard[int |
32
33
  ) and isinstance(value, int)
33
34
 
34
35
 
35
- def is_list_datatype(value: object, datatype: LMS_DataType) -> TypeGuard[str]:
36
- return datatype is LMS_DataType.LIST and isinstance(value, str)
36
+ def is_enum_datatype(value: object, datatype: LMS_DataType) -> TypeGuard[str]:
37
+ return datatype is LMS_DataType.ENUM and isinstance(value, str)
37
38
 
38
39
 
39
40
  def is_bool_datatype(value: object, datatype: LMS_DataType) -> TypeGuard[bool]:
@@ -48,7 +49,7 @@ def is_string_datatype(value: object, datatype: LMS_DataType) -> TypeGuard[str]:
48
49
  return datatype is LMS_DataType.STRING and isinstance(value, str)
49
50
 
50
51
 
51
- class LMS_DataType(Enum):
52
+ class LMS_DataType(IntEnum):
52
53
  """Enum that represents a datatype for a value entry in a MSBT/MSBP file."""
53
54
 
54
55
  UINT8 = 0
@@ -62,64 +63,56 @@ class LMS_DataType(Enum):
62
63
  FLOAT32 = 6
63
64
 
64
65
  STRING = 8
65
- LIST = 9
66
+ ENUM = 9
66
67
 
67
- # - Interface types -
68
- # These types act as an abstraction for a real LMS_Datatype
69
- # The actual value isn't important since they are not real types, but are instantiated from a config
70
- BOOL = "bool"
71
- BYTES = "byte"
72
-
73
- def to_string(self) -> str:
74
- return self._name_.lower()
68
+ # Interface type for UINT8
69
+ BOOL = auto()
75
70
 
76
71
  @property
77
72
  def signed(self) -> bool:
78
73
  """Property for if the type is signed or not."""
79
74
  if self not in [
80
- LMS_DataType.STRING,
81
- LMS_DataType.LIST,
82
- LMS_DataType.BOOL,
83
- LMS_DataType.BYTES,
75
+ self.STRING,
76
+ self.ENUM,
77
+ self.BOOL,
84
78
  ]:
85
- return self in [LMS_DataType.INT8, LMS_DataType.INT16, LMS_DataType.INT32]
79
+ return self in [self.INT8, self.INT16, self.INT32]
86
80
 
87
- raise TypeError(f"Signed is not a valid property for '{self.to_string()}'!")
81
+ raise TypeError(f"Signed is not a valid property for '{self.name.lower()}'!")
88
82
 
89
83
  @property
90
84
  def builtin_type(self) -> Type[int | float | str | bool | bytes]:
91
85
  """The enum as the builtin python type."""
92
86
  return {
93
- LMS_DataType.UINT8: int,
94
- LMS_DataType.UINT16: int,
95
- LMS_DataType.UINT32: int,
96
- LMS_DataType.INT8: int,
97
- LMS_DataType.INT16: int,
98
- LMS_DataType.INT32: int,
99
- LMS_DataType.FLOAT32: float,
100
- LMS_DataType.STRING: str,
101
- LMS_DataType.LIST: str,
102
- LMS_DataType.BOOL: bool,
103
- LMS_DataType.BYTES: bytes,
87
+ self.UINT8: int,
88
+ self.UINT16: int,
89
+ self.UINT32: int,
90
+ self.INT8: int,
91
+ self.INT16: int,
92
+ self.INT32: int,
93
+ self.FLOAT32: float,
94
+ self.STRING: str,
95
+ self.ENUM: str,
96
+ self.BOOL: bool,
104
97
  }[self]
105
98
 
106
99
  @property
107
100
  def stream_size(self) -> int:
108
101
  """Size of the datatype, only for fixed integers."""
109
102
  sizes = {
110
- LMS_DataType.UINT8: 1,
111
- LMS_DataType.UINT16: 2,
112
- LMS_DataType.UINT32: 4,
113
- LMS_DataType.INT8: 1,
114
- LMS_DataType.INT16: 2,
115
- LMS_DataType.INT32: 4,
116
- LMS_DataType.FLOAT32: 4,
103
+ self.UINT8: 1,
104
+ self.UINT16: 2,
105
+ self.UINT32: 4,
106
+ self.INT8: 1,
107
+ self.INT16: 2,
108
+ self.INT32: 4,
109
+ self.FLOAT32: 4,
117
110
  }
118
111
 
119
112
  try:
120
113
  return sizes[self]
121
114
  except KeyError:
122
- raise TypeError(f"Stream size is not defined for '{self.to_string()}'.")
115
+ raise TypeError(f"Stream size is not defined for '{self.name.lower()}'.")
123
116
 
124
117
  @classmethod
125
118
  def from_string(cls, string: str):
@@ -136,8 +129,8 @@ class LMS_DataType(Enum):
136
129
 
137
130
 
138
131
  def verify_number_from_datatype(
139
- value: int | float,
140
- datatype: LMS_DataType,
132
+ value: int | float,
133
+ datatype: LMS_DataType,
141
134
  ):
142
135
  if datatype is LMS_DataType.FLOAT32:
143
136
  max_value = FLOAT32_MAX
@@ -148,7 +141,7 @@ def verify_number_from_datatype(
148
141
  max_value = 2 ** (bits - 1)
149
142
  min_value = -max_value
150
143
  else:
151
- min_value, max_value = 0, (2**bits) - 1
144
+ min_value, max_value = 0, (2 ** bits) - 1
152
145
 
153
146
  if not min_value <= value <= max_value:
154
147
  raise ValueError(