Coder Social home page Coder Social logo

tyulis / 3dskit Goto Github PK

View Code? Open in Web Editor NEW
62.0 11.0 11.0 474 KB

A multi-purpose and pluggable program to extract and repack files found in 3DS (and some other Nintendo consoles) games

License: GNU General Public License v3.0

Python 91.69% C 8.31%
extract pack game-editing formats-decoding nintendo-hacking

3dskit's Introduction

3DSkit

3DSkit is a tool to extract and repack many files formats found on the NDS, DSi, 3DS, Wii U and Switch.

What does 3DSkit do?

3DSkit can:

  • Extract and convert many files formats found in NDS, 3DS, Wii U, Switch games
  • Pack or repack them
  • Decompress and compress these files to and from their original compression

Installation

Actually, some 3DSkit modules are based on libkit. This is a "virtual" module, which can be either c3DSkit, a C extension, or py3DSkit, its equivalent in pure Python. This means that you can use 3DSkit directly as is, without any setup: all 3DSkit modules can work without c3DSkit.

However, some formats are VERY, very slow to process in pure Python: for example, textures, fonts, audio... So if you can, build c3DSkit, that computes them much faster (sometimes 10000 times or more).

To install c3DSkit, just go into the c3DSkit directory and run python3 setup.py install. You need a working C compiler and the Python includes (that should be included in your python installation) When you update it, it may be required to remove the build/ directory. If you don't have the admin rights, try python3 setup.py install --user.

How to use

 usage: 3DSkit.py [-h] [-v] [-V] [-q] [-x | -p | -D | -C | -g PLUGIN] [-d]
    [-f FORMAT] [-l | -b] [-o OUT] [-c COMPRESSION]
    [--ckit | --pykit] [-O OPTIONS]
    [files [files ...]]

 Positional arguments:
 files                 Name of the file to convert or to pack into an archive

 Optional arguments:
 -h, --help            show this help message and exit
 -v, --verbose         Increases the verbosity of 3DSkit
 -V, --debug           Debugging mode, turns every 3DSkit error into Python
                       exceptions (only useful for debugging)
 -q, --quiet           Run without any terminal output
 -x, --extract         Extract files contained in the archive / decompress
                       the file if necessary and convert it to a readable
                       format. On a directory, recursively extracts all
                       contained files
 -p, --pack            Pack files into an archive, or convert it to a console
                       format
 -D, --decompress      Decompress the input files
 -C, --compress        Compress the input file
 -g PLUGIN, --plugin PLUGIN
                       Run a plugin
 -d, --dir             Use a directory to pack an archive. The root will be
                       the directory. Very recommended.
 -f FORMAT, --format FORMAT
                       Format to repack, or input format (to extract. See the
                       formats section of the help for more infos)
 -l, --little          Little endian (for 3DS / NDS files), default
 -b, --big             Big endian (for WiiU files)
 -o OUT, --out OUT     Output file name (only for repacking). If not given,
                       the output file name will be automatically determined
 -c COMPRESSION, --compression COMPRESSION
                       Output compression type
 --ckit                Force use of c3DSkit as libkit
 --pykit               Force use of py3DSkit as libkit
 -O OPTIONS, --options OPTIONS
                       Format-specific options, see below for details

Examples

Extract a DARC archive:

python3 3DSkit.py -x archive.darc

Recursively extract all the contents of a directory:

python3 3DSkit.py -x my-directory/

Extract a 3DS ROM (NCCH) without doing hash checks

python3 3DSkit.py -x -O dochecks=false my_ncch_partition.cxi

Convert a BFLIM image in verbose mode:

python3 3DSkit.py -xv myTexture.bflim

Convert into a BFLYT file with a custom output name:

python3 3DSkit.py -pf BFLYT -o myLayout.bflyt a-layout.tflyt

Pack a folder into a version 6 GARC archive in verbose mode

python3 3DSkit.py -pdvf GARC -O version=6 any-directory

Pack three files into an SARC file and compress it in LZ11

python3 3DSkit.py -pf SARC -c LZ11 file1 file2 file3

Pack a BFLIM texture for the WiiU (big endian):

python3 3DSkit.py -pbf BFLIM my_texture.png

Pack two BCSTM respectively with one and two tracks, the second with a loop.

