From 458ecc883197fcd7c4efc5fb16399dee2e63b7dc Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Fri, 20 Jul 2018 21:51:02 +0800 Subject: [PATCH] Import blues from cf84da6f --- decode.c | 56 ++++++++------ decode.h | 4 +- game.c | 61 +++++++++++++-- game.h | 2 +- level.c | 31 ++++---- main.c | 2 +- resource.c | 7 ++ resource.h | 2 + screen.c | 59 ++++++++++---- staticres.c | 216 ++++++++++++++++++++++++++++++++++++++++++++++++++++ sys_sdl2.c | 2 +- 11 files changed, 373 insertions(+), 69 deletions(-) diff --git a/decode.c b/decode.c index 6de03f3..52457ef 100644 --- a/decode.c +++ b/decode.c @@ -1,21 +1,21 @@ #include "decode.h" -void decode_ega_spr(const uint8_t *src, int src_pitch, int w, int h, uint8_t *dst, int dst_pitch, int dst_x, int dst_y) { +void decode_spr(const uint8_t *src, int src_pitch, int w, int h, int depth, uint8_t *dst, int dst_pitch, int dst_x, int dst_y, bool amiga) { assert((src_pitch & 7) == 0); src_pitch /= 8; assert((w & 7) == 0); w /= 8; dst += dst_y * dst_pitch + dst_x; - const int bitplane_size = w * h; + const int bitplane_size = src_pitch * h; for (int y = 0; y < h; ++y) { for (int x = 0; x < w; ++x) { for (int i = 0; i < 8; ++i) { int color = 0; const int mask = 1 << (7 - i); - for (int bit = 0; bit < 4; ++bit) { + for (int bit = 0; bit < depth; ++bit) { if (src[bit * bitplane_size] & mask) { - color |= 1 << (3 - bit); + color |= 1 << (amiga ? bit : (3 - bit)); } } dst[x * 8 + i] = color; @@ -27,27 +27,6 @@ void decode_ega_spr(const uint8_t *src, int src_pitch, int w, int h, uint8_t *ds } } -void decode_amiga_planar8(const uint8_t *src, int w, int h, int depth, uint8_t *dst, int dst_pitch, int dst_x, int dst_y) { - dst += dst_y * dst_pitch + dst_x; - const int plane_size = w * h; - for (int y = 0; y < h; ++y) { - for (int x = 0; x < w; ++x) { - for (int i = 0; i < 8; ++i) { - int color = 0; - const int mask = 1 << (7 - i); - for (int bit = 0; bit < depth; ++bit) { - if (src[bit * plane_size] & mask) { - color |= 1 << bit; - } - } - dst[x * 8 + i] = color; - } - ++src; - } - dst += dst_pitch; - } -} - void decode_amiga_blk(const uint8_t *src, uint8_t *dst, int dst_pitch) { uint16_t data[4]; for (int y = 0; y < 16; ++y) { @@ -67,3 +46,30 @@ void decode_amiga_blk(const uint8_t *src, uint8_t *dst, int dst_pitch) { dst += dst_pitch; } } + +void decode_amiga_gfx(uint8_t *dst, int dst_pitch, int w, int h, int depth, const uint8_t *src, int src_pitch, uint8_t palette_mask, uint16_t gfx_mask) { + assert((src_pitch & 15) == 0); + src_pitch /= 16; + assert((w & 15) == 0); + w /= 16; + const int plane_size = src_pitch * 2 * h; + for (int y = 0; y < h; ++y) { + for (int x = 0; x < w; ++x) { + for (int i = 0; i < 16; ++i) { + const int mask = 1 << (15 - i); + if (gfx_mask & mask) { + int color = 0; + for (int bit = 0; bit < depth; ++bit) { + if (READ_BE_UINT16(src + bit * plane_size) & mask) { + color |= 1 << bit; + } + } + dst[x * 16 + i] = palette_mask | color; + } + } + src += 2; + } + src += src_pitch - w; + dst += dst_pitch; + } +} diff --git a/decode.h b/decode.h index 3fb759a..af88610 100644 --- a/decode.h +++ b/decode.h @@ -4,8 +4,8 @@ #include "intern.h" -extern void decode_ega_spr(const uint8_t *src, int src_pitch, int w, int h, uint8_t *dst, int dst_pitch, int dst_x, int dst_y); -extern void decode_amiga_planar8(const uint8_t *src, int w, int h, int depth, uint8_t *dst, int dst_pitch, int dst_x, int dst_y); +extern void decode_spr(const uint8_t *src, int src_pitch, int w, int h, int depth, uint8_t *dst, int dst_pitch, int dst_x, int dst_y, bool amiga); extern void decode_amiga_blk(const uint8_t *src, uint8_t *dst, int dst_pitch); +extern void decode_amiga_gfx(uint8_t *dst, int dst_pitch, int w, int h, int depth, const uint8_t *src, const int src_pitch, uint8_t palette_mask, uint16_t gfx_mask); #endif /* DECODE_H__ */ diff --git a/game.c b/game.c index 7b3a645..a0c5620 100644 --- a/game.c +++ b/game.c @@ -3,8 +3,14 @@ #include "resource.h" #include "sys.h" +// palette colors 0..15 +static const uint16_t _colors_180_data[] = { + 0x180,0x000,0x182,0xfff,0x184,0xf86,0x186,0x000,0x188,0xf70,0x18a,0xc50,0x18c,0xa20,0x18e,0x620, + 0x190,0xeb8,0x192,0xb64,0x194,0x0ef,0x196,0x0bc,0x198,0x078,0x19a,0x056,0x19c,0x045,0x19e,0x034 +}; + // palette colors 16..31 -static const uint16_t _colors2_data[] = { +static const uint16_t _colors_1a0_data[] = { 0x1a0,0x000,0x1a2,0xfdd,0x1a4,0x678,0x1a6,0x046,0x1a8,0x000,0x1aa,0xa20,0x1ac,0xf87,0x1ae,0x955, 0x1b0,0xbcf,0x1b2,0xfca,0x1b4,0x30a,0x1b6,0xa9a,0x1b8,0x900,0x1ba,0x666,0x1bc,0x747,0x1be,0x020 }; @@ -252,11 +258,11 @@ static void do_inter_screen() { do_inter_screen_helper(xpos[i], ypos[i], 0); } } - if (g_vars.level == 5) { + if (g_vars.level == MAX_LEVELS - 1) { do_inter_screen_helper(xpos[g_vars.level], ypos[g_vars.level], 0); } fade_in_palette(); - if (g_vars.level > 0 && g_vars.level < 5) { + if (g_vars.level > 0 && g_vars.level < MAX_LEVELS - 1) { do_inter_screen_helper(xpos[g_vars.level - 1], ypos[g_vars.level - 1], 1); } g_vars.screen_draw_offset = 0x2000; @@ -289,16 +295,55 @@ void game_main() { screen_flip(); screen_init(); g_vars.start_level = 0; - load_sqv("sprite.sqv", g_res.spr_sqv, 0); - if (g_options.amiga_sprites) { + if (g_options.amiga_data) { load_spr("sprite", g_res.spr_sqv, 0); - // load_spr("objet", g_res.spr_sqv, 101); + load_spr("objet", g_res.spr_sqv + SPRITE_SIZE, 101); + } else { + load_sqv("sprite.sqv", g_res.spr_sqv, 0); + } + if (g_options.amiga_status_bar) { + uint16_t palette[16]; + for (int i = 0; i < 16; ++i) { + assert(_colors_180_data[i * 2] == 0x180 + i * 2); + palette[i] = _colors_180_data[i * 2 + 1]; + } + g_sys.set_palette_amiga(palette, 32); + g_res.spr_count = 120; + extern const uint8_t icon6e92[]; // top or bottom status bar + g_res.spr_frames[123] = icon6e92; + g_res.spr_frames[124] = icon6e92; + extern const uint8_t icon72de[]; // jake + g_res.spr_frames[115] = icon72de; + extern const uint8_t icon73a6[]; // elwood + g_res.spr_frames[117] = icon73a6; + extern const uint8_t icon6ef6[]; // heart + g_res.spr_frames[120] = icon6ef6; + extern const uint8_t icon740a[]; // instrument level 1 + g_res.spr_frames[135] = icon740a; + extern const uint8_t icon746e[]; // instrument level 2 + g_res.spr_frames[136] = icon746e; + extern const uint8_t icon74d2[]; // instrument level 3 + g_res.spr_frames[137] = icon74d2; + extern const uint8_t icon7536[]; // instrument level 4 + g_res.spr_frames[138] = icon7536; + extern const uint8_t icon759a[]; // instrument level 5 + g_res.spr_frames[139] = icon759a; + extern const uint8_t icon75fe[]; // instrument level 1 (found) + g_res.spr_frames[140] = icon75fe; + extern const uint8_t icon7662[]; // instrument level 2 (found) + g_res.spr_frames[141] = icon7662; + extern const uint8_t icon76c6[]; // instrument level 3 (found) + g_res.spr_frames[142] = icon76c6; + extern const uint8_t icon772a[]; // instrument level 4 (found) + g_res.spr_frames[143] = icon772a; + extern const uint8_t icon778e[]; // instrument level 5 (found) + g_res.spr_frames[144] = icon778e; } if (g_options.amiga_colors) { uint16_t palette[16]; for (int i = 0; i < 16; ++i) { - assert(_colors2_data[i * 2] == 0x1a0 + i * 2); - palette[i] = _colors2_data[i * 2 + 1]; + assert(_colors_1a0_data[i * 2] == 0x1a0 + i * 2); + palette[i] = _colors_1a0_data[i * 2 + 1]; } g_sys.set_palette_amiga(palette, 16); } diff --git a/game.h b/game.h index a182d85..feab382 100644 --- a/game.h +++ b/game.h @@ -42,8 +42,8 @@ struct options_t { int start_ypos16; bool amiga_copper_bars; bool amiga_colors; - bool amiga_sprites; bool amiga_data; + bool amiga_status_bar; }; extern struct options_t g_options; diff --git a/level.c b/level.c index 64216d8..aecad1f 100644 --- a/level.c +++ b/level.c @@ -60,26 +60,25 @@ static const struct { void load_level_data(int num) { print_debug(DBG_GAME, "load_level_data num %d", num); - if (num == 0 && (g_res.flags & RESOURCE_FLAGS_DEMO)) { - load_ck("demomag.ck1", 0x6000); - load_ck("demomag.ck2", 0x8000); - load_sql("demomag.sql"); - } else { - load_ck(_levels[num].ck1, 0x6000); - load_ck(_levels[num].ck2, 0x8000); - load_sql(_levels[num].sql); - } if (g_options.amiga_data) { load_blk(_levels_amiga[num].blk); read_file(_levels_amiga[num].tbl, g_res.sql, 0); load_bin(_levels_amiga[num].bin); - } else { - load_bin(_levels[num].bin); - } - load_avt(_levels[num].avt, g_res.avt_sqv, 0); - if (g_options.amiga_sprites) { + load_m(_levels_amiga[num].m); + // .avt load_spr(_levels_amiga[num].ennemi, g_res.tmp, SPRITES_COUNT); } else { + if (num == 0 && (g_res.flags & RESOURCE_FLAGS_DEMO)) { // DOS demo + load_ck("demomag.ck1", 0x6000); + load_ck("demomag.ck2", 0x8000); + load_sql("demomag.sql"); + } else { + load_ck(_levels[num].ck1, 0x6000); + load_ck(_levels[num].ck2, 0x8000); + load_sql(_levels[num].sql); + } + load_bin(_levels[num].bin); + load_avt(_levels[num].avt, g_res.avt_sqv, 0); load_sqv(_levels[num].sqv, g_res.tmp, SPRITES_COUNT); } memcpy(g_vars.level_xpos, _levels[num].xpos, MAX_OBJECTS * sizeof(int16_t)); @@ -2221,7 +2220,9 @@ void do_level() { if (1) { // if (_draw_last_sprite_flag != 0) { screen_clear_last_sprite(); screen_redraw_sprites(); - draw_foreground_tiles(); + if (!g_options.amiga_data) { + draw_foreground_tiles(); + } } ++g_vars.level_loop_counter; if (1) { // (!_screen_panel_drawn_flag) { diff --git a/main.c b/main.c index 07f6837..5ded4c7 100644 --- a/main.c +++ b/main.c @@ -27,8 +27,8 @@ int main(int argc, char *argv[]) { g_options.start_ypos16 = -1; g_options.amiga_copper_bars = true; g_options.amiga_colors = true; - // g_options.amiga_sprites = true; // g_options.amiga_data = true; + g_options.amiga_status_bar = true; const char *data_path = DEFAULT_DATA_PATH; int scale_factor = DEFAULT_SCALE_FACTOR; const char *scale_filter = DEFAULT_SCALE_FILTER; diff --git a/resource.c b/resource.c index edb5e8b..8ee8c36 100644 --- a/resource.c +++ b/resource.c @@ -259,6 +259,13 @@ void load_img(const char *filename) { memcpy(g_res.vga, g_res.tmp + 32000, 64000); } +void load_m(const char *filename) { + const int filesize = read_file(filename, g_res.tmp, 0); + const int count = READ_BE_UINT16(g_res.tmp); + assert(filesize == 2 + count * 32); + // 1-bit 16x16 mask +} + static int load_spr_helper(int offset, const uint8_t *ptr, uint16_t (*read16)(const uint8_t *), int depth) { const int count = read16(ptr); ptr += 6; print_debug(DBG_RESOURCE, "spr count %d", count); diff --git a/resource.h b/resource.h index c852aaa..8dd7435 100644 --- a/resource.h +++ b/resource.h @@ -24,6 +24,7 @@ struct trigger_t { #define MAX_AVT 50 #define MAX_SPR_FRAMES 200 #define MAX_TRIGGERS 256 +#define SPRITE_SIZE 35566 #define SOUND_SIZE 29376 #define SPRITES_COUNT 146 @@ -57,6 +58,7 @@ extern void load_bin(const char *filename); extern void load_blk(const char *filename); extern void load_ck(const char *filename, uint16_t offset); extern void load_img(const char *filename); +extern void load_m(const char *filename); extern void load_spr(const char *filename, uint8_t *dst, int offset); extern void load_sqv(const char *filename, uint8_t *dst, int offset); extern void load_sql(const char *filename); diff --git a/screen.c b/screen.c index d104a48..659a116 100644 --- a/screen.c +++ b/screen.c @@ -55,13 +55,23 @@ void screen_vsync() { } void screen_draw_frame(const uint8_t *frame, int a, int b, int c, int d) { - const int h = READ_LE_UINT16(frame - 4); - assert(a <= h); - const int w = READ_LE_UINT16(frame - 2); - assert(b <= w); const int x = c; const int y = d + a + 2; - decode_ega_spr(frame, w, b, h, g_res.vga, GAME_SCREEN_W, x, y); + if (g_options.amiga_status_bar) { + if (frame == g_res.spr_frames[123] || frame == g_res.spr_frames[124]) { // top or bottom status bar + for (int x = 0; x < GAME_SCREEN_W; x += 16) { + decode_amiga_gfx(g_res.vga + y * GAME_SCREEN_W + x, GAME_SCREEN_W, 16, 12, 4, frame, 16, 0x20, 0xFFFF); + } + } else { + decode_amiga_gfx(g_res.vga + y * GAME_SCREEN_W + x, GAME_SCREEN_W, 16, 12, 4, frame, 16, 0x20, 0xFFFF); + } + } else { + const int h = READ_LE_UINT16(frame - 4); + assert(a <= h); + const int w = READ_LE_UINT16(frame - 2); + assert(b <= w); + decode_spr(frame, w, b, h, 4, g_res.vga, GAME_SCREEN_W, x, y, false); + } } void screen_flip() { @@ -136,11 +146,31 @@ void screen_do_transition2() { print_warning("screen_do_transition2"); } +static void draw_number_amiga(int digit, int x, int y) { + extern const uint8_t icon7086[]; // 01 + extern const uint8_t icon70ea[]; // 23 + extern const uint8_t icon714e[]; // 45 + extern const uint8_t icon71b2[]; // 67 + extern const uint8_t icon7216[]; // 89 + static const uint8_t *icons[] = { icon7086, icon70ea, icon714e, icon71b2, icon7216 }; + uint16_t mask = 0xFF00; + if (digit & 1) { + x -= 8; + mask >>= 8; + } + decode_amiga_gfx(g_res.vga + y * GAME_SCREEN_W + x, GAME_SCREEN_W, 16, 12, 4, icons[digit >> 1], 16, 0x20, mask); +} + void screen_draw_number(int num, int x, int y, int color) { - extern const uint8_t font_data[]; y += TILEMAP_OFFSET_Y; - decode_ega_spr(font_data + (num / 10) * 32, 8, 8, 8, g_res.vga, GAME_SCREEN_W, x - 8, y); - decode_ega_spr(font_data + (num % 10) * 32, 8, 8, 8, g_res.vga, GAME_SCREEN_W, x, y); + if (g_options.amiga_status_bar) { + draw_number_amiga(num / 10, x - 8, y - 2); + draw_number_amiga(num % 10, x, y - 2); + } else { + extern const uint8_t font_data[]; + decode_spr(font_data + (num / 10) * 32, 8, 8, 8, 4, g_res.vga, GAME_SCREEN_W, x - 8, y, false); + decode_spr(font_data + (num % 10) * 32, 8, 8, 8, 4, g_res.vga, GAME_SCREEN_W, x, y, false); + } } void screen_add_game_sprite1(int x, int y, int frame) { @@ -163,6 +193,7 @@ static void decode_graphics(int spr_type, int start, int end) { struct sys_rect_t r[MAX_SPR_FRAMES]; uint8_t *data = (uint8_t *)calloc(MAX_SPRITESHEET_W * MAX_SPRITESHEET_H, 1); if (data) { + const int depth = g_options.amiga_data && (start == 0) ? 3 : 4; int current_x = 0; int max_w = 0; int current_y = 0; @@ -188,11 +219,7 @@ static void decode_graphics(int spr_type, int start, int end) { max_h = h; } } - if (g_options.amiga_sprites) { - decode_amiga_planar8(ptr, w / 8, h, (start == 0) ? 3 : 4, data, MAX_SPRITESHEET_W, current_x, current_y); - } else { - decode_ega_spr(ptr, w, w, h, data, MAX_SPRITESHEET_W, current_x, current_y); - } + decode_spr(ptr, w, w, h, depth, data, MAX_SPRITESHEET_W, current_x, current_y, g_options.amiga_data); r[j].x = current_x; r[j].y = current_y; r[j].w = w; @@ -205,7 +232,7 @@ static void decode_graphics(int spr_type, int start, int end) { assert(max_w <= MAX_SPRITESHEET_W); assert(current_y + max_h <= MAX_SPRITESHEET_H); render_unload_sprites(spr_type); - const int palette_offset = (g_options.amiga_sprites && start == 0) ? 16 : 0; + const int palette_offset = (g_options.amiga_data && start == 0) ? 16 : 0; render_load_sprites(spr_type, end - start, r, data, MAX_SPRITESHEET_W, current_y + max_h, palette_offset); free(data); } @@ -213,7 +240,7 @@ static void decode_graphics(int spr_type, int start, int end) { void screen_load_graphics() { if (g_res.spr_count <= SPRITES_COUNT) { - decode_graphics(RENDER_SPR_GAME, 0, SPRITES_COUNT); + decode_graphics(RENDER_SPR_GAME, 0, g_res.spr_count); } else { decode_graphics(RENDER_SPR_LEVEL, SPRITES_COUNT, g_res.spr_count); // foreground tiles @@ -224,7 +251,7 @@ void screen_load_graphics() { if (data) { const int pitch = g_res.avt_count * FG_TILE_W; for (int i = 0; i < g_res.avt_count; ++i) { - decode_ega_spr(g_res.avt[i], FG_TILE_W, FG_TILE_W, FG_TILE_H, data, pitch, i * FG_TILE_W, 0); + decode_spr(g_res.avt[i], FG_TILE_W, FG_TILE_W, FG_TILE_H, 4, data, pitch, i * FG_TILE_W, 0, false); r[i].x = i * FG_TILE_W; r[i].y = 0; r[i].w = FG_TILE_W; diff --git a/staticres.c b/staticres.c index 9628f5f..350d62f 100644 --- a/staticres.c +++ b/staticres.c @@ -1569,3 +1569,219 @@ const uint8_t font_data[] = { 0x06,0xDF,0x9F,0xCF,0xFF,0x0A,0x34,0x00,0x18,0x40,0xA8,0xF0,0x00,0x04,0xCB,0x00, 0xE7,0x77,0xDF,0xCF,0x07,0xFB,0x34,0xFF,0xE7,0x77,0xDF,0xCF,0x07,0xFB,0x34,0xFF }; +const uint8_t icon6e92[] = { + 0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff, + 0x00,0x00,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, + 0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff, + 0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon6ef6[] = { + 0xff,0xff,0x3f,0xf8,0xa3,0x13,0xec,0x1e,0x44,0x08,0x60,0x18,0x60,0x1f,0xd0,0x21, + 0x18,0x7c,0xf7,0x87,0x07,0xf0,0xff,0xff,0xff,0xff,0xf3,0x3f,0x70,0x3c,0x40,0x08, + 0x60,0x18,0xc0,0x0f,0xf0,0x3f,0xd8,0x61,0x0c,0xc0,0x0c,0xf8,0xff,0xff,0xff,0xff, + 0x00,0x00,0xe0,0x1f,0xc0,0x0f,0x80,0x07,0x80,0x07,0x00,0x00,0x00,0x00,0x20,0x1e, + 0xf0,0x3f,0xf8,0x7f,0xfc,0xff,0x00,0x00,0x00,0x00,0xec,0xdf,0xcf,0xcf,0xb3,0xf7, + 0x9b,0xe7,0xbf,0xf7,0xcf,0xcf,0xe7,0x9f,0xf3,0x3f,0xfb,0x7f,0xfc,0xff,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon6f5a[] = { + 0xff,0xff,0x3f,0xe0,0xa3,0x7f,0xec,0x60,0x44,0x6f,0x60,0xef,0x60,0xa0,0xd0,0x2f, + 0x18,0x60,0xf7,0xff,0x07,0xc0,0xff,0xff,0xff,0xff,0xf3,0x7f,0x70,0x60,0x40,0x40, + 0x60,0x6f,0xc0,0xc0,0xf0,0x8f,0xd8,0x4f,0x0c,0xe0,0x0c,0xc0,0xff,0xff,0xff,0xff, + 0x00,0x00,0xe0,0x7f,0xc0,0x7f,0x80,0x7f,0x80,0x70,0x00,0xf0,0x00,0xb0,0x20,0x30, + 0xf0,0x3f,0xf8,0x7f,0xfc,0xff,0x00,0x00,0x00,0x00,0xec,0xff,0xcf,0xff,0xb3,0xff, + 0x9b,0xff,0xbf,0xf0,0xcf,0xff,0xe7,0xbf,0xf3,0x3f,0xfb,0x7f,0xfc,0xff,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon6fbe[] = { + 0xff,0xff,0x3e,0x00,0xa3,0xff,0xef,0x00,0x47,0x1f,0x67,0x5f,0x63,0x60,0xd1,0x7f, + 0x19,0x00,0xf7,0xff,0x06,0x00,0xff,0xff,0xff,0xff,0xf3,0xff,0x71,0x00,0x43,0x00, + 0x62,0x1f,0xc6,0x60,0xf2,0x7f,0xd8,0x7f,0x0c,0x00,0x0c,0x00,0xff,0xff,0xff,0xff, + 0x00,0x00,0xe1,0xff,0xc1,0xff,0x83,0xff,0x83,0xe0,0x07,0x80,0x03,0x80,0x21,0x80, + 0xf1,0xff,0xf9,0xff,0xfd,0xff,0x00,0x00,0x00,0x00,0xed,0xff,0xcf,0xff,0xb3,0xff, + 0x9b,0xff,0xbf,0xe0,0xcf,0xff,0xe7,0xff,0xf3,0xff,0xfb,0xff,0xfd,0xff,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon7022[] = { + 0xff,0xff,0x3c,0x00,0xa7,0xff,0xee,0x00,0x4c,0x7f,0x6d,0x7f,0x65,0x80,0xd5,0xff, + 0x1f,0x00,0xf7,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x74,0x00,0x4c,0x00, + 0x68,0x7f,0xcd,0x80,0xf5,0xff,0xdd,0xff,0x0c,0x00,0x08,0x00,0xff,0xff,0xff,0xff, + 0x00,0x00,0xef,0xff,0xc7,0xff,0x8f,0xff,0x8f,0x80,0x0e,0x00,0x06,0x00,0x26,0x00, + 0xf7,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xef,0xff,0xcf,0xff,0xbf,0xff, + 0x9f,0xff,0xbf,0x80,0xcf,0xff,0xe7,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon7086[] = { + 0xff,0xff,0xff,0xff,0xdb,0xe7,0xbd,0xf7,0x99,0xef,0xdb,0xef,0xdb,0xef,0xdb,0xe7, + 0xbd,0xe7,0xdb,0xe7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xdb,0xef, + 0x99,0xe7,0x99,0xe7,0x99,0xe7,0x99,0xef,0xdb,0xef,0xff,0xff,0xff,0xff,0xff,0xff, + 0x00,0x00,0x3c,0x38,0x66,0x18,0x66,0x18,0x42,0x18,0x42,0x08,0x66,0x08,0x66,0x18, + 0x66,0x18,0x66,0x18,0x3c,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x24,0x00,0x24,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon70ea[] = { + 0xff,0xff,0xff,0xff,0xdb,0xdf,0xfd,0xfb,0xf9,0xf9,0x83,0xf3,0xdf,0xf9,0xdf,0xfb, + 0xbf,0xfd,0xdb,0xdb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfb,0xfb,0xf9, + 0xfb,0xfb,0xc7,0xe7,0x9f,0xfb,0x9f,0xf9,0xdf,0xfb,0xff,0xff,0xff,0xff,0xff,0xff, + 0x00,0x00,0x3c,0x3c,0x66,0x66,0x06,0x06,0x02,0x02,0x5e,0x14,0x60,0x06,0x60,0x06, + 0x60,0x06,0x66,0x66,0x3c,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x04,0x04,0x20,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon714e[] = { + 0xff,0xff,0xff,0xff,0xef,0xdb,0xd7,0xbf,0xdf,0xdf,0x8b,0x83,0x9b,0xf9,0x83,0xf9, + 0xfb,0xfd,0xfb,0xdb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf7,0xff,0xef,0xdf, + 0xcf,0x9f,0xdf,0xc7,0xdf,0xfb,0x81,0xfb,0xff,0xfb,0xff,0xff,0xff,0xff,0xff,0xff, + 0x00,0x00,0x18,0x3c,0x18,0x66,0x38,0x60,0x34,0x60,0x54,0x5e,0x64,0x02,0x72,0x02, + 0x04,0x06,0x04,0x66,0x04,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x20,0x20,0x00,0x04,0x0c,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon71b2[] = { + 0xff,0xff,0xff,0xff,0xdb,0xdb,0xbf,0xfd,0xdf,0xf1,0x9f,0xfb,0xc7,0xe3,0x99,0xf7, + 0x9d,0xc7,0xfb,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xdf,0xfb, + 0x9f,0xfb,0xdf,0xf3,0xe3,0xf7,0xdb,0xe7,0xdb,0xef,0xdf,0xcf,0xff,0xff,0xff,0xff, + 0x00,0x00,0x3c,0x3e,0x66,0x66,0x60,0x06,0x60,0x0a,0x60,0x0c,0x6e,0x14,0x66,0x18, + 0x66,0x28,0x66,0x30,0x3c,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x04,0x00,0x00,0x10,0x08,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon7216[] = { + 0xff,0xff,0xff,0xff,0xdf,0xdf,0xb9,0xb9,0x99,0x99,0xe3,0xe3,0xd9,0xf9,0xdb,0xfb, + 0xbd,0xfd,0xdb,0xdb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfb,0xfb,0xdb,0xdb, + 0xdb,0xdb,0xc7,0xc7,0x9b,0xfb,0x99,0xf9,0xdb,0xfb,0xff,0xff,0xff,0xff,0xff,0xff, + 0x00,0x00,0x3c,0x3c,0x66,0x66,0x66,0x66,0x66,0x66,0x6e,0x7e,0x66,0x06,0x66,0x06, + 0x66,0x06,0x66,0x66,0x3c,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon727a[] = { + 0xff,0xff,0x9f,0xf1,0xff,0xff,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x9f,0xfd,0xff,0xff,0xff,0xff,0xff,0x3f,0x80,0x3f,0x87,0xff, + 0xff,0x87,0xb9,0xff,0xfe,0x77,0xf6,0x0f,0xf3,0x1f,0xfb,0x87,0xff,0xab,0xff,0xff, + 0x00,0x00,0x60,0xce,0x02,0xc0,0x18,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x60,0x02,0x00,0x00,0x00,0x00,0x60,0xce,0x02,0xc2,0x18,0x0e, + 0x40,0x06,0x06,0x06,0x00,0x06,0x40,0x06,0x40,0x06,0x40,0x06,0x60,0x02,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon72de[] = { + 0xff,0xff,0x9f,0xf1,0xff,0xff,0xff,0xff,0xff,0x87,0xff,0xff,0xfe,0x77,0xf6,0x07, + 0xf3,0x07,0xfb,0x87,0x9f,0x81,0xff,0xff,0xff,0xff,0xff,0x3f,0xfc,0x3f,0xf7,0xff, + 0xff,0xef,0xf9,0xff,0xff,0xf7,0xff,0x1f,0xfb,0x87,0xff,0x8f,0xff,0xc7,0xff,0xff, + 0x00,0x00,0x60,0xce,0x03,0xc0,0x08,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x60,0x06,0x00,0x00,0x00,0x00,0x60,0xce,0x43,0xc2,0x48,0x0e, + 0x40,0x16,0x06,0x06,0x00,0x0e,0x40,0xe6,0x44,0x7e,0x40,0x76,0x60,0x3e,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon7342[] = { + 0xff,0xff,0x9f,0xe1,0xff,0xff,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xf7,0xff,0xbf,0xf1,0xff,0xff,0xff,0xff,0xe0,0xff,0x80,0x3f,0x8f,0x1f, + 0xe7,0xff,0xa6,0xff,0xfa,0x6f,0xfb,0x17,0xd9,0xbf,0xd1,0x0f,0xec,0x5f,0xff,0xff, + 0x00,0x00,0x7f,0x1e,0x02,0xc0,0x10,0xe0,0x08,0x00,0x01,0x00,0x01,0x00,0x00,0x00, + 0x22,0x00,0x28,0x80,0x50,0x0e,0x00,0x00,0x00,0x00,0x7f,0x1e,0x02,0xce,0x10,0xee, + 0x68,0x1e,0x01,0x02,0x41,0x06,0x40,0x06,0x62,0x0e,0x68,0x8e,0x50,0x0e,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon73a6[] = { + 0xff,0xff,0x8f,0xf1,0xff,0xff,0xf7,0xff,0xf7,0xff,0xfb,0x6f,0xfb,0x07,0xfb,0x8f, + 0xf9,0xaf,0xfc,0x1f,0x82,0x41,0xff,0xff,0xff,0xff,0xfc,0x3f,0xff,0x1f,0xff,0xe7, + 0xfe,0xfb,0xfe,0xff,0xff,0x9f,0xfd,0x8f,0xff,0x1f,0xfe,0x3f,0xfd,0x3f,0xff,0xff, + 0x00,0x00,0x73,0xce,0x00,0xe0,0x00,0x18,0x01,0x04,0x01,0x00,0x00,0x00,0x02,0x00, + 0x00,0x80,0x00,0x00,0x7c,0x3e,0x00,0x00,0x00,0x00,0x73,0xce,0x60,0xee,0x70,0x1e, + 0x71,0x06,0x71,0x06,0x70,0x66,0x72,0x7e,0x78,0xce,0x7d,0xde,0x7c,0xbe,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon740a[] = { + 0xff,0xff,0x7f,0xfe,0xff,0xef,0x7f,0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0xff,0xff, + 0x7f,0xfe,0xf7,0xff,0x7f,0xfe,0xff,0xff,0xff,0xff,0xff,0xf7,0x7f,0xe6,0x7f,0xfe, + 0xff,0xff,0x7b,0xfe,0xf9,0xff,0xf2,0xff,0x64,0x7e,0x61,0xfe,0xf3,0xff,0xff,0xff, + 0x00,0x00,0x80,0x1d,0x80,0x19,0x80,0x11,0x06,0x20,0x04,0x40,0x06,0x80,0x1d,0x00, + 0x9b,0xc1,0x9e,0x01,0x8e,0x01,0x00,0x00,0x00,0x00,0x80,0x1d,0x80,0x19,0x80,0x31, + 0x86,0x61,0x04,0xc0,0x87,0x81,0x9f,0x01,0x9f,0xc1,0x9e,0x01,0x8e,0x01,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon746e[] = { + 0xff,0xff,0x7f,0x5e,0xfe,0xef,0x7f,0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0xf7,0xff, + 0x7b,0xfe,0xff,0xff,0x7f,0xfe,0xff,0xff,0xff,0xff,0xff,0x5f,0x7e,0xae,0x7f,0x4e, + 0xfe,0xaf,0x7d,0x9e,0xfb,0x7f,0xf6,0xff,0x79,0xfa,0x7f,0xbe,0xfd,0xf7,0xff,0xff, + 0x00,0x00,0x80,0xa1,0x81,0x51,0x80,0xb1,0x01,0x50,0x02,0xe0,0x04,0x80,0x09,0x00, + 0x8e,0x05,0x88,0xe5,0x87,0x19,0x00,0x00,0x00,0x00,0x80,0xe1,0x81,0x51,0x81,0xb1, + 0x83,0x51,0x06,0xe0,0x8c,0x81,0x89,0x01,0x8e,0x05,0x88,0xe5,0x87,0x19,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon74d2[] = { + 0xff,0xff,0x6f,0xf6,0xdf,0xfb,0x7f,0x7e,0xff,0xff,0xff,0xff,0x77,0xfe,0xff,0xdf, + 0x5f,0xba,0xef,0xf7,0x6f,0xde,0xff,0xff,0xfc,0x3f,0xc3,0xc3,0x57,0xea,0x7d,0x3e, + 0xff,0xff,0x76,0x6e,0xf6,0x6f,0xfb,0xdf,0x5c,0x3a,0x4f,0xf2,0xf7,0xef,0xff,0xff, + 0x03,0xc0,0xbf,0xfd,0xa8,0x15,0xa2,0xc5,0x22,0x44,0x2d,0xb4,0x2d,0xb4,0x26,0x64, + 0xa3,0xc5,0xbf,0xfd,0x9c,0x39,0x00,0x00,0x03,0xc0,0xbf,0xfd,0xa8,0x15,0xa3,0xc5, + 0xa6,0x65,0x2d,0xb4,0xad,0xb5,0xa6,0x65,0xa3,0xc5,0xbf,0xfd,0x9c,0x39,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon7536[] = { + 0xff,0xff,0x7f,0xfe,0xff,0xbf,0x7f,0xfe,0xf7,0xff,0xff,0xff,0x7f,0xfe,0xff,0xff, + 0x7f,0xfe,0xff,0xff,0x7f,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xae,0x7f,0x8e, + 0xf5,0x87,0x71,0xfe,0xf0,0xff,0xff,0xf7,0x7f,0x96,0x6d,0x86,0xe8,0xc7,0xff,0xff, + 0x00,0x00,0x80,0x01,0x80,0x51,0x80,0x71,0x0a,0x78,0x0e,0x50,0x0f,0x00,0x0a,0x4c, + 0x80,0x6d,0x92,0x7d,0x97,0x3d,0x00,0x00,0x00,0x00,0x80,0x01,0x80,0x71,0x80,0xf1, + 0x8e,0x79,0x1e,0x50,0x8f,0x01,0x8a,0x4d,0x80,0x6d,0x92,0x7d,0x97,0x3d,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon759a[] = { + 0xff,0xff,0x6f,0xfe,0xff,0xff,0x7b,0x5e,0xff,0xff,0xed,0xd7,0x7f,0xfe,0xf7,0x6f, + 0x7f,0xfe,0xff,0xff,0x7f,0xfe,0xff,0xff,0xff,0xff,0xe3,0xff,0x7f,0xfe,0x79,0x06, + 0xff,0xff,0x68,0xd6,0xff,0xff,0xe5,0x47,0x7f,0xfe,0x5f,0xee,0xef,0x9f,0xff,0xff, + 0x00,0x00,0x9e,0x81,0x80,0x01,0x8e,0xf9,0x00,0x00,0x1f,0xac,0x00,0x00,0x1a,0xb8, + 0x80,0x01,0xa6,0x15,0x90,0xf1,0x28,0x00,0x00,0x00,0x9e,0x81,0x80,0x01,0x8e,0xf9, + 0x80,0x01,0x1f,0xac,0x80,0x01,0x9a,0xb9,0x80,0x01,0xa6,0x15,0x90,0xf1,0x28,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon75fe[] = { + 0xff,0xff,0x7f,0xea,0xff,0xf7,0x7f,0xde,0xff,0xbf,0xfd,0x7f,0x7a,0xfe,0xf9,0xff, + 0x76,0x7e,0xf1,0xff,0x7d,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xde, + 0xff,0xbf,0x7f,0x7e,0xfe,0xff,0xfd,0xff,0x7b,0xfe,0x7f,0xfe,0xff,0xff,0xff,0xff, + 0x00,0x00,0x80,0x19,0x80,0x15,0x80,0x11,0x02,0x20,0x06,0x40,0x06,0x80,0x1c,0x80, + 0x99,0xc1,0x9f,0x01,0x8f,0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x80,0x01,0x80,0x21, + 0x80,0x41,0x00,0x80,0x81,0x01,0x82,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon7662[] = { + 0xff,0xff,0x7f,0x5e,0xfe,0xef,0x7f,0xfe,0xfe,0xef,0xff,0x5f,0x78,0xfe,0xf9,0xff, + 0x7b,0xfa,0xff,0x1b,0x7c,0xe6,0xff,0xff,0xff,0xff,0xff,0x5f,0x7e,0x4e,0x7f,0xbe, + 0xff,0x4f,0x7b,0xde,0xf6,0xff,0xfd,0xff,0x7b,0xfa,0x77,0xbe,0xf9,0xf7,0xff,0xff, + 0x00,0x00,0x80,0xa1,0x81,0x11,0x80,0x01,0x03,0x10,0x05,0xa0,0x0b,0x80,0x17,0x04, + 0x9e,0x05,0x9d,0xf5,0x8f,0xbd,0x00,0x00,0x00,0x00,0x80,0xe1,0x81,0x11,0x81,0x11, + 0x83,0x11,0x06,0xe0,0x8d,0x81,0x9b,0x05,0x96,0x05,0x9d,0xf5,0x8f,0xbd,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon76c6[] = { + 0xff,0xff,0x7f,0xfe,0xf7,0xef,0x7d,0xbe,0xfb,0xdf,0xf6,0x6f,0x76,0xee,0xfb,0xdf, + 0x7d,0xbe,0xff,0xff,0x7f,0xfe,0xff,0xff,0xfc,0x3f,0xd3,0xcb,0x77,0xee,0x5f,0xfa, + 0xdf,0xfb,0x5f,0xfa,0xdf,0xfb,0xdf,0xfb,0x7f,0xfe,0x50,0x0a,0xf7,0xef,0xff,0xff, + 0x03,0xc0,0xaf,0xf5,0x94,0x01,0xa3,0xc5,0x26,0x64,0x2d,0xb4,0x2d,0xb4,0x26,0x64, + 0x83,0xc1,0xaf,0xf5,0x9c,0x39,0x00,0x00,0x03,0xc0,0xbf,0xfd,0xa8,0x15,0xa0,0x05, + 0xa0,0x05,0x20,0x04,0xa0,0x05,0xa0,0x05,0xa0,0x05,0xbf,0xfd,0x9c,0x39,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon772a[] = { + 0xff,0xff,0x40,0x02,0xc0,0x03,0x40,0x72,0xc0,0xf3,0xce,0xfb,0x5e,0x62,0xdf,0x53, + 0x5c,0x7a,0xda,0xff,0x7f,0xfe,0xff,0xff,0xff,0xff,0xc0,0x03,0x40,0x02,0x40,0x62, + 0xc0,0xf3,0x4c,0xfa,0xde,0xf3,0xdf,0x63,0x4a,0x62,0x5c,0xda,0xff,0x7b,0xff,0xff, + 0x00,0x00,0x80,0x01,0x80,0x01,0x80,0x11,0x00,0x00,0x0a,0x80,0x00,0x20,0x11,0x40, + 0x80,0x19,0x88,0x25,0x80,0x85,0x00,0x00,0x00,0x00,0xbf,0xfd,0xbf,0xfd,0xbf,0x9d, + 0xbf,0x0d,0x3b,0x04,0xa1,0x0d,0xa1,0x9d,0xb5,0xbd,0xa3,0x35,0x82,0x85,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; +const uint8_t icon778e[] = { + 0xff,0xff,0x55,0x52,0xf7,0xfb,0x5f,0xfa,0xfd,0xab,0xdf,0xfb,0x75,0x52,0xff,0xfb, + 0x7f,0xea,0xff,0xdb,0x5e,0xa2,0xff,0xff,0xff,0xff,0xc0,0x03,0x54,0x02,0x40,0x02, + 0xc4,0x0b,0x40,0x02,0xd0,0x13,0xc0,0x03,0x40,0x0a,0x40,0xc2,0xc0,0x03,0xff,0xff, + 0x00,0x00,0x80,0x01,0x88,0x01,0x80,0x01,0x02,0x50,0x00,0x00,0x0a,0xa8,0x20,0x00, + 0xb0,0x11,0x98,0x21,0xac,0x01,0x00,0x00,0x00,0x00,0xaa,0xad,0x9c,0x05,0xa0,0x05, + 0x86,0x5d,0x20,0x04,0x9a,0xbd,0x80,0x05,0x80,0x1d,0x80,0xe5,0xa1,0x5d,0x00,0x00, + 0x00,0x0c,0x00,0x10 +}; diff --git a/sys_sdl2.c b/sys_sdl2.c index 70595f6..67a909c 100644 --- a/sys_sdl2.c +++ b/sys_sdl2.c @@ -31,7 +31,7 @@ static SDL_Window *_window; static SDL_Renderer *_renderer; static SDL_Texture *_texture; static SDL_PixelFormat *_fmt; -static uint32_t _screen_palette[32]; +static uint32_t _screen_palette[48]; static uint32_t *_screen_buffer; static struct input_t *_input = &g_sys.input; static int _copper_color;