Face Library
Face Library is the name given to various libraries used for Nintendo titles that render and manage Mii data. There are many versions of the Face Library for every Nintendo console that supports Miis, starting from the Wii onwards.
The version for the Wii is called RFL, also referred to as RVLFaceLib (Revolution Face Library), NFL on the DS (only used by Tomodachi Life and Personal Trainer: Walking), CFL on the 3DS, FFL on the Wii U, and Miitomo contains symbols for "AFL" (A = Arch/Miitomo codename?).
AFL shares most of its symbols with FFL, and in Miitomo, the MiiDefaultShader.fsh/vsh files even contain references to FFL, suggesting that it is a fork of FFL with added support for OpenGL ES 2.0.
On the Switch, the library is usually just generally called "Face Library", and its functions/types begin with "nn::mii". (Notably, the CTR SDK used the name "nnmiiStoreData" as a public name for CFLiMiiDataPacket.) Some file magic from Switch resources start with "NF" = NintendoSDK/NX Face Library?
Switch Miis have more options for 100 "common colors" used on hair, eyes, eyebrows, beards, and glasses, new faceline colors, and a few new glass types, some of which are reuse existing glasses but are opaque. When Miitomo was updated to 2.3.0, a bunch of nn::mii symbols appeared alongside AFL suggesting they hackily included it into the game and made AFL use the nn::mii::CoreData format for storing Miis.
It's presumed that the Mii Studio site and rendering API uses AFL or Miitomo code internally, for a few reasons: It uses the Miitomo shader/material/lighting, the geometry seems to match that of AFLResHigh.dat (compared to the NNID/cdn-mii 1.0.0 renderers that use the FFLResMiddle shape quality), there are specific quirks such as glasses being larger than in FFL, and finally, cdn-mii Miis have been known to have supported Miitomo clothing and gear at a certain point, and for a certain point in time Mii Studio had a bug where the NNID imported Mii preview used Miitomo clothes ID 0/bear suit.
As well as rendering Mii heads, the Face Library also manages accessing the Mii database on all consoles, reading the database files directly except for on the Switch where they added a service to manage access to it. CFL and FFL contain functions referencing networking, such as: `CFL_InitNetInformation` and `FFLInitNetInformation`, as well as for converting NetInfo to StoreData. It's unknown exactly what these are for, although they are referenced in the Wii U Mii Maker.
Most Face Libraries require resource files, including textures and meshes, in order to work, which are included in NAND on the Wii U and higher. The names of these files include:
- RFL_Res.dat (Wii)
- NFL_Res.dat (DS)
- CFL_Res.dat (3DS)
- FFLResMiddle.dat, FFLResHigh.dat, and _LG (linear gamma) variants (Wii U)
- AFLResHigh.dat, AFLResHigh_2_3.dat (Miitomo)
- NXTextureMidSRGB.dat, NXTextureLowSRGB.dat (+ Linear variants), ShapeMid.dat, ShapeHigh.dat (Switch)
- (It's worth noting that Switch Mii resources are more or less the same as AFL's but with more compression (half float meshes, BCn/ASTC textures))
- FFLBodyRes.dat, IconBody.dat, MiiBody.dat (Resources for FFLIconWithBody, nn::mii::IconBody, nn::mii::VariableIconBody)
The Face Library and its headers have only been available to developers after request, until the Switch where it's included in the NintendoSDK. However, as of 2024, Bandai Namco is the only third party company Nintendo has allowed to use Miis on the Switch. Even after obtaining access to the Face Library, Nintendo applies restrictions to the use of Miis in games.
Face Library Reverse Engineering
There are two decompilation efforts for the Face Library: RVLFaceLib, FFL
DWARF info is available for all but FFL/AFL:
- Wii games in .elf format contain DWARF information for RFL which its decompilation linked above uses.
- niconico_develop.axf from the Kadokawa breach contains DWARF for CFL.
- libnn_mii_draw.a from the NintendoSDK contains limited DWARF for nn::mii.
FFLResource.py from the FFL decomp allows extracting meshes and textures from FFL resources and the ariankordi fork includes AFL/Miitomo support for unpacking/repacking.
RFL_Res.dat Editor is a WinForms app allowing editing of RFL_Res.dat, but according to Atlas the source code is lost.