python3 3DSkit.py -pf BCSTM -o oneTrackTest.bcstm track1.wav
python3 3DSkit.py -pf BCSTM -o twoTracksExample.bcstm -O loop=100000-2100000 track1.wav track2.wav

Compress a DARC file without any console output and with a specific output file name

python3 3DSkit.py -Cqc LZ11 -o archive_LZ.darc archive.darc

Decompress the previous DARC file

python3 3DSkit.py -D archive_LZ.darc

Format-specific options

Specify these options with the -O option. You can specify them with -O option1=value1 -O option2=value2 ...

Extraction options:

  • NCCH/ExeFS:
    • dochecks: If false, don't check if the content hashes match. If you get a HashMismatchError, it's theorically right, so change this only if you're sure of the integrity of your file. Defaults to true.
    • dumpfs: If true, dumps the ExeFS and the RomFS images as exefs.bin and romfs.bin before extracting them. Defaults to false
  • GARC:
    • skipdec: If true, force the module to not decompress the contained files. This may be useful if it detects a compression when there is not, but only in that case. Defaults to false
  • BFFNT:
    • origin: Sets the original console from which the file comes. Can be set to CTR for 3DS, CAFE for WiiU or NX for Switch. Try this if you get errors or glitched output. If not specified, tries to auto-detect from the file's version.
    • reverse: If the sheets are upside down, set this to true to reverse them automatically. Don't forget to use it again when you repack the file!
  • MSBT:
    • showescapes: If false, just erases undisplayed characters, else show them as \\uXXXX. Defaults to true

Packing options:

  • BFLIM:
    • format: Specify the color format. Can be: RGBA8, RGBA4, RGB8, RGB565, RGBA5551, LA8, LA4, L8, L4, A8, A4. Note that this will have an effect on color quality and file size, but not on the functionality of the game, you can repack in a different format from the original without any problem, for example for ETC1, which is not supported for packing. Defaults to RGBA8
    • swizzle: Specify the texture swizzling (see console output at extraction). Can be 0 (none), 4 (90º rotation) or 8 (transposition). Defaults to 0.
  • GARC:
    • version: Specify the version of the output file. Can be 4 or 6, look at the console output during the extraction. Defaults to 6.
  • mini:
    • type: Specify the file type (2 chars magic number) to use for the output file. Look at the console output during the extraction. If you don't use the right magic, it can prevent the game to load the packed file. Defaults to BL.
  • BCSTM:
    • format: Specify the audio format. Can be DSP-ADPCM, IMA-ADPCM, PCM16 or PCM8 (currently only DSP-ADPCM is supported). Defaults to DSP-ADPCM
    • loop: Makes a looping BCSTM. Must be of the form <start>-<end> (eg. 688123-2976543). If not given, the packed BCSTM won't loop at all.
    • writetracks: If a BCSTM contains only 1 track, sometimes the track is explicitly written in the file, and sometimes not. If you want to pack only one track, you can set it to false to not write the track info. Defaults to true, change only if default don't work. Note that a track is theorically a standalone stream, it's different than a channel

Supported formats

Info on the table:

  • X (Extract): 3DSkit can extract these files
  • P (Pack): 3DSkit can create and pack these files from scratch
  • R (Repack): 3DSkit can only repack files which have been extracted by 3DSkit
  • Extensions: Frequent file extensions or names for this format (all formats can sometimes have the .bin extension)

Crosses:

  • x: full support
  • e: experimental
  • p: partial support
  • blank: no support

Output: Output format of the unpacker. As explained previously, modules which use libkit may be very slow in pure Python and much faster if you have c3DSkit installed

Format X P R Extensions Output Uses libkit
ALYT x x .alyt files
BCGRP x .bcgrp files
BCSAR e .bcsar files
BCSTM x x .bcstm WAV Yes
BCWAR x .bcwar files
BCWAV x .bcwav WAV Yes
BFFNT p .bffnt PNG+JSON Yes
BFLAN p .bflan JSON
BFLIM x x .bflim PNG Yes
BFLYT x x .bflyt JSON
BNTX x p .bntx PNG+JSON Yes
CBMD e .bnr banner[.bin] files
DARC x e .arc .bcma (...) files
GARC x x .garc (none) files
GFA x .gfa files
mini x x .mini .bl .wd (none) files
MSBT x .msbt TX
NARC p .narc files
NCCH x .app .cxi .cfa sections
NDS x .nds files
SARC x x .sarc .arc .szs files

