qabriel99 Posted November 6 Share Posted November 6 A tool was available previously and now it's long gone. Can anyone share it? Link to comment Share on other sites More sharing options...
ikskoks Posted November 6 Share Posted November 6 As far as I know there was a quick bms script for PCK archives and all language files were compiled LUA scripts, so any lua decompiler should do the work just fine. Or maybe you meant some other tools? If yes, please share more details. Link to comment Share on other sites More sharing options...
qabriel99 Posted November 6 Author Share Posted November 6 There is a quickBMS script, which I recovered from an archive: get size asize math size - 0xC goto size get files short get FTsize long get DATAsize long goto DATAsize for i = 0 < files get FULLNAME basename log MEMORY_FILE 0 0 savepos offset getdstring dummy 0x14 get size long get size2 long get NAMEsize long getdstring dummy 0xA savepos TMP get key byte goto TMP if key <= 0x80 set key = 0x80 endif get FILEoffset long math FILEoffset + 0x1e getdstring name NAMEsize putdstring name NAMEsize MEMORY_FILE filexor key MEMORY_FILE goto 0x00 MEMORY_FILE getdstring name NAMEsize MEMORY_FILE filexor "" string FULLNAME + "/" string FULLNAME + name log FULLNAME FILEoffset size next i This does work with the data.pck file but the extracted files are named gibberish: I also tried DoubleFineExplorer which works fine but only works for extracting the files not injecting them back in. Lastly, a tool is mentioned: but the link is dead and I couldn't find any replacements. I think the person who made the tool is still active in this very forum but I don't know even if he still has it. Let's at least try pinging him. Hey @Thief1987 you wouldn't happen to still have this, would you now? Link to comment Share on other sites More sharing options...
Thief1987 Posted November 6 Share Posted November 6 (edited) Maybe they changed encryption for filenames, because script should work as well. Try the tool then BATool -u data.pck BATool -r data.pck Repacked archive will be inside data folder BATool.rar Edited November 6 by Thief1987 2 Link to comment Share on other sites More sharing options...
qabriel99 Posted November 7 Author Share Posted November 7 (edited) Is it the normal behavior of the tool to extract the files as encrypted .lua files? Edit: Also, here is an error when I directly run the tool. When I use it as intended, as in BATool.exe -u data.pck it works fine but extracts encrypted .lua files. Edited November 7 by qabriel99 Link to comment Share on other sites More sharing options...
Thief1987 Posted November 8 Share Posted November 8 Yeah there is an error if you start it without arguments. I'm not sure about lua files. Originally there wasn't any encryption or compression on data, so the program extract files as is. Maybe you can attach a couple of examples. Link to comment Share on other sites More sharing options...
qabriel99 Posted Saturday at 08:18 AM Author Share Posted Saturday at 08:18 AM (edited) I've added a couple of .lua files and the data file itself. MainGame_enUS.zip data.zip Did you build your tool while it was only 1 act? Maybe they changed some file encodings? Edited Saturday at 08:33 AM by qabriel99 Link to comment Share on other sites More sharing options...
Thief1987 Posted Saturday at 12:29 PM Share Posted Saturday at 12:29 PM (edited) 4 hours ago, qabriel99 said: I've added a couple of .lua files and the data file itself. MainGame_enUS.zip 316.38 kB · 2 downloads data.zip 5.41 MB · 2 downloads Did you build your tool while it was only 1 act? Maybe they changed some file encodings? Yeah we made translation for the first act. They released official localisation with the second act iirc Well lua files aren't encrypted they are compiled, they were like that originally too Edited Saturday at 12:33 PM by Thief1987 Link to comment Share on other sites More sharing options...
qabriel99 Posted Saturday at 05:58 PM Author Share Posted Saturday at 05:58 PM Any idea how to decompile them? I tried various tools such as unluac, but none of them work. The files contain something called luaQ, which I couldn't find much info on. Link to comment Share on other sites More sharing options...
qabriel99 Posted Monday at 08:51 AM Author Share Posted Monday at 08:51 AM I did some work on it in my spare time. Here's what I found: 1. The QuickBMS script was buggy before. Because when I downloaded Act 1 and extracted the files, I saw that the file names were still gibberish. 2. Even though the QuickBMS script makes the filenames gibberish, the files themselves make sense. They are very readable with Lua decompilers. But I haven't figured out yet how to restore the readable lua files back to their original state. 3. The tool created by Thief1987 extracts the files as they should be. But there is a problem with the content. When I make a comparison between their tool and quickBMS there is a difference: Taking the MainGame_enUS file as an example: Here is the beginning of the file from quickBMS: Here is the beginning of the file from BaTool: The file extracted with quickBMS can be easily decompiled with luadec but not with BaTool. To do this I have to delete it until I get to the .LuaQ part. Link to comment Share on other sites More sharing options...
Solution qabriel99 Posted Tuesday at 09:22 AM Author Solution Share Posted Tuesday at 09:22 AM I finally managed to do it, so here's a little guide in case anyone wants to do a similar translation in the future. 1. Extract the files using BaTool. 2. Delete the first 29 bytes from MainGame_enUS.lua using a hex editor. 3. You can now access the editable text using any decompiler application. I used decompiler.com. 4. When your translation is done, we need to compile the .lua file. I used this binary. After downloading it, you can compile it with CMD with the command luac5.1 outputfilename.lua inputfilename.lua. 5. We add back the 29 bytes we deleted previously in the compiled file. 6. We create the pck file using BaTool. 7. Voila! 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now