Repository navigation
Code Style
fosterbarnes edited this page Oct 29, 2026
·
1 revision
How FTB code is written. Match the file you are in; these are the rules behind it.
FTB keeps FBI's C style:
| Thing | Style | Example |
|---|---|---|
| Functions |
snake_case, prefixed with the module |
ciainstaller_open, list_set_layout
|
| Types |
snake_case, often with a _s struct tag |
list_item, ftb_settings, task_state
|
| Locals, parameters, fields | camelCase |
populateData, foldersVersion
|
| Macros and constants | UPPER_SNAKE_CASE |
CIA_FOLDERS_MAX, COLOR_TEXT
|
| File names | as they are (lowercase, no separators) |
ciainstaller.c, listtitles.c
|
- 4-space indents,
if(x) {with no space before the parenthesis, braces on the same line,type* name. - Guard clauses and early returns over deep nesting.
- Tables over long if/else chains: settings (
settings_bools,settings_choices), theme files (resources_colors,resources_textures), and services inmain.care all tables. - Designated initializers for static items:
{.name = "Settings", .color = COLOR_TEXT, .data = ...}. - Build text with
string_append(out, size, &pos, text), neverpos += snprintf(...). A pathsnprintfwhose cut result would touch the wrong file checks its return and fails withR_APP_OUT_OF_RANGE. - Zero compiler warnings.
ftpd keeps its own style: tabs, a space before call parentheses, m_ members, name_ parameters.
Mark FTB-specific changes with a FTB: comment where they would surprise someone who knows ftpd.
quirc and stb_image get real bug fixes and version updates only. Do not restyle them.
- Comment why, or how a piece fits with the rest, not what the next line does.
- Keep comments short and remove them when the code they describe changes.
-
TODO:for work not started.
- No em dashes anywhere: code, comments, UI strings, docs. Use
-or:. - UI strings say what something does or what state it is in. No taglines or filler text.
- Plain English in docs, short sentences.
-
UNIQUE_ID(0xF8F7B) andPRODUCT_CODE(CTR-P-CFTB) in theMakefile: they keep FTB installable next to FBI, and changing them makes the console treat updates as a different app. -
romfs/file names andtextcolor.cfgkeys: themes override them by name (see Theming). Add new art under new names. - Release asset names
FTB.cia,FTB.3dsx,FTB.3ds,FTB.zip: the in-app updater looks for them by name. - Values stored in
settings.cfg: append new enum values, never renumber.
Home · README · Releases · Something wrong on this page? Open an issue
Get started
Screens
- CIA Installer
- Title Manager
- SD File Browser
- 3DS Web Server
- FTP Server
- Remote Install
- FBI Legacy
- Settings
Reference
Help
Contributing