Refactor Xtreme Settings/Assets, -1.3kb DFU

This commit is contained in:
Willy-JL
2024-02-14 02:20:31 +00:00
parent 8375aaddad
commit 78e405051a
10 changed files with 171 additions and 266 deletions

View File

@@ -691,7 +691,7 @@ void bad_kb_config_refresh(BadKbApp* app) {
xtreme_settings.bad_bt_remember != app->bt_remember) { xtreme_settings.bad_bt_remember != app->bt_remember) {
xtreme_settings.bad_bt = app->is_bt; xtreme_settings.bad_bt = app->is_bt;
xtreme_settings.bad_bt_remember = app->bt_remember; xtreme_settings.bad_bt_remember = app->bt_remember;
XTREME_SETTINGS_SAVE(); xtreme_settings_save();
} }
} }

View File

@@ -116,7 +116,7 @@ bool xtreme_app_apply(XtremeApp* app) {
} }
if(app->save_settings) { if(app->save_settings) {
XTREME_SETTINGS_SAVE(); xtreme_settings_save();
} }
if(app->show_slideshow) { if(app->show_slideshow) {
@@ -131,7 +131,7 @@ bool xtreme_app_apply(XtremeApp* app) {
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewPopup); view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewPopup);
return true; return true;
} else if(app->apply_pack) { } else if(app->apply_pack) {
XTREME_ASSETS_FREE(); xtreme_assets_free();
popup_set_header(app->popup, "Reloading...", 64, 26, AlignCenter, AlignCenter); popup_set_header(app->popup, "Reloading...", 64, 26, AlignCenter, AlignCenter);
popup_set_text(app->popup, "Applying asset pack...", 64, 40, AlignCenter, AlignCenter); popup_set_text(app->popup, "Applying asset pack...", 64, 40, AlignCenter, AlignCenter);
popup_set_callback(app->popup, NULL); popup_set_callback(app->popup, NULL);
@@ -139,7 +139,7 @@ bool xtreme_app_apply(XtremeApp* app) {
popup_set_timeout(app->popup, 0); popup_set_timeout(app->popup, 0);
popup_disable_timeout(app->popup); popup_disable_timeout(app->popup);
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewPopup); view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewPopup);
XTREME_ASSETS_LOAD(); xtreme_assets_init();
} }
furi_record_close(RECORD_STORAGE); furi_record_close(RECORD_STORAGE);

View File

