2

I've been trying to edit the lua files for the game victor vran (made by developers of the tropico series) but when i tried to decompile the files i'd get back errors. So i opened up some of the files in both notepad++ and luaedit, and noticed the first string of every file was lz4 which I automatically associated with compression. After a quick google I found the lua rocks lz4 module. With that i tried to decompress some files but couldn't really wrap my head arround it.

If anybody could give me some tips to point me in the right direction/tell me where i'm going wrong, or even take a quick look at the files i'll link to below, to give me advice on the matter I'd be greatly appreciatave. I will include 2 types of lua files from the game, ones with the lz4 string and ones without. thank you so much in advance, ifanybody needs more information on the files or the steps i took ask away

.lua files with "LZ4" as first string https://drive.google.com/open?id=0B042ggDJxSmJaTJ2Z1l4RTkzUHc

.lua files without lz4 as first string https://drive.google.com/open?id=0B042ggDJxSmJa2VNcjQxVC1TZ1k

kaylin1997
  • 25
  • 1
  • 6
  • The LZ4 prefixed files don't seem to follow the [lz4 frame format](https://lz4.github.io/lz4/lz4_Frame_format.html), so it might be some custom format. I see `LUA_SIGNATURE` start at 18th byte -- seems like Lua 5.3 bytecode. Bytes 16 and 17 could be beginning of a [lz4 block](https://lz4.github.io/lz4/lz4_Block_format.html) -- if we treat them as such, they pair decodes as "literal of 18 bytes, followed by a match of 6 bytes". [Lua bytecode header](http://files.catwell.info/misc/mirror/lua-5.2-bytecode-vm-dirk-laurie/lua52vm.html) happens to be 18 bytes. – Dan Mašek Jul 30 '17 at 16:33
  • The header looks like 4 byte magic number, 4 bytes file size (??) and 8 bytes of some unknown flags that may become apparent over time. For start, I'd cut that off, and try to decode the rest as a single LZ4 block. – Dan Mašek Jul 30 '17 at 16:36
  • Here's a little prototype Python script that unpacks the files: https://pastebin.com/gGhZGWc0 | The "without lz4" files I have no clue what that could be at this point. – Dan Mašek Jul 30 '17 at 16:54
  • thanks for the reply, the script gave back some errors, what version of python is it written in? am i right in guessing 2.7.xx? – kaylin1997 Jul 30 '17 at 17:38
  • Correct. What sort of errors? You will need to do a `pip install lz4` to get the library it needs. – Dan Mašek Jul 30 '17 at 17:48
  • thanks i got it to work that's a great help, now I just need to find an alternative to luadec for 5.3. again thank you so much i've been stuck on that for days – kaylin1997 Jul 30 '17 at 18:27

0 Answers0