Telltale Games - How to create proper lua/lenc files for translation ?

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Taktloss
Posts: 9
Joined: Sat Sep 26, 2015 5:51 pm

Telltale Games - How to create proper lua/lenc files for translation ?

Post by Taktloss »

Hello ;)
i've got some questions about how the lua files for GoT work and how to load a newly created .ttarch2 archive.
I saw that some Russian Translation Groups use them to load their own .ttarch2 files.

If i'm not wrong for rebuilding a .ttarch2 something like the command below is good enough

Code: Select all

ttarchext -b -V 7 57 output_file.ttarch2 input_folder 

But especially in the case of Games of Throne i need to create these new .ttarch2 archives and load them through these LUA files since some files use the same file names for every episode and i can't just put the .landb file into the game directoy (they overwrite each other).
For example the ui_episode_english.landb is in every Episode and this leads to problems then (showing the wrong text, doesn't show at all or skipping text).

Thats how the _resdesc_50_GoT_Loc_Menu.lua (from XBox version luckily plaintext for PC version it's still decrypted :( ) looks but i'm not sure what needs to changed here btw. what is important :)

Code: Select all

local set = {}
set.name = "GoT_Loc_Menu"
set.setName = "GoT_Loc_Menu"
set.descriptionFilenameOverride = ""
set.logicalName = "<GoT_Loc_Menu>"
set.logicalDestination = "<Menu>"
set.priority = 500
set.localDir = _currentDirectory
set.enableMode = "constant"
set.version = "xx"
set.descriptionPriority = 0
set.gameDataName = "GoT_Loc_Menu Game Data"
set.gameDataPriority = 0
set.gameDataEnableMode = "constant"
set.localDirIncludeBase = true
set.localDirRecurse = false
set.localDirIncludeOnly = nil
set.localDirExclude =
{
    "_dev/"
}
set.gameDataArchives =
{
    _currentDirectory .. "GoT_xbox_GoT_Loc_Menu_all.ttarch2", (pretty sure that needs to be changed to the newly created archive name)
    _currentDirectory .. "xbox_GoT_Loc_Menu_ms.ttarch2"
}
RegisterSetDescription(set)


Usually i just created a 0.ttarch archive but that obviously doesn't work here.

I would really appreciate if someone more experienced as me could explain what i would need to do to get this working ;)
ariaCeleste
Posts: 5
Joined: Sat Oct 17, 2015 6:19 am

Re: Telltale Games - How to create proper lua/lenc files for translation ?

Post by ariaCeleste »

I would like to know also about it...

I managed to partially decompile some lua files in GOT.
If you compile back the script leaving as it is without editing something, it has another offset and the header is also different than before...
I think the key is to compile the lua script in the right way.

This is the header of _resdesc_50_Boot. It's LuaR:
Image
But for some reason after compiling, I got a hex value of 08 at offset 8 and offset A.
Offset 8 is some size_t size, and Offset A the size of number type. But I can't do anything with that stuff..

Also, I just wonder if it would be enough creating the .lua with its related ttarch archive in the game directory, in order that the proper ttarch works...
Maybe it's also necessary to rename both lua and ttarch in a way, to mantain a specific order in the game directory so that the ttarch works properly.
Last edited by ariaCeleste on Wed Nov 25, 2015 10:08 am, edited 2 times in total.
Taktloss
Posts: 9
Joined: Sat Sep 26, 2015 5:51 pm

Re: Telltale Games - How to create proper lua/lenc files for translation ?

Post by Taktloss »

Yes i think you a right about the decompiling/compiling but i'm personally not even that far that i can do that only i tried some decompilers withouth success :/

Another thing is i looked into the russian translation and in their LUA files.
Since some of their LUA files still leave some plaintext in them i came to the conlusion that some of the important parts are this

Code: Select all

set.name = "GoT_Loc_Menu" -- change that to whatever you want to name it
...
set.logicalName = "<GoT_Loc_Menu>" --same as name just with <>
set.logicalDestination = "<Menu>" --leave it at that this seems to be the "Name" you want to override/patch
...
set.version = "xx" --in the russian translation this seems to be changed too but dunno if that is important
...
set.gameDataName = "GoT_Loc_Menu Game Data" -- change that to whatever you want to name it similar like set.name
...
set.gameDataArchives =
{
    _currentDirectory .. "GoT_xbox_GoT_Loc_Menu_all.ttarch2" --change to the newly created .ttarch2 file
}

