True Crime: New York City .DAT Language Files

How to translate the files of a game
WillWNTD
Posts: 13
Joined: Mon Mar 14, 2022 7:12 pm

True Crime: New York City .DAT Language Files

Post by WillWNTD »

Hi, i need some help to export and import the texts from .dat files. I tried to edit the texts via hex editor, but the game crashed. Can someone take a look at the file structure, please? If it is possible to create a tool. Thanks in advance!

Sample files:
WillWNTD
Posts: 13
Joined: Mon Mar 14, 2022 7:12 pm

Re: True Crime: New York City .DAT Language Files

Post by WillWNTD »

I did some more tests, and in fact the game doesn't crash after hex edit, but the text spacing/formatting is wrong if the edited text has more or less characters than the original text. I took some screenshots:

https://imgur.com/a/JCQdC4W

Can anyone help, please?
NoobInCoding
Posts: 127
Joined: Sat Aug 07, 2021 9:49 am

Re: True Crime: New York City .DAT Language Files

Post by NoobInCoding »

This is the structure of the files. But there is no StringCount in the files, maybe it is in another file :idea:

Code: Select all

//------------------------------------------------
//--- 010 Editor v11.0.1 Binary Template
//
//      File: True Crime: New York City
//   Authors: NoobInCoding
//------------------------------------------------
local int Pos=0;
int BaseOff;
struct{
int ID;
int Offset;
Pos = FTell();
FSeek(Offset + BaseOff + 4);
string Str;
FSeek(Pos);
}String[150]<optimize=false>;
WillWNTD
Posts: 13
Joined: Mon Mar 14, 2022 7:12 pm

Re: True Crime: New York City .DAT Language Files

Post by WillWNTD »

NoobInCoding wrote:This is the structure of the files. But there is no StringCount in the files, maybe it is in another file :idea:

Code: Select all

//------------------------------------------------
//--- 010 Editor v11.0.1 Binary Template
//
//      File: True Crime: New York City
//   Authors: NoobInCoding
//------------------------------------------------
local int Pos=0;
int BaseOff;
struct{
int ID;
int Offset;
Pos = FTell();
FSeek(Offset + BaseOff + 4);
string Str;
FSeek(Pos);
}String[150]<optimize=false>;


Thanks for your attention! I attached some files that might contain some information about StringCount. If you can take a look at them, I would really appreciate it.

One more information: in "Lang" folder, there are 6 language folders (Eng, FRE, GER, ITA, SPA, UK), and all folders have exactly 38 files inside.
rabatini
Posts: 179
Joined: Tue Jan 18, 2022 12:21 am

Re: True Crime: New York City .DAT Language Files

Post by rabatini »

NoobInCoding wrote:This is the structure of the files. But there is no StringCount in the files, maybe it is in another file :idea:

Code: Select all

//------------------------------------------------
//--- 010 Editor v11.0.1 Binary Template
//
//      File: True Crime: New York City
//   Authors: NoobInCoding
//------------------------------------------------
local int Pos=0;
int BaseOff;
struct{
int ID;
int Offset;
Pos = FTell();
FSeek(Offset + BaseOff + 4);
string Str;
FSeek(Pos);
}String[150]<optimize=false>;


The char count is in there, but in a different way to see.

Image

You have take the baseoffset + 0x04 and sum with pointers of the photo above.
or
goto baseoff
get finalbaseoffset long
finalbaseoffset - baseoff = 4


Example:

C0570000
LITTLE ENDIAN ALWAYS
000057C0 + 0X04 = 57C4 = first string
57C4 + 00 00 00 2F = 57F3

57F3 = second string

57C4 + 00 00 01 03 = 58C7

58C7 = third string

just keeping sum
BASEOFF + 0X04 + POINTERS.

as per you can see in the next image, to offset let us to the exactly begin of the second string.

Image

