Skip to content

Instantly share code, notes, and snippets.

@karmic64
Last active January 22, 2022 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karmic64/fae8714bd24614990270eb7f72c67ad3 to your computer and use it in GitHub Desktop.
Save karmic64/fae8714bd24614990270eb7f72c67ad3 to your computer and use it in GitHub Desktop.
Mad Max (NES) map ripper
/*
mad max nes map ripper
coded by karmic, sep 3-4, 2021
massively improved jan 22, 2021
requires libpng (compile with -lpng)
rom must be in the working directory and called "Mad Max (U) [!].nes"
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <errno.h>
#include <setjmp.h>
#include <zlib.h>
#include <png.h>
#include "pal.h"
#include "font.h"
uint16_t get16(uint8_t *p) { return (p[0]) | (p[1]<<8); }
/* main road wars use chr banks $14-$17 for background */
/* level layout setter at $2:$8059 -> $0689 */
/* the last two bytes of each are the starting coords? */
/* arranged row by row, 8 bytes per row, 8 columns */
/* level data getter routine at $2:$94d2 */
/* screen pointer table at $2:$a1db */
/* $40 bytes of metatile ids */
/* meta-tile tile data pointer table is at $2:$b46b(lo) $b4ac(hi) */
/* screen meta-tiles are 8x8 tiles */
/* $40 bytes of tile data, then 4 bytes of attribute data */
/* level palette setter routine at $2:$80dc */
/* "special tile" collision code at $2:$8432 */
/* code at $2:$8020 checks if player has an arena pass and modifies level layout if so */
/* arenas use chr banks $3c-$3f for background */
/* arena level layout setter routine at $c:$815e */
/* level data pointers at $c:$a443 */
/* arena level data getter routine at $c:$92c9 */
/* arena screen pointer table at $c:$a363 */
/* arena metatile pointer table at $c:$b29e(lo) $c:$b2d1(hi) */
/* arena palette setter code at $c:$8434 */
/* cave map data looks like it's completely different */
/* caves use chr banks $24-$27 for background */
/* cave pointer initializer code is at $4:$8000 */
/* indoor section level data getter routine at $4:$9217 */
/* level data pointer is at RAM $59, data starts at bank $5 and there are 2 caves per bank, all the way until bank $a */
/* the pointer is at $b026 and $b7f6 */
/* initial start position is set to $6a/$6d */
/* indoor level data is just 40x50 metatiles, there is no screen abstraction */
/* there are two metatile lookup tables that the game uses to handle opening doors and collecting items, one at $4:$932d and another one at $4:$942d. for mapping purposes we can just take the first one as the "main" one */
/* indoor metatile pointer table at $5+:$adb7 (lo) $5+:$adfe (hi) */
/* indoor metatiles are only 4x4 tiles, and only have 1 byte of attribute data */
/* indoor palette setter code is at $8:$91ec */
/* constant palette is at $91f5 */
uint8_t prg[0x20000];
uint8_t main_chr[0x1000];
uint8_t cave_chr[0x1000];
uint8_t arena_chr[0x1000];
uint8_t *bitmap = NULL;
int bmpwidth = 0;
int bmpheight = 0;
void drawpix(uint8_t col, int x, int y)
{
if (x<bmpwidth && y<bmpheight)
bitmap[(y*bmpwidth) + x] = col;
}
void bigpix(uint8_t col, int x, int y, int width, int height)
{
for (int yf = 0; yf < height; yf++)
{
for (int xf = 0; xf < width; xf++)
{
drawpix(col, x+xf, y+yf);
}
}
}
void drawstring(char *str, int x, int y, int width, int height)
{
char c;
while ((c=*(str++))!=0)
{
for (int yf = 0; yf < 8; yf++)
{
for (int xf = 0; xf < 8; xf++)
{
if (font[c*8 + yf] & (0x80>>xf)) bigpix(0x30,x+(xf*width),y+(yf*height),width,height);
}
}
x += width*8;
}
}
void drawtile(uint8_t *chr, uint8_t *palette, uint8_t tile, uint8_t attr, int x, int y)
{
uint8_t *t = chr+(tile*0x10);
for (int yf = 0; yf < 8; yf++)
{
for (int xf = 0; xf < 8; xf++)
{
uint8_t tm = (0x80 >> xf);
uint8_t col = palette[((t[yf] & tm) ? 1 : 0) | ((t[yf+0x8] & tm) ? 2 : 0) | (attr * 4)];
drawpix(col, x+xf,y+yf);
}
}
}
void writepng(char* fnam)
{
FILE *f = fopen(fnam, "wb");
png_struct *png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,NULL,NULL,NULL);
png_info *info_ptr = png_create_info_struct(png_ptr);
if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_write_struct(&png_ptr,&info_ptr);
fclose(f);
free(bitmap);
remove(fnam);
return;
}
png_init_io(png_ptr, f);
png_set_compression_level(png_ptr, 9);
png_set_IHDR(png_ptr,info_ptr, bmpwidth,bmpheight,
8, PNG_COLOR_TYPE_PALETTE,
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
png_set_PLTE(png_ptr,info_ptr, m_pal,0x40);
png_write_info(png_ptr,info_ptr);
for (size_t y = 0; y < bmpheight; y++) { png_write_row(png_ptr, &bitmap[y*bmpwidth]); }
png_write_end(png_ptr, info_ptr);
png_destroy_write_struct(&png_ptr, &info_ptr);
fclose(f);
free(bitmap);
}
void drawlevel(uint8_t *prg, uint8_t *chr, uint8_t *palette, uint8_t *layout, uint8_t *screentbl, uint8_t *metatbllo, uint8_t *metatblhi)
{
bmpwidth = 8*8*8*8;
bmpheight = 8*8*8*8;
size_t bmpsize = bmpwidth*bmpheight*sizeof(*bitmap);
bitmap = malloc(bmpsize);
memset(bitmap, 0x0f, bmpsize);
for (int yscreen = 0; yscreen < 8; yscreen++)
{
for (int xscreen = 0; xscreen < 8; xscreen++)
{
for (int ymeta = 0; ymeta < 8; ymeta++)
{
for (int xmeta = 0; xmeta < 8; xmeta++)
{
for (int ytile = 0; ytile < 8; ytile++)
{
for (int xtile = 0; xtile < 8; xtile++)
{
uint8_t screenid = layout[yscreen*8 + xscreen];
uint8_t *screen = prg+(get16(screentbl+(2*screenid))&0x3fff);
uint8_t metaid = screen[ymeta*8 + xmeta];
uint8_t *meta = prg+((metatbllo[metaid]) | ((metatblhi[metaid]&0x3f) << 8));
uint8_t tileid = meta[ytile*8 + xtile];
uint8_t attr = meta[0x40 + (((ytile/4)<<1) + (xtile/4))];
if (ytile & 2) attr>>=4;
if (xtile & 2) attr>>=2;
attr &= 3;
int x;
int y;
x = xscreen*8;
x = (x+xmeta)*8;
x = (x+xtile)*8;
y = yscreen*8;
y = (y+ymeta)*8;
y = (y+ytile)*8;
drawtile(chr,palette,tileid,attr,x,y);
}
}
}
}
}
}
}
void drawcave(uint8_t *prg,uint8_t *this_prg, uint8_t *chr, uint8_t *palette, uint8_t *layout, uint8_t *metatbllo, uint8_t *metatblhi)
{
bmpwidth = 40*4*8;
bmpheight = 50*4*8;
bitmap = malloc(bmpwidth*bmpheight*sizeof(*bitmap));
memset(bitmap, 0x0f, bmpwidth*bmpheight*sizeof(*bitmap));
for (int ymeta = 0; ymeta < 50; ymeta++)
{
for (int xmeta = 0; xmeta < 40; xmeta++)
{
for (int ytile = 0; ytile < 4; ytile++)
{
for (int xtile = 0; xtile < 4; xtile++)
{
uint8_t metaid = prg[0x132d + layout[(ymeta*40)+xmeta]];
uint8_t *meta = this_prg + ((metatbllo[metaid]) | ((metatblhi[metaid]&0x1f) << 8));
uint8_t tileid = meta[(ytile*4)+xtile];
uint8_t attr = meta[0x10];
if (ytile & 2) attr>>=4;
if (xtile & 2) attr>>=2;
attr &= 3;
int x;
int y;
x = xmeta*4;
x = (x+xtile)*8;
y = ymeta*4;
y = (y+ytile)*8;
drawtile(chr,palette,tileid,attr,x,y);
}
}
}
}
}
int main(int argc, char *argv[])
{
FILE *f = fopen("Mad Max (U) [!].nes", "rb");
if (!f)
{
perror("rom opening error");
return EXIT_FAILURE;
}
fseek(f, 0x10, SEEK_SET);
fread(prg, 1, 0x20000, f);
fseek(f, (0x14*0x400)+0x20010, SEEK_SET);
fread(main_chr, 1, 0x1000, f);
fseek(f, (0x24*0x400)+0x20010, SEEK_SET);
fread(cave_chr, 1, 0x1000, f);
fseek(f, (0x3c*0x400)+0x20010, SEEK_SET);
fread(arena_chr, 1, 0x1000, f);
fclose(f);
/************ main levels ************/
uint8_t *main_prg = prg+(0x2*0x2000);
for (int level = 0; level < 3; level++)
{
fprintf(stderr, "Writing main level %i.\n",level+1);
const uint16_t levelpalbase[] = {0x00e5, 0x0111, 0x0139};
uint8_t *levelpal = main_prg + levelpalbase[level];
uint8_t *levellayout = main_prg + (get16(main_prg+0x225b+(level*2))&0x3fff);
/* modify level layout to make arena entrance open */
for (int i = 0; i < 0x40; i++)
{
uint8_t b = levellayout[i];
if (b == 0x35 || b == 0x36) levellayout[i] -= 0x10;
}
drawlevel(main_prg,main_chr, levelpal,levellayout, main_prg+0x21db, main_prg+0x346b,main_prg+0x34ac);
char fnam[32];
sprintf(fnam, "road-war-%i.png",level+1);
writepng(fnam);
fflush(NULL);
}
/************ arenas ************/
uint8_t *arena_prg = prg+(0xc*0x2000);
for (int level = 0; level < 3; level++)
{
fprintf(stderr, "Writing arena %i.\n",level+1);
const uint16_t levelpalbase[] = {0x0442, 0x0456, 0x0466};
uint8_t *levelpal = arena_prg + levelpalbase[level];
uint8_t *levellayout = arena_prg + (get16(arena_prg+0x2443+(level*2))&0x3fff);
drawlevel(arena_prg,arena_chr, levelpal,levellayout, arena_prg+0x2363, arena_prg+0x329e,arena_prg+0x32d1);
char fnam[32];
sprintf(fnam, "arena-%i.png",level+1);
writepng(fnam);
fflush(NULL);
}
/*********** caves **************/
uint8_t *cave_prg = prg+(0x4*0x2000);
for (int cave = 0; cave < 6*2; cave++)
{
fprintf(stderr, "Writing cave %i.\n",cave+1);
const uint16_t cavebase[] = {0x17f6,0x1026};
uint8_t *this_cave_prg = cave_prg + (cave/2 + 1)*0x2000;
uint8_t *layout = this_cave_prg+cavebase[cave % 2];
drawcave(cave_prg,this_cave_prg,cave_chr, cave_prg+0x11f5, layout, this_cave_prg+0x0db7,this_cave_prg+0x0dfe);
char fnam[32];
sprintf(fnam, "caves-%02i.png",cave+1);
writepng(fnam);
fflush(NULL);
}
}
unsigned char font[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x40, 0x70, 0x1a,
0x7a, 0x0e, 0x0a, 0x0a, 0x70, 0x40, 0x70, 0x12, 0x74, 0x08, 0x14, 0x22,
0x70, 0x40, 0x70, 0x42, 0x74, 0x08, 0x14, 0x22, 0x70, 0x40, 0x70, 0x40,
0x7e, 0x04, 0x04, 0x04, 0xe0, 0x80, 0xe0, 0x8c, 0xf2, 0x12, 0x12, 0x0d,
0x20, 0x50, 0x70, 0x52, 0x54, 0x18, 0x14, 0x12, 0x70, 0x48, 0x70, 0x48,
0x74, 0x04, 0x04, 0x07, 0x70, 0x48, 0x70, 0x4f, 0x74, 0x07, 0x01, 0x07,
0x50, 0x50, 0x70, 0x50, 0x5e, 0x04, 0x04, 0x04, 0x40, 0x40, 0x40, 0x4e,
0x78, 0x0c, 0x08, 0x08, 0x50, 0x50, 0x70, 0x50, 0x51, 0x1b, 0x15, 0x11,
0x3c, 0x40, 0x40, 0x44, 0x38, 0x08, 0x08, 0x0f, 0x38, 0x40, 0x40, 0x3e,
0x09, 0x0e, 0x0a, 0x09, 0x70, 0x40, 0x70, 0x10, 0x7c, 0x12, 0x12, 0x0c,
0x70, 0x40, 0x70, 0x10, 0x7e, 0x04, 0x04, 0x0e, 0x70, 0x48, 0x48, 0x4f,
0x74, 0x07, 0x04, 0x07, 0x70, 0x48, 0x48, 0x4a, 0x76, 0x02, 0x02, 0x07,
0x70, 0x48, 0x48, 0x4e, 0x71, 0x06, 0x08, 0x0f, 0x70, 0x48, 0x48, 0x4f,
0x71, 0x07, 0x01, 0x0f, 0x70, 0x48, 0x48, 0x4a, 0x76, 0x0a, 0x1f, 0x02,
0x48, 0x68, 0x58, 0x49, 0x4a, 0x0c, 0x0a, 0x09, 0x70, 0x40, 0x70, 0x10,
0x79, 0x0d, 0x0b, 0x09, 0x70, 0x40, 0x70, 0x4e, 0x79, 0x0e, 0x09, 0x0e,
0x38, 0x40, 0x40, 0x38, 0x09, 0x0d, 0x0b, 0x09, 0x70, 0x40, 0x70, 0x40,
0x71, 0x1b, 0x15, 0x11, 0x70, 0x40, 0x70, 0x1c, 0x72, 0x1c, 0x12, 0x1c,
0x70, 0x40, 0x70, 0x40, 0x7e, 0x10, 0x10, 0x0e, 0x00, 0x08, 0x04, 0x7e,
0x04, 0x08, 0x00, 0x00, 0x00, 0x10, 0x20, 0x7e, 0x20, 0x10, 0x00, 0x00,
0x00, 0x08, 0x1c, 0x2a, 0x08, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x08,
0x2a, 0x1c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x08, 0x00, 0x24, 0x24, 0x24, 0x00,
0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x7e, 0x24, 0x7e, 0x24, 0x24, 0x00,
0x08, 0x1e, 0x28, 0x1c, 0x0a, 0x3c, 0x08, 0x00, 0x00, 0x62, 0x64, 0x08,
0x10, 0x26, 0x46, 0x00, 0x30, 0x48, 0x48, 0x30, 0x4a, 0x44, 0x3a, 0x00,
0x04, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x10,
0x10, 0x08, 0x04, 0x00, 0x20, 0x10, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00,
0x08, 0x2a, 0x1c, 0x3e, 0x1c, 0x2a, 0x08, 0x00, 0x00, 0x08, 0x08, 0x3e,
0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10,
0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x18, 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00,
0x3c, 0x42, 0x46, 0x5a, 0x62, 0x42, 0x3c, 0x00, 0x08, 0x18, 0x28, 0x08,
0x08, 0x08, 0x3e, 0x00, 0x3c, 0x42, 0x02, 0x0c, 0x30, 0x40, 0x7e, 0x00,
0x3c, 0x42, 0x02, 0x1c, 0x02, 0x42, 0x3c, 0x00, 0x04, 0x0c, 0x14, 0x24,
0x7e, 0x04, 0x04, 0x00, 0x7e, 0x40, 0x78, 0x04, 0x02, 0x44, 0x38, 0x00,
0x1c, 0x20, 0x40, 0x7c, 0x42, 0x42, 0x3c, 0x00, 0x7e, 0x42, 0x04, 0x08,
0x10, 0x10, 0x10, 0x00, 0x3c, 0x42, 0x42, 0x3c, 0x42, 0x42, 0x3c, 0x00,
0x3c, 0x42, 0x42, 0x3e, 0x02, 0x04, 0x38, 0x00, 0x00, 0x00, 0x08, 0x00,
0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x08, 0x10,
0x0e, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x7e, 0x00,
0x7e, 0x00, 0x00, 0x00, 0x70, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x70, 0x00,
0x3c, 0x42, 0x02, 0x0c, 0x10, 0x00, 0x10, 0x00, 0x1c, 0x22, 0x4a, 0x56,
0x4c, 0x20, 0x1e, 0x00, 0x18, 0x24, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00,
0x7c, 0x22, 0x22, 0x3c, 0x22, 0x22, 0x7c, 0x00, 0x1c, 0x22, 0x40, 0x40,
0x40, 0x22, 0x1c, 0x00, 0x78, 0x24, 0x22, 0x22, 0x22, 0x24, 0x78, 0x00,
0x7e, 0x40, 0x40, 0x78, 0x40, 0x40, 0x7e, 0x00, 0x7e, 0x40, 0x40, 0x78,
0x40, 0x40, 0x40, 0x00, 0x1c, 0x22, 0x40, 0x4e, 0x42, 0x22, 0x1c, 0x00,
0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x1c, 0x08, 0x08, 0x08,
0x08, 0x08, 0x1c, 0x00, 0x0e, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00,
0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x40, 0x40, 0x40, 0x40,
0x40, 0x40, 0x7e, 0x00, 0x42, 0x66, 0x5a, 0x5a, 0x42, 0x42, 0x42, 0x00,
0x42, 0x62, 0x52, 0x4a, 0x46, 0x42, 0x42, 0x00, 0x18, 0x24, 0x42, 0x42,
0x42, 0x24, 0x18, 0x00, 0x7c, 0x42, 0x42, 0x7c, 0x40, 0x40, 0x40, 0x00,
0x18, 0x24, 0x42, 0x42, 0x4a, 0x24, 0x1a, 0x00, 0x7c, 0x42, 0x42, 0x7c,
0x48, 0x44, 0x42, 0x00, 0x3c, 0x42, 0x40, 0x3c, 0x02, 0x42, 0x3c, 0x00,
0x3e, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x42, 0x42, 0x42, 0x42,
0x42, 0x42, 0x3c, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x00,
0x42, 0x42, 0x42, 0x5a, 0x5a, 0x66, 0x42, 0x00, 0x42, 0x42, 0x24, 0x18,
0x24, 0x42, 0x42, 0x00, 0x22, 0x22, 0x22, 0x1c, 0x08, 0x08, 0x08, 0x00,
0x7e, 0x02, 0x04, 0x18, 0x20, 0x40, 0x7e, 0x00, 0x3c, 0x20, 0x20, 0x20,
0x20, 0x20, 0x3c, 0x00, 0x22, 0x22, 0x14, 0x3e, 0x08, 0x3e, 0x08, 0x00,
0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x3c, 0x00, 0x08, 0x14, 0x22, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00,
0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x04,
0x3c, 0x44, 0x3a, 0x00, 0x40, 0x40, 0x5c, 0x62, 0x42, 0x62, 0x5c, 0x00,
0x00, 0x00, 0x3c, 0x42, 0x40, 0x42, 0x3c, 0x00, 0x02, 0x02, 0x3a, 0x46,
0x42, 0x46, 0x3a, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x7e, 0x40, 0x3c, 0x00,
0x0c, 0x12, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x3a, 0x46,
0x46, 0x3a, 0x02, 0x3c, 0x40, 0x40, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x00,
0x08, 0x00, 0x18, 0x08, 0x08, 0x08, 0x1c, 0x00, 0x04, 0x00, 0x0c, 0x04,
0x04, 0x04, 0x44, 0x38, 0x40, 0x40, 0x44, 0x48, 0x50, 0x68, 0x44, 0x00,
0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1c, 0x00, 0x00, 0x00, 0x76, 0x49,
0x49, 0x49, 0x49, 0x00, 0x00, 0x00, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x00,
0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x5c, 0x62,
0x62, 0x5c, 0x40, 0x40, 0x00, 0x00, 0x3a, 0x46, 0x46, 0x3a, 0x02, 0x02,
0x00, 0x00, 0x5c, 0x62, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x3e, 0x40,
0x3c, 0x02, 0x7c, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x12, 0x0c, 0x00,
0x00, 0x00, 0x42, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, 0x00, 0x42, 0x42,
0x42, 0x24, 0x18, 0x00, 0x00, 0x00, 0x41, 0x49, 0x49, 0x49, 0x36, 0x00,
0x00, 0x00, 0x42, 0x24, 0x18, 0x24, 0x42, 0x00, 0x00, 0x00, 0x42, 0x42,
0x46, 0x3a, 0x02, 0x3c, 0x00, 0x00, 0x7e, 0x04, 0x18, 0x20, 0x7e, 0x00,
0x0e, 0x10, 0x10, 0x20, 0x10, 0x10, 0x0e, 0x00, 0x08, 0x08, 0x00, 0x00,
0x00, 0x08, 0x08, 0x00, 0x70, 0x08, 0x08, 0x04, 0x08, 0x08, 0x70, 0x00,
0x30, 0x49, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
unsigned int ______0_snes_font_rom_len = 1024;
png_color m_pal[] = {
{0x66, 0x66, 0x66},
{0x00, 0x2a, 0x88},
{0x14, 0x12, 0xa7},
{0x3b, 0x00, 0xa4},
{0x5c, 0x00, 0x7e},
{0x6e, 0x00, 0x40},
{0x6c, 0x06, 0x00},
{0x56, 0x1d, 0x00},
{0x33, 0x35, 0x00},
{0x0b, 0x48, 0x00},
{0x00, 0x52, 0x00},
{0x00, 0x4f, 0x08},
{0x00, 0x40, 0x4d},
{0x00, 0x00, 0x00},
{0x00, 0x00, 0x00},
{0x00, 0x00, 0x00},
{0xad, 0xad, 0xad},
{0x15, 0x5f, 0xd9},
{0x42, 0x40, 0xff},
{0x75, 0x27, 0xfe},
{0xa0, 0x1a, 0xcc},
{0xb7, 0x1e, 0x7b},
{0xb5, 0x31, 0x20},
{0x99, 0x4e, 0x00},
{0x6b, 0x6d, 0x00},
{0x38, 0x87, 0x00},
{0x0c, 0x93, 0x00},
{0x00, 0x8f, 0x32},
{0x00, 0x7c, 0x8d},
{0x00, 0x00, 0x00},
{0x00, 0x00, 0x00},
{0x00, 0x00, 0x00},
{0xff, 0xfe, 0xff},
{0x64, 0xb0, 0xff},
{0x92, 0x90, 0xff},
{0xc6, 0x76, 0xff},
{0xf3, 0x6a, 0xff},
{0xfe, 0x6e, 0xcc},
{0xfe, 0x81, 0x70},
{0xea, 0x9e, 0x22},
{0xbc, 0xbe, 0x00},
{0x88, 0xd8, 0x00},
{0x5c, 0xe4, 0x30},
{0x45, 0xe0, 0x82},
{0x48, 0xcd, 0xde},
{0x4f, 0x4f, 0x4f},
{0x00, 0x00, 0x00},
{0x00, 0x00, 0x00},
{0xff, 0xfe, 0xff},
{0xc0, 0xdf, 0xff},
{0xd3, 0xd2, 0xff},
{0xe8, 0xc8, 0xff},
{0xfb, 0xc2, 0xff},
{0xfe, 0xc4, 0xea},
{0xfe, 0xcc, 0xc5},
{0xf7, 0xd8, 0xa5},
{0xe4, 0xe5, 0x94},
{0xcf, 0xef, 0x96},
{0xbd, 0xf4, 0xab},
{0xb3, 0xf3, 0xcc},
{0xb5, 0xeb, 0xf2},
{0xb8, 0xb8, 0xb8},
{0x00, 0x00, 0x00},
{0x00, 0x00, 0x00}
};
unsigned int m_pal_len = 192;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment