XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Fri Jan 19, 2018 2:21 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Tomb Rider 9 (2013) locals.bin
PostPosted: Sat Oct 21, 2017 4:15 am 
Offline
beginner

Joined: Thu Aug 24, 2017 6:50 am
Posts: 21
Has thanked: 1 time
Have thanks: 0 time














You can make the ads go away by registering

huy
i need to edit this locals.bin from Tomb Rider 2013. how can i unpack and repack?


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.



Top
 Profile  
 
 Post subject: Re: Tomb Rider 9 (2013) locals.bin
PostPosted: Wed Oct 25, 2017 10:02 am 
Offline
ultra-n00b
User avatar

Joined: Thu Jul 14, 2016 11:33 am
Posts: 6
Has thanked: 1 time
Have thanks: 2 times
I tried to make an exporter but no luck,
In the picture below is what i know about the file structure.
i hope this is useful if someone is willing to help you.


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.



Top
 Profile  
 
 Post subject: Re: Tomb Rider 9 (2013) locals.bin
PostPosted: Fri Dec 15, 2017 8:58 am 
Offline
advanced
User avatar

Joined: Sat Sep 13, 2014 2:05 pm
Posts: 50
Has thanked: 7 times
Have thanks: 18 times
I have not yet break the header, but I can easily see that at 0x20C you can spot absolute pointer to text file segment. Every text is in UTF8 encoding. This is Polish language and it also uses HTML for marking text language. This file is quite easy format.

Header:
uint32 (here 7) - probably Polish language indicator. I don't really know why, but in my job we use '7' for language code for Polish too
uint32 - unknown
uint32 - I though it's text count, but it doesn't calculate.
Looks like header is 584 bytes long, after that normal pointer list (absolute) appears.

Every string is terminated with 0. I'm going for a meeting now, but I will code a tool for you when I get back.

Strings count as stated by MajKSA is wrong. :(

EDIT:
This is standalone file, so manipulating it should be easy, also there's no EOF or sections, but the file has pointers in it, that complicates things a bit, but that's still fine

String at 0x3554 is indeed one string and means "Błąd Tomb Raider". Therefore every special character in this case polish ł and ą are made by using two bytes, this is casual encoding thing. I can't seem to find the header structure (before pointers)

Found pointers count:
uint32 - unknown/ as said above- looks like language ID. Here 7=polish
uint32 - unknown_A
uint32 - unknown_B
Add unknown_A and unknown_B to get all pointers list. Keep in mind you can encounter null pointers!


Top
 Profile  
 
 Post subject: Re: Tomb Rider 9 (2013) locals.bin
PostPosted: Mon Dec 18, 2017 1:04 pm 
Offline
advanced
User avatar

Joined: Sat Sep 13, 2014 2:05 pm
Posts: 50
Has thanked: 7 times
Have thanks: 18 times
There you are:

Code:
import sys
import struct

curr = 0

lingual = open("locals.bin", "rb")
lingual.seek(4,0)
unk_A = struct.unpack('I', lingual.read(4))[0]
unk_B = struct.unpack('I', lingual.read(4))[0]
ffconst = unk_A + unk_B
pointerlist = []
while (curr < ffconst):
    returnme = lingual.read(4)
    pointerlist.append(struct.unpack('I', returnme)[0])
    curr = curr + 1
curr = 0
while (curr <= len(pointerlist)-1):
    if pointerlist[curr] < ((unk_A+unk_B)*4 ):
        curr = curr + 1
        continue
    lingual.seek(pointerlist[curr],0)
    charr = ""
    char_ = -1
    while (char_ != "\0"):
        char_ = lingual.read(1)
        charr+=str(char_)
    print(charr)
    curr = curr + 1


This will display all texts

For modifying I'm thinking of dumping whole script file and then rebuild the pointers basing on line, but there are some lines that have null pointer, so developer should also take note of it


Top
 Profile  
 
 Post subject: Re: Tomb Rider 9 (2013) locals.bin
PostPosted: Mon Dec 18, 2017 8:13 pm 
Offline
ultra-veteran
ultra-veteran

Joined: Fri Nov 06, 2009 12:13 am
Posts: 595
Has thanked: 72 times
Have thanks: 130 times
keep pointerlist as 2 separate arrays - they are different things 8)

the first is something you need to leave as-is - it indexes the second array
the second is the string offsets you can change

the values are either 0 (fallback to default language maybe?) or pointers into the strings. values of 0 should be kept intact too!

strings are utf-8 encoded and must be kept that way - beware there are "special characters" for injecting font glyphs

edit: also note some strings support a html-like syntax! look at colours

Code:
<font color="#3C96E1">hello world</font>

_________________
Useful tool links:


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group