3DSkit icon indicating copy to clipboard operation
3DSkit copied to clipboard

No Support for packing BFFNT v4.1

Open apolope opened this issue 6 years ago • 25 comments

I can unpack and make changes, but I can not package. I'm new to this and I do not know if I'm doing it right.

I unpacked with these arguments python 3DSkit.py -xf BFFNT -O reverse=true -O origin=NX "MessageFont38.bffnt"

And I try to pack with these arguments python 3DSkit.py -pf BFFNT -O reverse=true -O meta="MessageFont38_meta.json" "MessageFont38_sheet0.png" "MessageFont38_sheet1.png"

Returns this message UnsupportedFormatError: 3DSkit is currently unable to pack this format (101)

FontData.zip

These are files from the Super Mario Odyssey game of the Nintendo Switch

Forgive me for my lack of knowledge.

apolope avatar Mar 30 '19 01:03 apolope

That's because the BFFNT packer is not released yet ^^ Don't know why did i put this in the Readme so early...

Tyulis avatar Mar 30 '19 07:03 Tyulis

Thanks for agile answer, congratulation for your commitment. I'm waiting for the launch of this feature, so I finish the translation of the game. I would like to be able to help you implement, but I do not know much about python. I'm available for whatever I can help. Thanks so very much.

apolope avatar Mar 30 '19 15:03 apolope

I see that this was for many months in readme. Is this feature progressing or not? I would be happy for every to->BNTX or to->CMAP converter.

masagrator avatar Apr 01 '19 23:04 masagrator

I develop 3DSkit on my free time...

And the problem is that i don't have free time. So i try to answer to issues as fast as i can, but i can't work on this as fast as i'd like. Making a module is quite complicated, as it is not always well documented, so i have to document, program, test, re-program, ... And BFFNT is one of the most complicated formats i worked on.

Anyway, don't know why this was in the Readme. I'll try to do that, and as always any help is welcome for other formats ^^

Tyulis avatar Apr 02 '19 00:04 Tyulis

It would be very difficult to keep a quick made extractor in the BFFNT module. So this is what i'll do :

  • a BNTX extractor. The BFFNT extractor will just extract the BNTX section, and then call the BNTX extractor
  • Then a BNTX packer to rebuild them
  • And finally the full BFFNT packer that will call the BNTX packer

It may be a bit longer, but it's necessary to keep the consistency of 3DSkit, and just to rebuild correctly the files.

Tyulis avatar Apr 06 '19 18:04 Tyulis

Thanks for your commitment!

Unfortunately I'm a newbie on this and not know very much. Would like to help...

@masagrator helped me a lot. Just as you have helped a lot of people too and me.

When finish let us know. And we can ends ours projects. Thanks!

apolope avatar Apr 06 '19 18:04 apolope

Just a few news : the BNTX packer is on the way, i'm just struggling with texture compression but it should be done today or tomorrow.

Tyulis avatar Apr 23 '19 08:04 Tyulis

Regarding the BNTX extractor:


3DSkit.py -xf BNTX __Combined.bntx -v

