Custom SGB Borders

Click here to download the example. (Release: 2016-04)

How to:

It should be self-explanatory for the most part...

Convert the border graphics to SNES format using whatever method you like. I used pcx2sopt (available here) for this. The program is old so I ran it in DOSBox. Specify palette 5 instead of 4 due to its naming convention. Note that it supports only one 16-color palette. I post-processed the data into arrays (i.e. border.h).

In your code, it is recommended to check that the program is running on SGB hardware before trying to use its functions. GBDK's sgb_check() didn't seem to work correctly for me; I wrote my own (included), which returns 1 if SGB is detected, 0 for everything else.

After confirming SGB hardware, simply call:
  set_sgb_border(tiledata, tilemap, palettes);

Compile with sgb.o and be sure to set the SGB-enable bytes in the header (0x146=0x03; 0x14B=0x33).