meowteusz / xfw-unpacker

Utility script to convert Flipper Zero Xtreme Firmware asset packs into GIF files
GNU General Public License v3.0
3 stars 0 forks source link

Complementary info #1

Open Kuronons opened 4 months ago

Kuronons commented 4 months ago

Hey,

First of all, interesting project.

Now am wondering on a few things here.

As I am understanding it, tool is meant to make gifs from animations already compiled into .bm frames. With step 1 being to "unpack" / re-compile .bm files to .png ones.

You re talking about XBM... I guess (but might be wrong here) that it's about the .bmx files ? Tho, those are only used for internal graphic assets when animations are still being compiled as "simple" .bm frames. (the meta.txt file taking off the table the need of .bmx graphical size infos)

Also, you wrote that the script needs directory with XBM files + MANIFEST.TXT... Isn't the META.TXT file that should be required instead of manifest one ?

Thanks in advance for your enlightments !

meowteusz commented 4 months ago

Answering these in order of confidence; I worked on this code a while ago but only now documented and uploaded it 😅.

The script requires the BM files and manifest.txt to reconstruct image data yes. I use the manifest file to point the script at directories that contain the BM data. Because the Flipper screen size is constant, I assume the frames are in-order per their filenames. This allows me to convert BM files to XBM files, which the Pillow library can work with.

Once I have each frame as XBM and PIL understands it internally, I can just use the library functions to dump out each frame as a PNG, then knit the frames sequentially into a GIF. Looking back now it would be more ideal to also read meta.txt to get duration times so I can set the animation speed accordingly, so that needs to be implemented.

I hadn't come across .bmx files in my research; all I recall is figuring out that the .bm frames were just the old .xbm file format (which is just a C array with dimension info) with said dimension info in the meta.txt files.

Kuronons commented 4 months ago

Thanks for the reply !

So if I get it correctly, the script is not restrained to xfw (or momentum fw) but would work on any .bm frames animations folders in the end.

The implementation of meta.txt file in the process would be a great addition for making the GIF as animation's frame order may not be respecting the frame naming (or having repeating frames sequences, etc -> this is often the case on custom anims made from scratch as well as original flipper ones versus anims made from gif where it's always -or so- a simple contineous sequence).

Also note that, even if cases are really rare, animation pixel size can be lower than the screen size (but 99.99% of custom anims are set to 128x64px). Still, that might be something you want to consider.

.bmx files are the file format of graphic assets used by xtreme and momentum fw. (ie app screen graphics assets, passport, icons, etc, used in their asset packs.). I guess it's pretty much the same than XBM. I'll ask WillyJL about that for confirmation.

Anyway, being able to make png frames back from bm ones is a really nice tool !

If you don t mind, I'll add a link to your repo in my FZ Graphics one's tool section. O_oV

meowteusz commented 4 months ago

Correct, the script is firmware agnostic (provided the asset pack format for flipper is standardized; I assume yes?) and will consume any BM frames in the structure:

AssetPackFolder
    Anims
        Anim1
        Anim2
        .
        .
        .
        AnimN

Again, this is something that can be made smarter, along with the inclusion of meta.txt for ensuring in-order traversal and dimensions, as you pointed out.

Feel free to add the link, I appreciate it!

Kuronons commented 4 months ago

Ah no, folder structure is not standardized. This would work for xtreme or momentum fw.

On ofw and unleashed fw, animations along with the manifest are in SD/Dolphin/ folder. I think it s also different on RM (but long time I haven t used it so am unsure).

A nice update would be that the script uses the manifest and all the animation folders aside without being restricted by the name of the folder containing them.

Link added ! O_oV

image

meowteusz commented 4 months ago

Oo nice note. I haven't used unleashed in a long time, would be good to support those animations as well. Arbitrary folder names would also be a great addition. Adding to my todo list! And thanks for adding the link ^^