PopCap Games Compiled Lua Scripts: *.LUC (LUA 5.6 fake header? Lua 5.0.2)

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

PopCap Games Compiled Lua Scripts: *.LUC (LUA 5.6 fake header? Lua 5.0.2)

Post by LolHacksRule »

I want to view the LUC files of a game's (Plants VS Zombies) DRM and the two Bookworm Adventures games, they are proper compiled LUA files according to the header, but written in a version (LUA 5.6) no one knows (or is stupidly headered LuaV) any advice on decompiling these or will someone try? Thanks so much. I tried to decompile these with unluac.jar but got nowhere... UPDATE: Ok, turns out the pesky games use LUA 5.0.2, given by executable data and they are definitely headered stupidly. Heck, the game's still read them in the DRM or scripts/common (BWA) if the file extension is LUA. UPDATE2: Bookworm Adventures has a built-in Lua compiler for in scripts/common which compiles Lua files in this form if compiled files aren't present.

Image

Also the plaintext LUAs from BWAVOL2 cannot be compiled, how to fix their data to compile them properly?
Last edited by LolHacksRule on Thu Jan 28, 2021 5:25 pm, edited 7 times in total.
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: PopCap Games (.LUC, LUA 5.6?)

Post by LolHacksRule »

Anything? These files are making me furious.
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: PopCap Games (.LUC, LUA 5.6?)

Post by LolHacksRule »

Anything now? I really want to document the data and mod the game and these are the only files in the way. Debug compiling information is also present. The game can compile its own from scripts/common/common.lua.
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: PopCap Games *.LUC (LUA 5.6?)

Post by LolHacksRule »

Hate rebumping but anyone going to work on this? I tried ChunkSpy but that also doesn't help...
atom0s
Posts: 250
Joined: Sat Dec 27, 2014 8:49 pm

Re: PopCap Games *.LUC (LUA 5.6 fake header? Lua 5.0.2)

Post by atom0s »

These files are not stock Lua at all. They are using a heavily modified version of Lua, so none of the existing decompiler tools are going to work with it. They have changed a lot of the core language features that do not exist in stock Lua.

- Functions have brace-based scope.
- Keywords such as: class, def, super,
- Object creation with sub-classing/inheritance.
- C style comments. (//, /* */, etc.)
- C style bitwise/logic operators.
- C style pointers.

And more. This is a ton of major changes to the core language.
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: PopCap Games *.LUC (LUA 5.6 fake header? Lua 5.0.2)

Post by LolHacksRule »

Oof, thanks for the advice. And yes I know its their internal modified version of Lua 5.0.2.
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: PopCap Games *.LUC (LUA 5.6 fake header? Lua 5.0.2)

Post by LolHacksRule »

Someone made this https://github.com/wxarmstrong/PopLua-Disassembler, it doesn't output the true lua file but its something.