[TOOL] XPL (LuaJIT) files decompiler

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Kumba42
Posts: 42
Joined: Sat, 23. Nov 13, 13:18
x4

Post by Kumba42 » Mon, 26. May 14, 07:02

It looks like the latest git clone of this Lua decompiler/disassembler can't operate on 'ui/addons/gameoptions/gameoptions.xpl' from X:R 2.0. It throws this traceback instead:

Code: Select all

$ python3.3 main.py gameoptions.xpl > gameoptions.lua
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 "/tmp/ljd/ljd/ast/unwarper.py", line 36, in unwarp
    _run_step(_unwarp_ifs, node)
  File "/tmp/ljd/ljd/ast/unwarper.py", line 43, in _run_step
    statements.contents = step(statements.contents, **kargs)
  File "/tmp/ljd/ljd/ast/unwarper.py", line 161, in _unwarp_ifs
    _unwarp_if_statement(start, body, end, end)
  File "/tmp/ljd/ljd/ast/unwarper.py", line 968, in _unwarp_if_statement
    then_blocks = _unwarp_ifs(then_body, then_body[-1], topmost_end)
  File "/tmp/ljd/ljd/ast/unwarper.py", line 161, in _unwarp_ifs
    _unwarp_if_statement(start, body, end, end)
  File "/tmp/ljd/ljd/ast/unwarper.py", line 937, in _unwarp_if_statement
    topmost_end)
  File "/tmp/ljd/ljd/ast/unwarper.py", line 1017, in _extract_if_expression
    false, end_i = _search_expression_end(expression, falses)
  File "/tmp/ljd/ljd/ast/unwarper.py", line 1049, in _search_expression_end
    assert false is not None
AssertionError

flywithpig
Posts: 1
Joined: Wed, 25. Jun 14, 12:37

hi!I Have a Error on LuaJit2.0.1 like this!

Post by flywithpig » Wed, 25. Jun 14, 14:29

E:\tools\ljd-0.1.3>python main.py resNPC.lua.out
Traceback (most recent call last):
File "main.py", line 123, in <module>
retval = main()
File "main.py", line 77, in main
header, prototype = ljd.rawdump.parser.parse(file_in)
File "E:\tools\ljd-0.1.3\ljd\rawdump\parser.py", line 34, in parse
r = r and _read_prototypes(parser, parser.prototypes)
File "E:\tools\ljd-0.1.3\ljd\rawdump\parser.py", line 72, in _read_prototypes
if not ljd.rawdump.prototype.read(state, prototype):
File "E:\tools\ljd-0.1.3\ljd\rawdump\prototype.py", line 52, in read
r = r and _read_constants(parser, prototype)
File "E:\tools\ljd-0.1.3\ljd\rawdump\prototype.py", line 140, in _read_constan
ts
return ljd.rawdump.constants.read(parser, prototype.constants)
File "E:\tools\ljd-0.1.3\ljd\rawdump\constants.py", line 31, in read
r = r and _read_complex_constants(parser, constants.complex_constants)
File "E:\tools\ljd-0.1.3\ljd\rawdump\constants.py", line 59, in _read_complex_
constants
complex_constants.append(string.decode("ascii"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd8 in position 6: ordinal
not in range(128)

User avatar
Litauen
Posts: 193
Joined: Fri, 22. Nov 13, 21:09
xr

Failed to read prototype

Post by Litauen » Wed, 13. Aug 14, 22:51

Many files cannot be decompiled and return such error:

Code: Select all

c:\ljd>python main.py helptext.xpl > helptext.lua
Failed to read prototype

copperzinc
Posts: 80
Joined: Sun, 23. Sep 12, 20:29
x4

Post by copperzinc » Thu, 21. Aug 14, 18:59

Nice work nord. I've used luadec with custom headers to mod tropico games before, and indeed I have noticed there are some problems with figuring out relations with local variables, and sometimes it simply cannot figure out previous functions in the stack. Would be great if we have a better LUA decompiler sometime =]

Ziuta
Posts: 1
Joined: Fri, 7. Nov 14, 17:32

Post by Ziuta » Fri, 7. Nov 14, 17:34

Code: Select all

D:\Programy\Python34>python main.py FruitUtil.luc > FruitUtil.lua
Traceback (most recent call last):
  File "main.py", line 123, in <module>
    retval = main()
  File "main.py", line 85, in main
    ast = ljd.ast.builder.build(prototype)
  File "D:\Programy\Python34\ljd\ast\builder.py", line 28, in build
    return _build_function_definition(prototype)
  File "D:\Programy\Python34\ljd\ast\builder.py", line 49, in _build_function_definition
    node.statements.contents = _build_function_blocks(state, instructions)
  File "D:\Programy\Python34\ljd\ast\builder.py", line 71, in _build_function_blocks
    _establish_warps(state, instructions)
  File "D:\Programy\Python34\ljd\ast\builder.py", line 175, in _establish_warps
    block.warp, shift = _build_warp(state, block.last_address, warp)
  File "D:\Programy\Python34\ljd\ast\builder.py", line 198, in _build_warp
    return _build_numeric_loop_warp(state, last_addr, last)
  File "D:\Programy\Python34\ljd\ast\builder.py", line 318, in _build_numeric_loop_warp
    warp.body = state._warp_in_block(destination)
  File "D:\Programy\Python34\ljd\ast\builder.py", line 22, in _warp_in_block
    block = self.block_starts[addr]
KeyError: -32718

MagixJonsn
Posts: 45
Joined: Thu, 3. Oct 13, 19:49

Re:

Post by MagixJonsn » Fri, 17. Apr 20, 01:14

Ginger470 wrote:
Sun, 9. Mar 14, 06:26
Can we get a step-by-step on how to use this :) That would be uber-useful ;)
Now there is an easy-to-use online Lua decompiler.
Last edited by MagixJonsn on Mon, 4. Jan 21, 11:50, edited 1 time in total.

radcapricorn
Moderator (English)
Moderator (English)
Posts: 3230
Joined: Mon, 14. Jul 08, 13:07
x4

Re: Re:

Post by radcapricorn » Fri, 17. Apr 20, 19:17

MagixJonsn wrote:
Fri, 17. Apr 20, 01:14
Ginger470 wrote:
Sun, 9. Mar 14, 06:26
Can we get a step-by-step on how to use this :) That would be uber-useful ;)
Now there is an easy-to-use online Lua decompiler.
While progress is certainly a good thing, I wouldn't say it's worth waking up a 5-and-a-half year old thread, replying to a person last seen three years past, ony to acknowledge that.

Post Reply

Return to “X Rebirth - Scripts and Modding”