PyLibMS 4.2.0__tar.gz → 4.2.2__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.
- pylibms-4.2.2/MANIFEST.in +1 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/PKG-INFO +2 -2
- {pylibms-4.2.0 → pylibms-4.2.2}/PyLibMS.egg-info/PKG-INFO +2 -2
- {pylibms-4.2.0 → pylibms-4.2.2}/README.md +1 -1
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/flowchart/definitions/flowchart.py +1 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/flowchart/definitions/node.py +112 -33
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/flowchart/definitions/node_type.py +5 -5
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/flowchart/flw3.py +340 -336
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/definitions/nodes.py +8 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/presets/Tomodachi Life NA-EU.yaml +6 -1
- {pylibms-4.2.0 → pylibms-4.2.2}/pyproject.toml +1 -1
- pylibms-4.2.0/MANIFEST.in +0 -2
- {pylibms-4.2.0 → pylibms-4.2.2}/LICENSE +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/PyLibMS.egg-info/SOURCES.txt +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/PyLibMS.egg-info/dependency_links.txt +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/PyLibMS.egg-info/requires.txt +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/PyLibMS.egg-info/top_level.txt +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/__init__.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/common/__init__.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/common/field/__init__.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/common/field/io.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/common/field/lms_datatype.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/common/field/lms_field.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/common/lms_constants.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/common/lms_exceptions.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/common/lms_fileinfo.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/common/stream/fileinfo.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/common/stream/hashtable.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/common/stream/section.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/fileio/encoding.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/fileio/io.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/flowchart/__init__.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/flowchart/definitions/__init__.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/flowchart/definitions/lms_nodeexceptions.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/flowchart/msbf.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/flowchart/msbfio.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/__init__.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/definitions/__init__.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/definitions/field/__init__.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/lms_messagetext.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/msbt.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/msbtentry.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/msbtio.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/section/__init__.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/section/atr1.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/section/nli1.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/section/tsy1.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/section/txt2.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/tag/__init__.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/tag/io/param_io.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/tag/io/tag_io.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/tag/lms_tag.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/message/tag/lms_tagexceptions.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/__init__.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/definitions/__init__.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/definitions/attribute.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/definitions/color.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/definitions/style.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/definitions/tag.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/msbp.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/msbpread.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/section/ali2.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/section/ati2.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/section/clr1.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/section/string.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/section/syl3.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/section/tag2.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/section/tgg2.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/project/section/tgp2.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/__init__.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/config.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/definitions/__init__.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/definitions/attribute.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/definitions/tags.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/definitions/value.py +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/presets/Badge Arcade.yaml +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/presets/Brain Age Concentration Training.yaml +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/presets/Kirby Planet Robobot.yaml +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/presets/Super Mario 3D Land.yaml +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/presets/Super Mario 3D World + Bowsers Fury.yaml +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/presets/Super Mario Odyssey.yaml +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/presets/The Legend of Zelda Echos of Wisdom.yaml +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/presets/The Legend of Zelda a Link Between Worlds.yaml +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/lms/titleconfig/presets/Tomodachi Life Living The Dream.yaml +0 -0
- {pylibms-4.2.0 → pylibms-4.2.2}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include README.md LICENSE
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyLibMS
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.2
|
|
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
|
|
@@ -107,7 +107,7 @@ pip install -e .
|
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
# Credits & Sources
|
|
110
|
-
|
|
110
|
+
* [SS-Decomp](https://github.com/zeldaret/ss): Referenced some parts of their MSBF decomp when adding the format to [Nintendo-File-Formats](https://nintendo-formats.com) and this library.
|
|
111
111
|
* [Nintendo-File-Formats](https://nintendo-formats.com) by Kinnay: For existing information on the MSBT and MSBP file
|
|
112
112
|
formats.
|
|
113
113
|
* [Trippixyz](https://github.com/Trippixyz): For helping me get started general decompilation of the formats and general
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyLibMS
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.2
|
|
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
|
|
@@ -107,7 +107,7 @@ pip install -e .
|
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
# Credits & Sources
|
|
110
|
-
|
|
110
|
+
* [SS-Decomp](https://github.com/zeldaret/ss): Referenced some parts of their MSBF decomp when adding the format to [Nintendo-File-Formats](https://nintendo-formats.com) and this library.
|
|
111
111
|
* [Nintendo-File-Formats](https://nintendo-formats.com) by Kinnay: For existing information on the MSBT and MSBP file
|
|
112
112
|
formats.
|
|
113
113
|
* [Trippixyz](https://github.com/Trippixyz): For helping me get started general decompilation of the formats and general
|
|
@@ -86,7 +86,7 @@ pip install -e .
|
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
# Credits & Sources
|
|
89
|
-
|
|
89
|
+
* [SS-Decomp](https://github.com/zeldaret/ss): Referenced some parts of their MSBF decomp when adding the format to [Nintendo-File-Formats](https://nintendo-formats.com) and this library.
|
|
90
90
|
* [Nintendo-File-Formats](https://nintendo-formats.com) by Kinnay: For existing information on the MSBT and MSBP file
|
|
91
91
|
formats.
|
|
92
92
|
* [Trippixyz](https://github.com/Trippixyz): For helping me get started general decompilation of the formats and general
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import string
|
|
3
4
|
from collections import deque
|
|
4
5
|
from types import MappingProxyType
|
|
5
6
|
from typing import Generator
|
|
@@ -27,15 +28,14 @@ class LMS_BaseNode:
|
|
|
27
28
|
id: int | None,
|
|
28
29
|
node_type: LMS_NodeType,
|
|
29
30
|
parameter_type: LMS_NodeParameterType,
|
|
30
|
-
parameter_value: LMS_NodeParameter | None
|
|
31
|
-
stream_next_id: int | None = None):
|
|
31
|
+
parameter_value: LMS_NodeParameter | None):
|
|
32
32
|
self.id = id
|
|
33
33
|
self._node_type = node_type
|
|
34
34
|
|
|
35
35
|
self._parameter_type = parameter_type
|
|
36
36
|
self._parameter_value = parameter_value
|
|
37
37
|
|
|
38
|
-
self._stream_next_id: int | None =
|
|
38
|
+
self._stream_next_id: int | None = None
|
|
39
39
|
self._next_node: LMS_BaseNode | None = None
|
|
40
40
|
|
|
41
41
|
@property
|
|
@@ -76,14 +76,6 @@ class LMS_BaseNode:
|
|
|
76
76
|
if not isinstance(value, self._parameter_type.builtin_type):
|
|
77
77
|
raise TypeError(f"Wrong value provided! Expected {self._parameter_type.builtin_type} got {type(value)}")
|
|
78
78
|
|
|
79
|
-
sliced_datatype = {
|
|
80
|
-
LMS_NodeParameterType.PARAM_16_16: (LMS_DataType.UINT16, LMS_DataType.UINT16),
|
|
81
|
-
LMS_NodeParameterType.PARAM_16_8_8: (LMS_DataType.UINT16, LMS_DataType.UINT8, LMS_DataType.UINT8),
|
|
82
|
-
LMS_NodeParameterType.PARAM_8_8_16: (LMS_DataType.UINT8, LMS_DataType.UINT8, LMS_DataType.UINT16),
|
|
83
|
-
LMS_NodeParameterType.PARAM_8_8_8_8: (LMS_DataType.UINT8, LMS_DataType.UINT8, LMS_DataType.UINT8,
|
|
84
|
-
LMS_DataType.UINT8)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
79
|
match self._parameter_type:
|
|
88
80
|
case LMS_NodeParameterType.STRING:
|
|
89
81
|
self._parameter_value = value
|
|
@@ -92,7 +84,8 @@ class LMS_BaseNode:
|
|
|
92
84
|
self._parameter_value = value
|
|
93
85
|
case _:
|
|
94
86
|
for i, parameter in enumerate(value):
|
|
95
|
-
verify_number_from_datatype(parameter,
|
|
87
|
+
verify_number_from_datatype(parameter,
|
|
88
|
+
self._parameter_type.sliced_datatype[self._parameter_type][i])
|
|
96
89
|
|
|
97
90
|
self._parameter_value = value
|
|
98
91
|
|
|
@@ -100,8 +93,6 @@ class LMS_BaseNode:
|
|
|
100
93
|
"""Set the next node for the instance.
|
|
101
94
|
|
|
102
95
|
:param node: the node object, None for no next node."""
|
|
103
|
-
# Once next_node is properly set, stream_id is never accessed again
|
|
104
|
-
# While it does become stale, there is no point to altering it afterward
|
|
105
96
|
self._next_node = node
|
|
106
97
|
return node
|
|
107
98
|
|
|
@@ -143,7 +134,6 @@ class LMS_MessageNode(LMS_BaseNode):
|
|
|
143
134
|
|
|
144
135
|
def __init__(self,
|
|
145
136
|
id: int | None,
|
|
146
|
-
stream_next_node: int,
|
|
147
137
|
msbt_index: int,
|
|
148
138
|
label_index: int,
|
|
149
139
|
msbt: MSBT | None = None
|
|
@@ -153,7 +143,6 @@ class LMS_MessageNode(LMS_BaseNode):
|
|
|
153
143
|
LMS_NodeType.MESSAGE,
|
|
154
144
|
LMS_NodeParameterType.NONE,
|
|
155
145
|
None,
|
|
156
|
-
stream_next_node
|
|
157
146
|
)
|
|
158
147
|
|
|
159
148
|
self.msbt_index = msbt_index
|
|
@@ -173,7 +162,7 @@ class LMS_MessageNode(LMS_BaseNode):
|
|
|
173
162
|
@classmethod
|
|
174
163
|
def new_msbt(cls, file_index: int, entry: MSBTEntry, msbt: MSBT):
|
|
175
164
|
"""
|
|
176
|
-
Creates a new LMS_MessageNode given a MSBT object.
|
|
165
|
+
Creates a new ``LMS_MessageNode`` given a MSBT object.
|
|
177
166
|
|
|
178
167
|
:param file_index: index of the MSBT file in a folder/archive.
|
|
179
168
|
:param entry: the MSBTEntry object to reference.
|
|
@@ -211,13 +200,20 @@ class LMS_BranchNode(LMS_BaseNode):
|
|
|
211
200
|
LMS_NodeType.BRANCH,
|
|
212
201
|
parameter_type,
|
|
213
202
|
parameter_value,
|
|
214
|
-
NO_NEXT_NODE
|
|
215
203
|
)
|
|
216
204
|
|
|
217
205
|
self._condition_id = condition_id
|
|
218
206
|
self._branches: dict[int, LMS_BaseNode | None] = {}
|
|
219
207
|
self._definition = definition
|
|
220
208
|
|
|
209
|
+
def __repr__(self):
|
|
210
|
+
if self._definition is None:
|
|
211
|
+
return super().__repr__()
|
|
212
|
+
return f"{self._definition.name}({ {field.name: field.value for field in self._parameter_value} } {self.id}"
|
|
213
|
+
|
|
214
|
+
def set_next_node(self, node: LMS_BaseNode | None) -> LMS_BaseNode | None:
|
|
215
|
+
raise NotImplementedError("Use function set_branch_case to alter the flow of a branch node!")
|
|
216
|
+
|
|
221
217
|
@classmethod
|
|
222
218
|
def new(cls,
|
|
223
219
|
parameter_type: LMS_NodeParameterType,
|
|
@@ -275,6 +271,67 @@ class LMS_BranchNode(LMS_BaseNode):
|
|
|
275
271
|
"""The node branches."""
|
|
276
272
|
return MappingProxyType(self._branches)
|
|
277
273
|
|
|
274
|
+
def get_case_options(self, compress_shared_references: bool = False) -> list[
|
|
275
|
+
tuple[tuple[int, ...], str, LMS_BaseNode | None]]:
|
|
276
|
+
"""
|
|
277
|
+
Retrieves the cases from this node formatted with the proper messages.
|
|
278
|
+
|
|
279
|
+
If a definition is provided, and either ``case_format`` or ``case_options`` are provied, the resulting
|
|
280
|
+
message will utilize those values to format the message.
|
|
281
|
+
|
|
282
|
+
:param compress_shared_references: whether to compress shared references into one case.
|
|
283
|
+
"""
|
|
284
|
+
result, case_map = [], {}
|
|
285
|
+
|
|
286
|
+
for case, branch in self._branches.items():
|
|
287
|
+
case_map.setdefault(branch, []).append(case)
|
|
288
|
+
|
|
289
|
+
if self.definition is not None:
|
|
290
|
+
|
|
291
|
+
if self.definition.case_options:
|
|
292
|
+
for case, branch in self._branches.items():
|
|
293
|
+
case_message = self.definition.case_options.get(case, f"Case {case}")
|
|
294
|
+
|
|
295
|
+
result.append(((case,), case_message, branch))
|
|
296
|
+
|
|
297
|
+
return result
|
|
298
|
+
|
|
299
|
+
if self.definition.case_format is not None:
|
|
300
|
+
if compress_shared_references:
|
|
301
|
+
for branch, cases in case_map.items():
|
|
302
|
+
case_message = self._format_case_message(merge_shared_cases(cases))
|
|
303
|
+
result.append((tuple(cases), case_message, branch))
|
|
304
|
+
else:
|
|
305
|
+
for case, branch in self._branches.items():
|
|
306
|
+
case_message = self._format_case_message(case)
|
|
307
|
+
result.append(((case,), case_message, branch))
|
|
308
|
+
|
|
309
|
+
return result
|
|
310
|
+
|
|
311
|
+
if compress_shared_references:
|
|
312
|
+
for branch, cases in case_map.items():
|
|
313
|
+
case_message = f"Case {cases[0]}" if len(cases) == 1 else f"Cases {merge_shared_cases(cases)}"
|
|
314
|
+
result.append((tuple(cases), case_message, branch))
|
|
315
|
+
else:
|
|
316
|
+
for case, branch in self._branches.items():
|
|
317
|
+
case_message = f"Case {case}"
|
|
318
|
+
result.append((case,), case_message, branch)
|
|
319
|
+
|
|
320
|
+
return result
|
|
321
|
+
|
|
322
|
+
def _format_case_message(self, case_prefix: str):
|
|
323
|
+
prefix = string.Template(self._definition.case_format)
|
|
324
|
+
|
|
325
|
+
# Unpack dict for formatting $case and $param formats
|
|
326
|
+
# Allows inserting parameter values dynamically into the case message
|
|
327
|
+
string_map = {}
|
|
328
|
+
for param_definition in self.definition.parameter_definitions:
|
|
329
|
+
string_map[param_definition.name] = self.parameter_value[
|
|
330
|
+
param_definition.name].value
|
|
331
|
+
|
|
332
|
+
string_map["case"] = case_prefix
|
|
333
|
+
return prefix.substitute(**string_map)
|
|
334
|
+
|
|
278
335
|
def add_branch(self, node: LMS_BaseNode | None) -> None:
|
|
279
336
|
"""
|
|
280
337
|
Adds a branch to the node.
|
|
@@ -345,31 +402,34 @@ class LMS_EventNode(LMS_BaseNode):
|
|
|
345
402
|
parameter_type: LMS_NodeParameterType,
|
|
346
403
|
parameter_value: LMS_FieldMap | int | str | tuple[int, ...],
|
|
347
404
|
action_id: int,
|
|
348
|
-
stream_next_id: int | None = None,
|
|
349
405
|
definition: NodeDefinition | None = None,
|
|
350
406
|
):
|
|
351
407
|
super().__init__(
|
|
352
408
|
id,
|
|
353
409
|
LMS_NodeType.EVENT,
|
|
354
410
|
parameter_type,
|
|
355
|
-
parameter_value
|
|
356
|
-
stream_next_id)
|
|
411
|
+
parameter_value)
|
|
357
412
|
|
|
358
|
-
self.
|
|
413
|
+
self._event_id = action_id
|
|
359
414
|
self._definition = definition
|
|
360
415
|
|
|
416
|
+
def __repr__(self):
|
|
417
|
+
if self._definition is None:
|
|
418
|
+
return super().__repr__()
|
|
419
|
+
return f"{self._definition.name}({ {field.name: field.value for field in self._parameter_value} } {self.id}"
|
|
420
|
+
|
|
361
421
|
@classmethod
|
|
362
|
-
def new(cls, parameter_type: LMS_NodeParameterType, parameter_value: int | str | tuple[int, ...],
|
|
422
|
+
def new(cls, parameter_type: LMS_NodeParameterType, parameter_value: int | str | tuple[int, ...], event_id: int):
|
|
363
423
|
"""
|
|
364
424
|
Instantiates a new event node.
|
|
365
425
|
|
|
366
426
|
:param parameter_type: the parameter type.
|
|
367
427
|
:param parameter_value: the parameter value.
|
|
368
|
-
:param
|
|
428
|
+
:param event_id: the event_id of the node.
|
|
369
429
|
|
|
370
430
|
"""
|
|
371
431
|
verify_parameter_structure(parameter_value, parameter_type)
|
|
372
|
-
return cls(None, parameter_type, parameter_value,
|
|
432
|
+
return cls(None, parameter_type, parameter_value, event_id)
|
|
373
433
|
|
|
374
434
|
@classmethod
|
|
375
435
|
def new_from_definition(cls,
|
|
@@ -399,9 +459,9 @@ class LMS_EventNode(LMS_BaseNode):
|
|
|
399
459
|
return self._definition.name
|
|
400
460
|
|
|
401
461
|
@property
|
|
402
|
-
def
|
|
462
|
+
def event_id(self) -> int:
|
|
403
463
|
"""The identifier to determine which action to run."""
|
|
404
|
-
return self.
|
|
464
|
+
return self._event_id
|
|
405
465
|
|
|
406
466
|
|
|
407
467
|
class LMS_EntryNode(LMS_BaseNode):
|
|
@@ -409,13 +469,12 @@ class LMS_EntryNode(LMS_BaseNode):
|
|
|
409
469
|
Class that represents an entry node. Node that is at the start of a flowchart.
|
|
410
470
|
"""
|
|
411
471
|
|
|
412
|
-
def __init__(self, id: int,
|
|
472
|
+
def __init__(self, id: int, flowchart_name: str = ""):
|
|
413
473
|
super().__init__(
|
|
414
474
|
id,
|
|
415
475
|
LMS_NodeType.ENTRY,
|
|
416
476
|
LMS_NodeParameterType.NONE,
|
|
417
|
-
None
|
|
418
|
-
stream_next_id)
|
|
477
|
+
None)
|
|
419
478
|
|
|
420
479
|
self.flowchart_name = flowchart_name
|
|
421
480
|
|
|
@@ -425,13 +484,12 @@ class LMS_JumpNode(LMS_BaseNode):
|
|
|
425
484
|
Class that represents a jump node. Node that jumps to another flowchart.
|
|
426
485
|
"""
|
|
427
486
|
|
|
428
|
-
def __init__(self, id: int,
|
|
487
|
+
def __init__(self, id: int, unknown_short0a: int):
|
|
429
488
|
super().__init__(
|
|
430
489
|
id,
|
|
431
490
|
LMS_NodeType.JUMP,
|
|
432
491
|
LMS_NodeParameterType.NONE,
|
|
433
|
-
None
|
|
434
|
-
next_flowchart_id)
|
|
492
|
+
None)
|
|
435
493
|
|
|
436
494
|
self.next_flowchart: LMS_EntryNode | None = None
|
|
437
495
|
|
|
@@ -478,3 +536,24 @@ def verify_parameter_structure(value: int | tuple[int, ...] | str, parameter_typ
|
|
|
478
536
|
if isinstance(value, tuple) and len(value) != parameter_type.value_count:
|
|
479
537
|
raise node_exceptions.LMS_NodeMissingParameterValueError(
|
|
480
538
|
f"Parameter type {parameter_type} expects {parameter_type.value_count} parameter values, got {len(value)}!")
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
def merge_shared_cases(cases: list[int]) -> str:
|
|
542
|
+
cases = sorted(cases)
|
|
543
|
+
|
|
544
|
+
result = []
|
|
545
|
+
start = cases[0]
|
|
546
|
+
end = cases[0]
|
|
547
|
+
|
|
548
|
+
for case in cases[1:]:
|
|
549
|
+
if case == end + 1:
|
|
550
|
+
end = case
|
|
551
|
+
continue
|
|
552
|
+
|
|
553
|
+
result.append(str(start) if start == end else f"{start}-{end}")
|
|
554
|
+
|
|
555
|
+
start = case
|
|
556
|
+
end = case
|
|
557
|
+
|
|
558
|
+
result.append(str(start) if start == end else f"{start}-{end}")
|
|
559
|
+
return ", ".join(result)
|
|
@@ -54,21 +54,21 @@ class LMS_NodeParameterType(IntEnum):
|
|
|
54
54
|
NONE = -1
|
|
55
55
|
|
|
56
56
|
@property
|
|
57
|
-
def sliced_datatype(self):
|
|
58
|
-
"""The parameter type split into the raw datatypes. Not valid for
|
|
57
|
+
def sliced_datatype(self) -> tuple[LMS_DataType, ...]:
|
|
58
|
+
"""The parameter type split into the raw datatypes. Not valid for STRING."""
|
|
59
59
|
if self in [
|
|
60
60
|
LMS_NodeParameterType.NONE,
|
|
61
|
-
LMS_NodeParameterType.PARAM_32_0,
|
|
62
|
-
LMS_NodeParameterType.PARAM_32_1,
|
|
63
61
|
LMS_NodeParameterType.STRING]:
|
|
64
62
|
raise TypeError(f"There is no sliced datatypes for {self} parameter types!")
|
|
65
63
|
|
|
66
64
|
return {
|
|
65
|
+
LMS_NodeParameterType.PARAM_32_0: (LMS_DataType.UINT32,),
|
|
67
66
|
LMS_NodeParameterType.PARAM_16_16: (LMS_DataType.UINT16, LMS_DataType.UINT16),
|
|
68
67
|
LMS_NodeParameterType.PARAM_16_8_8: (LMS_DataType.UINT16, LMS_DataType.UINT8, LMS_DataType.UINT8),
|
|
69
68
|
LMS_NodeParameterType.PARAM_8_8_16: (LMS_DataType.UINT8, LMS_DataType.UINT8, LMS_DataType.UINT16),
|
|
70
69
|
LMS_NodeParameterType.PARAM_8_8_8_8: (LMS_DataType.UINT8, LMS_DataType.UINT8, LMS_DataType.UINT8,
|
|
71
|
-
LMS_DataType.UINT8)
|
|
70
|
+
LMS_DataType.UINT8),
|
|
71
|
+
LMS_NodeParameterType.PARAM_32_1: (LMS_DataType.UINT32,)
|
|
72
72
|
}[self]
|
|
73
73
|
|
|
74
74
|
@property
|