There is also:

  • unpack.ExtHeader:
    • Unpacks NCCH extended headers (automatic when unpacking an NCCH partition). Needs a specific file name (exheader.bin, extheader.bin or DecryptedExtHeader.bin) to be recognized. Outputs as a TXTree
  • unpack.ExeFS:
    • Unpacks ExeFS images (automatic when unpacking an NCCH partition). The file must have the .exefs extension or be "exefs.bin" or "DecryptedExeFS.bin" to be recognized
  • unpack.RomFS:
    • Unpacks RomFS images (automatic when unpacking an NCCH partition). The file must have the .romfs extension or be "romfs.bin" or "DecryptedRomFS.bin" to be recognized

Compressions:

  • D: Decompressible
  • C: Compressible
Compression D C Extensions Uses libkit
LZ10 x x (none) .cmp .l *_LZ.bin .LZ
LZ11 x x (none) .cmp .l *_LZ.bin .LZ Yes
LZH8 x .cx
Yaz0 x .szs
ETC1 x Texture compression in BFLIM

Dependencies

To access all 3DSkit functionalities, you need:

  • Python 3.5+
  • Numpy (use sudo apt-get install python3-numpy or pip3 install numpy)
  • Pillow (use sudo apt-get install python3-pil or pip3 install pillow)

Pillow is only needed for textures and images (BFLIM, BFFNT). If you don't have it, other modules will work as well.

Contributing

Before submitting an issue, take a look at the program's help (-H option), your problem may have an easy fix, or already explained there. Don't forget to check if the issue has already been reported, or fixed (check also in the closed issues tab). Check if you have the latest commit. After all that, if you've actually found a new issue, you should state:

  • Your Python version
  • The console output (in verbose mode, -v option)
  • Attach the file being used and also a screenshot of the problem in the game file if it is relevant and/or possible to do so.

3dskit's People

Contributors

applecuckoo avatar cesarmiquel avatar martin005 avatar obscenityib avatar tyulis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

3dskit's Issues

Error extracting nx_bffnt font ,I don't know why.

Font found in [Captain Toad:Treasure Tracker] NS version
https://drive.google.com/open?id=1X4yCZtTADGWygFNK0ELZhMU5h2Id1sjW

Error Log

D:\TEST\3DSkit>3DSkit.py -x -V TitleFont32.bffnt

--------TitleFont32.bffnt--------
No compression
BFFNT file found
Extracting...
Version 4.1.0 (NX)
Texture format: BC4
Sheet width: 1024
Sheet height: 1024

Extracting wrapped BNTX
BNTI info for sheet 0:
 - Format: BC4
 - Width: 1024
 - Height: 1024
Traceback (most recent call last):
  File "D:\TEST\3DSkit\3DSkit.py", line 239, in <module>
    result = main(args, opts)
  File "D:\TEST\3DSkit\3DSkit.py", line 161, in main
    extract_files(filename, args.big, args.format, args.verbose, opts)
  File "D:\TEST\3DSkit\3DSkit.py", line 111, in extract_files
    unpack.extract(filename, file, format, endian, verbose, opts)
  File "D:\TEST\3DSkit\unpack\__init__.py", line 16, in extract
    unpacker = cls(*args)
  File "D:\TEST\3DSkit\util\utils.py", line 16, in __new__
    return self.main(*args, **kwargs)
  File "D:\TEST\3DSkit\unpack\BFFNT.py", line 84, in main
    self.readTGLP(data, self.tglpoffset - 8)
  File "D:\TEST\3DSkit\unpack\BFFNT.py", line 133, in readTGLP
    self.extract_underlying_BNTX(data)
  File "D:\TEST\3DSkit\unpack\BFFNT.py", line 189, in extract_underlying_BNTX
    self.extract_sheet_c3DSkit(data, outname, width, height, sheetsize, BNTI_FORMAT_NAMES[format], swizzlesize)
  File "D:\TEST\3DSkit\unpack\BFFNT.py", line 148, in extract_sheet_c3DSkit
    format = c3DSkit.getTextureFormatId(format)
