Jump to content

Broken Age - localization tool


Go to solution Solved by qabriel99,

Recommended Posts

Posted

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.

  • ikskoks changed the title to Broken Age - localization tool
Posted

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:

resim.png.44ca38b0437544575b2adacd9eeb8763.png
I also tried DoubleFineExplorer which works fine but only works for extracting the files not injecting them back in.

Lastly, a tool is mentioned:

resim.png.f88f5c4554827394aee2e9ab2af1c0b9.png

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?

Posted (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 by Thief1987
  • Like 2
Posted (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.

resim.png.40c43a09003ccaad116837bdc9f84577.png

Edited by qabriel99
Posted

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.

Posted (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 by Thief1987
Posted

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.

Posted

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: resim.png.840885a00d2be3c5c2fb3457d11ad015.png 

Here is the beginning of the file from BaTool: resim.png.9350cc26933548b98913cb5c38941b6a.png

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.

  • Solution
Posted

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!

  • Like 3
  • 2 months later...
Posted
On 1/29/2025 at 3:29 AM, sigmagamma said:

Thanks, @qabriel99, that worked perfectly! Do you happen to know how to extract and edit the font for Broken age from pdata.pck?

 

You're welcome. The game supported my accented letters, so I didn't have to deal with the fonts.
The problem was that neither the quickBMS script nor the tool worked with the pdata.pck file.

However, I fixed the script, and now it works for all of the files. Also, I wrote a little tool to convert .tex files to .dds files and vice versa. You can find them both here:
https://github.com/qabRieL99/BrokenAgeTex

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...