SWBF1 Lua Decompiler (WIP/beta)

Started by Dark_Phantom, June 23, 2020, 12:58:03 PM

Previous topic - Next topic
https://github.com/phantom567459/BF1LuaDC

I have been working on a basic lua 4.0.1 decompiler.  Right now it can take simple lua bytecode files (which have to be manually crafted from .script files and then run through luac -l, if you want some help let me know.).  There is an example addme.txt file included to show what it should look like after you run these commands.  There is no release build yet, so if you want to try it, you have to compile and run from source (and edit the filename variable).

Some stuff is still hard coded and clunky, it's pretty early stages but I'm extremely pleased with where it's come to at this point.  Attached to this post is the decompiled geonosis.script file that is included with the Xbox demo but obviously never used.
The BOBclan:  A Rich History


Quote from: Unit 33 on November 29, 2014, 03:44:44 AM
'Please, tell me more about the logistics of the design of laser swords being wielded by space wizards' - Some guy on the internet.

This is some great work so far. Good job, Dark_Phantom!  :tu:
In Progress:
--Star Wars: Battlefront - Anniversary Edition (formerly Star Wars: Battlefront - Legacy Edition)
--Endor: Imperial Base

On Hold:
--Star Wars Battlefront: Elite Squadron For SWBF1

great work indeed for one cant wait to see how far we can push bf1
mods and maps in progress:<br />--Bf1 expanded edition 3.0 version
-- bf1 tcw battles
-- bf1 seasons mod season 1
-- bf2 expanded edition tbh

Cool,
I started one for Lua 5, but got unmotivated to continue when I was looking at the TEST & JMP operations (and/or logic).
I don't really remember why I stopped and I think it's entirely possible to get something pretty close to source.

Perhaps we can work together and discuss?

I posted a Lua 5 VM instruction manual at:
https://github.com/BAD-AL/SWBF2_Xbox_mod_effort/blob/master/SWBF2CodeHelper/ANoFrillsIntroToLua5VMInstructions.pdf

Did you find a similar one for Lua 4?

I should probably document my code better, but that pdf (I've been linked to it before) was what I used to start.  In my other thread (the common/shell builder), I've been doing comparisons to get them exactly the same as Steam/GOG's files.  It's also been helping me grasp better how to logically structure my code.  I can handle simple files, right now I'm working on nested table logic and then I think if-then logic is next.

There are a couple different instructions, which I had to make my own determinations on, but a lot of the concepts are the same.
The BOBclan:  A Rich History


Quote from: Unit 33 on November 29, 2014, 03:44:44 AM
'Please, tell me more about the logistics of the design of laser swords being wielded by space wizards' - Some guy on the internet.

Yea, looks like there are more instructions in Lua 4;
Here's a look at all the opcodes:
http://www.lua.org/source/4.0/lopcodes.h.html

This one looks pretty well documented for source code.

Way ahead of you.  I had a commit already in my system (now pushed) that had added all of them to the public static variable list.  The nice thing is that if I don't know what something does, I can usually just find a file with it and generate the bytecode for it.  However, they do a great job of saying what each of them do.
The BOBclan:  A Rich History


Quote from: Unit 33 on November 29, 2014, 03:44:44 AM
'Please, tell me more about the logistics of the design of laser swords being wielded by space wizards' - Some guy on the internet.

is splitscreen possible? to code in am going to assume no it probably would probably require source code change.
mods and maps in progress:<br />--Bf1 expanded edition 3.0 version
-- bf1 tcw battles
-- bf1 seasons mod season 1
-- bf2 expanded edition tbh

That's not part of this topic, you want something like this: http://www.swbfgamers.com/index.php?topic=11251.0

We already have all the source lua scripts and learned the source code controls the splitscreen stuff for consoles.  You need an external program for it.
The BOBclan:  A Rich History


Quote from: Unit 33 on November 29, 2014, 03:44:44 AM
'Please, tell me more about the logistics of the design of laser swords being wielded by space wizards' - Some guy on the internet.

cool so it is possible for bf1
mods and maps in progress:<br />--Bf1 expanded edition 3.0 version
-- bf1 tcw battles
-- bf1 seasons mod season 1
-- bf2 expanded edition tbh