AttributeError: module 'c3DSkit' has no attribute 'getTextureFormatId'

Slow performance makes extraction unwieldy

I attempted to extract a GARC file, but found 3DSKit to be unexpectedly slow, and during this time, a folder was created but was not being populated. Investigating further, I noted extracting a 55MB GARC took almost 2 minutes between when extractGARC.readheader() is called and extractGARC.extract() is even called. Given that GARCs can grow to be over a gigabyte big, this renders such large garcs effectively unextractable.

It seems the line that causes this lag in particular is
fato, ptr = self.unpack_from(GARC_FATO_SECTION, data, ptr, getptr=True).
Once this is done, all other sections of the code, such as the FATB extraction, proceed smoothly. Could rawutil.py's _unpack() be the culprit? Could the entire 55MB be being copied repeatedly through several nested function calls through the arguments when it shouldn't be? Further investigation is warranted to eliminate this unwanted lag.

No Support for packing BFFNT v4.1

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.

Packing BFLIM crashes due to swizzle option

$ 3DSkit.py -p 'intro_bg_01.png' -o intro_bg_01.bflim -f BFLIM
creates this error message:

Packing BFLIM
Traceback (most recent call last):
  File "3DSkit.py", line 163, in <module>
    pack_files(files, args.out, args.compression, args.format.upper(), args.big, opts)
  File "3DSkit.py", line 34, in pack_files
    outnames = pack.pack(filenames, output, format, endian, opts)
  File "3DSkit/pack/__init__.py", line 9, in pack
    func(*args)
  File "3DSkit/util/funcops.py", line 14, in __new__
    return self.main(*args, **kwargs)
  File "3DSkit/pack/BFLIM.py", line 77, in main
    img = self.swizzle(img, opts['swizzle'])
KeyError: 'swizzle'

Opts is an empty dict, so it has no swizzle option. Also, self.swizzle doesn't seem to be a function.

Show message if program is run without any arguments

Right now, if the program is run without any arguments, it quits. This isn't very helpful, and may make people think the program is broken. You already have a message written out, displayed upon --help, so perhaps that message should show up if no arguments are given?

Error unpacking new BFLYT Nintendo Switch

Trying to extract a BFLYT from the Nintendo Switch ResidentMenu.szs. Files in ResidentMenu are mostly layout information, which the one I'm trying to decompress is one of. I am trying to convert it to readable text to change the order of a few items, and I am searching for a tool that enables me to do that. Wexos is the layout editor I'm using but it can't change the order of panels (and other items). This is what I am trying to accomplish:
image

My file:
https://drive.google.com/file/d/1lCrVG1bG0chnk7p8ypakEahvAkFW9h7Q/view?usp=sharing
I thought it wouldn't hurt to try, but the following error message is stopping me:


--------RdtBtnShop.bflyt--------
No compression
BFLYT file found
Extracting...
Version: 00000000
Section count: 47
Traceback (most recent call last):
  File "3DSkit.py", line 249, in <module>
    result = main(args, opts)
  File "3DSkit.py", line 169, in main
    extract_files(filename, args.big, args.format, args.verbose, opts)
  File "3DSkit.py", line 112, in extract_files
    unpack.extract(filename, file, format, endian, verbose, opts)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\unpack\__init__.py", line 16, in extract
    unpacker = cls(*args)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\util\utils.py", line 18, in __new__
    return self.main(*args, **kwargs)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\unpack\BFLYT.py", line 133, in main
    write(dump(self.parsedata()), outfile)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\unpack\BFLYT.py", line 192, in parsedata
    method(chunk)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\unpack\BFLYT.py", line 508, in readusd1
    secname = 'usd1-%s' % self.actnode['__prevname']
