Castlevania LoS Mirror of Fate HD Font Edit

How to translate the files of a game
Gamer
Posts: 4
Joined: Tue Feb 05, 2019 6:58 pm

Castlevania LoS Mirror of Fate HD Font Edit

Post by Gamer »

Are there any tools for that this files editing? I want change or add some characters.
I hope there are that anyone can help me?
akintos
Posts: 88
Joined: Tue May 08, 2018 7:48 pm

Re: Castlevania LoS Mirror of Fate HD Font Edit

Post by akintos »

You can extract texture(*.bctex) files with script below:

Code: Select all

import struct
import os

from PIL import Image


MTXT_MAGIC = b'MTXT'


inpath = 'bradley27.bctex'
outpath = os.path.splitext(inpath)[0] + '_%02d.png'

with open(inpath, 'rb') as f:
    magic, unk1, unk2, unk3, unk4, width, height, mips, totalsize, headersize = struct.unpack('<4s4H5I', f.read(0x20))

    if magic != MTXT_MAGIC:
        raise IOError("Invalid file magic : %s" % magic)
   
    print("width=%d height=%d" % (width, height))
    print("mips:%d" % mips)

    imagesizes = struct.unpack('<%dI' % mips, f.read(4 * mips))

    if f.tell() != headersize:
        raise IOError("Failed to fully parse header.")

    for i in range(mips):
        imgdata = f.read(imagesizes[i])
        img = Image.frombytes('LA', (width, height), imgdata, 'raw', 'LA')
        img.save(outpath % i)

        width //= 2
        height //= 2
   
    print("Extracted %d images from %s" % (mips, inpath))


I didn't fully analyzed font files but it seems to be not possible to add characters.

There are only character coordinates in font files, not character numbers.
Gamer
Posts: 4
Joined: Tue Feb 05, 2019 6:58 pm

Re: Castlevania LoS Mirror of Fate HD Font Edit

Post by Gamer »

akintos wrote:You can extract texture(*.bctex) files with script below:

Code: Select all

...

I didn't fully analyzed font files but it seems to be not possible to add characters.

There are only character coordinates in font files, not character numbers.


it enough that only I edit some characters.

Script is worked. I extracted as .png file.

But How I reimport ".png" file as ".bctex" file?
Gamer
Posts: 4
Joined: Tue Feb 05, 2019 6:58 pm

Re: Castlevania LoS Mirror of Fate HD Font Edit

Post by Gamer »

Hi! @akintos
Is it possible to convert this file to ".bctex" file?