TeamPBCN / Metroid-Dread

Metroid Dread localization tools
1 stars 2 forks source link

Need help about BTXT and Font on Metroid Dread Nintendo Switch. #1

Closed JokerDKha closed 2 years ago

JokerDKha commented 2 years ago

Need help to translation Metroid Dread on Nintendo Switch. File almost like the 3ds version. Tks for about helping out. Sample.zip.

LITTOMA commented 2 years ago

I created a new repo for Metroid Dread: https://github.com/TeamPBCN/Metroid-Dread

Support for the new version of BTXT is added. Also upgraded python version to python3.

JokerDKha commented 2 years ago

Text BTXT working perfect. Are font using same method on font 3ds?

LITTOMA commented 2 years ago

Fonts in dread is different from samus returns. Good news is we've finished the reverse engineering. It would take some time to coding.

LITTOMA commented 2 years ago

Added font tools. You can find font_example.bat for reference.

JokerDKha commented 2 years ago

@LITTOMA tks but what path and font i need to put in what folder ? I need a guid path for that.

JokerDKha commented 2 years ago

Update Error image image

LITTOMA commented 2 years ago

Generating font tables and texture

To generate a font you should use tools/scripts/font.py.

Here are the options:

Here's the complete command: python3 .\tools\scripts\font.py create --ttf-path ".\temp\a.ttf" --charset-path ".\temp\simplified_chinese.txt" --gtbl-path ".\temp\chc_glyphtable.buct" --bfnt-path-fmt ".\temp\chc_{}.bfont" --mtxt-path ".\temp\chc_atlas.bctex" --mtxt-width 4096 --mtxt-height 2048 --gtbl-path-ingame "system/fonts/symbols/chc_glyphtable.buct" --mtxt-path-ingame "system/fonts/textures/chc_atlas.bctex" --32 .\temp\simplified_chinese.txt --32-useicon --52 .\temp\simplified_chinese.txt --52-ttf ".\temp\b.ttf"

To run this command, you need to prepare:

That's all!

By running this command you will have .\temp\chc_glyphtable.buct, .\temp\chc_32.bfont, .\temp\chc_52.bfont, .\temp\chc_atlas.png in the temporary folder.

Importing font texture

We'll import the generated font texture to the original chc_atlas.bctex

The command: .\tools\bin\mtxttool.exe -ig .\temp\chc_atlas.png -t .\temp\chc_atlas.bctex .\temp\origin\Romfs\textures\system\fonts\textures\chc_atlas.bctex

Before running you should extract the original romfs folder and put it into .\temp\origin.

This will import .\temp\chc_atlas.png to the original .\temp\orign\Romfs\textures\system\fonts\textures\chc_atlas.bctex and write the output to .\temp\chc_atlas.bctex

Making a layeredFS patch

Run the following commands to make a patch which can be used in Atmosphere.

set FONTDIR=temp\010093801237C000\romfs\system\fonts
set SYMDIR=%FONTDIR%\symbols
set TEXDIR=temp\010093801237C000\romfs\textures\system\fonts\textures
md %SYMDIR%
md %TEXDIR%

move ".\temp\chc_glyphtable.buct" %SYMDIR%
move ".\temp\chc_*.bfont" %FONTDIR%
move ".\temp\chc_atlas.bctex" %TEXDIR%

Or, just run font_example.bat when you prepare all files mentioned above :)

Testing

After doing all these, you can copy temp\010093801237C000 to sdcard:\atmosphere\contents\ and change the game language to Simplified Chinese to see if the font changed to what your TTF file looks like!

You can use Atmosphere's Language Override to change the game's default language.

JokerDKha commented 2 years ago

@LITTOMA tks you so much for the guide, but im still got this error. Im using font_example.bat image my temp file. image

LITTOMA commented 2 years ago

@JokerDKha can you upload your ttf file?

JokerDKha commented 2 years ago

@LITTOMA font.zip

LITTOMA commented 2 years ago

Snipaste_2021-10-14_11-31-47 You have 2 ".ttf" in your file names. Remove 1 of them should work.

LITTOMA commented 2 years ago

Note that a dependency pip package should be installed from GitHub: python3 -m pip install git+https://github.com/ssbothwell/greedypacker.git

JokerDKha commented 2 years ago

image greedypacker.git i cant install it on python 3

JokerDKha commented 2 years ago

Now im got this after pip install greedypacker 0.4 image

LITTOMA commented 2 years ago

You can download zip file from greedypacker's master branch and use pip to install the zip file.

