unidecompiler-plugin-lua 0.1.4__tar.gz → 0.2.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.
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/PKG-INFO +2 -2
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/pyproject.toml +2 -2
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/src/unidecompiler_plugin_lua/lifter.py +24 -3
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/src/unidecompiler_plugin_lua/plugin.py +6 -0
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/src/unidecompiler_plugin_lua.egg-info/PKG-INFO +2 -2
- unidecompiler_plugin_lua-0.2.0/src/unidecompiler_plugin_lua.egg-info/requires.txt +1 -0
- unidecompiler_plugin_lua-0.1.4/src/unidecompiler_plugin_lua.egg-info/requires.txt +0 -1
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/README.md +0 -0
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/setup.cfg +0 -0
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/src/unidecompiler_plugin_lua/__init__.py +0 -0
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/src/unidecompiler_plugin_lua/chunk54.py +0 -0
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/src/unidecompiler_plugin_lua/luac.py +0 -0
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/src/unidecompiler_plugin_lua/normalize.py +0 -0
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/src/unidecompiler_plugin_lua/simulation.py +0 -0
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/src/unidecompiler_plugin_lua/support.py +0 -0
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/src/unidecompiler_plugin_lua.egg-info/SOURCES.txt +0 -0
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/src/unidecompiler_plugin_lua.egg-info/dependency_links.txt +0 -0
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/src/unidecompiler_plugin_lua.egg-info/entry_points.txt +0 -0
- {unidecompiler_plugin_lua-0.1.4 → unidecompiler_plugin_lua-0.2.0}/src/unidecompiler_plugin_lua.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: unidecompiler-plugin-lua
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Lua bytecode frontend plugin for unidecompiler
|
|
5
5
|
Author-email: Wker <1670133844@qq.com>
|
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
|
@@ -9,7 +9,7 @@ Project-URL: Repository, https://github.com/Wker666/unidecompiler
|
|
|
9
9
|
Project-URL: Issues, https://github.com/Wker666/unidecompiler/issues
|
|
10
10
|
Requires-Python: >=3.11
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
|
-
Requires-Dist: unidecompiler<0.
|
|
12
|
+
Requires-Dist: unidecompiler<0.3.0,>=0.2.0
|
|
13
13
|
|
|
14
14
|
# unidecompiler-plugin-lua
|
|
15
15
|
|
|
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "unidecompiler-plugin-lua"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "Lua bytecode frontend plugin for unidecompiler"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "AGPL-3.0-or-later"
|
|
11
11
|
authors = [{ name = "Wker", email = "1670133844@qq.com" }]
|
|
12
12
|
requires-python = ">=3.11"
|
|
13
|
-
dependencies = ["unidecompiler>=0.
|
|
13
|
+
dependencies = ["unidecompiler>=0.2.0,<0.3.0"]
|
|
14
14
|
|
|
15
15
|
[project.urls]
|
|
16
16
|
Homepage = "https://github.com/Wker666/unidecompiler"
|
|
@@ -41,6 +41,7 @@ from unidecompiler.core.vm_region import (
|
|
|
41
41
|
VMStatefulCallbacks,
|
|
42
42
|
build_hint_region_profile,
|
|
43
43
|
)
|
|
44
|
+
from unidecompiler.progress import ProgressReporter, report_progress
|
|
44
45
|
from unidecompiler_plugin_lua.luac import LuaChunk, LuaFunctionListing
|
|
45
46
|
|
|
46
47
|
|
|
@@ -919,10 +920,17 @@ LUA_EFFECT_TABLE = VMEffectTable(
|
|
|
919
920
|
)
|
|
920
921
|
|
|
921
922
|
|
|
922
|
-
def lift_lua_chunk(
|
|
923
|
+
def lift_lua_chunk(
|
|
924
|
+
chunk: LuaChunk,
|
|
925
|
+
metadata: dict,
|
|
926
|
+
*,
|
|
927
|
+
reporter: ProgressReporter | None = None,
|
|
928
|
+
) -> ModuleIR:
|
|
923
929
|
functions: tuple[FunctionIR, ...]
|
|
924
930
|
if chunk.functions:
|
|
925
|
-
|
|
931
|
+
total = len(chunk.functions)
|
|
932
|
+
report_progress(reporter, phase="lift", status="started", completed=0, total=total, unit="function", message="lifting Lua functions")
|
|
933
|
+
root, next_index = _lift_lua_function_tree(chunk.functions, 0, reporter=reporter, total=total, progress=[0])
|
|
926
934
|
if next_index != len(chunk.functions):
|
|
927
935
|
raise ValueError("incomplete Lua function tree reconstruction")
|
|
928
936
|
functions = (root,)
|
|
@@ -950,6 +958,10 @@ def lift_lua_chunk(chunk: LuaChunk, metadata: dict) -> ModuleIR:
|
|
|
950
958
|
def _lift_lua_function_tree(
|
|
951
959
|
listings: tuple[LuaFunctionListing, ...],
|
|
952
960
|
index: int,
|
|
961
|
+
*,
|
|
962
|
+
reporter: ProgressReporter | None = None,
|
|
963
|
+
total: int | None = None,
|
|
964
|
+
progress: list[int] | None = None,
|
|
953
965
|
) -> tuple[FunctionIR, int]:
|
|
954
966
|
listing = listings[index]
|
|
955
967
|
function_ir = recover_vm_function(
|
|
@@ -960,10 +972,19 @@ def _lift_lua_function_tree(
|
|
|
960
972
|
for instruction in listing.instructions
|
|
961
973
|
),
|
|
962
974
|
)
|
|
975
|
+
if reporter is not None and total is not None and progress is not None:
|
|
976
|
+
progress[0] += 1
|
|
977
|
+
report_progress(reporter, phase="lift", completed=progress[0], total=total, unit="function", message=f"lifting function {progress[0]}/{total}")
|
|
963
978
|
next_index = index + 1
|
|
964
979
|
nested_functions: list[FunctionIR] = []
|
|
965
980
|
for _ in range(listing.child_function_count):
|
|
966
|
-
nested_function, next_index = _lift_lua_function_tree(
|
|
981
|
+
nested_function, next_index = _lift_lua_function_tree(
|
|
982
|
+
listings,
|
|
983
|
+
next_index,
|
|
984
|
+
reporter=reporter,
|
|
985
|
+
total=total,
|
|
986
|
+
progress=progress,
|
|
987
|
+
)
|
|
967
988
|
nested_functions.append(nested_function)
|
|
968
989
|
return replace(function_ir, nested_functions=tuple(nested_functions)), next_index
|
|
969
990
|
|
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from unidecompiler.core.ir import ModuleIR
|
|
4
4
|
from unidecompiler.plugins import FrontendModule
|
|
5
|
+
from unidecompiler.progress import ProgressReporter
|
|
5
6
|
from unidecompiler_plugin_lua.lifter import lift_lua_chunk
|
|
6
7
|
from unidecompiler_plugin_lua.chunk54 import decode_lua54_chunk, Lua54ChunkError
|
|
7
8
|
from unidecompiler_plugin_lua.luac import (
|
|
@@ -69,6 +70,11 @@ class LuaFrontendPlugin:
|
|
|
69
70
|
|
|
70
71
|
return lift_lua_chunk(module.payload, module.metadata)
|
|
71
72
|
|
|
73
|
+
def lift_with_progress(self, module: FrontendModule, reporter: ProgressReporter) -> ModuleIR:
|
|
74
|
+
if module.frontend_id != self.id:
|
|
75
|
+
raise TypeError(f"Lua frontend cannot lift module from {module.frontend_id!r}")
|
|
76
|
+
return lift_lua_chunk(module.payload, module.metadata, reporter=reporter)
|
|
77
|
+
|
|
72
78
|
|
|
73
79
|
class Lua54BinaryChunkDecoder:
|
|
74
80
|
id = "lua54-binary"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: unidecompiler-plugin-lua
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Lua bytecode frontend plugin for unidecompiler
|
|
5
5
|
Author-email: Wker <1670133844@qq.com>
|
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
|
@@ -9,7 +9,7 @@ Project-URL: Repository, https://github.com/Wker666/unidecompiler
|
|
|
9
9
|
Project-URL: Issues, https://github.com/Wker666/unidecompiler/issues
|
|
10
10
|
Requires-Python: >=3.11
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
|
-
Requires-Dist: unidecompiler<0.
|
|
12
|
+
Requires-Dist: unidecompiler<0.3.0,>=0.2.0
|
|
13
13
|
|
|
14
14
|
# unidecompiler-plugin-lua
|
|
15
15
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
unidecompiler<0.3.0,>=0.2.0
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
unidecompiler<0.2.0,>=0.1.10
|
|
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
|