Here the bms script to extract the text individually as per pointers that i show above.
its kind useless but, it will be very easy to create a tool with these informations.

Code: Select all

#true crime text pointers extract
#rabatini (luke)

get baseoff long
xmath mainoff "(baseoff + 0x04)"
goto 0x10
get size long
math i = 0
string NAME p "%01x.txt" i
log name mainoff size
xmath filecount "(baseoff / 8)"

xmath entries "(filecount - 1)"
goto 0x10


for rip = 1 to entries

get offset long
xmath offset "(mainoff + offset)"
get null long
savepos temp
get size long
xmath sizeking "(mainoff + size)"
xmath size "(sizeking - offset)"
get null long
goto temp
String FILENAME P "%rip%.txt"
if size == 0x741e4fec
get size asize
xmath size "(size - offset)"
log FILENAME offset size
endif
slog FILENAME offset size

next rip




works on langtable.dat
i think is the main text.
Last edited by rabatini on Sat Apr 16, 2022 12:06 am, edited 4 times in total.
WillWNTD
Posts: 13
Joined: Mon Mar 14, 2022 7:12 pm

Re: True Crime: New York City .DAT Language Files

Post by WillWNTD »

@rabatini Thank you so much for the information, appreciate it!
@NoobInCoding With the information given, would it be possible for you to create a tool please?
h3x3r
Posts: 165
Joined: Wed Jun 01, 2016 5:53 pm

Re: True Crime: New York City .DAT Language Files

Post by h3x3r »

Code: Select all

//------------------------------------------------
//--- 010 Editor v11.0.1 Binary Template
//
//      File:
//   Authors:
//   Version:
//   Purpose:
//  Category:
// File Mask:
//  ID Bytes:
//   History:
//------------------------------------------------
local int i,strcount;

int tablesize;
strcount=tablesize/8;
struct{
for( i = 0, i = 0; i < strcount; i++ )
    struct{
        int hash;
        int string_offset;
    }strtable;
}Table;
struct{
for( i = 0, i = 0; i < strcount; i++ )
    struct{
        string Text;
    }text;
}Texts;
rabatini
Posts: 179
Joined: Tue Jan 18, 2022 12:21 am

Re: True Crime: New York City .DAT Language Files

Post by rabatini »

h3x3r wrote:

Code: Select all

//------------------------------------------------
//--- 010 Editor v11.0.1 Binary Template
//
//      File:
//   Authors:
//   Version:
//   Purpose:
//  Category:
// File Mask:
//  ID Bytes:
//   History:
//------------------------------------------------
local int i,strcount;

int tablesize;
strcount=tablesize/8;
struct{
for( i = 0, i = 0; i < strcount; i++ )
    struct{
        int hash;
        int string_offset;
    }strtable;
}Table;
struct{
for( i = 0, i = 0; i < strcount; i++ )
    struct{
        string Text;
    }text;
}Texts;

I never use 010 editor before.
did is possible make a script with pointers recalculation?
Just curiosity.
h3x3r
Posts: 165
Joined: Wed Jun 01, 2016 5:53 pm

Re: True Crime: New York City .DAT Language Files

Post by h3x3r »

I think it's possible with this function. But not sure how to connect it to table.

Code: Select all

int ReadStringLength( int64 pos, int maxLen=-1 )
Returns the length of a null-terminated string if it were read at the address pos in the target file.
Delutto
Posts: 561
Joined: Tue Oct 13, 2015 1:26 pm

Re: True Crime: New York City .DAT Language Files

Post by Delutto »

True Crime New York City DAT Tool [PC]
By Delutto
See Readme.txt for instructions.
True_Crime_New_York_City_DAT_Tool_By_Delutto.7z
WillWNTD
Posts: 13
Joined: Mon Mar 14, 2022 7:12 pm

Re: True Crime: New York City .DAT Language Files

Post by WillWNTD »

Thanks a lot, Delutto! I really appreciate it.