XPL File Format?
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 23
- Joined: Fri, 21. Jan 11, 21:47
XPL File Format?
Has anyone figured out the format of the XPL files? Are they compiled scripts?
-
- Posts: 299
- Joined: Wed, 9. Apr 08, 05:52
Yes, from what I understand they are compiled LUA.
You don't talks about X:Rebirth...
X4 Mods: Collect Inventory Wares Stations Supply Build Storage Mass Move Marines
X4 Mods: Collect Inventory Wares Stations Supply Build Storage Mass Move Marines
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
discussion is going on on this, seems to be compiled lua files but no standard version of it. at least that is the current consens on that.
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help

-
- Posts: 716
- Joined: Tue, 20. Jun 06, 02:29
-
- Posts: 280
- Joined: Tue, 11. Oct 11, 19:13
-
- Posts: 2774
- Joined: Tue, 29. Oct 13, 21:59
Did a little digging with this and came up smelling good
The xpl files are lua compiled with luajt http://luajit.org/luajit.html.
A working decompiler can be found here : https://github.com/bobsayshilol/luajit-decomp
with instructions in the Wiki for use.
*EDIT* looking at the output... Good luck!

A working decompiler can be found here : https://github.com/bobsayshilol/luajit-decomp
with instructions in the Wiki for use.
*EDIT* looking at the output... Good luck!
X Rebirth - A Sirius Cybernetics Corporation Product
Split irritate visiting pilot with strange vocal patterns.
Split irritate visiting pilot with strange vocal patterns.
-
- Posts: 366
- Joined: Wed, 28. Aug 13, 12:42
As far as I know, a reverseengineering to source it's not possible even with -decomp. The best results what we can get by now are bytecode or assemblies.YorrickVander wrote:Did a little digging with this and came up smelling goodThe xpl files are lua compiled with luajt http://luajit.org/luajit.html.
A working decompiler can be found here : https://github.com/bobsayshilol/luajit-decomp
with instructions in the Wiki for use.
*EDIT* looking at the output... Good luck!
For a full source reverse engineering are also the header files needed.
-
- Posts: 2774
- Joined: Tue, 29. Oct 13, 21:59
-
- Posts: 366
- Joined: Wed, 28. Aug 13, 12:42
I use the method described here: https://github.com/bobsayshilol/luajit- ... i/TutorialYorrickVander wrote:It is possible, but not for the feint hearted
If You use another less painful method let us know please

-
- Posts: 2774
- Joined: Tue, 29. Oct 13, 21:59
-
- Posts: 366
- Joined: Wed, 28. Aug 13, 12:42
So I have played around a bit with the jit files. It is possible to refactor the bytecode 2.0 into source back. but it is really pita to do so.
here just an example of the first lines of /UI/menu_controlentities.xpl:
asm from menu_controlentities.xpl via luajit -b
Now if we take a look into it and can read some bytecode the Lua SourceCode expression of the asm above would look like similar to this then:
It's easy to use the compare method here by compiling our source "guess" and compare it against original. With this it should be possible to refactor the .xpl into 100% sources. But why should we do that?
How I've sayed, it is pita to transform bytecode to source manually. Whats about patches? So, no it is not the right way. Btw, I was able to inject Luacode by runtime, this could be an alternative, but thats really nasty stuff. Feels like hacking around. Especially if it could be so easy by getting some sources from ES (if they would be so kind).
Someone - or we together - should ask for it.
here just an example of the first lines of /UI/menu_controlentities.xpl:
asm from menu_controlentities.xpl via luajit -b
Code: Select all
-- BYTECODE -- menu_controlentities.lua:11-17
0001 GGET 0 0 ; "Menus"
0002 IST 0
0003 JMP 1 => 0005
0004 TNEW 0 0
0005 => GSET 0 0 ; "Menus"
0006 GGET 0 1 ; "table"
0007 TGETS 0 0 2 ; "insert"
.
.
.
Code: Select all
if not Menus then
local Menus = {}
end
Menus = Menus
table.insert(Menus, menu)
.
.
.
How I've sayed, it is pita to transform bytecode to source manually. Whats about patches? So, no it is not the right way. Btw, I was able to inject Luacode by runtime, this could be an alternative, but thats really nasty stuff. Feels like hacking around. Especially if it could be so easy by getting some sources from ES (if they would be so kind).
Someone - or we together - should ask for it.
-
- Posts: 2774
- Joined: Tue, 29. Oct 13, 21:59
I popped in a request for samples and/or docs as an xmas pressie from egosoft, but no sign of it yet 
A combo of the byte code, along with results of decompiled source might get there sooner rather than later of course.

A combo of the byte code, along with results of decompiled source might get there sooner rather than later of course.
X Rebirth - A Sirius Cybernetics Corporation Product
Split irritate visiting pilot with strange vocal patterns.
Split irritate visiting pilot with strange vocal patterns.