THIS IS A MIRROR OF https://git.sr.ht/~nytpu/tonc-template! I will not respond to pull requests or issues here. See Contributing for details on how to contribute, and https://git.sr.ht/~nytpu/tonc-template for the canonical source.
This template is designed to be used to create gba homebrew using the Tonc Library. The template is written from scratch and is designed to be self-contained (other than devkitPro) and easy to understand and modify.
If you want to make homebrew the tonc tutorial is the best place to learn to do so, even if you intend to use libgba afterwards.
- Easy to understand and modify build system
- Very portable, all that's required to build is a POSIX-compatible sh(1), POSIX-compatible make(1), and a devkitARM installation.
- Includes bundled libgbfs for easily including binary files such as art and music
- Automatically determines all tool and compiler paths, all you have to do is
set the $
- POSIX or POSIX-compatible
makes (including GNU Make and BSD Make) support the POSIX standard.
- A full devkitARM (
gba-dev) installation. See the devkitPro wiki for help on installation.
DEVKITPRO to point to your devkitPro installation (this should be
automatically done most of the time). You can also set
LDFLAGS to add additional flags to the C compiler, assembler, and
and the ROM will be output as
PROGNAME.gba if you
PROGNAME in the
Change the $
PROGNAME macro in the
Makefile to match your game's name. Then
simply add your code to
main.c like you normally would. To add more C source
files, add them to the $
OBJS macro in the
In your source code, you can include
<tonc.h> to get libtonc functions and
"gbfs.h" to get GBFS functions. Also included is a modified version of my
own libmisc that provides some useful
functions; notably an arena allocator (
arena.h) and string utilities
To use GBFS, first go the
$(PROGNAME).gba rule in the
Makefile and follow the instructions in the comment to
enable GBFS. To add files to be bundled with the ROM with GBFS, add the
filename to the $
GBFSFILES macro in the
Makefile; if you want to include
images instead of already binary files, then add the files to the $
The upstream URL of this project is https://git.sr.ht/~nytpu/tonc-template. Send suggestions, bugs, and other contributions to ~email@example.com. For help sending a patch through email, see https://git-send-email.io. You can browse the list archives at https://lists.sr.ht/~nytpu/public-inbox.
Copyright (c) 2021 nytpu <alex [at] nytpu.com>
This repository contains libmisc, which is also Copyright (c) 2021 nytpu and is licensed under the terms of the Boost Software License, version 1.0.
All credit for tonc goes to cearn.