git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

commit 530031465e406fb0601b95ea9bfa3eb2dca716f2
parent 857bb7877e35bd5d03f5a630f9ddb1aa8ab25e71
Author: Toxa <56631470+untoxa@users.noreply.github.com>
Date:   Sat, 23 Oct 2021 22:56:47 +0300

Merge pull request #281 from gbdk-2020/feature/png2asset-4bpp

Feature/png2asset 4bpp
Diffstat:
Mgbdk-lib/examples/gb/sgb_border/Makefile2++
Mgbdk-lib/examples/gb/sgb_border/border.c2+-
Dgbdk-lib/examples/gb/sgb_border/border_data.c192-------------------------------------------------------------------------------
Dgbdk-lib/examples/gb/sgb_border/border_data.h15---------------
Agbdk-lib/examples/gb/sgb_border/gb_border.png0
Mgbdk-support/png2asset/png2asset.cpp200++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
6 files changed, 136 insertions(+), 275 deletions(-)

diff --git a/gbdk-lib/examples/gb/sgb_border/Makefile b/gbdk-lib/examples/gb/sgb_border/Makefile @@ -1,6 +1,8 @@ CC = ../../../bin/lcc +PNG2ASSET = ../../../bin/png2asset all: + $(PNG2ASSET) gb_border.png -map -bpp 4 -max_palettes 4 -pack_mode sgb -use_map_attributes -c border_data.c $(CC) -Wm-ys -o border.gb border.c sgb_border.c border_data.c compile.bat: Makefile diff --git a/gbdk-lib/examples/gb/sgb_border/border.c b/gbdk-lib/examples/gb/sgb_border/border.c @@ -6,7 +6,7 @@ void main(void) { DISPLAY_ON; - set_sgb_border(border_chr, border_chr_size, border_map, border_map_size, border_pal, border_pal_size); + set_sgb_border(border_data_tiles, sizeof(border_data_tiles), border_data_map, sizeof(border_data_map), border_data_palettes, sizeof(border_data_palettes)); while(1) { wait_vbl_done(); } diff --git a/gbdk-lib/examples/gb/sgb_border/border_data.c b/gbdk-lib/examples/gb/sgb_border/border_data.c @@ -1,192 +0,0 @@ -const unsigned char border_chr[]={ -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x00, -0x02,0x02,0x0b,0x08,0x1c,0x13,0x30,0x2f,0x61,0x5f,0x22,0x1e,0xc4,0xbc,0x49,0x39,0xfe,0xfd,0xfb,0xf4,0xfc,0xe0,0xf0,0xc0,0xe0,0x81,0xa0,0xc3,0xc0,0x07,0x40,0x8f, -0x7f,0x80,0x80,0x7f,0x00,0xff,0x38,0xf8,0x80,0x80,0x1c,0x1f,0xc0,0xff,0x00,0xff,0x7f,0x00,0x80,0x00,0x00,0x00,0x00,0x3f,0x00,0xff,0x00,0xfc,0x00,0xc0,0x00,0x00, -0xff,0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00, -0xfe,0x01,0x01,0xfe,0x00,0xff,0x1c,0x1f,0x01,0x01,0x38,0xf8,0x03,0xff,0x00,0xff,0xfe,0x00,0x01,0x00,0x00,0x00,0x00,0xfc,0x00,0xff,0x00,0x3f,0x00,0x03,0x00,0x00, -0x40,0x40,0xd0,0x10,0x38,0xc8,0x0c,0xf4,0x86,0xfa,0x44,0x78,0x23,0x3d,0x92,0x9c,0x7f,0xbf,0xdf,0x2f,0x3f,0x07,0x0f,0x03,0x07,0x81,0x05,0xc3,0x03,0xe0,0x02,0xf1, -0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xfe,0xfe,0xfe,0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe, -0x4a,0xbb,0x82,0x73,0x90,0x73,0x94,0x77,0x94,0x77,0x84,0x67,0x80,0x67,0x80,0x67,0x40,0x0e,0x80,0x0e,0x80,0x1c,0x80,0x1c,0x80,0x1c,0x80,0x1c,0x80,0x18,0x80,0x18, -0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0xff,0x00,0x00,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0xff,0x00,0x00,0xff,0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0x00,0x00, -0x00,0xff,0x00,0xff,0x0e,0xfe,0x09,0xfd,0x09,0xff,0x09,0xfd,0x0e,0xfe,0x00,0xff,0x00,0x00,0x00,0x00,0x06,0x01,0x00,0x02,0x00,0x00,0x00,0x02,0x06,0x01,0x00,0x00, -0x00,0xff,0x00,0xff,0x33,0xb7,0x49,0xcf,0x49,0xff,0x49,0xcf,0x31,0xb7,0x00,0xff,0x00,0x00,0x00,0x00,0x31,0x48,0x00,0x30,0x00,0x00,0x00,0x30,0x30,0x48,0x00,0x00, -0x00,0xff,0x00,0xff,0x81,0xff,0x01,0xfd,0x03,0xff,0x02,0xfe,0x02,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x02,0x03,0x00,0x00,0x01,0x00,0x00,0x00,0x00, -0x00,0xff,0x00,0xff,0x42,0xfa,0x45,0x5d,0xe5,0xf7,0xaf,0xbf,0x28,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x40,0x05,0x05,0xa2,0xe0,0x08,0x0a,0x40,0x00,0x00,0x00,0x00, -0x00,0xff,0x00,0xff,0x3b,0xff,0x12,0xff,0x13,0x7f,0x92,0xff,0x92,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x01,0x80,0x80,0x00,0x00,0x00,0x00,0x00, -0x00,0xff,0x00,0xff,0x94,0xbd,0x52,0x7a,0x91,0xbd,0x92,0xba,0x54,0x7d,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x42,0x02,0x85,0x80,0x42,0x02,0x45,0x00,0x82,0x00,0x00, -0x00,0xff,0x00,0xff,0x41,0x7f,0x81,0xbf,0x01,0x7f,0x80,0xbe,0x40,0x7f,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x40,0x01,0x80,0x80,0x41,0x00,0x80,0x00,0x00, -0x00,0xff,0x00,0xff,0x15,0xff,0x14,0xff,0x54,0x5f,0xa4,0xaf,0xa4,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0xa0,0xa0,0x50,0x00,0x00,0x00,0x00, -0x00,0xff,0x00,0xff,0xd2,0xff,0x92,0xff,0x9e,0xff,0x92,0xff,0x92,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0xff,0x00,0xff,0x07,0xf7,0x08,0xfb,0x06,0xf6,0x01,0xfd,0x0e,0xfe,0x00,0xff,0x00,0x00,0x00,0x00,0x05,0x08,0x00,0x04,0x00,0x09,0x00,0x02,0x0a,0x01,0x00,0x00, -0x00,0xff,0x00,0xff,0x77,0xff,0x24,0xff,0x27,0xff,0x24,0xff,0x27,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00, -0x00,0xff,0x00,0xff,0x73,0xf7,0x4a,0xef,0x73,0xf7,0x52,0xf7,0x4b,0xef,0x00,0xff,0x00,0x00,0x00,0x00,0x21,0x08,0x00,0x10,0x30,0x08,0x00,0x08,0x01,0x10,0x00,0x00, -0x00,0xff,0x00,0xff,0x98,0xdb,0x24,0xe7,0xa4,0xff,0x24,0xe7,0x98,0xdb,0x00,0xff,0x00,0x00,0x00,0x00,0x18,0x24,0x00,0x18,0x80,0x00,0x00,0x18,0x18,0x24,0x00,0x00, -0x00,0xff,0x00,0xff,0x0e,0xef,0x10,0xf7,0x0c,0xed,0x02,0xfb,0x1c,0xfd,0x00,0xff,0x00,0x00,0x00,0x00,0x0a,0x10,0x00,0x08,0x00,0x12,0x00,0x04,0x14,0x02,0x00,0x00, -0x00,0xff,0x00,0xff,0x64,0x6f,0x94,0x9f,0x94,0xff,0x94,0x9c,0x63,0x6b,0x00,0xff,0x00,0x00,0x00,0x00,0x64,0x90,0x00,0x60,0x00,0x00,0x00,0x63,0x63,0x94,0x00,0x00, -0x00,0xff,0x00,0xff,0xa5,0xff,0xb5,0xff,0xbd,0xff,0xad,0xff,0x25,0x7f,0x00,0xff,0x00,0x00,0x00,0x00,0x84,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x20,0x80,0x00,0x00, -0x00,0xff,0x00,0xff,0xc0,0xdf,0x20,0xbf,0x20,0xff,0x20,0xbf,0xc0,0xdf,0x00,0xff,0x00,0x00,0x00,0x00,0xc0,0x20,0x00,0x40,0x00,0x00,0x00,0x40,0xc0,0x20,0x00,0x00, -0x52,0xdd,0x41,0xce,0x09,0xce,0x29,0xee,0x29,0xee,0x21,0xe6,0x01,0xe6,0x01,0xe6,0x02,0x70,0x01,0x70,0x01,0x38,0x01,0x38,0x01,0x38,0x01,0x38,0x01,0x18,0x01,0x18, -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0xff,0x7f,0xff,0x7f,0xff,0x7f,0xff,0x7f,0xff,0x7f,0xff,0x7f, -0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe, -0x80,0x67,0x80,0x67,0x80,0x67,0x80,0x67,0x80,0x67,0x80,0x67,0x80,0x67,0x80,0x67,0x80,0x18,0x80,0x18,0x80,0x18,0x80,0x18,0x80,0x18,0x80,0x18,0x80,0x18,0x80,0x18, -0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x01,0xfe,0x03,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00, -0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x00, -0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x80,0x7f,0xc0,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0xc0,0x00, -0x01,0xe6,0x01,0xe6,0x01,0xe6,0x01,0xe6,0x01,0xe6,0x01,0xe6,0x01,0xe6,0x01,0xe6,0x01,0x18,0x01,0x18,0x01,0x18,0x01,0x18,0x01,0x18,0x01,0x18,0x01,0x18,0x01,0x18, -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xff,0x7f,0xff,0x7f,0xff,0x7f,0xff,0x7f,0xff,0x7f,0xff,0x7f,0xff,0x7f,0xff,0x7f, -0x03,0xfc,0x03,0xfc,0x03,0xfc,0x03,0xfc,0x03,0xfc,0x03,0xfc,0x03,0xfc,0x03,0xfc,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0xc0,0x3f,0xc0,0x3f,0xc0,0x3f,0xc0,0x3f,0xc0,0x3f,0xc0,0x3f,0xc0,0x3f,0xc0,0x3f,0xc0,0x00,0xc0,0x00,0xc0,0x00,0xc0,0x00,0xc0,0x00,0xc0,0x00,0xc0,0x00,0xc0,0x00, -0x3c,0xc3,0x78,0x83,0xec,0x00,0xfc,0x00,0xfd,0x01,0x39,0x83,0x02,0x87,0x18,0xdb,0x3c,0x00,0x44,0x10,0x92,0x39,0x82,0x39,0x83,0x10,0x45,0x00,0x3a,0x40,0x18,0x24, -0x00,0xff,0x00,0xff,0xc4,0xd5,0xae,0xff,0xca,0xdf,0xae,0xff,0xca,0xdf,0x00,0xff,0x00,0x00,0x00,0x00,0x40,0x2a,0x2e,0x00,0xc0,0x20,0x2e,0x00,0x40,0x20,0x00,0x00, -0x00,0xff,0x00,0xff,0xee,0xff,0x44,0xff,0x44,0xff,0x44,0xff,0x44,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x00,0x00,0x00, -0x00,0xff,0x00,0xff,0xee,0xff,0x8a,0xff,0xec,0xfd,0x8a,0xfb,0xea,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x66,0x00,0x00,0x00,0xec,0x02,0x02,0x04,0x60,0x00,0x00,0x00, -0x03,0xfc,0x03,0xfc,0xa3,0xfc,0xa3,0xbc,0xe3,0xfc,0x43,0xfc,0x43,0xfc,0x03,0xfc,0x03,0x00,0x03,0x00,0xa3,0x00,0x03,0x40,0xe3,0x00,0x03,0x00,0x03,0x00,0x03,0x00, -0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xff,0x7f,0xff,0x7f,0xff,0x7f,0xff,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, -0x29,0xee,0x2a,0xec,0x2a,0xec,0x0a,0xcc,0x03,0xcd,0x43,0xcd,0x53,0xdd,0x55,0xd9,0x01,0x38,0x02,0x39,0x02,0x39,0x02,0x39,0x03,0x30,0x03,0x70,0x02,0x70,0x04,0x72, -0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x7f,0x7f,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x01,0xff,0x01,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01, -0x15,0x99,0x06,0x9a,0xa6,0xba,0xaa,0xb2,0x28,0x30,0x0c,0x34,0x4c,0x74,0x54,0x64,0x04,0x72,0x07,0x61,0x07,0xe1,0x09,0xe5,0x0b,0xe7,0x0f,0xc3,0x0f,0xc3,0x13,0xcb, -0x00,0xfe,0x02,0xfe,0x00,0xfc,0x01,0xf9,0x08,0xf9,0x00,0xf3,0x04,0xe7,0x21,0xe6,0x00,0x01,0x00,0x03,0x00,0x03,0x00,0x07,0x00,0x0e,0x00,0x0c,0x00,0x1c,0x01,0x38, -0x10,0x60,0x98,0xe8,0x20,0xc0,0x30,0xd0,0x40,0x80,0x60,0xa0,0xc0,0x40,0x40,0x40,0x17,0x8f,0x1f,0x87,0x2f,0x1f,0x3f,0x0f,0x5f,0x3f,0x5f,0x1f,0xff,0x3f,0x3f,0xbf, -0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe,0xfe,0xfe,0xfe,0xfe, -0x80,0x67,0x80,0x67,0x84,0x67,0x94,0x77,0x94,0x77,0x90,0x73,0x82,0x73,0x4a,0xbb,0x80,0x18,0x80,0x18,0x80,0x1c,0x80,0x1c,0x80,0x1c,0x80,0x1c,0x80,0x0e,0x40,0x0e, -0x03,0xfc,0x01,0xfe,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x03,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0xff,0x00,0xff,0x00,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0xc0,0x3f,0x80,0x7f,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0xc0,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x03,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, -0x00,0xff,0x00,0xff,0x00,0xfe,0x00,0xfc,0x08,0xf8,0x02,0xe3,0x40,0xc7,0x11,0x1e,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x0f,0x00,0x1e,0x00,0x78,0x01,0xf0, -0x41,0xce,0x93,0x9d,0x27,0x3b,0x4a,0x72,0x14,0xe4,0x28,0xc8,0x70,0xb0,0xc0,0x40,0x01,0x70,0x03,0xf0,0x06,0xe0,0x09,0xc5,0x13,0x0b,0x27,0x17,0x6f,0x0f,0xff,0x3f, -0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0x49,0x39,0xc4,0xbc,0x22,0x1e,0x61,0x5f,0x30,0x2f,0x1c,0x13,0x0b,0x08,0x02,0x02,0x40,0x8f,0xc0,0x07,0xa0,0xc3,0xe0,0x81,0xf0,0xc0,0xfc,0xe0,0xfb,0xf4,0xfe,0xfd, -0x00,0xff,0xc0,0xff,0x1c,0x1f,0x80,0x80,0x38,0xf8,0x00,0xff,0x80,0x7f,0x7f,0x80,0x00,0x00,0x00,0xc0,0x00,0xfc,0x00,0xff,0x00,0x3f,0x00,0x00,0x80,0x00,0x7f,0x00, -0x00,0xff,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0xff,0x00, -0x00,0xff,0x07,0xff,0xe0,0xe0,0x03,0x03,0xf0,0xff,0x01,0xfe,0x7e,0x80,0x8f,0x0f,0x00,0x00,0x00,0x07,0x00,0xff,0x00,0xff,0x00,0xf0,0x01,0x00,0x7e,0x01,0x8c,0x70, -0x30,0xf0,0x03,0x03,0x38,0x3f,0x81,0xfe,0x1e,0xe0,0xe7,0x07,0x70,0x70,0x80,0x80,0x00,0x3f,0x00,0xff,0x00,0xf8,0x01,0x80,0x1e,0x01,0xe6,0x18,0x6f,0x8f,0x7f,0x7f, -0x42,0x7c,0x0f,0xf3,0x34,0xc4,0xd0,0x10,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0xc1,0x0e,0x00,0x33,0x0b,0xdf,0x2f,0x7f,0xbf,0xff,0xff,0xff,0xff,0xff,0xff, -0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x04,0xff,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xfb, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0xe3,0xff,0x00,0xf3,0x0c,0xff,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9c,0x7f,0xff,0xff,0xf3,0xff, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x87,0xcf,0x08,0x87,0x48,0xff,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x7f,0xff,0xf7,0xb7,0xff, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x80,0x80,0x00,0xff,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0xff,0xff,0xff, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x28,0x70,0x48,0x38,0x40,0xff,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd7,0xff,0xf7,0xbf,0xbf,0xff, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x1c,0x08,0x14,0x3c,0x20,0xff,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf3,0xef,0xeb,0xff,0xff,0xdf, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x20,0x3f,0x20,0x1f,0x20,0xff,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xdf,0xff,0xdf,0xdf,0xff, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x10,0xf0,0x10,0xd0,0x30,0xff,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xff,0xff,0xef,0xdf,0xef, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x01,0x3f,0x20,0x3b,0x24,0xff,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xdf,0xfb,0xdf, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xc0,0xc0,0x20,0xe0,0x11,0xff,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xbf,0xdf,0xff,0xee,0xff, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4a,0x76,0x7f,0x81,0xff,0x00,0xff,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xcb,0xbd,0x7f,0xfe,0xff,0xff, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x10,0x38,0x48,0x70,0x48,0xff,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xff,0xbf,0xf7,0xf7,0xbf, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x24,0x70,0x48,0x38,0x48,0xff,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xdf,0xfb,0xf7,0xbf,0xbf,0xf7, -0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xc0,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x08,0x7c,0x04,0x78,0x04,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf7,0xff,0xff,0xfb,0xfb,0xff, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xec,0x02,0xec,0x02,0xe0,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfd,0xff,0xfd,0xff,0xff,0xff, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x10,0xf8,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xff,0xff,0xff, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x0e,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0x0f,0x08,0x0e,0x01,0x0c,0x12,0x1e,0x02,0x38,0x24,0x1c,0x24,0x3c,0x04,0x38,0x00,0xff,0xf7,0xfe,0xff,0xed,0xff,0xff,0xfd,0xfb,0xdf,0xdf,0xfb,0xff,0xfb,0xff,0xff, -0x63,0xe3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x41,0xfe,0x80,0x7f,0x9c,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0xfe,0xff,0x7f, -0x4f,0xc0,0x1f,0x10,0x0f,0x10,0x1d,0x02,0x3f,0x22,0x18,0x25,0x3c,0x05,0x77,0x4f,0x7f,0xbf,0xff,0xef,0xef,0xff,0xfd,0xff,0xff,0xdd,0xda,0xff,0xfe,0xfb,0xf7,0xb8, -0xc0,0x40,0xc0,0x40,0x80,0x40,0x80,0x40,0xc0,0x00,0xe0,0x20,0xe1,0x21,0xc0,0x21,0xff,0xbf,0xff,0xbf,0xbf,0xff,0xbf,0xff,0xff,0xff,0xff,0xdf,0xff,0xde,0xde,0xff, -0x3c,0x44,0x7c,0x04,0xf8,0x84,0x78,0x84,0x7c,0x80,0xdf,0x23,0xde,0x23,0xed,0x32,0xbf,0xfb,0xff,0xfb,0xfb,0x7f,0x7b,0xff,0x7f,0xff,0xdf,0xfc,0xde,0xfd,0xed,0xdf, -0x1c,0x20,0x7e,0x42,0x3e,0x42,0xfe,0x82,0x6c,0x92,0xcc,0x32,0xec,0x32,0x9e,0x50,0xdf,0xff,0xff,0xbd,0xbf,0xfd,0xff,0x7d,0x6d,0xff,0xcd,0xff,0xed,0xdf,0xbf,0xef, -0x1c,0x24,0x1c,0x24,0x38,0x00,0x30,0x08,0x30,0x08,0x7f,0x40,0x7f,0x40,0x7f,0x40,0xdf,0xfb,0xdf,0xfb,0xff,0xff,0xf7,0xff,0xf7,0xff,0xff,0xbf,0xff,0xbf,0xff,0xbf, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x20,0xe0,0x20,0xa0,0x60,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xdf,0xff,0xff,0xdf,0xbf,0xdf, -0x1c,0x24,0x18,0x20,0x38,0x00,0x30,0x08,0x76,0x4f,0x7f,0x40,0x3f,0x40,0x3f,0x40,0xdf,0xfb,0xdf,0xff,0xff,0xff,0xf7,0xff,0xf6,0xb9,0xff,0xbf,0xbf,0xff,0xbf,0xff, -0x73,0x82,0xf1,0x82,0xf1,0x82,0x67,0x94,0xf3,0x14,0xc3,0x24,0xf3,0x14,0xe7,0x10,0x7f,0xfd,0xfd,0x7f,0xfd,0x7f,0x6f,0xfb,0xfb,0xef,0xdb,0xff,0xfb,0xef,0xef,0xff, -0xe7,0x18,0xe3,0x24,0x87,0x44,0xc3,0x40,0x03,0x80,0x83,0x80,0x83,0x80,0x07,0x04,0xe7,0xff,0xfb,0xdf,0xbf,0xfb,0xff,0xbf,0x7f,0xff,0xff,0x7f,0xff,0x7f,0xff,0xfb, -0xb0,0x88,0x98,0xa0,0x3d,0xa5,0x18,0x85,0x8f,0x12,0x9f,0x10,0x8f,0x00,0x06,0x89,0xf7,0x7f,0xdf,0x7f,0x7f,0xda,0x7a,0xff,0xef,0xfd,0xff,0xef,0xff,0xff,0x76,0xff, -0xe0,0x90,0x70,0x90,0xc0,0x20,0xe0,0x20,0x80,0x40,0xc0,0x40,0x00,0x80,0x80,0x80,0xef,0x7f,0x7f,0xef,0xdf,0xff,0xff,0xdf,0xbf,0xff,0xff,0xbf,0x7f,0xff,0xff,0x7f, -0x76,0x0a,0x7c,0x0a,0x73,0x05,0x76,0x05,0x71,0x02,0x73,0x02,0x70,0x01,0x00,0x00,0xf7,0xfd,0xfd,0xf7,0xfb,0xfe,0xfe,0xfb,0xfd,0xff,0xff,0xfd,0xfe,0xff,0xff,0xff, -0xe0,0x0e,0xee,0x00,0xee,0x00,0xee,0x00,0xee,0x00,0xee,0x00,0xee,0x00,0x00,0x00,0xf1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xe8,0x0e,0xfe,0x01,0xee,0x19,0xf7,0x10,0xe7,0x00,0xe7,0x00,0xe7,0x00,0x00,0x00,0xf9,0xf7,0xfe,0xff,0xee,0xf7,0xff,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0x61,0x12,0x63,0x14,0x63,0x14,0x67,0x10,0x63,0x14,0x63,0x14,0x61,0x12,0x00,0x00,0xed,0xff,0xeb,0xff,0xeb,0xff,0xef,0xff,0xeb,0xff,0xeb,0xff,0xed,0xff,0xff,0xff, -0xe3,0x10,0xf3,0xc8,0x33,0x08,0xfb,0x00,0x03,0x00,0x53,0x68,0xe3,0x10,0x00,0x00,0xef,0xff,0xf7,0x3f,0xf7,0xff,0xff,0xff,0xff,0xff,0xd7,0xbf,0xef,0xff,0xff,0xff, -0xa0,0x38,0xf8,0x05,0xb8,0x65,0xdd,0x40,0x9c,0x01,0x9c,0x01,0x9c,0x00,0x00,0x00,0xe7,0xdf,0xfa,0xff,0xba,0xdf,0xff,0xbf,0xfe,0xff,0xfe,0xff,0xff,0xff,0xff,0xff, -0x7e,0x80,0xfe,0x30,0xce,0x00,0xce,0x00,0xce,0x00,0xfe,0x30,0x7e,0x80,0x00,0x00,0x7f,0xff,0xff,0xcf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xcf,0x7f,0xff,0xff,0xff, -0x3c,0x42,0x7e,0x99,0x66,0x81,0xe7,0x00,0x66,0x81,0x7e,0x99,0x3c,0x42,0x00,0x00,0xbd,0xff,0x7e,0xe7,0x7e,0xff,0xff,0xff,0x7e,0xff,0x7e,0xe7,0xbd,0xff,0xff,0xff, -0x38,0x00,0x3c,0x04,0x3c,0x04,0x18,0x24,0x3d,0x23,0x0f,0x10,0x07,0x08,0x05,0x06,0xff,0xff,0xff,0xfb,0xff,0xfb,0xdb,0xff,0xfd,0xde,0xef,0xff,0xf7,0xff,0xfd,0xfb, -0x7c,0x82,0x0e,0x12,0x1c,0x00,0x38,0x24,0x7c,0x44,0x79,0x81,0xf0,0x09,0xd1,0x30,0x7d,0xff,0xef,0xfd,0xff,0xff,0xfb,0xdf,0xff,0xbb,0x7f,0xfe,0xf6,0xff,0xdf,0xef, -0x3f,0x40,0x7f,0x00,0xef,0x9f,0x70,0x90,0xe0,0x00,0xc0,0x20,0xe0,0x20,0xc0,0x00,0xbf,0xff,0xff,0xff,0xef,0x70,0x7f,0xef,0xff,0xff,0xdf,0xff,0xff,0xdf,0xff,0xff, -0xc0,0x21,0xe1,0x00,0x73,0x92,0x71,0x92,0xe1,0x92,0xe3,0x90,0x7f,0x0c,0x3b,0x4c,0xde,0xff,0xff,0xff,0x7f,0xed,0x7d,0xef,0xed,0x7f,0xef,0x7f,0xff,0xf3,0xbb,0xf7, -0xcd,0x12,0x9f,0x50,0x8f,0x40,0xc6,0x49,0x87,0x09,0x0c,0x8a,0x0e,0x8a,0x80,0x84,0xed,0xff,0xbf,0xef,0xbf,0xff,0xf6,0xbf,0xf7,0xfe,0x7d,0xf7,0x7f,0xf5,0xfb,0x7f, -0xde,0x50,0x0f,0x81,0x8f,0x81,0x07,0x09,0x06,0x09,0x06,0x09,0x0e,0x09,0x0f,0x08,0xff,0xaf,0x7f,0xfe,0xff,0x7e,0xf7,0xfe,0xf6,0xff,0xf6,0xff,0xfe,0xf7,0xff,0xf7, -0x38,0x48,0x38,0x48,0xb0,0xc0,0xe0,0x90,0xe0,0x90,0xff,0x80,0xff,0x80,0xff,0x80,0xbf,0xf7,0xbf,0xf7,0xbf,0x7f,0xef,0x7f,0xef,0x7f,0xff,0x7f,0xff,0x7f,0xff,0x7f, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x10,0xf0,0x10,0xd0,0x30,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xff,0xff,0xef,0xdf,0xef, -0x79,0x09,0x78,0x08,0xf0,0x80,0xe0,0x90,0x6d,0x9e,0x7f,0x80,0xff,0x00,0xf9,0x07,0xff,0xf6,0xff,0xf7,0xff,0x7f,0xef,0x7f,0x6d,0xf3,0x7f,0xff,0xff,0xff,0xf9,0xfe, -0x77,0x80,0xf7,0x80,0xf3,0x84,0x63,0x94,0xf7,0x14,0xc3,0x20,0x83,0x42,0x81,0x81,0x7f,0xff,0xff,0x7f,0xfb,0x7f,0x6b,0xff,0xff,0xeb,0xdf,0xff,0xbf,0xfd,0xff,0x7e, -0x07,0x04,0x03,0x04,0x8f,0x88,0x16,0x99,0xaf,0x71,0xfc,0x02,0xf8,0x04,0x48,0xb8,0xff,0xfb,0xfb,0xff,0xff,0x77,0x76,0xef,0xaf,0xde,0xfd,0xff,0xfb,0xff,0x4f,0xf7, -0x0e,0x89,0x8e,0x89,0x87,0x89,0x07,0x09,0x0e,0x00,0x0e,0x00,0x1c,0x12,0x1c,0x12,0x7e,0xf7,0xfe,0x77,0xf7,0x7e,0xf7,0xfe,0xff,0xff,0xff,0xff,0xfd,0xef,0xfd,0xef, -0x00,0x00,0x00,0x00,0x1c,0x22,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x00,0x08,0xff,0xff,0xff,0xff,0xdd,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf7,0xff, -0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x50,0xf8,0x20,0xa8,0x50,0xa8,0x00,0x20,0xa8,0xff,0xff,0xff,0xff,0x77,0xff,0xaf,0xff,0xff,0xdf,0xaf,0xff,0xff,0xff,0x77,0xdf, -}; -extern const unsigned int border_chr_size = sizeof(border_chr); -const unsigned char border_map[]={ -0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10, -0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10, -0x00,0x10,0x00,0x10,0x01,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10, -0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x02,0x10,0x03,0x10,0x00,0x10,0x00,0x10, -0x00,0x10,0x04,0x10,0x05,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10, -0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x06,0x10,0x07,0x10,0x08,0x10,0x00,0x10, -0x09,0x10,0x0a,0x10,0x0b,0x10,0x0c,0x10,0x0c,0x10,0x0c,0x10,0x0c,0x10,0x0c,0x10,0x0c,0x10,0x0c,0x10,0x0d,0x10,0x0e,0x10,0x0f,0x10,0x10,0x10,0x11,0x10,0x12,0x10, -0x13,0x10,0x14,0x10,0x15,0x10,0x16,0x10,0x17,0x10,0x18,0x10,0x19,0x10,0x1a,0x10,0x1b,0x10,0x1c,0x10,0x1d,0x10,0x0c,0x10,0x0c,0x10,0x0b,0x10,0x1e,0x10,0x1f,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x22,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x10, -0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x23,0x10,0x24,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x26,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x26,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x26,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x26,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x26,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x26,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x26,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x2a,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x26,0x10, -0x20,0x10,0x21,0x10,0x2b,0x10,0x2c,0x10,0x2d,0x10,0x2e,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x26,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x26,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x26,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x26,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x26,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x26,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x26,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x25,0x10,0x2f,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x30,0x10,0x31,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x32,0x10,0x33,0x10,0x00,0x10, -0x20,0x10,0x21,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x27,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10, -0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x28,0x10,0x29,0x10,0x0b,0x10,0x0b,0x10,0x34,0x10,0x35,0x10,0x00,0x10, -0x36,0x10,0x37,0x10,0x0b,0x10,0x0b,0x10,0x0b,0x10,0x38,0x10,0x39,0x10,0x39,0x10,0x39,0x10,0x39,0x10,0x39,0x10,0x39,0x10,0x39,0x10,0x39,0x10,0x39,0x10,0x39,0x10, -0x39,0x10,0x39,0x10,0x39,0x10,0x39,0x10,0x39,0x10,0x39,0x10,0x39,0x10,0x39,0x10,0x39,0x10,0x39,0x10,0x3a,0x10,0x3b,0x10,0x3c,0x10,0x3d,0x10,0x3e,0x10,0x00,0x10, -0x00,0x10,0x3f,0x10,0x40,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10, -0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x41,0x10,0x42,0x10,0x43,0x10,0x44,0x10,0x45,0x10,0x00,0x10,0x00,0x10, -0x00,0x10,0x00,0x10,0x46,0x10,0x47,0x10,0x47,0x10,0x47,0x10,0x47,0x10,0x47,0x10,0x47,0x10,0x47,0x10,0x48,0x10,0x49,0x10,0x4a,0x10,0x4b,0x10,0x4c,0x10,0x4d,0x10, -0x4e,0x10,0x4f,0x10,0x50,0x10,0x51,0x10,0x52,0x10,0x53,0x10,0x54,0x10,0x47,0x10,0x47,0x10,0x55,0x10,0x56,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10, -0x00,0x10,0x00,0x10,0x57,0x10,0x58,0x10,0x00,0x10,0x59,0x10,0x00,0x10,0x00,0x10,0x5a,0x10,0x00,0x10,0x5b,0x10,0x5c,0x10,0x5d,0x10,0x5e,0x10,0x5f,0x10,0x60,0x10, -0x61,0x10,0x62,0x10,0x63,0x10,0x64,0x10,0x65,0x10,0x66,0x10,0x67,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10, -0x00,0x10,0x00,0x10,0x68,0x10,0x69,0x10,0x6a,0x10,0x6b,0x10,0x6c,0x10,0x6d,0x10,0x6e,0x10,0x6f,0x10,0x70,0x10,0x71,0x10,0x72,0x10,0x73,0x10,0x74,0x10,0x75,0x10, -0x76,0x10,0x77,0x10,0x78,0x10,0x79,0x10,0x7a,0x10,0x7b,0x10,0x7c,0x10,0x7d,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10, -}; -extern const unsigned int border_map_size = sizeof(border_map); -const unsigned char border_pal[]={ -0x1f,0x7c,0x98,0x39,0xad,0x3d,0x19,0x63,0x11,0x31,0x49,0x1d,0xed,0x2c,0x94,0x52,0xef,0x45,0xdf,0x59,0xab,0x51,0xce,0x41,0x7c,0x73,0x06,0x3d,0x1f,0x7c,0x1f,0x7c, -}; -extern const unsigned int border_pal_size = sizeof(border_pal); diff --git a/gbdk-lib/examples/gb/sgb_border/border_data.h b/gbdk-lib/examples/gb/sgb_border/border_data.h @@ -1,14 +0,0 @@ -#ifndef __SGB_BORDER_DATA_H_INCLUDE -#define __SGB_BORDER_DATA_H_INCLUDE - -#include <gb/gb.h> -#include <stdint.h> - -extern const unsigned char border_chr[]; -extern const unsigned int border_chr_size; -extern const unsigned char border_map[]; -extern const unsigned int border_map_size; -extern const unsigned char border_pal[]; -extern const unsigned int border_pal_size; - -#endif - diff --git a/gbdk-lib/examples/gb/sgb_border/gb_border.png b/gbdk-lib/examples/gb/sgb_border/gb_border.png Binary files differ. diff --git a/gbdk-support/png2asset/png2asset.cpp b/gbdk-support/png2asset/png2asset.cpp @@ -15,6 +15,9 @@ void loadFile(vector<unsigned char>& buffer, const std::string& filename); bool export_as_map = false; bool use_map_attributes = false; +size_t pal_size; +int tile_h; +int bpp = 2; struct Tile { @@ -33,6 +36,38 @@ struct Tile pal = t.pal; return *this; } + + enum PackMode { + GB, + SGB, + SMS, + }; + + vector< unsigned char > GetPackedData(PackMode pack_mode) { + vector< unsigned char > ret(tile_h * bpp, 0); + if(pack_mode == GB) { + for(int j = 0; j < tile_h; ++j) { + for(int i = 0; i < 8; ++ i) { + unsigned char col = data[8 * j + i]; + ret[j * 2 ] |= BIT(col, 0) << (7 - i); + ret[j * 2 + 1] |= BIT(col, 1) << (7 - i); + } + } + } + else if(pack_mode == SGB) + { + for(int j = 0; j < tile_h; ++j) { + for(int i = 0; i < 8; ++ i) { + unsigned char col = data[8 * j + i]; + ret[j * 2 ] |= BIT(col, 0) << (7 - i); + ret[j * 2 + 1] |= BIT(col, 1) << (7 - i); + ret[(tile_h + j) * 2 ] |= BIT(col, 2) << (7 - i); + ret[(tile_h + j) * 2 + 1] |= BIT(col, 3) << (7 - i); + } + } + } + return ret; + } }; struct PNGImage @@ -46,7 +81,7 @@ struct PNGImage unsigned char GetGBColor(int x, int y) { - return data[w * y + x] % 4; + return data[w * y + x] % pal_size; } bool ExtractGBTile(int x, int y, int tile_h, Tile& tile) @@ -56,18 +91,12 @@ struct PNGImage bool all_zero = true; for(int j = 0; j < tile_h; ++ j) { - unsigned char& l = tile.data[j * 2]; - unsigned char& h = tile.data[j * 2 + 1]; - l = h = 0; - for(int i = 0; i < 8; ++i) { - unsigned char color = GetGBColor(x + i, y + j); - l |= BIT(color, 0) << (7 - i); - h |= BIT(color, 1) << (7 - i); + unsigned char color_idx = GetGBColor(x + i, y + j); + tile.data[j * 8 + i] = color_idx; + all_zero = all_zero && (color_idx == 0); } - - all_zero = all_zero && (l == 0) && (h == 0); } return !all_zero; } @@ -87,21 +116,23 @@ struct MTTile typedef vector< MTTile > MetaSprite; vector< Tile > tiles; vector< MetaSprite > sprites; -unsigned char* map = 0; -unsigned char* map_attributes = 0; +vector< unsigned char > map; +vector< unsigned char > map_attributes; PNGImage image; -int tile_h; int props_default = 0x00; // Default Sprite props has no attributes enabled bool use_structs = false; bool flip_tiles = true; +Tile::PackMode pack_mode = Tile::GB; Tile FlipH(const Tile& tile) { Tile ret; - for(unsigned int i = 0; i < tile.data.size(); i += 2) + for(int j = (int)tile.data.size() - 8; j >= 0; j -= 8) { - ret.data.push_back(tile.data[tile.data.size() - 1 - i - 1]); - ret.data.push_back(tile.data[tile.data.size() - 1 - i]); + for(int i = 0; i < 8; ++ i) + { + ret.data.push_back(tile.data[j + i]); + } } ret.pal = tile.pal; return ret; @@ -110,17 +141,14 @@ Tile FlipH(const Tile& tile) Tile FlipV(const Tile& tile) { Tile ret; - ret.pal = tile.pal; - for(unsigned int i = 0; i < tile.data.size(); ++i) + for(int j = 0; j < (int)tile.data.size(); j += 8) { - const unsigned char& c0 = tile.data[i]; - unsigned char c1 = 0; - for(int j = 0; j < 8; ++j) + for(int i = 7; i >= 0; -- i) { - c1 |= BIT(c0, 7 - j) << j; + ret.data.push_back(tile.data[j + i]); } - ret.data.push_back(c1); } + ret.pal = tile.pal; return ret; } @@ -179,7 +207,7 @@ void GetMetaSprite(int _x, int _y, int _w, int _h, int pivot_x, int pivot_y) { for(int x = _x; x < _x + _w && x < (int)image.w; x += 8) { - Tile tile(tile_h * 2); + Tile tile(tile_h * 8); if (image.ExtractGBTile(x, y, tile_h, tile)) { unsigned char idx; @@ -212,7 +240,7 @@ void GetMap() { for(int x = 0; x < (int)image.w; x += 8) { - Tile tile(8 * 2); + Tile tile(8 * 8); image.ExtractGBTile(x, y, 8, tile); unsigned char idx; @@ -222,14 +250,27 @@ void GetMap() tiles.push_back(tile); idx = (unsigned char)tiles.size() - 1; props = props_default; + + if(tiles.size() > 256) + printf("Warning: found more than 256 tiles on x:%d,y:%d\n", x, y); } - map[(y / 8) * (image.w / 8) + (x / 8)] = idx; - if(map_attributes) + map.push_back(idx); + + if(use_map_attributes) { - unsigned char pal_idx = image.data[y * image.w + x] >> 2; //We can pick the palette from the first pixel of this tile - props |= pal_idx; - map_attributes[(y / 8) * (image.w / 8) + (x / 8)] = props; + unsigned char pal_idx = image.data[y * image.w + x] >> bpp; //We can pick the palette from the first pixel of this tile + if(pack_mode == Tile::SGB) + { + props = props << 1; //Mirror flags in SGB are on bit 7 + props |= (pal_idx + 4) << 2; //Pals are in bits 2,3,4 and need to go from 4 to 7 + map.push_back(props); //Also they are stored within the map tiles + } + else + { + props |= pal_idx; + map_attributes.push_back(props); + } } } } @@ -324,6 +365,9 @@ int main(int argc, char *argv[]) printf("-map Export as map (tileset + bg)\n"); printf("-use_map_attributes Use CGB BG Map attributes (default: palettes are stored for each tile in a separate array)\n"); printf("-use_structs Group the exported info into structs (default: false)\n"); + printf("-bpp bits per pixel (default: 2)\n"); + printf("-max_palettes maximum number of palettes allowed (default: 2)\n"); + printf("-pack_mode gb, sgb or sms (default:GB)\n"); return 0; } @@ -335,10 +379,11 @@ int main(int argc, char *argv[]) int pivot_w = 0xFFFFFF; int pivot_h = 0xFFFFFF; tile_h = 16; - string output_filename = argv[1]; + string output_filename = argv[1]; output_filename = output_filename.substr(0, output_filename.size() - 4) + ".c"; int bank = 0; bool keep_palette_order = false; + size_t max_palettes = 8; //Parse argv for(int i = 2; i < argc; ++i) @@ -407,8 +452,30 @@ int main(int argc, char *argv[]) { use_structs = true; } + else if(!strcmp(argv[i], "-bpp")) + { + bpp = atoi(argv[++ i]); + } + else if(!strcmp(argv[i], "-max_palettes")) + { + max_palettes = atoi(argv[++ i]); + } + else if(!strcmp(argv[i], "-pack_mode")) + { + std::string pack_mode_str = argv[++ i]; + if (pack_mode_str == "gb") pack_mode = Tile::GB; + else if(pack_mode_str == "sgb") pack_mode = Tile::SGB; + else if(pack_mode_str == "sms") pack_mode = Tile::SMS; + else + { + printf("-pack_mode must be one of gb, sgb or sms\n"); + return 1; + } + } } + pal_size = 1 << bpp; + if(export_as_map) tile_h = 8; //Force tiles_h to 8 on maps @@ -468,9 +535,9 @@ int main(int argc, char *argv[]) { //Get palette colors on (x, y, 8, tile_h) SetPal pal = GetPaletteColors(image32, x, y, 8, tile_h); - if(pal.size() > 4) + if(pal.size() > pal_size) { - printf("Error: more than 4 colors found on (%d, %d, %d, %d)\n", x, y, 8, tile_h); + printf("Error: more than %d colors found on (%d, %d, %d, %d)\n", pal_size, x, y, 8, tile_h); return 1; } @@ -481,9 +548,9 @@ int main(int argc, char *argv[]) //Try to merge this palette wit any of the palettes (checking if they are equal is not enough since the palettes can have less than 4 colors) SetPal merged(palettes[i]); merged.insert(pal.begin(), pal.end()); - if(merged.size() <= 4) + if(merged.size() <= pal_size) { - if(palettes[i].size() <= 4) + if(palettes[i].size() <= pal_size) palettes[i] = merged; //Increase colors with this palette (it has less than 4 colors) break; //Found palette } @@ -492,9 +559,9 @@ int main(int argc, char *argv[]) if(i == palettes.size()) { //Palette not found, add a new one - if(palettes.size() == 8) + if(palettes.size() == max_palettes) { - printf("Error: more than 8 palettes found\n"); + printf("Error: more than %d palettes found\n", max_palettes); return 1; } @@ -510,13 +577,13 @@ int main(int argc, char *argv[]) image.w = image32.w; image.h = image32.h; - image.palettesize = palettes.size() * 4; - image.palette = new unsigned char[palettes.size() * 4 * 4]; //4 color * 4 bytes each + image.palettesize = palettes.size() * pal_size; + image.palette = new unsigned char[palettes.size() * pal_size * 4]; //pal_size colors * 4 bytes each for(size_t p = 0; p < palettes.size(); ++ p) { - int *color_ptr = (int*)&image.palette[p * 16]; + int *color_ptr = (int*)&image.palette[p * pal_size * 4]; - //TODO: if palettes[p].size() != 4 we should probably try to fill the gaps based on grayscale values + //TODO: if palettes[p].size() != pal_size we should probably try to fill the gaps based on grayscale values for(SetPal::iterator it = palettes[p].begin(); it != palettes[p].end(); ++ it, color_ptr ++) { @@ -533,7 +600,7 @@ int main(int argc, char *argv[]) int color32 = (c32ptr[0] << 24) | (c32ptr[1] << 16) | (c32ptr[2] << 8) | c32ptr[3]; unsigned char palette = palettes_per_tile[(y / tile_h) * (image32.w / 8) + (x / 8)]; unsigned char index = std::distance(palettes[palette].begin(), palettes[palette].find(color32)); - image.data.push_back((palette << 2) + index); + image.data.push_back((palette << bpp) + index); } } @@ -551,9 +618,6 @@ int main(int argc, char *argv[]) if(export_as_map) { //Extract map - map = new unsigned char[(image.w * image.h) / 64]; - if(use_map_attributes) - map_attributes = new unsigned char[(image.w * image.h) / 64];; GetMap(); } else @@ -608,13 +672,13 @@ int main(int argc, char *argv[]) if(export_as_map) { fprintf(file, "#define %s_MAP_ATTRIBUTES ", data_name.c_str()); - if(map_attributes) + if(use_map_attributes && map_attributes.size()) fprintf(file, "%s_map_attributes\n", data_name.c_str()); else fprintf(file, "0\n"); fprintf(file, "#define %s_TILE_PALS ", data_name.c_str()); - if(map_attributes) + if(use_map_attributes) fprintf(file, "0\n"); else fprintf(file, "%s_tile_pals\n", data_name.c_str()); @@ -630,16 +694,18 @@ int main(int argc, char *argv[]) fprintf(file, "BANKREF_EXTERN(%s)\n", data_name.c_str()); fprintf(file, "\n"); fprintf(file, "extern const uint16_t %s_palettes[%d];\n", data_name.c_str(), (unsigned int)image.palettesize); - fprintf(file, "extern const uint8_t %s_tiles[%d];\n", data_name.c_str(), (unsigned int)(tiles.size() * tile_h * 2)); + fprintf(file, "extern const uint8_t %s_tiles[%d];\n", data_name.c_str(), (unsigned int)(tiles.size() * (8 * tile_h * bpp / 8))); fprintf(file, "\n"); if(export_as_map) { - fprintf(file, "extern const unsigned char %s_map[%d];\n", data_name.c_str(), image.w * image.h / 64); + fprintf(file, "extern const unsigned char %s_map[%d];\n", data_name.c_str(), map.size()); - if(map_attributes) - fprintf(file, "extern const unsigned char* %s_map_attributes[%d];\n", data_name.c_str(), image.w * image.h / 64); - else + if(use_map_attributes) { + if(map_attributes.size()) { + fprintf(file, "extern const unsigned char* %s_map_attributes[%d];\n", data_name.c_str(), (unsigned int)map_attributes.size()); + } + } else fprintf(file, "extern const unsigned char* %s_tile_pals[%d];\n", data_name.c_str(), (unsigned int)tiles.size()); } else @@ -689,15 +755,16 @@ int main(int argc, char *argv[]) fprintf(file, "\n};\n"); fprintf(file, "\n"); - fprintf(file, "const uint8_t %s_tiles[%d] = {\n", data_name.c_str(), (unsigned int)(tiles.size() * tile_h * 2)); + fprintf(file, "const uint8_t %s_tiles[%d] = {\n", data_name.c_str(), (unsigned int)(tiles.size() * 8 * tile_h * bpp / 8)); for(vector< Tile >::iterator it = tiles.begin(); it != tiles.end(); ++ it) { fprintf(file, "\t"); - for(vector< unsigned char >::iterator it2 = (*it).data.begin(); it2 != (*it).data.end(); ++ it2) + vector< unsigned char > packed_data = (*it).GetPackedData(pack_mode); + for(vector< unsigned char >::iterator it2 = packed_data.begin(); it2 != packed_data.end(); ++ it2) { fprintf(file, "0x%02x", (*it2)); - if((it + 1) != tiles.end() || (it2 + 1) != (*it).data.end()) + if((it + 1) != tiles.end() || (it2 + 1) != packed_data.end()) fprintf(file, ","); } @@ -781,31 +848,30 @@ int main(int argc, char *argv[]) //Export map fprintf(file, "\n"); - fprintf(file, "const unsigned char %s_map[%d] = {\n", data_name.c_str(), image.w * image.h / 64); - unsigned char* m = map; - for(size_t y = 0; y < image.h; y += 8) + fprintf(file, "const unsigned char %s_map[%d] = {\n", data_name.c_str(), map.size()); + size_t line_size = map.size() / (image.h / 8); + for(size_t j = 0; j < image.h / 8; ++ j) { fprintf(file, "\t"); - for(size_t x = 0; x < image.w; x += 8, m ++) + for(size_t i = 0; i < line_size; ++ i) { - fprintf(file, "0x%02x,", *m); + fprintf(file, "0x%02x,", map[j * line_size + i]); } fprintf(file, "\n"); } fprintf(file, "};\n"); //Export map attributes (if any) - if(map_attributes) + if(use_map_attributes && map_attributes.size()) { fprintf(file, "\n"); - fprintf(file, "const unsigned char %s_map_attributes[%d] = {\n", data_name.c_str(), image.w * image.h / 64); - unsigned char* m = map_attributes; - for(size_t y = 0; y < image.h; y += 8) + fprintf(file, "const unsigned char %s_map_attributes[%d] = {\n", data_name.c_str(), map_attributes.size()); + for(size_t j = 0; j < image.h / 8; ++ j) { fprintf(file, "\t"); - for(size_t x = 0; x < image.w; x += 8, m ++) + for(size_t i = 0; i < line_size; ++ i) { - fprintf(file, "0x%02x,", *m); + fprintf(file, "0x%02x,", map_attributes[j * line_size + i]); } fprintf(file, "\n"); } @@ -822,7 +888,7 @@ int main(int argc, char *argv[]) fprintf(file, "\t%s_map, //map\n", data_name.c_str()); fprintf(file, "\t%d, //with\n", image.w >> 3); fprintf(file, "\t%d, //height\n", image.h >> 3); - if(map_attributes) + if(use_map_attributes && map_attributes.size()) fprintf(file, "\t%s_map_attributes, //map attributes\n", data_name.c_str()); else fprintf(file, "\t%s, //map attributes\n", "0");

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.