chill1Penguin / l64decode

A Python script to decode Farming Simulator 2019 .l64 files to LuaJIT bytecode files.
MIT License
12 stars 7 forks source link

Unable to decode FS25 files #11

Open TAEMBO opened 6 days ago

TAEMBO commented 6 days ago

This script works fine to decode Farming Simulator 22 files, however Farming Simulator 25 seems to be using a different format - an error 'File "{filePath}" contains an invalid .l64 header.' is returned for any and all l64 files retrieved from FS25.

Here's a download link to one of the .l64 files in question: https://cdn.taembo.net/main.l64

tn4799 commented 5 days ago

An importent information is that the l64 files differ from each other starting at the third byte, compared to the old files where the first 16 bytes always are the same.

tn4799 commented 5 days ago

@VidhosticeSDK Would your algorithm also work if the bytes now change from row to row? Since in fs22 the files all had the same first 16 bytes.

19BlueDragon83 commented 4 days ago

If someone has a solution, it would be nice if he would share it :). How did you open the .gar file?

scfmod commented 3 days ago

FS25 does not use LuaJIT anymore, they now use Luau. The first 2 bytes of the .l64 is the version (0x02 0xEF = luau bytecode version 3 when interpreted by the game .exe). So the old lookup tables won't work at all for these :-) Other than that I don't have much information on it.

scfmod commented 3 days ago
0x02, 0x13, 0x0a, 0x08, 0x01, 0x07, 0x02, 0x02
Rockstar94FS commented 3 days ago

Hi, I found a way to decode the .l64 files. https://github.com/Rockstar94FS/Farming-Simulator-L64-Decoder

Unfortunately, they are still unreadable. Does anyone know of any tool to decompile them?

TAEMBO commented 3 days ago

@Rockstar94FS What does this attempt decode them to? LuaJIT or Luau?

Rockstar94FS commented 3 days ago

@TAEMBO Luau bytecode

scfmod commented 3 days ago

That script will only decode FS19/FS22 .l64 files, not FS25

Rockstar94FS commented 3 days ago

It works with FS25, the algorithm is similar but different from that of FS19/FS22.

CoderKane commented 3 days ago

Rockstar's tool works for unlocking the l64 files! I wonder if some of the decompilers for Roblox lua scripts work since it also used Luau? Oracle decompiler supposedly works with LUAJIT 2.0-2.1 and Luau (bytecode version 3-6). Though it's paid software. Anyone gave it a try yet?

scfmod commented 3 days ago

Yeah my bad, it actually worked :-) I didn't notice the change of the formula, just that it used the same lookup table from previous versions. The lookup table I posted here works with the old formula

TAEMBO commented 2 days ago

@CoderKane https://github.com/xgladius/luauDec seems to be the most prevalent Luau decompiler out there based on my research that isn't pay-walled, however I'm unable to comprehend how to fully build it w/ make or with VS, have only gotten past the cmake part.

If anyone has any insight into that or knows a better solution, do let me know. I'm looking for something I can ship as a binary as opposed to a GUI or online web kind.

scfmod commented 2 days ago

luauDec only supports bytecode version 2 and unfortunately seems to fail randomly every time it's executed.

19BlueDragon83 commented 2 days ago

Maybe this?

https://github.com/cadenmarinozzi/Luau-Decompiler

scfmod commented 2 days ago

It seems that the bytecode format in FS25 is a bit modified from the "standard" format. I can deserialize v4 bytecode generated by luau compiler without any problems, but not these files.

Edit: Seemingly the bytecode version they use is 3