Jump to content

Broken Age - localization tool


qabriel99
Go to solution Solved by qabriel99,

Recommended Posts

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

  • ikskoks changed the title to Broken Age - localization tool

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Solution

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 2
Link to comment
Share on other sites

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...