This is my fork of AboodXD's FFL decompilation, which was originally decompiled from FFL 1.3.10 in New SUPER MARIO BROS. U v1.3.0.
View the original README contents here. TL;DR, FFL is the library that renders Miis and manages Mii data on Wii U and is only accessible to approved developers.
Decompilation of Wii U Face Library v1.3.10, used in New Super Mario Bros. U v1.3.0.
FFL is a library that is part of nn (Nintendo SDK C++ API Namespace?), used for dealing with Mii data. While most of nn is already open to developers as part of the Cafe SDK by Nintendo, FFL is a closed-source library that is sent to developers on demand.
This decompilation aims to provide more information on Mii data, as well as to further push the progress on the New Super Mario Bros. U decompilation project.
See Sead for matching policy.
Specifically, this is Abood's port to RIO (OpenGL 3.3) which works on PC alongside Wii U.
Both of the below are originally by Abood, but I am linking to my forks since that's what is expected.
-
- This branch of the FFL decomp relies on it.
- This is a framework to abstract functionality between Wii U (RIO_IS_CAFE) and PC (RIO_IS_WIN).
- Although you can build without RIO sources, you will always need RIO's headers, for now.
-
ninTexUtils (NOT the
pythonbranch but the cpp one)- This is for "deswizzling" Wii U textures/converting textures with GX2 default tile mode to linear tile mode.
- Required for FFL resources (FFLResHigh.dat, FFLResMiddle.dat), or else textures will look wrong because they are tiled.
- If you don't want this, build with
FFL_NO_NINTEXUTILSbut you will have to use AFL resource files from Miitomo.- You can actually get AFLResHigh_2_3.dat here: https://web.archive.org/web/20180502054513/http://download-cdn.miitomo.com/native/20180125111639/android/v2/asset_model_character_mii_AFLResHigh_2_3_dat.zip
Also see the FFL-Testing CMakeLists.
- Clone this repo and dependencies.
git clone https://github.com/ariankordi/ffl # This repo.
git clone https://github.com/ariankordi/rio # RIO framework.
git clone https://github.com/ariankordi/ninTexUtils # ninTexUtils for deswizzling.
The CMake assumes that RIO is located at ../rio, but you can also pass -DFFL_WITH_RIO=path/to/rio (Exact same for ninTexUtils)
- Choose a build mode. Here are your options:
- For a program using RIO.
- Such as FFL-Testing.
-DFFL_MODE=for-rio
- Without RIO / standalone.
- Will most likely use the dynamic library:
-DFFL_BUILD_SHARED=1
- Will most likely use the dynamic library:
- Head into the
fflfolder and use CMake to build.
cmake -S . -B build(Add any extra args at the end)cmake --build build
- Your library is in
build/
> ls build
CMakeCache.txt CMakeFiles/ cmake_install.cmake libffl.so* Makefile
^^^^^^^^^^
- In my case on Linux, it's in
libffl.sobut I think on Windows it will beffl.dll.- For the shared library of course not static
- There will be extra suffixes if it's for RIO or OpenGL.
- Copy this to your program's directory or include the CMakeLists as a dependency.
More instructions are TBD.
Over time, I've added new features that are not included in Abood's original decomp. As of writing (December 2024), these include:
- Support for building on 64-bit, on non-Windows platforms and on MSVC. Also proper support for flipped Y (OpenGL <4.5)
- Color tables for Switch Miis imported from nn::mii.
- Note that methods to convert from Switch structures are not in here at the moment, they live here: github.com/ariankordi/FFL-Testing, renderer-server-prototype branch: /src/DataUtils.cpp
- Allow using the Miitomo AFL resource files alongside FFL resources from Wii U.
- This means that, if you need a resource file, you can just use the Miitomo one downloadable from web.archive.org.
- Additionally added Miitomo exclusive expressions.
- Flags to remove unneeded functionality such as FFL_NO_DATABASE_FILE, FFL_NO_NINTEXUTILS, FFL_NO_FS,
- Applying FFL_NO_DATABASE_FILE is probably essential if you're on a PC - FFL will try to load the database file when it is initialized.
- Note that with FFL_NO_NINTEXUTILS, you can't load Wii U resources - just ones from Miitomo.
- Fixes for calling FFL from C (broken in the RIO port) and OpenGL ES 2.0.
- Various functions such as FFLSetScale, and enum definitions missing from the decomp.
- Minor adjustments and optimizations and accuracy tweaks for the mask texture.
- WIP: Exports and a texture callback system to assist using FFL without RIO or OpenGL (todo, detail this?)
This documents all of the definitions that this supports to add/remove functionality, as of October 2025.
- FFL_ENABLE_NEW_MASK_ONLY_FLAG - Enables new mask only flag which does not initialize shapes.
- FFL_NO_DATABASE_DEFAULT - disables default guest Miis
- FFL_NO_DATABASE_FILE - Disables opening and use of hidden/official databases.
- FFL_NO_DATABASE_RANDOM - Disables use of random database and FFLiGetRandomCharInfo.
- FFL_NO_MIDDLE_DB - Disables FFLMiddleDB functionality (^^)
- FFL_NO_FS - Disables FFL's use of RIO filesystem.
- This is used for databases and non-cached resource loading.
- FFL_NO_NINTEXUTILS - Disables ninTexUtils, which is needed for Wii U/FFLRes resource file support.
- Specifically, this library deswizzles Wii U format textures. You can still use AFL resources with this.
- FFL_NO_DRAW_MASK_ALPHA_VALUES - Skip drawing alpha values on mask (FFL default behavior)...
- This makes zero difference to the mask's appearance for me. Maybe alpha testing needs to be enabled.
- FFL_MLC_PATH - Takes a quoted string. Defines the MLC path if FS is not disabled.
- FFL_PART_INDEX_WRAP - When out of bounds part indexes are passed in (invalid CharInfo)...
- ... This option will choose to wrap that part index.
- FFL_USE_ADJUST_MTX - Passes scale/translate transforms for shapes via a matrix in FFLDrawParam, rather than FFL transforming all vertex data on the CPU. This is needed to use half-float vertex format.
- The matrix should be easily decomposable.
- FFL_USE_ADJUST_MTX_MASK does the same thing but specifically for mask transforms. This matrix is not easily decomposable, and also has a projection.
- FFL_LOG_CHARMODEL_CLEANUP - Enable verbse logging for specific allocations in CharModel/faceline/mask.
- FFL_USE_EM_INFLATE - Use em_inflate instead of zlib. Assumes FFL_NO_ZLIB=ON and em_inflate repo is cloned in
include/.
- FFL_USE_MODULATE_EYEBROW_EX
- FFL_USE_TEXTURE_CALLBACK
FFL_USE_MINIZFFL_NO_RIO
All of the changes that I have made to FFL in this repo are hereby licensed under the Unlicense. However, this does not account for changes made by Abood when porting the decompilation, or the library to begin with.