pip install "path/to/greedypacker-master.zip"

JokerDKha commented 2 years ago

@LITTOMA Update still got error: image

LITTOMA commented 2 years ago

Please check your greedypacker version pip list

This is an error in 0.4. After installing the zip file, the version should be 0.4.1.

JokerDKha commented 2 years ago

Tks you so much, any thing is working now. image

JokerDKha commented 2 years ago

image Testing in game got this error. Edit: im know what wrong. im try use on english text, this only working simple-chinese. Any way can we do any thing on english text and font english?

JokerDKha commented 2 years ago

Update some icon error like this image image

LITTOMA commented 2 years ago

Are there any *.bctex file in temp\010093801237C000\romfs\textures\system\fonts\textures?

JokerDKha commented 2 years ago

yeah it have this is romfs im make. romfs.zip

LITTOMA commented 2 years ago

What language do you set in yuzu's emulation settings?

JokerDKha commented 2 years ago

@LITTOMA is this right? image

LITTOMA commented 2 years ago

This is right. Your generated files also seem good. It looks like an emulator issue. Because the game language didn't change to Chinese...

JokerDKha commented 2 years ago

@LITTOMA after using simplified_chinese.txt , is working. But using on english text is will make error icon. i think font not working on english txt. Also my font not support chinese font. image

LITTOMA commented 2 years ago

You can rename the generated file to the english file name.

chc_32.bfont -> eng_32.bfont chc_glyphtable.buct -> eng_glyphtable.buct chc_atlas.bctex -> eng_atlas.bctex

etc.

JokerDKha commented 2 years ago

image i cant find any eng font in original... i dont think rename like: chc_32.bfont -> eng_32.bfont chc_glyphtable.buct -> eng_glyphtable.buct chc_atlas.bctex -> eng_atlas.bctex

will working.

LITTOMA commented 2 years ago

Can you find anything else relative to us_english? I don't have the extracted romfs at this time.

JokerDKha commented 2 years ago

us_english.zip This is a font and us text. i think?

LITTOMA commented 2 years ago

try to add --20 <path/to/utf16_charset.txt> and --42 <path/to/utf16_charset.txt> to the font generation script. These 2 sizes of fonts could be used by english text.

JokerDKha commented 2 years ago

Still got error with font us_english after using --20 <path/to/utf16_charset.txt> --42 <path/to/utf16_charset.txt> image romfs.zip

LITTOMA commented 2 years ago

@rewold you can fire a new issue. post your console outputs in the new issue.

LITTOMA commented 2 years ago

@JokerDKha I tested us_english font without problem. You can try to add --20-useicon and --42-useicon to the command line.

JokerDKha commented 2 years ago

@LITTOMA Update .bat for font us, still need for simplified_chinese but it now working. occ_20 (use for number) 32 and 52 (use for a text) and i dont know 40 use for. Us_font.bat: (after use rename all chc to occ) python3 .\tools\scripts\font.py create --ttf-path ".\temp\a.ttf" --charset-path ".\temp\simplified_chinese.txt" --gtbl-path ".\temp\chcglyphtable.buct" --bfnt-path-fmt ".\temp\chc{}.bfont" --mtxt-path ".\temp\chc_atlas.bctex" --mtxt-width 4096 --mtxt-height 2048 --gtbl-path-ingame "system/fonts/symbols/chc_glyphtable.buct" --mtxt-path-ingame "system/fonts/textures/chc_atlas.bctex" --32 .\temp\simplified_chinese.txt --32-useicon --20 .\temp\simplified_chinese.txt --20-useicon --40 .\temp\simplified_chinese.txt --52 .\temp\simplified_chinese.txt --52-ttf ".\temp\b.ttf" .\tools\bin\mtxttool.exe -ig .\temp\chc_atlas.png -t .\temp\chc_atlas.bctex .\temp\origin\Romfs\textures\system\fonts\textures\chc_atlas.bctex

set FONTDIR=temp\010093801237C000\romfs\system\fonts set SYMDIR=%FONTDIR%\symbols set TEXDIR=temp\010093801237C000\romfs\textures\system\fonts\textures md %SYMDIR% md %TEXDIR%

move ".\temp\chcglyphtable.buct" %SYMDIR% move ".\temp\chc*.bfont" %FONTDIR% move ".\temp\chc_atlas.bctex" %TEXDIR%

JokerDKha commented 2 years ago

New Update working fine on us_english txt and occ font. <3 tks you for hard working. unknown