[SOLVED] lego batman 1 localization problem

How to translate the files of a game
aoto
Posts: 6
Joined: Tue May 25, 2021 2:54 am

[SOLVED] lego batman 1 localization problem

Post by aoto »

hi, my english not good, so please Be patient, thanks.
I localize lego batman 1, i translated txt file to chinese. find the font file, and i Understand the file structure.
but if i change the font size, This game won't start, if i just overwrite this font file hex and don't change file size, this game work and displays chinese.
so i think The problem lies in game exe file.It limits the font file size.(if i delete some hex change font file size, the game not work)
But I don’t know anything about EXE file. if you Know how to solve it,please tell me.
thanks.

this is game exe file and font file
https://drive.google.com/file/d/1TeXHUKMJajeAknQkGPbxqiSRWe9oCXAP/view?usp=sharing
Last edited by aoto on Sat Jun 05, 2021 7:46 pm, edited 1 time in total.
Zmkiy
Posts: 27
Joined: Mon Mar 09, 2020 3:14 pm

Re: lego batman 1 localization problem

Post by Zmkiy »

There're 2 offset at 0x0 (size file - 68) and 0xC44 (size dds - 68).
I'm not sure if you've edited this.
LinkOFF
Posts: 88
Joined: Thu Aug 11, 2016 6:52 pm

Re: lego batman 1 localization problem

Post by LinkOFF »

0x00 - size without footer (-68 bytes)
0x08 - size of table
0x1C (or 0x20) - number of entries?
0x48 - size of first table?
0xC44 - size of dds without footer (-68 bytes)
aoto
Posts: 6
Joined: Tue May 25, 2021 2:54 am

Re: lego batman 1 localization problem

Post by aoto »

Zmkiy wrote:There're 2 offset at 0x0 (size file - 68) and 0xC44 (size dds - 68).
I'm not sure if you've edited this.


OMG!I always thought it was fileHead And ignore it.
but i Checked other files. this is real file size flag!
I don't know if the change will work, but this information really escaped my attention!
thank you!!!(I don't know how to say thank you in English,so thankkkkkkkkkk you!!!!!)
aoto
Posts: 6
Joined: Tue May 25, 2021 2:54 am

Re: lego batman 1 localization problem

Post by aoto »

LinkOFF wrote:0x00 - size without footer (-68 bytes)
0x08 - size of table
0x1C (or 0x20) - number of entries?
0x48 - size of first table?
0xC44 - size of dds without footer (-68 bytes)


thank you!This problem should be right in the 0x00.I thought this was the file header and ignored it.
0x08 - Except for the size after DDS
0x1C - Number of characters included DDS
0x20 - characters mapping
0x48 - size of Number of characters included DDS
aoto
Posts: 6
Joined: Tue May 25, 2021 2:54 am

Re: lego batman 1 localization problem

Post by aoto »

Code: Select all

//------------------------------------------------
//--- 010 Editor v11.0.1 Binary Template
//
//      File: LegoBatman1_font.bt
//   Authors: aoto
//   Version: 1.0
//   Purpose: Parse FNT font files
//  Category: FNT
// File Mask: *.FNT
//  ID Bytes:
//   History:
//      1.0 2021-6-4    aoto: Initial release.
//------------------------------------------------
struct FNT {
    LittleEndian();
    DWORD fileSize;
    DWORD offsetTag;
    DWORD offsetFnt1;    // exclude DDS size,but include DDS msg.
    BYTE flags1[8];    // aways zero.
    DWORD dwVersion;
    DWORD offsetFnt2;    // exclude DDS && DDS msg size.
    DWORD dwNumChars;
    DWORD dwNumUnicodeTables;
    float height;   // height of char.
    float baseLine;
    float spaceWidth;   // 'space' key width
    BYTE flags2[20];    // aways zero.

    struct CharsMappingArray {
        DWORD offsetCharsMappingArrayHead;
        DWORD offsetCharsMappingArraySize;
        BYTE flags3[20];    //aways zero.
        local int i;
       for(i = 0; i < dwNumChars; i++) {
          float charX;
          float charY;
          float charWidth;
       }
    } charsMappingArray;
   
    struct UnicodeTablesArray {
        local int j;
        for(j = 0; j < dwNumUnicodeTables; j++){
            WORD wUnicodeChar;  // unicode char number
            WORD wFontMappingIndex; // Index of the char mapping from the image (except 'space' that uses the spaceWidth)
        }
    } unicodeTablesArray;

    BYTE flags4[24];    // aways zero.
   
    struct DDS {
        DWORD DDS_height;
        DWORD DDS_width;
        BYTE flags5[36];    // aways zero.
        DWORD DDS_PIXELFORMAT_flags;
        BYTE flags6[8];
        DWORD unknowNum1;   //is 6
        BYTE flags7[4];
        DWORD DDS_mipMapCount;
        DWORD DDS_size;
        BYTE flags8[8];
        DWORD unknowNum2;    //is 3
        DWORD unknowNum3;    //is 1
        BYTE flags9[40];
        BYTE DDS_file[DDS_size];
    } dds;
   
    struct UnknowBlock {
        DWORD offsetUnknow;
        local int i;
        for(i = 0; i < (offsetUnknow / 4 - 1); i++){
            WORD Unknow1;
            WORD Unknow2;
        }
    } unkonwBlock;

} fnt;


this is i edit 010editor template for this game font file.
i insert one glyph.
insert 0x8F4 12bytes.
insert 0xBE4 4bytes.
change 0x00(file size - 68 bytes) + 16 bytes.
change 0x08 + 16 bytes.
change 0x18 + 16 bytes.
change 0x48 + 12 bytes.
DDS just export write and import it(file size not change).
can't open game.

if i just write and not insert(font file size not change), game work and show glyph change.
Could it be related to the footer?
thanks!
aoto
Posts: 6
Joined: Tue May 25, 2021 2:54 am

Re: lego batman 1 localization problem

Post by aoto »

i found lego star wars font file.
I put this file directly into batman folder, the game is open!
I compared the two files and tried to modify without changing the size,I found that the most likely problem is the footer.

I found that just keeping the 32BYTES footer game can run normally.
batman font file footer is 0x6270
10 00 00 00 90 9D FA FF 90 9D FA FF BC 9D FA FF
BC 9D FA FF BC 9D FA FF BC 9D FA FF BC 9D FA FF
BC 9D FA FF BC 9D FA FF BC 9D FA FF BC 9D FA FF
7C A9 FA FF 84 A9 FA FF 88 A9 FA FF 90 A9 FA FF
9C A9 FA FF

starwars font file footer is 0x1000
0B 00 00 00 00 F0 EF FF 00 F0 EF FF 2C F0 EF FF
2C F0 EF FF 2C F0 EF FF 2C F0 EF FF 2C F0 EF FF
2C F0 EF FF 2C F0 EF FF 2C F0 EF FF 2C F0 EF FF

I can't see what information this represents, please help me. thanks!
aoto
Posts: 6
Joined: Tue May 25, 2021 2:54 am

Re: [SOLVED] lego batman 1 localization problem

Post by aoto »

this footer 0x00 > 7
0x04,0x08 => Binary => (1 <-> 0) = fileSize(fileHeader) - 1bytes
0x0C,0x10,0x14,0x18,0x1C => Binary => (1 <-> 0) = fileSize(fileHeader) - 45bytes
The rest can be deleted.
Thanks to the people who helped me.it's work!