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
python
branch but the cpp one)- This is for "deswizzling" Wii U textures/converting GX2 tiled textures.
- Required for FFL resources (FFLResHigh.dat, FFLResMiddle.dat), or else textures can't be read from it.
- If you don't want this, build with
FFL_NO_NINTEXUTILS
but you will have to use AFL resources from Miitomo.
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 RIO program/game.
- Such as FFL-Testing.
-DFFL_MODE=for-rio
- For an OpenGL program, bundling RIO code with it.
- Such as the FFL raylib samples.
-DFFL_MODE=opengl-33
,-DFFL_MODE=opengl-es2
- Without RIO or OpenGL.
- Standalone, for something like FFLSharp.
- Will most likely use the dynamic library:
-DFFL_BUILD_SHARED=1
- Head into the
ffl
folder 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.so
but I think on Windows it will beffl.dll
.- For the shared library of course not static
- There will be extra prefixes 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 December 2024.
- FFL_ADD_GLAD_GL_IMPLEMENTATION - Adds GLAD implementation, enabling FFLGladLoadGL (dynamic linking)
- 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_RENDER_TEXTURE - Do not use FFLiRenderTexture (breaks FFLInitCharModelGPUStep)
- 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.
- 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
- FFL_USE_MINIZ
- FFL_USE_MODULATE_EYEBROW_EX
- FFL_LOG_CHARMODEL_CLEANUP
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.