unidecompiler-plugin-lua 0.1.2__tar.gz → 0.1.4__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.2 → unidecompiler_plugin_lua-0.1.4}/PKG-INFO +2 -2
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/pyproject.toml +2 -2
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/src/unidecompiler_plugin_lua/lifter.py +74 -5
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/src/unidecompiler_plugin_lua.egg-info/PKG-INFO +2 -2
- unidecompiler_plugin_lua-0.1.4/src/unidecompiler_plugin_lua.egg-info/requires.txt +1 -0
- unidecompiler_plugin_lua-0.1.2/src/unidecompiler_plugin_lua.egg-info/requires.txt +0 -1
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/README.md +0 -0
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/setup.cfg +0 -0
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/src/unidecompiler_plugin_lua/__init__.py +0 -0
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/src/unidecompiler_plugin_lua/chunk54.py +0 -0
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/src/unidecompiler_plugin_lua/luac.py +0 -0
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/src/unidecompiler_plugin_lua/normalize.py +0 -0
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/src/unidecompiler_plugin_lua/plugin.py +0 -0
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/src/unidecompiler_plugin_lua/simulation.py +0 -0
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/src/unidecompiler_plugin_lua/support.py +0 -0
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/src/unidecompiler_plugin_lua.egg-info/SOURCES.txt +0 -0
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/src/unidecompiler_plugin_lua.egg-info/dependency_links.txt +0 -0
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/src/unidecompiler_plugin_lua.egg-info/entry_points.txt +0 -0
- {unidecompiler_plugin_lua-0.1.2 → unidecompiler_plugin_lua-0.1.4}/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.1.
|
|
3
|
+
Version: 0.1.4
|
|
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.2.0,>=0.1.
|
|
12
|
+
Requires-Dist: unidecompiler<0.2.0,>=0.1.10
|
|
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.1.
|
|
7
|
+
version = "0.1.4"
|
|
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.1.
|
|
13
|
+
dependencies = ["unidecompiler>=0.1.10,<0.2.0"]
|
|
14
14
|
|
|
15
15
|
[project.urls]
|
|
16
16
|
Homepage = "https://github.com/Wker666/unidecompiler"
|
|
@@ -10,6 +10,7 @@ from unidecompiler.core.ir import (
|
|
|
10
10
|
CapturedVar,
|
|
11
11
|
Const,
|
|
12
12
|
Expr,
|
|
13
|
+
ExprStmt,
|
|
13
14
|
Global,
|
|
14
15
|
GetItem,
|
|
15
16
|
MapLiteral,
|
|
@@ -96,9 +97,6 @@ IGNORED_OPS = {
|
|
|
96
97
|
"MMBINK",
|
|
97
98
|
"VARARGPREP",
|
|
98
99
|
"EXTRAARG",
|
|
99
|
-
"LFALSESKIP",
|
|
100
|
-
"CLOSE",
|
|
101
|
-
"TBC",
|
|
102
100
|
*(CONTROL_OPS - frozenset({"FORPREP", "FORLOOP", "TESTSET", "TFORPREP", "TFORLOOP"})),
|
|
103
101
|
}
|
|
104
102
|
@dataclass(frozen=True)
|
|
@@ -501,7 +499,20 @@ def _lua_set_list(context: LuaEffectContext, instruction, source: SourceRef) ->
|
|
|
501
499
|
base = int(operands[0])
|
|
502
500
|
count = int(operands[1])
|
|
503
501
|
if count <= 0:
|
|
504
|
-
return (
|
|
502
|
+
return (
|
|
503
|
+
Emit(
|
|
504
|
+
source=source,
|
|
505
|
+
statement=ExprStmt(
|
|
506
|
+
source=source,
|
|
507
|
+
value=Call(
|
|
508
|
+
source=source,
|
|
509
|
+
callee=Global(name="lua_setlist", source=source),
|
|
510
|
+
args=(Var(name=_read_register_name(context.listing, base, instruction.pc), source=source),),
|
|
511
|
+
returns=0,
|
|
512
|
+
),
|
|
513
|
+
),
|
|
514
|
+
),
|
|
515
|
+
)
|
|
505
516
|
table = Var(name=_read_register_name(context.listing, base, instruction.pc), source=source)
|
|
506
517
|
return tuple(
|
|
507
518
|
Emit(
|
|
@@ -601,7 +612,24 @@ def _lua_tforcall_effect(context: LuaEffectContext, instruction, source: SourceR
|
|
|
601
612
|
base = int(operands[0])
|
|
602
613
|
count = int(operands[2])
|
|
603
614
|
if count <= 0:
|
|
604
|
-
|
|
615
|
+
base = int(operands[0])
|
|
616
|
+
return (
|
|
617
|
+
Emit(
|
|
618
|
+
source=source,
|
|
619
|
+
statement=ExprStmt(
|
|
620
|
+
source=source,
|
|
621
|
+
value=Call(
|
|
622
|
+
source=source,
|
|
623
|
+
callee=Global(name="lua_generic_for_next", source=source),
|
|
624
|
+
args=tuple(
|
|
625
|
+
Var(name=_read_register_name(context.listing, base + index, instruction.pc), source=source)
|
|
626
|
+
for index in range(3)
|
|
627
|
+
),
|
|
628
|
+
returns=0,
|
|
629
|
+
),
|
|
630
|
+
),
|
|
631
|
+
),
|
|
632
|
+
)
|
|
605
633
|
names = tuple(
|
|
606
634
|
_write_register_name(context.listing, register, instruction.pc)
|
|
607
635
|
for register in range(base + 4, base + 4 + count)
|
|
@@ -629,6 +657,28 @@ def _lua_tforcall_effect(context: LuaEffectContext, instruction, source: SourceR
|
|
|
629
657
|
)
|
|
630
658
|
|
|
631
659
|
|
|
660
|
+
def _lua_runtime_marker(name: str):
|
|
661
|
+
"""Represent a runtime-only Lua lifecycle operation without dropping stack values."""
|
|
662
|
+
|
|
663
|
+
def factory(_context: LuaEffectContext, _instruction, source: SourceRef) -> tuple:
|
|
664
|
+
return (
|
|
665
|
+
Emit(
|
|
666
|
+
source=source,
|
|
667
|
+
statement=ExprStmt(
|
|
668
|
+
source=source,
|
|
669
|
+
value=Call(
|
|
670
|
+
source=source,
|
|
671
|
+
callee=Global(name=name, source=source),
|
|
672
|
+
args=(),
|
|
673
|
+
returns=0,
|
|
674
|
+
),
|
|
675
|
+
),
|
|
676
|
+
),
|
|
677
|
+
)
|
|
678
|
+
|
|
679
|
+
return factory
|
|
680
|
+
|
|
681
|
+
|
|
632
682
|
def _lua_tforloop_effect(context: LuaEffectContext, instruction, source: SourceRef) -> tuple | None:
|
|
633
683
|
operands = instruction.operands
|
|
634
684
|
if not operands:
|
|
@@ -851,6 +901,11 @@ LUA_EFFECT_TABLE = VMEffectTable(
|
|
|
851
901
|
"FORLOOP": _lua_forloop_effect,
|
|
852
902
|
"TFORPREP": _lua_no_effect,
|
|
853
903
|
"TFORCALL": _lua_tforcall_effect,
|
|
904
|
+
"LFALSESKIP": lambda context, instruction, source: (
|
|
905
|
+
_lua_assign(context.listing, int(instruction.operands[0]), instruction.pc, Const(value=False, source=source), source),
|
|
906
|
+
) if instruction.operands else (UnknownOpcode(source=source, opcode="LFALSESKIP", raw="missing register"),),
|
|
907
|
+
"CLOSE": _lua_runtime_marker("lua_close"),
|
|
908
|
+
"TBC": _lua_runtime_marker("lua_tbc"),
|
|
854
909
|
"TFORLOOP": _lua_tforloop_effect,
|
|
855
910
|
"TESTSET": _lua_testset_effect,
|
|
856
911
|
"RETURN1": _lua_return1,
|
|
@@ -1119,6 +1174,20 @@ def _lua_operand_role(operand: str):
|
|
|
1119
1174
|
|
|
1120
1175
|
|
|
1121
1176
|
def _lua_instruction_hints(listing: LuaFunctionListing, instruction, source: SourceRef) -> tuple[VMHint, ...]:
|
|
1177
|
+
if instruction.opcode == "LFALSESKIP":
|
|
1178
|
+
# Lua's skip instruction advances over the following instruction when
|
|
1179
|
+
# the assigned false value is consumed. Preserve that edge as a
|
|
1180
|
+
# neutral hint; core owns the actual CFG recovery.
|
|
1181
|
+
return (
|
|
1182
|
+
VMHint(
|
|
1183
|
+
kind="branch-target",
|
|
1184
|
+
source=source,
|
|
1185
|
+
target=instruction.pc + 2,
|
|
1186
|
+
label=instruction.opcode,
|
|
1187
|
+
detail="target-if-false",
|
|
1188
|
+
flow="unconditional",
|
|
1189
|
+
),
|
|
1190
|
+
)
|
|
1122
1191
|
if instruction.opcode in CONDITIONAL_OPS:
|
|
1123
1192
|
return (
|
|
1124
1193
|
VMHint(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: unidecompiler-plugin-lua
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
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.2.0,>=0.1.
|
|
12
|
+
Requires-Dist: unidecompiler<0.2.0,>=0.1.10
|
|
13
13
|
|
|
14
14
|
# unidecompiler-plugin-lua
|
|
15
15
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
unidecompiler<0.2.0,>=0.1.10
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
unidecompiler<0.2.0,>=0.1.2
|
|
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
|