@@ -44,7 +44,7 @@ void desktop_scene_lock_menu_save_settings(Desktop* desktop) {
desktop->lock_menu->save_notification = false; desktop->lock_menu->save_notification = false;
} }
if(desktop->lock_menu->save_xtreme) { if(desktop->lock_menu->save_xtreme) {
XTREME_SETTINGS_SAVE(); xtreme_settings_save();
desktop->lock_menu->save_xtreme = false; desktop->lock_menu->save_xtreme = false;
} }
if(desktop->lock_menu->save_bt) { if(desktop->lock_menu->save_bt) {

View File

@@ -128,17 +128,22 @@ void flipper_init() {
#ifndef FURI_RAM_EXEC #ifndef FURI_RAM_EXEC
if(furi_hal_is_normal_boot()) { if(furi_hal_is_normal_boot()) {
// Wait for storage record
furi_record_open(RECORD_STORAGE); furi_record_open(RECORD_STORAGE);
furi_record_close(RECORD_STORAGE); furi_record_close(RECORD_STORAGE);
flipper_boot_status(canvas, "Migrating Files"); flipper_boot_status(canvas, "Migrating Files");
flipper_migrate_files(); flipper_migrate_files();
flipper_boot_status(canvas, "Starting Namespoof"); flipper_boot_status(canvas, "Starting Namespoof");
NAMESPOOF_INIT(); namespoof_init();
flipper_boot_status(canvas, "Loading Xtreme Settings"); flipper_boot_status(canvas, "Loading Xtreme Settings");
XTREME_SETTINGS_LOAD(); xtreme_settings_load();
furi_hal_light_sequence("rgb RB"); furi_hal_light_sequence("rgb RB");
flipper_boot_status(canvas, "Loading Xtreme Assets"); flipper_boot_status(canvas, "Loading Xtreme Assets");
XTREME_ASSETS_LOAD(); xtreme_assets_init();
} else { } else {
FURI_LOG_I(TAG, "Special boot, skipping optional components"); FURI_LOG_I(TAG, "Special boot, skipping optional components");
} }

View File

@@ -19,7 +19,8 @@ XtremeAssets xtreme_assets = {
.font_params = {NULL}, .font_params = {NULL},
}; };
void load_icon_animated(const Icon* replace, const char* name, FuriString* path, File* file) { static void
load_icon_animated(const Icon* replace, const char* name, FuriString* path, File* file) {
const char* pack = xtreme_settings.asset_pack; const char* pack = xtreme_settings.asset_pack;
furi_string_printf(path, ICONS_FMT "/meta", pack, name); furi_string_printf(path, ICONS_FMT "/meta", pack, name);
if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) { if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) {
@@ -70,7 +71,7 @@ void load_icon_animated(const Icon* replace, const char* name, FuriString* path,
storage_file_close(file); storage_file_close(file);
} }
void load_icon_static(const Icon* replace, const char* name, FuriString* path, File* file) { static void load_icon_static(const Icon* replace, const char* name, FuriString* path, File* file) {
furi_string_printf(path, ICONS_FMT ".bmx", xtreme_settings.asset_pack, name); furi_string_printf(path, ICONS_FMT ".bmx", xtreme_settings.asset_pack, name);
if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) { if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) {
uint64_t size = storage_file_size(file) - 8; uint64_t size = storage_file_size(file) - 8;
@@ -97,7 +98,7 @@ void load_icon_static(const Icon* replace, const char* name, FuriString* path, F
storage_file_close(file); storage_file_close(file);
} }
void free_icon(const Icon* icon) { static void free_icon(const Icon* icon) {
uint8_t** frames = (void*)icon->frames; uint8_t** frames = (void*)icon->frames;
int32_t frame_count = icon->frame_count; int32_t frame_count = icon->frame_count;
@@ -111,7 +112,7 @@ void free_icon(const Icon* icon) {
free(frames); free(frames);
} }
void load_font(Font font, const char* name, FuriString* path, File* file) { static void load_font(Font font, const char* name, FuriString* path, File* file) {
furi_string_printf(path, FONTS_FMT, xtreme_settings.asset_pack, name); furi_string_printf(path, FONTS_FMT, xtreme_settings.asset_pack, name);
if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) { if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) {
uint64_t size = storage_file_size(file); uint64_t size = storage_file_size(file);
@@ -133,7 +134,7 @@ void load_font(Font font, const char* name, FuriString* path, File* file) {
storage_file_close(file); storage_file_close(file);
} }
void free_font(Font font) { static void free_font(Font font) {
free(xtreme_assets.fonts[font]); free(xtreme_assets.fonts[font]);
xtreme_assets.fonts[font] = NULL; xtreme_assets.fonts[font] = NULL;
free(xtreme_assets.font_params[font]); free(xtreme_assets.font_params[font]);
@@ -148,7 +149,7 @@ static const char* font_names[] = {
[FontBatteryPercent] = "BatteryPercent", [FontBatteryPercent] = "BatteryPercent",
}; };
void XTREME_ASSETS_LOAD() { void xtreme_assets_init() {
const char* pack = xtreme_settings.asset_pack; const char* pack = xtreme_settings.asset_pack;
xtreme_assets.is_nsfw = !strncmp(pack, "NSFW", strlen("NSFW")); xtreme_assets.is_nsfw = !strncmp(pack, "NSFW", strlen("NSFW"));
if(pack[0] == '\0') return; if(pack[0] == '\0') return;
@@ -181,7 +182,7 @@ void XTREME_ASSETS_LOAD() {
furi_record_close(RECORD_STORAGE); furi_record_close(RECORD_STORAGE);
} }
void XTREME_ASSETS_FREE() { void xtreme_assets_free() {
for(size_t i = 0; i < ICON_PATHS_COUNT; i++) { for(size_t i = 0; i < ICON_PATHS_COUNT; i++) {
if(ICON_PATHS[i].icon->original != NULL) { if(ICON_PATHS[i].icon->original != NULL) {
free_icon(ICON_PATHS[i].icon); free_icon(ICON_PATHS[i].icon);

View File

@@ -4,7 +4,7 @@
#define TAG "NameSpoof" #define TAG "NameSpoof"
void NAMESPOOF_INIT() { void namespoof_init() {
FuriString* str = furi_string_alloc(); FuriString* str = furi_string_alloc();
Storage* storage = furi_record_open(RECORD_STORAGE); Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* file = flipper_format_file_alloc(storage); FlipperFormat* file = flipper_format_file_alloc(storage);

View File

@@ -4,4 +4,4 @@
#define NAMESPOOF_VERSION 1 #define NAMESPOOF_VERSION 1
#define NAMESPOOF_PATH EXT_PATH("dolphin/name.txt") #define NAMESPOOF_PATH EXT_PATH("dolphin/name.txt")
void NAMESPOOF_INIT(); void namespoof_init();

View File

@@ -45,261 +45,155 @@ XtremeSettings xtreme_settings = {
.file_naming_prefix_after = false, // Before .file_naming_prefix_after = false, // Before
}; };
void XTREME_SETTINGS_LOAD() { typedef enum {
XtremeSettings* x = &xtreme_settings; xtreme_settings_type_str,
xtreme_settings_type_int,
xtreme_settings_type_uint,
xtreme_settings_type_enum,
xtreme_settings_type_bool,
} xtreme_settings_type;
static const struct {
xtreme_settings_type type;
const char* key;
void* val;
union {
size_t str_len;
struct {
int32_t i_min;
int32_t i_max;
};
struct {
uint32_t u_min;
uint32_t u_max;
};
uint8_t e_cnt;
};
#define clamp(t, min, max) .t##_min = min, .t##_max = max
#define setting(t, n) .type = xtreme_settings_type##t, .key = #n, .val = &xtreme_settings.n
#define setting_str(n) setting(_str, n), .str_len = sizeof(xtreme_settings.n)
#define setting_int(n, min, max) setting(_int, n), clamp(i, min, max)
#define setting_uint(n, min, max) setting(_uint, n), clamp(u, min, max)
#define setting_enum(n, cnt) setting(_enum, n), .e_cnt = cnt
#define setting_bool(n) setting(_bool, n)
} xtreme_settings_entries[] = {
{setting_str(asset_pack)},
{setting_uint(anim_speed, 25, 300)},
{setting_int(cycle_anims, -1, 86400)},
{setting_bool(unlock_anims)},
{setting_bool(credits_anim)},
{setting_enum(menu_style, MenuStyleCount)},
{setting_bool(bad_pins_format)},
{setting_bool(allow_locked_rpc_commands)},
{setting_bool(lock_on_boot)},
{setting_bool(lockscreen_poweroff)},
{setting_bool(lockscreen_time)},
{setting_bool(lockscreen_seconds)},
{setting_bool(lockscreen_date)},
{setting_bool(lockscreen_statusbar)},
{setting_bool(lockscreen_prompt)},
{setting_bool(lockscreen_transparent)},
{setting_enum(battery_icon, BatteryIconCount)},
{setting_bool(statusbar_clock)},
{setting_bool(status_icons)},
{setting_bool(bar_borders)},
{setting_bool(bar_background)},
{setting_bool(sort_dirs_first)},
{setting_bool(show_hidden_files)},
{setting_bool(show_internal_tab)},
{setting_uint(favorite_timeout, 0, 60)},
{setting_bool(bad_bt)},
{setting_bool(bad_bt_remember)},
{setting_bool(dark_mode)},
{setting_bool(rgb_backlight)},
{setting_uint(butthurt_timer, 0, 172800)},
{setting_uint(charge_cap, 5, 100)},
{setting_enum(spi_cc1101_handle, SpiCount)},
{setting_enum(spi_nrf24_handle, SpiCount)},
{setting_enum(uart_esp_channel, FuriHalSerialIdMax)},
{setting_enum(uart_nmea_channel, FuriHalSerialIdMax)},
{setting_enum(uart_general_channel, FuriHalSerialIdMax)},
{setting_bool(file_naming_prefix_after)},
};
void xtreme_settings_load() {
Storage* storage = furi_record_open(RECORD_STORAGE); Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* file = flipper_format_file_alloc(storage); FlipperFormat* file = flipper_format_file_alloc(storage);
if(flipper_format_file_open_existing(file, XTREME_SETTINGS_PATH)) { if(flipper_format_file_open_existing(file, XTREME_SETTINGS_PATH)) {
FuriString* s = furi_string_alloc(); FuriString* val_str = furi_string_alloc();
uint32_t u; int32_t val_int;
int32_t i; uint32_t val_uint;
bool b; bool val_bool;
if(flipper_format_read_string(file, "asset_pack", s)) {
strlcpy(x->asset_pack, furi_string_get_cstr(s), sizeof(x->asset_pack)); bool ok;
} else { for(size_t entry_i = 0; entry_i < COUNT_OF(xtreme_settings_entries); entry_i++) {
flipper_format_rewind(file); #define entry xtreme_settings_entries[entry_i]
switch(entry.type) {
case xtreme_settings_type_str:
ok = flipper_format_read_string(file, entry.key, val_str);
if(ok) strlcpy((char*)entry.val, furi_string_get_cstr(val_str), entry.str_len);
break;
case xtreme_settings_type_int:
ok = flipper_format_read_int32(file, entry.key, &val_int, 1);
if(ok) *(int32_t*)entry.val = CLAMP(val_int, entry.i_max, entry.i_min);
break;
case xtreme_settings_type_uint:
ok = flipper_format_read_uint32(file, entry.key, &val_uint, 1);
if(ok) *(uint32_t*)entry.val = CLAMP(val_uint, entry.u_max, entry.u_min);
break;
case xtreme_settings_type_enum:
ok = flipper_format_read_uint32(file, entry.key, &val_uint, 1);
if(ok) *(uint8_t*)entry.val = CLAMP(val_uint, entry.e_cnt - 1U, 0U);
break;
case xtreme_settings_type_bool:
ok = flipper_format_read_bool(file, entry.key, &val_bool, 1);
if(ok) *(bool*)entry.val = val_bool;
break;
default:
continue;
}
if(!ok) flipper_format_rewind(file);
} }
if(flipper_format_read_uint32(file, "anim_speed", &u, 1)) {
x->anim_speed = CLAMP(u, 300U, 25U); furi_string_free(val_str);
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_int32(file, "cycle_anims", &i, 1)) {
x->cycle_anims = CLAMP(i, 86400, -1);
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "unlock_anims", &b, 1)) {
x->unlock_anims = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "credits_anim", &b, 1)) {
x->credits_anim = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_uint32(file, "menu_style", &u, 1)) {
x->menu_style = CLAMP(u, MenuStyleCount - 1U, 0U);
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "bad_pins_format", &b, 1)) {
x->bad_pins_format = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "allow_locked_rpc_commands", &b, 1)) {
x->allow_locked_rpc_commands = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "lock_on_boot", &b, 1)) {
x->lock_on_boot = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "lockscreen_poweroff", &b, 1)) {
x->lockscreen_poweroff = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "lockscreen_time", &b, 1)) {
x->lockscreen_time = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "lockscreen_seconds", &b, 1)) {
x->lockscreen_seconds = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "lockscreen_date", &b, 1)) {
x->lockscreen_date = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "lockscreen_statusbar", &b, 1)) {
x->lockscreen_statusbar = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "lockscreen_prompt", &b, 1)) {
x->lockscreen_prompt = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "lockscreen_transparent", &b, 1)) {
x->lockscreen_transparent = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_uint32(file, "battery_icon", &u, 1)) {
x->battery_icon = CLAMP(u, BatteryIconCount - 1U, 0U);
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "statusbar_clock", &b, 1)) {
x->statusbar_clock = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "status_icons", &b, 1)) {
x->status_icons = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "bar_borders", &b, 1)) {
x->bar_borders = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "bar_background", &b, 1)) {
x->bar_background = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "sort_dirs_first", &b, 1)) {
x->sort_dirs_first = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "show_hidden_files", &b, 1)) {
x->show_hidden_files = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "show_internal_tab", &b, 1)) {
x->show_internal_tab = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_uint32(file, "favorite_timeout", &u, 1)) {
x->favorite_timeout = CLAMP(u, 60U, 0U);
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "bad_bt", &b, 1)) {
x->bad_bt = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "bad_bt_remember", &b, 1)) {
x->bad_bt_remember = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "dark_mode", &b, 1)) {
x->dark_mode = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "rgb_backlight", &b, 1)) {
x->rgb_backlight = b;
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_uint32(file, "butthurt_timer", &u, 1)) {
x->butthurt_timer = CLAMP(u, 172800U, 0U);
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_uint32(file, "charge_cap", &u, 1)) {
x->charge_cap = CLAMP(u, 100U, 5U);
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_uint32(file, "spi_cc1101_handle", &u, 1)) {
x->spi_cc1101_handle = CLAMP(u, SpiCount - 1U, 0U);
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_uint32(file, "spi_nrf24_handle", &u, 1)) {
x->spi_nrf24_handle = CLAMP(u, SpiCount - 1U, 0U);
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_uint32(file, "uart_esp_channel", &u, 1)) {
x->uart_esp_channel = CLAMP(u, FuriHalSerialIdMax - 1U, 0U);
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_uint32(file, "uart_nmea_channel", &u, 1)) {
x->uart_nmea_channel = CLAMP(u, FuriHalSerialIdMax - 1U, 0U);
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_uint32(file, "uart_general_channel", &u, 1)) {
x->uart_general_channel = CLAMP(u, FuriHalSerialIdMax - 1U, 0U);
} else {
flipper_format_rewind(file);
}
if(flipper_format_read_bool(file, "file_naming_prefix_after", &b, 1)) {
x->file_naming_prefix_after = b;
} else {
flipper_format_rewind(file);
}
furi_string_free(s);
} }
flipper_format_free(file); flipper_format_free(file);
furi_record_close(RECORD_STORAGE); furi_record_close(RECORD_STORAGE);
rgb_backlight_load_settings(x->rgb_backlight); rgb_backlight_load_settings(xtreme_settings.rgb_backlight);
} }
void XTREME_SETTINGS_SAVE() { void xtreme_settings_save() {
XtremeSettings* x = &xtreme_settings;
Storage* storage = furi_record_open(RECORD_STORAGE); Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* file = flipper_format_file_alloc(storage); FlipperFormat* file = flipper_format_file_alloc(storage);
if(flipper_format_file_open_always(file, XTREME_SETTINGS_PATH)) { if(flipper_format_file_open_always(file, XTREME_SETTINGS_PATH)) {
uint32_t e; uint32_t tmp_enum;
flipper_format_write_string_cstr(file, "asset_pack", x->asset_pack); for(size_t entry_i = 0; entry_i < COUNT_OF(xtreme_settings_entries); entry_i++) {
flipper_format_write_uint32(file, "anim_speed", &x->anim_speed, 1); #define entry xtreme_settings_entries[entry_i]
flipper_format_write_int32(file, "cycle_anims", &x->cycle_anims, 1); switch(entry.type) {
flipper_format_write_bool(file, "unlock_anims", &x->unlock_anims, 1); case xtreme_settings_type_str:
flipper_format_write_bool(file, "credits_anim", &x->credits_anim, 1); flipper_format_write_string_cstr(file, entry.key, (char*)entry.val);
e = x->menu_style; break;
flipper_format_write_uint32(file, "menu_style", &e, 1); case xtreme_settings_type_int:
flipper_format_write_bool(file, "bad_pins_format", &x->bad_pins_format, 1); flipper_format_write_int32(file, entry.key, (int32_t*)entry.val, 1);
flipper_format_write_bool( break;
file, "allow_locked_rpc_commands", &x->allow_locked_rpc_commands, 1); case xtreme_settings_type_uint:
flipper_format_write_bool(file, "lock_on_boot", &x->lock_on_boot, 1); flipper_format_write_uint32(file, entry.key, (uint32_t*)entry.val, 1);
flipper_format_write_bool(file, "lockscreen_poweroff", &x->lockscreen_poweroff, 1); break;
flipper_format_write_bool(file, "lockscreen_time", &x->lockscreen_time, 1); case xtreme_settings_type_enum:
flipper_format_write_bool(file, "lockscreen_seconds", &x->lockscreen_seconds, 1); tmp_enum = *(uint8_t*)entry.val;
flipper_format_write_bool(file, "lockscreen_date", &x->lockscreen_date, 1); flipper_format_write_uint32(file, entry.key, &tmp_enum, 1);
flipper_format_write_bool(file, "lockscreen_statusbar", &x->lockscreen_statusbar, 1); break;
flipper_format_write_bool(file, "lockscreen_prompt", &x->lockscreen_prompt, 1); case xtreme_settings_type_bool:
flipper_format_write_bool(file, "lockscreen_transparent", &x->lockscreen_transparent, 1); flipper_format_write_bool(file, entry.key, (bool*)entry.val, 1);
e = x->battery_icon; break;
flipper_format_write_uint32(file, "battery_icon", &e, 1); default:
flipper_format_write_bool(file, "statusbar_clock", &x->statusbar_clock, 1); continue;
flipper_format_write_bool(file, "status_icons", &x->status_icons, 1); }
flipper_format_write_bool(file, "bar_borders", &x->bar_borders, 1); }
flipper_format_write_bool(file, "bar_background", &x->bar_background, 1);
flipper_format_write_bool(file, "sort_dirs_first", &x->sort_dirs_first, 1);
flipper_format_write_bool(file, "show_hidden_files", &x->show_hidden_files, 1);
flipper_format_write_bool(file, "show_internal_tab", &x->show_internal_tab, 1);
flipper_format_write_uint32(file, "favorite_timeout", &x->favorite_timeout, 1);
flipper_format_write_bool(file, "bad_bt", &x->bad_bt, 1);
flipper_format_write_bool(file, "bad_bt_remember", &x->bad_bt_remember, 1);
flipper_format_write_bool(file, "dark_mode", &x->dark_mode, 1);
flipper_format_write_bool(file, "rgb_backlight", &x->rgb_backlight, 1);
flipper_format_write_uint32(file, "butthurt_timer", &x->butthurt_timer, 1);
flipper_format_write_uint32(file, "charge_cap", &x->charge_cap, 1);
e = x->spi_cc1101_handle;
flipper_format_write_uint32(file, "spi_cc1101_handle", &e, 1);
e = x->spi_nrf24_handle;
flipper_format_write_uint32(file, "spi_nrf24_handle", &e, 1);
e = x->uart_esp_channel;
flipper_format_write_uint32(file, "uart_esp_channel", &e, 1);
e = x->uart_nmea_channel;
flipper_format_write_uint32(file, "uart_nmea_channel", &e, 1);
e = x->uart_general_channel;
flipper_format_write_uint32(file, "uart_general_channel", &e, 1);
flipper_format_write_bool(
file, "file_naming_prefix_after", &x->file_naming_prefix_after, 1);
} }
flipper_format_free(file); flipper_format_free(file);
furi_record_close(RECORD_STORAGE); furi_record_close(RECORD_STORAGE);
} }

