In the Game Boy Advance SDK Version 3.0 the source code for a variety of tools are available to learn from and modify. These tools all have a command line interface (CLI) and are targeted for the Windows Operating System. They even come with Visual C++ 5.0 project files to make it really easy to build and extend, if you can still find a working version of VC++ 5.0 for your PC.
The GBA development tools with source code available are:
Tool Name | Description |
---|---|
act2agb | Converts an Adobe Photoshop .ACT (Adobe Color Table) file to a GBA pallete in C source code form |
agbparts | Converts a bitmap image into 8x8 pixel parts useful for an optimized tileset or even sprites |
bin2h | generates a C header file from the Binary result of objcopy |
bmp2agb | Converts BMP images to either binary or text with optional compression |
bmp2bin | Converts BMP files to binary formats .imb (Image Binary) and .plb (Palette Binary) |
bmp2map | Converts BMP files to C-source code based on 8x8 pixel tiles |
bmpgrid | Splits up a Bitmap into tiles/partitions based on input width/height (minimum 8x8) |
bmpred | Reduces the colors of a BMP image using a specified palette |
sgi2bmp | Converts an SGI format image into a BMP format image |
Along with a directory for each of the tools mentioned above, there are also a few files and directories that provide further information:
It seems to be a library containing common functionality used across multiple development tools for GBA development, as most of the tools operate on images there is common code to read and write image formats.
So the first 3 letters lib is a common prefix for statically compiled libraries, the next letter M is unknown but it could be short for iMage since this library mainly handles image conversions. The next 3 letters AGB stands for Advanced Game Boy but the last letter X is unknown.
Each individual tool has its own source code folder, however the interesting logic is all in the common library known as libmagbX, all the folders contain are Visual C++ project files and a main.cpp file that calls the functionality from the common library.
Since each tool has its own Visual C++ project, there are a few common files that you will see across the codebase:
This folder contains contains the source code for the tool that converts Adobe Photoshop Palette files into GBA compatible palette files.
There is not much of interest here as all the main.cpp source file itself does is:
So the actual processing of the ACT file format and the conversion to GBA format is all in the Palette class of the libmagbX library.
File Name | Extension | Description |
---|---|---|
act2agb | .dsp, .dsw, .ncb, .opt, .plg, .rc | see common files section for description of the files |
main | .cpp | Just contains main function that shows the usage information, parses the arguments and calls the library functions |
resource | .h | Include file for declaring the default macros from Visual C++ 5.0 (Nothing added by Nintendo) |
This folder contains
File Name | Extension | Description |
---|---|---|
agbparts | .dsp, .dsw, .ncb, .opt, .plg, .rc | see common files section for description of the files |
main | .cpp | |
resource | .h | Include file for declaring the default macros from Visual C++ 5.0 (Nothing added by Nintendo) |
This folder contains
File Name | Extension | Description |
---|---|---|
bin2h | .dsp, .dsw, .ncb, .opt, .plg, .rc | see common files section for description of the files |
main | .cpp | |
resource | .h | Include file for declaring the default macros from Visual C++ 5.0 (Nothing added by Nintendo) |
This folder contains the source code to bmp2bin which is a simple tool that converts a single BMP image into a binary .IMB file that can be included inside a GBA ROM.
File Name | Extension | Description |
---|---|---|
bmp2bin | .aps, .dsp, .dsw, .ncb, .opt, .plg, .rc | see common files section for description of the files |
main | .cpp | |
resource | .h | Include file for declaring the default macros from Visual C++ 5.0 (Nothing added by Nintendo) |
This folder contains the source code for bmp2map which converts a BMP image into a C Source code file that can be compiled into a GBA ROM. It splits the single BMP image into 8x8 tiles that can be drawn using GBA functions.
File Name | Extension | Description |
---|---|---|
bmp2map | .dsp, .dsw, .ncb, .opt, .plg, .rc | see common files section for description of the files |
main | .cpp | |
resource | .h | Include file for declaring the default macros from Visual C++ 5.0 (Nothing added by Nintendo) |
This folder contains the source code for bmpgrid a command line tool that converts a single BMP into multiple images based on the width and height of a tile.
File Name | Extension | Description |
---|---|---|
BmpGrid | .dsp, .dsw, .ncb, .opt, .plg, .rc | see common files section for description of the files |
main | .cpp | |
resource | .h | Include file for declaring the default macros from Visual C++ 5.0 (Nothing added by Nintendo) |
This folder contains the source code for a Command Line tool known as bmpred that reduces the number of unique colors inside a BMP image, useful for getting the BMP into a good state to display on the GBA.
File Name | Extension | Description |
---|---|---|
bmpred | .dsp, .dsw, .ncb, .opt, .plg | see common files section for description of the files |
colorspace | .cpp, .h | |
main | .cpp | |
reduction | .cpp | |
res | .rc | |
resource | .h | Include file for declaring the default macros from Visual C++ 5.0 (Nothing added by Nintendo) |
This folder contains the source code for a tool that converts images from the SGI Image format to a standard BMP image format. This tool can be quite useful for any GBA or N64 development that was done on SGI machines which used the SGI image format.
File Name | Extension | Description |
---|---|---|
GlobalFnc | .cpp, .h | |
RgbLoader | .cpp, .h | |
main | .cpp | |
pic_create | .cpp, .h | |
resource | .h | Include file for declaring the default macros from Visual C++ 5.0 (Nothing added by Nintendo) |
sgi2bmp | .dsp, .dsw, .ncb, .opt, .plg, .rc | see common files section for description of the files |
This folder contains three text documents that describe the source code for all the tools, including the shared library and the use of the Standard Template Library (STL)
The three text files are as follows:
This folder contains all the C header files used by each of the tools in order to describe the functionality of the common library. This allows each tool to use common functions from the libMagbX, reducing the need for duplicate code in each tool.
File Name | Extension | Description |
---|---|---|
agbtypes | .h | Include file for declaring |
angle | .h | Include file for declaring |
bmpstruct | .h | Include file for declaring |
buffer | .h | Include file for declaring |
char16set | .h | Include file for declaring |
char256set | .h | Include file for declaring |
character | .h | Include file for declaring |
character16 | .h | Include file for declaring |
character256 | .h | Include file for declaring |
charset | .h | Include file for declaring |
color | .h | Include file for declaring |
filename | .h | Include file for declaring |
hpicture | .h | Include file for declaring |
image | .h | Include file for declaring |
map | .h | Include file for declaring |
map16 | .h | Include file for declaring |
map256 | .h | Include file for declaring |
mapsrimage | .h | Include file for declaring |
maptextimage | .h | Include file for declaring |
maptextunit | .h | Include file for declaring |
palette | .h | Include file for declaring |
pathname | .h | Include file for declaring |
picture | .h | Include file for declaring |
util | .h | Include file for declaring |
This folder contains the actual C++ source code for the libMagbX library that is used by each of the development tools listed at the start of this page. Most of the functionality of this library is Image manipulation.
File Name | Extension | Description |
---|---|---|
angle | .cpp | |
buffer | .cpp | |
char16set | .cpp | |
char256set | .cpp | |
character | .cpp | |
character16 | .cpp | |
charset | .cpp | |
color | .cpp | |
filename | .cpp | |
hpicture | .cpp | |
image | .cpp | |
libsrc | .dep, .dsp, .dsw, .ncb, .opt, .plg | see common files section for description of the files |
map | .cpp | |
map16 | .cpp | |
map256 | .cpp | |
mapsrimage | .cpp | |
maptextimage | .cpp | |
maptextunit | .cpp | |
palette | .cpp | Contains functions to parse Adobe ACT files and convert to GBA format palettes |
pathname | .cpp | |
picture | .cpp | |
util | .cpp |