KeyError: '__prevname'```

Error extracting .bflyt "KeyError: '__parent'"

Trying to extract a .bflyt to JSON and I'm getting KeyError: '__parent'.

Terminal Output:
PS D:\Switch Modding\romfs\lyt\ResidentMenu\blyt> python C:\Users\imado\Downloads\3DSkit-master\3DSkit-master\3dSkit.py -x RdtBase.bflyt

--------RdtBase.bflyt--------
No compression
BFLYT file found
Extracting...
Traceback (most recent call last):
File "C:\Users\imado\Downloads\3DSkit-master\3DSkit-master\3dSkit.py", line 249, in
result = main(args, opts)
File "C:\Users\imado\Downloads\3DSkit-master\3DSkit-master\3dSkit.py", line 169, in main
extract_files(filename, args.big, args.format, args.verbose, opts)
File "C:\Users\imado\Downloads\3DSkit-master\3DSkit-master\3dSkit.py", line 112, in extract_files
unpack.extract(filename, file, format, endian, verbose, opts)
File "C:\Users\imado\Downloads\3DSkit-master\3DSkit-master\unpack_init_.py", line 16, in extract
unpacker = cls(*args)
File "C:\Users\imado\Downloads\3DSkit-master\3DSkit-master\util\utils.py", line 18, in new
return self.main(*args, **kwargs)
File "C:\Users\imado\Downloads\3DSkit-master\3DSkit-master\unpack\BFLYT.py", line 66, in main
self.readdata(data)
File "C:\Users\imado\Downloads\3DSkit-master\3DSkit-master\unpack\BFLYT.py", line 107, in readdata
self.curparent = self.curparent['__parent']
KeyError: '__parent'
PS D:\Switch Modding\romfs\lyt\ResidentMenu\blyt>

Mini repacking: "3DSkit is currently unable to pack this format"

Using 3DSkit, I managed to unpack a .bin file which is actually a BL mini format archive.
(command line: 3DSkit.py -x 0.bin)

However, the tool doesn't allow repacking, with that error message thrown.
I confirm that the mini.py is indeed in the "pack" folder.

As I'm trying to pack a directory of files, command line used is:
3DSkit.py -pdvf mini 0 (0 being the folder; I understand without options, it'll default to BL)

I've tried playing around with the command line, and can't get it to work, so it might be a bug.
(assuming it's not an error on my side; I've managed to get sarc packing, garc packing, bflim injecting to work, so this is the only thing that bugs me on my end)

Extracting files inside exefs Nintendo Switch

You seem quite skilled (especially because I have no idea what has to be done to extract all these binary files), so I wanted to ask you if you could also take a look at the files in the exefs partition. I was wondering if those can be unpacked an converted to a readable format aswell. I don't know though if it'll be of anything useful.
The three files inside the qlaunch's (Nintendo's system titles) exefs:
image
And here's the link
https://drive.google.com/drive/folders/1RixtA-_BSjd0-ihIJ1tHPQUDgxm0ctfY?usp=sharing

I'm not saying you have to do this, just asking (<- that 'just' can be quite a lot tho) if you could if you have the time available. I don't know if it is even possible, also because there isn't much documentation.

Contributing

Hello, @hlixed sent me, I figured I'd help out since python and Nintendo is my expertise, I started by looking at the Yaz0 decompressor which could probably use some rework (I haven't tested it vs. my implementation), but I wanted to send this your way
https://gist.github.com/NWPlayer123/05dd55dd1cce6eb5457741ce14f48587
some things I learned/would suggest:
ord + bit-manipulation is far faster than using struct
could probably use BytesIO instead of an array (I use wb+ to seek back and forth, might be faster to write in one go instead of allocating all the zeroes )
I dunno what you're doing here, but I'd recommend doing the masking like I do.
I dunno how the cycles compare on what I do vs. what you're doing, but I'd also do this so we don't have to catch anything, one less compare (I made the same mistake before)
My fancy buffer trick would also save some time since you don't have to keep a track of the full amount back you can go (0x111, 0xFF on third byte + the 0x12 added)
Also probably a slight waste to re-read the first two bytes.
One fun fact: you have to read byte-by-byte cuz their algo lets stuff overlap (aka, data isn't already there if you just copy the whole size at once), but you don't have to every time, only if size is bigger than how far back you go.

Missing parenthesis

Line 64 of /unpack/GARC.py is missing a closing parenthesis. This prevents any GARCs from being unpacked.

BFLIM unpacking/repacking of non-multiple of 8px images results in weirdly distorted images

(Firstly, unpacking an alyt file seems to produce two folders: one x folder containing the alyt folder, and one x_ folder with the timg and other folders.)

I've downloaded this nice cat off the internet to serve as a test image (downscaled here).
testcat

I then packed it into a BFLIM:
python3 3DSkit.py -p testcat.png -f BFLIM -o testcat_packed.bflim
and took it back out again:
python3 3DSkit.py -x testcat_packed.bflim

However, in the process, 3DSkit horribly mangled this poor kitty. You wouldn't want to leave this poor innocent kitty like this, would you?
testcat_new

However, I've noticed this doesn't happen with all images: This quick test Kirby, for example, passes through extraction and repacking just fine. (excuse his appearance; he only had a few seconds to compose himself)
lunasol_edited3
lunasol_edited2

Do you know why this might be happening? Is it something to do with the dimensions of the image?

bksnd support

I'm sorry for asking so much of you, but there seems to be a completely new filetype used on the Switch: bksnd. The folder the files are in is called 'sound' which would mean the snd stands for sound. The b probably means Binary and the second letter is part of the codename of the device. My Switch's codenumber on the back is BKEHAC001, which just is Nintendo's grantee code. The bksnd files are not the sounds themselves, because those are in the bfsar. I'm just giving these files to you because 1. I am curious and 2. I'd like to see if there's something editable.
image
I can provide you with the files again:
https://drive.google.com/drive/folders/1dz1myNu84X7_FPtqWifFeYrstVwlFNkX?usp=sharing

Error packing new BFLYT Nintendo Switch

When trying to repack the LineFooter.json -> LineFooter.bflyt an error is generated. Unpacking is fine though.

Packing .\LineFooter-edit.bflyt...
Packing BFLYT
Traceback (most recent call last):
  File "3DSkit.py", line 249, in <module>
    result = main(args, opts)
  File "3DSkit.py", line 193, in main
    pack_files(files, args.out, args.compression, args.format, args.big, args.verbose, opts)
  File "3DSkit.py", line 52, in pack_files
    pack.pack(filenames, output, format, endian, verbose, opts)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit-master\pack\__init__.py", line 10, in pack
    return func(*args)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit-master\util\utils.py", line 18, in __new__
    return self.main(*args, **kwargs)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit-master\pack\BFLYT.py", line 69, in main
    self.packdata(data, output)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit-master\pack\BFLYT.py", line 87, in packdata
    self.packsection(secname, section, output)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit-master\pack\BFLYT.py", line 98, in packsection
    self.packmat1(name, data, output)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit-master\pack\BFLYT.py", line 265, in packmat1
    self.pack('3f', node['rotation'], node['x warp'], node['y warp'], output)
KeyError: 'x warp'

File:
https://drive.google.com/file/d/1n42hjXlsJS0WZGEfnwIjtsZxZtgBdWz7/view?usp=sharing

BFLIM replacement in ALYT files results in a crash

At the bottom of the ALYTtool repo, you mention "NOTE THAT ACTUALLY, IF YOU REPACK A BFLYT FILE IN AN ALYT FILE, THERE IS SOME ISSUES WITH THE ELEMENT DISPLAYING (or there is not displaying at all...)." For the last week or so, I've been trying to pack a BFLIM, replace it in an ALYT, and then pack that into a GARC. However, it looks like it's crashing every time the specific repacked BFLIM is being loaded. I'm not sure what the problem is; I've tried packing and repacking and it doesn't seem to work.

Other BFLIMS in the same ALYT file load fine - only when the game tries to load the one 180x360 BFLIM that was replaced does it cause problems.

Do you know what I could do to test or otherwise figure out what's causing this problem?

packing BFFNT

I just try to pack BFFNT but there is something mess up with CMAP

I even tried to unpack and pack without changes anything to catch up if i did something wrong

these arguments i used

unpack
3DSkit.py -xf BFFNT -O origin=NX jpn_heading.bffnt

and pack
3DSkit.py -pf BFFNT jpn_heading_meta.json

original bffnt size 6,301,668
after packing 6,300,864

so i checked back in HxD
original
original

after packing
after

and here example

https://drive.google.com/file/d/1VQNGUAyiXaaMSR1oapyUwB8g1MAyK1OW/view?usp=sharing

Error unpacking new BFLAN Nintendo Switch

I don't want to overload you with issues, but here is another error.
The common.szs (another system file that contains info just like ResidentMenu.szs) also comes with an animation folder. Some of these animations can be opened in Wexos and extracted by your kit, like SystemColorFader_In.bflan, but others, like SystemColorFader_Color.bflan, result in an error. This so far only happens with files that (I assume) contain color information: BgNml_Color.bflan, BlurBg2_Color.bflan, CntrIndicatorS_Color.bflan, SystemColorFader_Color.bflan etc.
SystemColorFader_In.bflan:
https://drive.google.com/open?id=1YaYKFYTffGlzWl7kkRnddsEwO7aUiWm_

--------SystemColorFader_Color.bflan--------
No compression
BFLAN file found
Extracting...
Traceback (most recent call last):
  File "3DSkit.py", line 249, in <module>
    result = main(args, opts)
  File "3DSkit.py", line 169, in main
    extract_files(filename, args.big, args.format, args.verbose, opts)
  File "3DSkit.py", line 112, in extract_files
    unpack.extract(filename, file, format, endian, verbose, opts)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\unpack\__init__.py", line 16, in extract
    unpacker = cls(*args)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\util\utils.py", line 18, in __new__
    return self.main(*args, **kwargs)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\unpack\BFLAN.py", line 41, in main
    self.extract_sections(ptr)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\unpack\BFLAN.py", line 63, in extract_sections
    method(ptr)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\unpack\BFLAN.py", line 131, in readpai1
    data = self.unpack_from(pai1_TAG, self.file, tagpos)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\util\rawutil.py", line 101, in unpack_from
    unpacked, ptr = _unpack(stct, data, offset, byteorder, refdata)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\util\rawutil.py", line 58, in __new__
    return ins.main(*args, **kwargs)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\util\rawutil.py", line 317, in main
    return self.unpack_file(stct)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\util\rawutil.py", line 415, in unpack_file
    final.append([self.unpack_file(el.stct)[0] for i in range(count)])
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\util\rawutil.py", line 415, in <listcomp>
    final.append([self.unpack_file(el.stct)[0] for i in range(count)])
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\util\rawutil.py", line 467, in unpack_file
    final += struct.unpack(substruct, subdata)
struct.error: unpack requires a buffer of 4 bytes

Idk if Wexos' error will add anything, but I'll include it anyway
image

Some files return a bit different error, like FooterBtn_TextColor.bflan
FooterBtn_TextColor.bflan:
https://drive.google.com/open?id=1viUh1Xuy_WFCtLbvjWfljpKfbBaBt8Qm

--------FooterBtn_TextColor.bflan--------
No compression
BFLAN file found
Extracting...
Traceback (most recent call last):
  File "3DSkit.py", line 249, in <module>
    result = main(args, opts)
  File "3DSkit.py", line 169, in main
    extract_files(filename, args.big, args.format, args.verbose, opts)
  File "3DSkit.py", line 112, in extract_files
    unpack.extract(filename, file, format, endian, verbose, opts)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\unpack\__init__.py", line 16, in extract
    unpacker = cls(*args)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\util\utils.py", line 18, in __new__
    return self.main(*args, **kwargs)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\unpack\BFLAN.py", line 41, in main
    self.extract_sections(ptr)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\unpack\BFLAN.py", line 63, in extract_sections
    method(ptr)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\unpack\BFLAN.py", line 148, in readpai1
    tagentry['type2'] = self.gettype(type2, type)
  File "S:\Mijn Drive\Things\NSW\Themes\Very nice theme\tools\3DSkit\unpack\BFLAN.py", line 161, in gettype
    el = eval('%s_types[type]' % tagtype)
ValueError: source code string cannot contain null bytes

And here's Wexos' error for that one:
image

Edit: I'm adding some more info

I have executed the unpack command for every file.
Here's a hastebin: https://hastebin.com/direwirose.rb
I noticed that not every color file, BgNml_Color.bflan and BlurBg2_Color.bflan, results in an error when unpacking.
Oh whoops, I forgot that unpacking BFLAN's is only partially supported and they cannot be repacked yet.

Error unpacking ALYT files

When unpacking alyt archive I get an error. There is no such problem with other alyt archives. Help me to solve the problem. I attach the file with the problem.
dec_7.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.