From 73dd992dcb2ccaae3d81b5e5dac22c560fdca363 Mon Sep 17 00:00:00 2001 From: Leeroy <135471162+LeeroysHub@users.noreply.github.com> Date: Wed, 23 Sep 2026 10:11:30 +1000 Subject: [PATCH] Get rid of Hacky Icons in Config Plugin variable_item_list, use the FAL icons. --- application.fam | 2 ++ helpers/variable_item_list.c | 61 +++++------------------------------- 2 files changed, 9 insertions(+), 54 deletions(-) diff --git a/application.fam b/application.fam index 2df9e98..4292f69 100644 --- a/application.fam +++ b/application.fam @@ -427,10 +427,12 @@ App( apptype=FlipperAppType.PLUGIN, entry_point="protopirate_config_plugin_ep", requires=["proto_pirate"], + cdefines=["PROTOPIRATE_CONFIG_PLUGIN_BUILD"], sources=[ "helpers/protopirate_models.c", "helpers/variable_item_list.c", "scenes/plugins/protopirate_config_plugin.c", ], + fap_icon_assets="images", fal_embedded=True, ) \ No newline at end of file diff --git a/helpers/variable_item_list.c b/helpers/variable_item_list.c index 97d9089..3f14504 100644 --- a/helpers/variable_item_list.c +++ b/helpers/variable_item_list.c @@ -5,58 +5,11 @@ #include #include -/**************************************************************************************************/ -/* ICON ASSETS */ -/**************************************************************************************************/ -struct Icon { - const uint16_t width; - const uint16_t height; - const uint8_t frame_count; - const uint8_t frame_rate; - const uint8_t* const* frames; -}; - -const uint8_t _I_WarningDolphin_45x42e_0[] = { - 0x01, 0x00, 0xc6, 0x00, 0x00, 0x1c, 0x22, 0x04, 0x05, 0x7f, 0xfc, 0x1e, 0x20, 0x05, 0x1e, 0x04, - 0x02, 0x30, 0x05, 0x29, 0x84, 0x02, 0xc1, 0x20, 0x02, 0x8c, 0x22, 0x01, 0x80, 0x02, 0x94, 0x10, - 0x32, 0x30, 0x10, 0x10, 0x87, 0xca, 0x84, 0x03, 0x10, 0x42, 0x81, 0x48, 0x28, 0x38, 0x08, 0x04, - 0x3e, 0x01, 0x84, 0x83, 0xe0, 0x30, 0x11, 0x08, 0x05, 0xa2, 0x11, 0x40, 0xa0, 0x4b, 0xc6, 0xc5, - 0x40, 0xd0, 0x56, 0xe0, 0x10, 0x60, 0x29, 0x54, 0xf0, 0x10, 0x18, 0xf0, 0x14, 0x6b, 0xf6, 0x0c, - 0x04, 0x3e, 0x40, 0x05, 0x12, 0x80, 0xc1, 0xe4, 0x01, 0xd2, 0xf8, 0x40, 0xe4, 0x18, 0x09, 0xf4, - 0x03, 0xf1, 0x01, 0x90, 0x40, 0x28, 0x30, 0x0f, 0xe4, 0x00, 0x16, 0x24, 0x11, 0xbf, 0x01, 0x44, - 0xee, 0x53, 0xf0, 0x29, 0xf0, 0x3e, 0x02, 0x91, 0x3b, 0x8c, 0xc3, 0x81, 0x13, 0x90, 0x48, 0x20, - 0x3f, 0xf9, 0xfc, 0x42, 0x60, 0x05, 0x10, 0x98, 0x81, 0x56, 0x11, 0x38, 0x02, 0x9c, 0x1a, 0x31, - 0x1e, 0x02, 0x8f, 0x02, 0x03, 0x1c, 0x90, 0xc0, 0x7c, 0x02, 0xf1, 0xce, 0x02, 0x07, 0x01, 0x1f, - 0x80, 0x63, 0xa8, 0x08, 0x71, 0x3c, 0x8e, 0x39, 0x24, 0x40, 0x51, 0xc7, 0x81, 0x53, 0x0f, 0x3c, - 0x02, 0x9d, 0x1e, 0x38, 0x29, 0x10, 0x29, 0x17, 0xc8, 0x0a, 0x32, 0x3a, 0x00, 0x14, 0x4b, 0xa2, - 0x05, 0x58, 0x98, 0x15, 0x22, 0x20, 0x54, 0x84, 0x81, 0x50, -}; -const uint8_t* const _I_WarningDolphin_45x42e[] = {_I_WarningDolphin_45x42e_0}; - -const Icon I_WarningDolphin_45x42e = { - .width = 45, - .height = 42, - .frame_count = 1, - .frame_rate = 0, - .frames = _I_WarningDolphin_45x42e}; - -const uint8_t _I_Lock_7x8e_0[] = { - 0x00, - 0x1c, - 0x22, - 0x22, - 0x7f, - 0x7f, - 0x77, - 0x7f, - 0x3e, -}; -const uint8_t* const _I_Lock_7x8e[] = {_I_Lock_7x8e_0}; - -const Icon I_Lock_7x8e = - {.width = 7, .height = 8, .frame_count = 1, .frame_rate = 0, .frames = _I_Lock_7x8e}; - -/**************************************************************************************************/ +#ifdef PROTOPIRATE_CONFIG_PLUGIN_BUILD +#include "protopirate_config_plugin_icons.h" +#else +#include "proto_pirate_icons.h" +#endif struct VariableItem { FuriString* label; @@ -170,7 +123,7 @@ static void variable_item_list_draw_callback(Canvas* canvas, void* _model) { (position != model->position)); if(item->locked) { - canvas_draw_icon(canvas, value_pos_x, item_text_y - 8, &I_Lock_7x8e); + canvas_draw_icon(canvas, value_pos_x, item_text_y - 8, &I_Lock_7x8); } else { if(item->current_value_index > 0) { canvas_draw_str(canvas, value_pos_x, item_text_y, "<"); @@ -203,7 +156,7 @@ static void variable_item_list_draw_callback(Canvas* canvas, void* _model) { canvas_set_color(canvas, ColorWhite); canvas_draw_box(canvas, 8, 10, 110, 48); canvas_set_color(canvas, ColorBlack); - canvas_draw_icon(canvas, 10, 14, &I_WarningDolphin_45x42e); + canvas_draw_icon(canvas, 10, 14, &I_WarningDolphin_45x42); canvas_draw_rframe(canvas, 8, 8, 112, 50, 3); canvas_draw_rframe(canvas, 9, 9, 110, 48, 2); elements_multiline_text_aligned(