Closed JokerDKha closed 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.
Text BTXT working perfect. Are font using same method on font 3ds?
Fonts in dread is different from samus returns. Good news is we've finished the reverse engineering. It would take some time to coding.
Added font tools. You can find font_example.bat for reference.
@LITTOMA tks but what path and font i need to put in what folder ? I need a guid path for that.
Update Error
To generate a font you should use tools/scripts/font.py
.
Here are the options:
--ttf-path
: The input TrueType font file (*.ttf).--charset-path
: The input charset file. It should be a plain text file in UTF-16 encoding that containing the characters you want to put into the generated font. This means you can set it to the translated text file.--gtbl-path
: The output *_glyphtable.buct file. You can find this kind of file under romfs/system/fonts/symbols
. And you should put the generated buct file under this folder.--bfnt-path-fmt
: The output *.bfont file path format. The {}
in this parameter will be replaced to the font sizes you specified.--mtxt-path
: The output *.bctex file. Aka the font texture file. At this time .bctex
in the parameter will be replaced to .png
. So you would find a .png file instead of .bctex after generated. We'll import the png file to a bctex file in the next step.--mtxt-width
, --mtxt-height
: The font texture width and height. These should be the same as the original texture file. You can use tools/bin/mtxttool
to export the original texture file and check its size.--gtbl-path-ingame
: Path to the generated *.buct file in romfs.--mtxt-path-ingame
: Path to the generated *.bctex file in romfs.--<decimal number>
options: To specify the output font sizes and their character filters. We found that the game only use font size at 32 and 52 points. 20 and 32b seem to be useless. So basically you just specify --32 <filter for font size 32>
and --52 <filter for font size 52>
. The filter files are also plain text files in UTF-16 encoding.--<decimal number>-ttf
: The input TrueType font file for a font size. You can use different font styles for different sizes by specifying this parameter. If omitted, all font sizes will use what --ttf-path
specified.`--32-useicon
: Add this parameter anyway.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:
temp
.\temp\simplified_chinese.txt
. You can export a text file from BTXT for testing this example..\temp\a.ttf
and .\temp\b.ttf
.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.
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
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%
font_example.bat
when you prepare all files mentioned above :)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.
@LITTOMA tks you so much for the guide, but im still got this error.
Im using font_example.bat
my temp file.
@JokerDKha can you upload your ttf file?
You have 2 ".ttf" in your file names. Remove 1 of them should work.
Note that a dependency pip package should be installed from GitHub:
python3 -m pip install git+https://github.com/ssbothwell/greedypacker.git
greedypacker.git i cant install it on python 3
Now im got this after pip install greedypacker 0.4
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"
@LITTOMA Update still got error:
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.
Tks you so much, any thing is working now.
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?
Update some icon error like this
Are there any *.bctex file in temp\010093801237C000\romfs\textures\system\fonts\textures
?
What language do you set in yuzu's emulation settings?
@LITTOMA is this right?
This is right. Your generated files also seem good. It looks like an emulator issue. Because the game language didn't change to Chinese...
@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.
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.
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.
Can you find anything else relative to us_english? I don't have the extracted romfs at this time.
us_english.zip This is a font and us text. i think?
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.
Still got error with font us_english after using --20 <path/to/utf16_charset.txt> --42 <path/to/utf16_charset.txt>
romfs.zip
@rewold you can fire a new issue. post your console outputs in the new issue.
@JokerDKha I tested us_english font without problem. You can try to add --20-useicon
and --42-useicon
to the command line.
@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%
New Update working fine on us_english txt and occ font.
<3 tks you for hard working.
Need help to translation Metroid Dread on Nintendo Switch. File almost like the 3ds version. Tks for about helping out. Sample.zip.