jjdredd / ljd Goto Github PK
View Code? Open in Web Editor NEWThis project forked from terrantian/ljd
LuaJIT raw-bytecode decompiler
License: MIT License
This project forked from terrantian/ljd
LuaJIT raw-bytecode decompiler
License: MIT License
hi questions could help her decode at FS19
I can not keep up with it
https://workupload.com/file/HKERD8JQ
i consider your effort and time
I used luajit 2.0.1 to compile a simple local function lua, but cannot decompile it, the lua file is:
local function foo(a)
end
foo("xx")
could u help me on how to solve the problem?
The following is the exception:
Traceback (most recent call last):
File "main.py", line 123, in
retval = main()
File "main.py", line 115, in main
ljd.ast.validator.validate(ast, warped=False)
File "E:\tools\ljd2\ljd\ast\validator.py", line 340, in validate
traverse.traverse(visitor, ast)
File "E:\tools\ljd2\ljd\ast\traverse.py", line 251, in traverse
visitor._visit(node)
File "E:\tools\ljd2\ljd\ast\validator.py", line 332, in _visit
traverse.Visitor._visit(self, node)
File "E:\tools\ljd2\ljd\ast\traverse.py", line 238, in _visit
node._accept(self)
File "E:\tools\ljd2\ljd\ast\nodes.py", line 22, in _accept
visitor._visit(self.statements)
File "E:\tools\ljd2\ljd\ast\validator.py", line 332, in _visit
traverse.Visitor._visit(self, node)
File "E:\tools\ljd2\ljd\ast\traverse.py", line 238, in _visit
node._accept(self)
File "E:\tools\ljd2\ljd\ast\nodes.py", line 146, in _accept
visitor._visit_list(self.contents)
File "E:\tools\ljd2\ljd\ast\traverse.py", line 244, in _visit_list
self._visit(node)
File "E:\tools\ljd2\ljd\ast\validator.py", line 332, in _visit
traverse.Visitor._visit(self, node)
File "E:\tools\ljd2\ljd\ast\traverse.py", line 238, in _visit
node._accept(self)
File "E:\tools\ljd2\ljd\ast\nodes.py", line 253, in _accept
visitor._visit(self.function)
File "E:\tools\ljd2\ljd\ast\validator.py", line 327, in _visit
restrictions.check(node)
File "E:\tools\ljd2\ljd\ast\validator.py", line 28, in check
.format(type(node), typespec)
AssertionError: Invalid node type: <class 'ljd.ast.nodes.FunctionDefinition'> should be: (<class 'ljd.ast.nodes.Identifier'>, <class 'ljd.ast.nodes.TableElement'>, <class 'ljd.ast.nodes.MULTRES'>)
ljd exit with following error:
Traceback (most recent call last):
File "main.py", line 123, in
retval = main()
File "main.py", line 99, in main
ljd.ast.slotworks.eliminate_temporary(ast)
File "w:\work\ljd\ast\slotworks.py", line 14, in eliminate_tempo
rary
_eliminate_temporary(slots)
File "w:\work\ljd\ast\slotworks.py", line 46, in _eliminate_temp
orary
_fill_massive_refs(info, simple, massive, iterators)
File "w:\work\ljd\ast\slotworks.py", line 68, in _fill_massive_r
efs
assert len(info.references) == 2
AssertionError
local lpeg = require "lpeg"
local P = lpeg.P
local V = lpeg.V
local next = next
local proto_tbl = { "PROTO" }
local k, v = next(patterns)
local p = V(k)
proto_tbl[k] = v --- Error
return parser
I have a script compiled in LuaJIT (newer version than 2.0), and I wanted to decompile it with "LJD," but I have a problem. I have Linux Mint 17 and installed Python 3.4 and tried to decompile the script, but I have this error:
kamil@AsusK53SV ~/ljd $ python3 main.py SkidSteerFix.luc
Traceback (most recent call last):
File "main.py", line 123, in
retval = main()
File "main.py", line 85, in main
ast = ljd.ast.builder.build(prototype)
File "/home/kamil/ljd/ljd/ast/builder.py", line 28, in build
return _build_function_definition(prototype)
File "/home/kamil/ljd/ljd/ast/builder.py", line 49, in _build_function_definition
node.statements.contents = _build_function_blocks(state, instructions)
File "/home/kamil/ljd/ljd/ast/builder.py", line 71, in _build_function_blocks
_establish_warps(state, instructions)
File "/home/kamil/ljd/ljd/ast/builder.py", line 175, in _establish_warps
block.warp, shift = _build_warp(state, block.last_address, warp)
File "/home/kamil/ljd/ljd/ast/builder.py", line 198, in _build_warp
return _build_numeric_loop_warp(state, last_addr, last)
File "/home/kamil/ljd/ljd/ast/builder.py", line 318, in _build_numeric_loop_warp
warp.body = state._warp_in_block(destination)
File "/home/kamil/ljd/ljd/ast/builder.py", line 22, in _warp_in_block
block = self.block_starts[addr]
KeyError: -32723
File "main.py", line 123, in <module>
retval = main()
File "main.py", line 104, in main
ljd.ast.unwarper.unwarp(ast)
File "/tmp/ljd/ljd/ast/unwarper.py", line 36, in unwarp
_run_step(_unwarp_ifs, node)
File "/tmp/ljd/ast/unwarper.py", line 43, in _run_step
statements.contents = step(statements.contents, **kargs)
File "/tmp/ljd/ast/unwarper.py", line 153, in _unwarp_ifs
blocks, topmost_end)
File "/tmp/ljd/ast/unwarper.py", line 176, in _extract_if_body
end = _find_branching_end(blocks[start_index:], topmost_end)
File "/tmp/ljd/ast/unwarper.py", line 1070, in _find_branching_end
assert block == end
AssertionError
local b = 2
function add()
c = 3
return b + c
end
print(add())
slot0 = 2
function add()
c = 3
return 3 + c
end
print(add())
return
with bugfix-locals branch, ljd crashed:
Traceback (most recent call last):
File "main.py", line 123, in
retval = main()
File "main.py", line 104, in main
ljd.ast.unwarper.unwarp(ast)
File "/Users/../ljd/ast/unwarper.py", line 38, in unwarp
_glue_flows(node)
File "/Users/../ljd/ast/unwarper.py", line 61, in _glue_flows
assert isinstance(blocks[-1].warp, nodes.EndWarp)
AttributeError: 'Return' object has no attribute 'warp'
I use ljd-v2.1, decompile several files and work, but at one (so far) appeared such errors. I tried with the other branches, but they did not decompiles files (even those without errors at this decompiles).
kamil@AsusK53SV ~/ljd-ljv2.1 $ python3 main.py Fillable.luc
Traceback (most recent call last):
File "main.py", line 123, in <module>
retval = main()
File "main.py", line 104, in main
ljd.ast.unwarper.unwarp(ast)
File "/home/kamil/ljd-ljv2.1/ljd/ast/unwarper.py", line 36, in unwarp
_run_step(_unwarp_ifs, node)
File "/home/kamil/ljd-ljv2.1/ljd/ast/unwarper.py", line 43, in _run_step
statements.contents = step(statements.contents, **kargs)
File "/home/kamil/ljd-ljv2.1/ljd/ast/unwarper.py", line 161, in _unwarp_ifs
_unwarp_if_statement(start, body, end, end)
File "/home/kamil/ljd-ljv2.1/ljd/ast/unwarper.py", line 937, in _unwarp_if_statement
topmost_end)
File "/home/kamil/ljd-ljv2.1/ljd/ast/unwarper.py", line 1028, in _extract_if_expression
expression = _compile_expression(expression, None, true, false)
File "/home/kamil/ljd-ljv2.1/ljd/ast/unwarper.py", line 504, in _compile_expression
parts = _unwarp_expression(body, end, true, false)
File "/home/kamil/ljd-ljv2.1/ljd/ast/unwarper.py", line 622, in _unwarp_expressio000n
assert target in terminators
AssertionError
Hi,
I figure you probably don't work on this anymore but you are the best lead I have right now ^^.
I saw this and managed to get some of the FS15 scripts decompiled using ldj 2.1, Thanks! and great work.
I moved my attention to FS17 and it seems that this game has moved to a new model of storing their Luc data. Each script is now represented by a .l32 and .l64 file.
When using your ldj 2.1 branch I get the error:
Unknown flags set: 111101110000 Failed to read raw-dump header
It figures i guess that they have changed the headers between game versions.
I was wonder if you have time maybe you could have a quick look over these files and perhaps point me in the right direction?
I am hoping it may only require that I add new or modified headers to the ldj2.1 branch.
FS15 Samples:
FS15 luc files.zip
FS17 Samples:
FS17 luc files.zip
Thank you :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.