--------__Combined.bntx--------
No compression
BNTX file found
Extracting...
File version : 0.4.1.0
Extracting texture BalloonTipShdw^s, element 0
0
Extracting texture BalloonTip^s, element 0
0
Traceback (most recent call last):
  File "K:\NSW\Themes\Very nice theme\tools\clean_3DSKit\3DSkit.py", line 249, in <module>
    result = main(args, opts)
  File "K:\NSW\Themes\Very nice theme\tools\clean_3DSKit\3DSkit.py", line 169, in main
    extract_files(filename, args.big, args.format, args.verbose, opts)
  File "K:\NSW\Themes\Very nice theme\tools\clean_3DSKit\3DSkit.py", line 112, in extract_files
    unpack.extract(filename, file, format, endian, verbose, opts)
  File "K:\NSW\Themes\Very nice theme\tools\clean_3DSKit\unpack\__init__.py", line 16, in extract
    unpacker = cls(*args)
  File "K:\NSW\Themes\Very nice theme\tools\clean_3DSKit\util\utils.py", line 18, in __new__
    return self.main(*args, **kwargs)
  File "K:\NSW\Themes\Very nice theme\tools\clean_3DSKit\unpack\BNTX.py", line 59, in main
    texmeta.append(self.read_texture(data, brtioffset))
  File "K:\NSW\Themes\Very nice theme\tools\clean_3DSKit\unpack\BNTX.py", line 159, in read_texture
    libkit.extractTiledTexture(indata, out, width, height, format, swizzle_value if tilemode == 0 else -1, self.byteorder == '<')
  File "K:\NSW\Themes\Very nice theme\tools\clean_3DSKit\py3DSkit\graphx.py", line 367, in extractTiledTexture
    _extractBC4Texture(input, output, width, height, format, swizzlesize, littleendian)
  File "K:\NSW\Themes\Very nice theme\tools\clean_3DSKit\py3DSkit\graphx.py", line 360, in _extractBC4Texture
    output[outpos] = output[outpos + 1] = output[outpos + 2] = lum
IndexError: index 572 is out of bounds for axis 0 with size 572

The file is from the ResidentMenu of the Nintendo Switch https://drive.google.com/file/d/1aJUnRfWBK6dARm-vLyI0Y_XP3Iviv8rS/view?usp=sharing

Excuse me if I reported this too soon, or it might be

currently only extracts uncompressed 2…

Migushthe2nd avatar Apr 23 '19 11:04 Migushthe2nd

Congratulations : you found a new version ^^" If you don't mind I'll first finish the BFFNT stuff and then i'll try to fix that. But thank you very much for your contribution !

Tyulis avatar Apr 23 '19 12:04 Tyulis

The BNTX packer is seemingly working, now i start the BFFNT packer ^^

Tyulis avatar Apr 23 '19 14:04 Tyulis

Very good and congratulation for your work. I was job travel, and now go test.

apolope avatar Apr 28 '19 21:04 apolope

Pfff... Really sorry for the wait, no time at all this month... Anyway, it works quite well, just a few things to fix and it should be done

Tyulis avatar May 15 '19 16:05 Tyulis

So.... Finally it's committed, you can try if it works ^^

Tyulis avatar May 24 '19 17:05 Tyulis

Good new. Can you share bffnt repack tools?

TROguz avatar May 29 '19 13:05 TROguz

They are already in the repo, just pull it ^^

Tyulis avatar May 29 '19 13:05 Tyulis

Oh, nice. Thank you. I want to edit zelda botw and wind waker hd fonts. This bffnt script its work on Wii U games?

TROguz avatar May 29 '19 13:05 TROguz

Why give me error script? SyntaxError: unexpected character after line continuation character

TROguz avatar May 29 '19 14:05 TROguz

Can you build this tools?

TROguz avatar May 29 '19 14:05 TROguz

This is python script. What you want to build? I will test it in couple of days on Super Mario Party fonts.

masagrator avatar May 29 '19 17:05 masagrator

I want bffnt unpack repack fonts. But script give me error for unpack. Example Zelda wind waker hd fonts: https://www94.zippyshare.com/v/4JOtjm8y/file.html

TROguz avatar May 29 '19 18:05 TROguz

For me your WiiU bffnt is extracting normally, json is good, but textures are broken. python 3dskit.py -x -O origin=CAFE CKingMain.bffnt

masagrator avatar May 29 '19 18:05 masagrator

Thanks but where is the problem? https://prnt.sc/nv28fl

TROguz avatar May 29 '19 18:05 TROguz

Don't try to run it from python command line. Just put this whole line to cmd with python at the beginning

masagrator avatar May 29 '19 18:05 masagrator

Currently it only repacks Switch fonts, but i'm working on WiiU ones. I'll take a look at your file ^^

Tyulis avatar May 29 '19 20:05 Tyulis

Thanks but i cant unpack. Can you make tutorial video for unpack and repack? Thanks for everything.

TROguz avatar May 29 '19 20:05 TROguz