ariaCeleste wrote:Also, I just wonder if it would be enough creating the .lua with its related ttarch archive in the game directory, in order that the proper ttarch works...
Maybe it's also necessary to rename both lua and ttarch in a way, to mantain a specific order in the game directory so that the ttarch works properly.

As far as i can tell they only use the LUA and the .ttarch2 files and that seems to be enough.
The names doesn't seem so important. They are like these

Code: Select all

_resdesc_50_GoT_Menu_Rus_by_QucklyTeam.lua
GoT_Menu_RT_by_QucklyTeam.ttarch2

You would just set set.gameDataArchives to GoT_Menu_RT_by_QucklyTeam.ttarch2 so that this file is used

But as you said as long as we can't compile proper LUA files that won't work :|
ariaCeleste
Posts: 5
Joined: Sat Oct 17, 2015 6:19 am

Re: Telltale Games - How to create proper lua/lenc files for translation ?

Post by ariaCeleste »

Wenn compiling, the standard Header of LuaR is beeing used by the Compiler.
The hex value 8 in Offset A means that for the number-type (double) is used. But in original _resdesc_50_Boot.lua (single/float) is used.
In order our proper lua to work I think that number-type has to be changed manually to (single/float) in some way, as long the Compiler uses always the standard header number-type (double)..

Greetz
Last edited by ariaCeleste on Wed Nov 25, 2015 10:12 am, edited 1 time in total.
ariaCeleste
Posts: 5
Joined: Sat Oct 17, 2015 6:19 am

Re: Telltale Games - How to create proper lua/lenc files for translation ?

Post by ariaCeleste »

So after all, it took me several hours to find a solution. But I think I got it now.
Like I expected, the key is to compile the lua script with single or float number type instead of the standard double number type used by the lua compiler!
In order to change that number type, you have to make a little modification in the header file from lua and then generate the lua binary.
From there on, it uses number type (single/float) instead of double when compiling the plain lua script.
That was the most interesting part and absolutely required before editing something in the plain lua script, in order the script works!
Now that the compiling problem is solved, you can dedicade modifying the plain script and changing the values in there...

Code: Select all

local set = {}
set.name = "GoT_Boot_german"               [-- changed it same as lua file name]
set.setName = "GoT_Boot_german"            [-- changed it same as lua file name]
set.descriptionFilenameOverride = ""
set.logicalName = "<GoT_Boot_german>"      [-- changed it same as lua file name]
set.logicalDestination = "<Boot>"          [-- leave it at that this seems to be the "Name" you want to override/patch]
set.priority = 500                         [-- seems to be very important, with a low value it doesn't seem to work!]
set.localDir = _currentDirectory
set.enableMode = "constant"                [-- ?]
set.version = "trunk"                      [-- ?]
set.descriptionPriority = 0
set.gameDataName = "GoT_Boot_german Game Data"
set.gameDataPriority = 0
set.gameDataEnableMode = "constant"
set.localDirIncludeBase = true
set.localDirRecurse = false
set.localDirIncludeOnly = nil
set.localDirExclude = {"_dev/"}
set.gameDataArchives = {
  _currentDirectory .. "test.ttarch2"      [--change to the newly created .ttarch2 file]
}
RegisterSetDescription(set)


I got still many questions what some properties and their values stand for, especially concerning set.priority.
But I got the proper boot.lua with it's proper ttarch working now, and I hope to manage the other files as well soon.

Greetz
Taktloss
Posts: 9
Joined: Sat Sep 26, 2015 5:51 pm

Re: Telltale Games - How to create proper lua/lenc files for translation ?

Post by Taktloss »

Was going to upload the russian files then i saw your news, thought i can still upload them if you want.
I got the LUA stuff now working too :D

I would really like to create a Toolset ;)
ariaCeleste
Posts: 5
Joined: Sat Oct 17, 2015 6:19 am

Re: Telltale Games - How to create proper lua/lenc files for translation ?

Post by ariaCeleste »

Nice to hear that you got it working too now :)
darkdragon83
Posts: 1
Joined: Tue Apr 26, 2016 6:26 am

Re: Telltale Games - How to create proper lua/lenc files for translation ?

Post by darkdragon83 »

hello,
it is possible to change the _currentDirectory of ttarch file in this string?

"set.gameDataArchives = {
_currentDirectory .. "test.ttarch2"

I would like to separate ttarch files in different folders

thanks in advance