PyREUser3 0.3.0__tar.gz → 0.5.0__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 (48) hide show
  1. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/PKG-INFO +4 -2
  2. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/PyREUser3.egg-info/PKG-INFO +4 -2
  3. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/PyREUser3.egg-info/SOURCES.txt +3 -1
  4. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/README.md +3 -2
  5. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/docs/PYPI.md +3 -1
  6. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/docs/README.zh-CN.md +2 -2
  7. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyproject.toml +1 -1
  8. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/api.py +3 -4
  9. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/core.py +67 -0
  10. pyreuser3-0.5.0/pyreuser3/export/__init__.py +27 -0
  11. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/export/base.py +2 -0
  12. pyreuser3-0.5.0/pyreuser3/export/enums.py +486 -0
  13. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/export/fields.py +39 -6
  14. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/export/metadata.py +78 -9
  15. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/export/tree.py +11 -0
  16. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/export/user3.py +14 -6
  17. pyreuser3-0.5.0/pyreuser3/pack/__init__.py +27 -0
  18. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/pack/base.py +10 -2
  19. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/pack/plan.py +23 -13
  20. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/pack/writer.py +58 -12
  21. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/schema.py +94 -2
  22. pyreuser3-0.5.0/tests/test_enum_binary.py +221 -0
  23. pyreuser3-0.5.0/tests/test_export_enums.py +195 -0
  24. pyreuser3-0.3.0/pyreuser3/export/__init__.py +0 -9
  25. pyreuser3-0.3.0/pyreuser3/export/enums.py +0 -184
  26. pyreuser3-0.3.0/pyreuser3/pack/__init__.py +0 -9
  27. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/LICENSE +0 -0
  28. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/MANIFEST.in +0 -0
  29. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/PyREUser3.egg-info/dependency_links.txt +0 -0
  30. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/PyREUser3.egg-info/entry_points.txt +0 -0
  31. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/PyREUser3.egg-info/requires.txt +0 -0
  32. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/PyREUser3.egg-info/top_level.txt +0 -0
  33. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/__init__.py +0 -0
  34. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/__main__.py +0 -0
  35. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/cli.py +0 -0
  36. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/export/postprocess.py +0 -0
  37. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/pack/models.py +0 -0
  38. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/rich_ui.py +0 -0
  39. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/web/__init__.py +0 -0
  40. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/web/__main__.py +0 -0
  41. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/web/handler.py +0 -0
  42. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/web/jobs.py +0 -0
  43. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/web/page.py +0 -0
  44. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/web/picker.py +0 -0
  45. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/web/runners.py +0 -0
  46. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/web/server.py +0 -0
  47. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/pyreuser3/web/settings.py +0 -0
  48. {pyreuser3-0.3.0 → pyreuser3-0.5.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyREUser3
3
- Version: 0.3.0
3
+ Version: 0.5.0
4
4
  Summary: Pure Python tools for converting RE Engine .user.3 files to and from JSON.
5
5
  Author: Egg Targaryen
6
6
  License-Expression: MIT
@@ -49,7 +49,9 @@ pip install pyreuser3
49
49
  - CLI commands through `pyreuser3`.
50
50
  - A local `.user.3` export Web UI through `pyreuser3-web`.
51
51
 
52
- The published package intentionally does not include game resources, dumped game data, RE_RSZ templates, `il2cpp_dump.json`, `.msg.23` conversion tools, or repository-specific helper scripts. You need to provide data files that match the target game and version.
52
+ The published package intentionally does not include game resources, dumped game data, RE_RSZ templates,
53
+ `il2cpp_dump.json`, or repository-specific helper scripts. You need to provide data files that match the target game and
54
+ version.
53
55
 
54
56
  ## Requirements
55
57
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyREUser3
3
- Version: 0.3.0
3
+ Version: 0.5.0
4
4
  Summary: Pure Python tools for converting RE Engine .user.3 files to and from JSON.
5
5
  Author: Egg Targaryen
6
6
  License-Expression: MIT
@@ -49,7 +49,9 @@ pip install pyreuser3
49
49
  - CLI commands through `pyreuser3`.
50
50
  - A local `.user.3` export Web UI through `pyreuser3-web`.
51
51
 
52
- The published package intentionally does not include game resources, dumped game data, RE_RSZ templates, `il2cpp_dump.json`, `.msg.23` conversion tools, or repository-specific helper scripts. You need to provide data files that match the target game and version.
52
+ The published package intentionally does not include game resources, dumped game data, RE_RSZ templates,
53
+ `il2cpp_dump.json`, or repository-specific helper scripts. You need to provide data files that match the target game and
54
+ version.
53
55
 
54
56
  ## Requirements
55
57
 
@@ -38,4 +38,6 @@ pyreuser3/web/page.py
38
38
  pyreuser3/web/picker.py
39
39
  pyreuser3/web/runners.py
40
40
  pyreuser3/web/server.py
41
- pyreuser3/web/settings.py
41
+ pyreuser3/web/settings.py
42
+ tests/test_enum_binary.py
43
+ tests/test_export_enums.py
@@ -33,7 +33,8 @@ from pyreuser3 import REUser3Converter
33
33
  - CLI commands through `pyreuser3`.
34
34
  - A local `.user.3` export Web UI through `pyreuser3-web`.
35
35
 
36
- This PyPI package intentionally does not include game resources, dumped game data, RE_RSZ templates, `il2cpp_dump.json`, `.msg.23` conversion tools, or repository-specific helper scripts.
36
+ This PyPI package intentionally does not include game resources, dumped game data, RE_RSZ templates, `il2cpp_dump.json`,
37
+ or repository-specific helper scripts.
37
38
 
38
39
  ## Requirements
39
40
 
@@ -72,7 +73,7 @@ Start the local `.user.3` export Web UI:
72
73
  pyreuser3-web --port 8765
73
74
  ```
74
75
 
75
- The Web UI only handles `.user.3` export. It does not pack files and does not provide `.msg.23` conversion.
76
+ The Web UI only handles `.user.3` export. It does not pack files.
76
77
 
77
78
  ## Python API
78
79
 
@@ -16,7 +16,9 @@ pip install pyreuser3
16
16
  - CLI commands through `pyreuser3`.
17
17
  - A local `.user.3` export Web UI through `pyreuser3-web`.
18
18
 
19
- The published package intentionally does not include game resources, dumped game data, RE_RSZ templates, `il2cpp_dump.json`, `.msg.23` conversion tools, or repository-specific helper scripts. You need to provide data files that match the target game and version.
19
+ The published package intentionally does not include game resources, dumped game data, RE_RSZ templates,
20
+ `il2cpp_dump.json`, or repository-specific helper scripts. You need to provide data files that match the target game and
21
+ version.
20
22
 
21
23
  ## Requirements
22
24
 
@@ -35,7 +35,7 @@ PyREUser3 当前提供:
35
35
  - `pyreuser3` 命令行工具;
36
36
  - `pyreuser3-web` 本地 Web 导出界面。
37
37
 
38
- PyPI 包不会包含游戏资源、游戏 dump、RE_RSZ 模板、`il2cpp_dump.json`、`.msg.23` 转换工具或特定仓库脚本。调用方需要自己准备与目标游戏版本匹配的数据文件。
38
+ PyPI 包不会包含游戏资源、游戏 dump、RE_RSZ 模板、`il2cpp_dump.json`、或特定仓库脚本。调用方需要自己准备与目标游戏版本匹配的数据文件。
39
39
 
40
40
  ## 环境要求
41
41
 
@@ -99,7 +99,7 @@ pyreuser3-web --port 8765
99
99
  http://127.0.0.1:8765/
100
100
  ```
101
101
 
102
- Web UI 只提供 `.user.3` 导出,不提供 JSON 封包,也不提供 `.msg.23` 转换。
102
+ Web UI 只提供 `.user.3` 导出,不提供 JSON 封包。
103
103
 
104
104
  ## Python API
105
105
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "PyREUser3"
7
- version = "0.3.0"
7
+ version = "0.5.0"
8
8
  description = "Pure Python tools for converting RE Engine .user.3 files to and from JSON."
9
9
  readme = "docs/PYPI.md"
10
10
  requires-python = ">=3.9"
@@ -402,17 +402,16 @@ class REUser3Converter:
402
402
  """
403
403
  if self.il2cpp_dump_path is None or not self.il2cpp_dump_path.is_file():
404
404
  raise FileNotFoundError("il2cpp_dump_path is required for parsing JSON")
405
- with self.il2cpp_dump_path.open("r", encoding="utf-8") as f:
406
- il2cpp_dump = json.load(f)
407
405
  # Batch export writes Enums_Internal.json for downstream tools; direct
408
406
  # parsing keeps the same lookup only in memory.
409
407
  # Keep the generated metadata attached to the exporter so field parsing can
410
408
  # format enum names consistently.
411
- enums_internal = exporter.export_enums_internal(il2cpp_dump)
409
+ enums_internal, enum_context = exporter.export_il2cpp_metadata_from_path(
410
+ self.il2cpp_dump_path
411
+ )
412
412
  exporter.enum_lookup = exporter._build_enum_lookup_from_enums_internal(
413
413
  enums_internal
414
414
  )
415
- enum_context = exporter.export_enum_context_internal(il2cpp_dump)
416
415
  exporter._apply_enum_context(enum_context)
417
416
  exporter._ensure_enum_lookup()
418
417
 
@@ -28,6 +28,41 @@ HEX32_RE = re.compile(r"^[0-9a-fA-F]{32}$")
28
28
  # packing stay reversible.
29
29
  ENUM_UNUSED_KEY = "value__"
30
30
 
31
+ ENUM_UNDERLYING_TYPE_MAP = {
32
+ "byte": "U8",
33
+ "system.byte": "U8",
34
+ "u8": "U8",
35
+ "uint8": "U8",
36
+ "sbyte": "S8",
37
+ "system.sbyte": "S8",
38
+ "s8": "S8",
39
+ "int8": "S8",
40
+ "short": "S16",
41
+ "system.int16": "S16",
42
+ "int16": "S16",
43
+ "s16": "S16",
44
+ "ushort": "U16",
45
+ "system.uint16": "U16",
46
+ "uint16": "U16",
47
+ "u16": "U16",
48
+ "int": "S32",
49
+ "system.int32": "S32",
50
+ "int32": "S32",
51
+ "s32": "S32",
52
+ "uint": "U32",
53
+ "system.uint32": "U32",
54
+ "uint32": "U32",
55
+ "u32": "U32",
56
+ "long": "S64",
57
+ "system.int64": "S64",
58
+ "int64": "S64",
59
+ "s64": "S64",
60
+ "ulong": "U64",
61
+ "system.uint64": "U64",
62
+ "uint64": "U64",
63
+ "u64": "U64",
64
+ }
65
+
31
66
 
32
67
  class ParseError(RuntimeError):
33
68
  """Signal expected binary-format problems separately from programming errors.
@@ -52,6 +87,38 @@ def align(value: int, alignment: int) -> int:
52
87
  return (value + (alignment - 1)) & ~(alignment - 1)
53
88
 
54
89
 
90
+ def normalize_enum_storage_type(type_name: Any) -> str | None:
91
+ """Normalize an il2cpp enum underlying type name to an RSZ scalar storage code."""
92
+ if not isinstance(type_name, str):
93
+ return None
94
+ text = type_name.strip()
95
+ if not text:
96
+ return None
97
+ return ENUM_UNDERLYING_TYPE_MAP.get(text.lower())
98
+
99
+
100
+ def enum_storage_type_from_size(size: int) -> str:
101
+ """Choose a conservative enum storage type from a schema-declared byte size."""
102
+ if size == 1:
103
+ return "U8"
104
+ if size == 2:
105
+ return "U16"
106
+ if size == 8:
107
+ return "S64"
108
+ return "S32"
109
+
110
+
111
+ def enum_storage_size(storage_type: str) -> int:
112
+ """Return the byte width for a normalized enum storage type."""
113
+ if storage_type in {"S8", "U8"}:
114
+ return 1
115
+ if storage_type in {"S16", "U16"}:
116
+ return 2
117
+ if storage_type in {"S64", "U64"}:
118
+ return 8
119
+ return 4
120
+
121
+
55
122
  def format_guid_text_from_hex32(hex32: str) -> str:
56
123
  """Format compact hexadecimal GUID text with canonical separators.
57
124
 
@@ -0,0 +1,27 @@
1
+ """Expose the public exporter type for the export subpackage.
2
+
3
+ Implementation details are split across mixins, but callers can import User3Exporter
4
+ from this package directly.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from importlib import import_module
10
+ from typing import Any
11
+
12
+ __all__ = ["User3Exporter"]
13
+
14
+ _EXPORT_MODULES = {
15
+ "User3Exporter": ".base",
16
+ }
17
+
18
+
19
+ def __getattr__(name: str) -> Any:
20
+ """Resolve lazily exported subpackage attributes on first access."""
21
+ module_name = _EXPORT_MODULES.get(name)
22
+ if module_name is None:
23
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
24
+ module = import_module(module_name, __name__)
25
+ value = getattr(module, name)
26
+ globals()[name] = value
27
+ return value
@@ -88,7 +88,9 @@ class User3Exporter(
88
88
  self.serializable_to_fixed: dict[str, str] = {}
89
89
  self.generic_container_rules: dict[str, tuple[str, str]] = {}
90
90
  self.param_type_default_enum: dict[str, str] = {}
91
+ self.enum_underlying_types: dict[str, str] = {}
91
92
  self.enum_member_to_types: dict[str, list[str]] = {}
93
+ self._pending_enum_context: dict | None = None
92
94
 
93
95
  def run(self) -> dict[str, int]:
94
96
  """Run the batch exporter and return conversion counters.