The firefly.toml
configuration file tells firefly-cli how to build a ROM for the project. It should be placed at the root of the project (though you can explicitly specify the path using --config
) and must be in the TOML format.
Required:
author_id
(string): your username. It should be unique, otherwise users may get a warning about invalid signature when launching your app. The best way to ensure that your author_id is unique is to add it into catalog.fireflyzero.com. There are also limitations on the length of the ID and used characters. If your ID (or any of the options below) is invalid, thebuild
command will tell you.app_id
(string): the app ID. Must be unique for the given author. THe combinationauthor_id.app_id
is the full ID of the app, and that must be globally unique.author_name
(string): your name. It will be shown in the launcher next to the app name. It must use the latin alphabet. Non-latin names have to be transliterated.app_name
(string): the human-readable name of the game. Shown in the launcher.
Optional:
lang
(string): the programming language of the app source code. Dictates the build command that is used to build the WebAssembly binary. If not specified, the language will be automatically detected.compile_args
(array of strings): an array of additional CLI arguments to pass into the command used to build the WebAssembly binary. The command is language-specific: it will becargo
for Rust,tinygo
for Go,zig
for Zig, etc.launcher
(boolean): set totrue
if the app is a launcher. The launcher is the first app that starts when the device (or emulator) is launched. Its job is to provide means for launching all other apps on the device.sudo
(boolean): set totrue
if the app needs access to privilieged functions, like reading files in other apps or starting other apps.cheats
(table): specifies how a cheat code should be converted to a number. For example,set-health = 3
means that when you callfirefly_cli cheat set-health 100
, thecheat
callback in the running app will be called with values3
and100
.files
(table): covered below.badges
(table): see Badges and scores.boards
(table): see Badges and scores.
files #
The [files]
optional table lists additional files (like game assets) that you want to include into the ROM.
The key (the text on the left from =
) is how the file will be called in the ROM. This is how you referrer to the file when loading it from your code. It must be short and unique within the app. It also shouldn’t have an extension.
The value is an inline table that may have the following keys:
path
(string, required): the path to the asset to include.url
(string): the URL from which to download the file if it doesn’t exist inpath
.sha256
(string): the SHA-256 hash of the file. Validated only when downloading the file from theurl
. If the specified hash doesn’t match the actual one, thebuild
command will fail. It’s not required but recommended to always include it if you specifyurl
.copy
(bool): set totrue
to copy the file as-is without any modifications. If not specified, thebuild
command will try to convert the file into a native format. For example, PNG images will be converted into the native Firefly image format.
Customizing builds #
Does your app require a complicated build process? No problem! There are a few ways to customize the compilation:
-
The
compile_args
option allows you to pass additional CLI arguments in the build command that firefly_cli invokes internally. For most compilers, it will be added at the end of all the default arguments. But for some compilers, like C/C++ (wasi-sdk), it will overwrite some of the defaults. -
Language-specific configuration files:
- Rust: binary builds can be customized using
Cargo.toml
. See Cargo Targets. - Go: you can create a
target.json
file in the root of your project. It will fully replace the defaulttarget.json
used by firefly_cli. See Important Build Options. - Zig: you can create a
build.zig
file in the root of your project. It will fully replace the defaultbuild.zig
used by firefly_cli. - C/C++: clang doesn’t have a build configuration file. Use other ways to customize the build.
- Rust: binary builds can be customized using
-
Lastly, you can build the wasm binary yourself in whatever way works for you. It is especially useful when developing a new SDK for a not yet supported language. Tell firefly_cli to copy your binary as
_bin
file, and it will skip the compilation step:[files] _bin = { path = "main.wasm", copy = true }