View File

@@ -45,6 +45,11 @@ typedef enum {
SpiCount, SpiCount,
} SpiHandle; } SpiHandle;
_Static_assert(sizeof(MenuStyle) == sizeof(uint8_t), "enum too big, fix load/save");
_Static_assert(sizeof(BatteryIcon) == sizeof(uint8_t), "enum too big, fix load/save");
_Static_assert(sizeof(SpiHandle) == sizeof(uint8_t), "enum too big, fix load/save");
_Static_assert(sizeof(FuriHalSerialId) == sizeof(uint8_t), "enum too big, fix load/save");
typedef struct { typedef struct {
char asset_pack[XTREME_ASSETS_PACK_NAME_LEN]; char asset_pack[XTREME_ASSETS_PACK_NAME_LEN];
uint32_t anim_speed; uint32_t anim_speed;
@@ -91,12 +96,12 @@ typedef struct {
CanvasFontParameters* font_params[FontTotalNumber]; CanvasFontParameters* font_params[FontTotalNumber];
} XtremeAssets; } XtremeAssets;
void XTREME_SETTINGS_LOAD(); void xtreme_settings_load();
void XTREME_SETTINGS_SAVE(); void xtreme_settings_save();
extern XtremeSettings xtreme_settings; extern XtremeSettings xtreme_settings;
void XTREME_ASSETS_LOAD(); void xtreme_assets_init();
void XTREME_ASSETS_FREE(); void xtreme_assets_free();
extern XtremeAssets xtreme_assets; extern XtremeAssets xtreme_assets;
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -394,10 +394,6 @@ Function,-,SK6805_set_led_color,void,"uint8_t, uint8_t, uint8_t, uint8_t"
Function,-,SK6805_update,void, Function,-,SK6805_update,void,
Function,-,SystemCoreClockUpdate,void, Function,-,SystemCoreClockUpdate,void,
Function,-,SystemInit,void, Function,-,SystemInit,void,
Function,+,XTREME_ASSETS_FREE,void,
Function,+,XTREME_ASSETS_LOAD,void,
Function,-,XTREME_SETTINGS_LOAD,void,
Function,+,XTREME_SETTINGS_SAVE,void,
Function,-,_Exit,void,int Function,-,_Exit,void,int
Function,+,__aeabi_uldivmod,void*,"uint64_t, uint64_t" Function,+,__aeabi_uldivmod,void*,"uint64_t, uint64_t"
Function,-,__assert,void,"const char*, int, const char*" Function,-,__assert,void,"const char*, int, const char*"
@@ -3610,6 +3606,10 @@ Function,+,widget_alloc,Widget*,
Function,+,widget_free,void,Widget* Function,+,widget_free,void,Widget*
Function,+,widget_get_view,View*,Widget* Function,+,widget_get_view,View*,Widget*
Function,+,widget_reset,void,Widget* Function,+,widget_reset,void,Widget*
Function,+,xtreme_assets_free,void,
Function,+,xtreme_assets_init,void,
Function,-,xtreme_settings_load,void,
Function,+,xtreme_settings_save,void,
Function,-,y0,double,double Function,-,y0,double,double
Function,-,y0f,float,float Function,-,y0f,float,float
Function,-,y1,double,double Function,-,y1,double,double
1 entry status name type params
394 Function - SK6805_update void
395 Function - SystemCoreClockUpdate void
396 Function - SystemInit void
Function + XTREME_ASSETS_FREE void
Function + XTREME_ASSETS_LOAD void
Function - XTREME_SETTINGS_LOAD void
Function + XTREME_SETTINGS_SAVE void
397 Function - _Exit void int
398 Function + __aeabi_uldivmod void* uint64_t, uint64_t
399 Function - __assert void const char*, int, const char*
3606 Function + widget_free void Widget*
3607 Function + widget_get_view View* Widget*
3608 Function + widget_reset void Widget*
3609 Function + xtreme_assets_free void
3610 Function + xtreme_assets_init void
3611 Function - xtreme_settings_load void
3612 Function + xtreme_settings_save void
3613 Function - y0 double double
3614 Function - y0f float float
3615 Function - y1 double double