Procházet zdrojové kódy

[FL-2274] Inventing streams and moving FFF to them (#981)

* Streams: string stream
* String stream: updated insert/delete api
* Streams: generic stream interface and string stream implementation
* Streams: helpers for insert and delete_and_insert
* FFF: now compatible with streams
* MinUnit: introduced tests with arguments
* FFF: stream access violation
* Streams: copy data between streams
* Streams: file stream
* FFF: documentation
* FFStream: documentation
* FFF: alloc as file
* MinUnit: support for nested tests
* Streams: changed delete_and_insert, now it returns success flag. Added ability dump stream inner parameters and data to cout.
* FFF: simplified file open function
* Streams: unit tests
* FFF: tests
* Streams: declare cache_size constant as define, to allow variable modified arrays
* FFF: lib moved to a separate folder
* iButton: new FFF
* RFID: new FFF
* Animations: new FFF
* IR: new FFF
* NFC: new FFF
* Flipper file format: delete lib
* U2F: new FFF
* Subghz: new FFF and streams
* Streams: read line
* Streams: split
* FuriCore: implement memset with extra asserts
* FuriCore: implement extra heap asserts without inventing memset
* Scene manager: protected access to the scene id stack with a size check
* NFC worker: dirty fix for issue where hal_nfc was busy on app start
* Furi: update allocator to erase memory on allocation. Replace furi_alloc with malloc.
* FuriCore: cleanup memmgr code.
* Furi HAL: furi_hal_init is split into critical and non-critical parts. The critical part is currently clock and console.
* Memmgr: added ability to track allocations and deallocations through console.
* FFStream: some speedup
* Streams, FF: minor fixes
* Tests: restore
* File stream: a slightly more thread-safe version of file_stream_delete_and_insert

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
SG před 3 roky
rodič
revize
274c12fc56
100 změnil soubory, kde provedl 429 přidání a 403 odebrání
  1. 1 1
      applications/archive/archive.c
  2. 1 1
      applications/archive/views/archive_browser_view.c
  3. 1 1
      applications/bad_usb/bad_usb_app.c
  4. 1 1
      applications/bad_usb/bad_usb_script.c
  5. 1 1
      applications/bad_usb/views/bad_usb_view.c
  6. 1 1
      applications/bt/bt_debug_app/bt_debug_app.c
  7. 1 1
      applications/bt/bt_debug_app/views/bt_carrier_test.c
  8. 1 1
      applications/bt/bt_debug_app/views/bt_packet_test.c
  9. 1 1
      applications/bt/bt_debug_app/views/bt_test.c
  10. 1 1
      applications/bt/bt_hid_app/bt_hid.c
  11. 1 1
      applications/bt/bt_hid_app/views/bt_hid_keynote.c
  12. 1 1
      applications/bt/bt_hid_app/views/bt_hid_media.c
  13. 1 1
      applications/bt/bt_service/bt.c
  14. 1 1
      applications/bt/bt_settings_app/bt_settings_app.c
  15. 1 1
      applications/cli/cli.c
  16. 3 3
      applications/crypto/crypto_cli.c
  17. 1 1
      applications/debug_tools/display_test/display_test.c
  18. 1 1
      applications/debug_tools/display_test/view_display_test.c
  19. 3 3
      applications/debug_tools/uart_echo.c
  20. 1 1
      applications/debug_tools/usb_test.c
  21. 1 1
      applications/desktop/animations/animation_manager.c
  22. 63 66
      applications/desktop/animations/animation_storage.c
  23. 4 4
      applications/desktop/animations/views/bubble_animation_view.c
  24. 1 1
      applications/desktop/animations/views/one_shot_animation_view.c
  25. 1 1
      applications/desktop/desktop.c
  26. 1 1
      applications/desktop/desktop_settings/desktop_settings_app.c
  27. 1 1
      applications/desktop/desktop_settings/views/desktop_settings_view_pin_setup_howto.c
  28. 1 2
      applications/desktop/desktop_settings/views/desktop_settings_view_pin_setup_howto2.c
  29. 1 1
      applications/desktop/scenes/desktop_scene_hw_mismatch.c
  30. 1 1
      applications/desktop/scenes/desktop_scene_pin_input.c
  31. 1 1
      applications/desktop/views/desktop_view_debug.c
  32. 1 1
      applications/desktop/views/desktop_view_first_start.c
  33. 1 1
      applications/desktop/views/desktop_view_lock_menu.c
  34. 1 1
      applications/desktop/views/desktop_view_locked.c
  35. 1 1
      applications/desktop/views/desktop_view_main.c
  36. 1 1
      applications/desktop/views/desktop_view_pin_input.c
  37. 1 1
      applications/desktop/views/desktop_view_pin_setup_done.c
  38. 1 1
      applications/desktop/views/desktop_view_pin_timeout.c
  39. 1 1
      applications/dialogs/dialogs.c
  40. 2 3
      applications/dialogs/dialogs_module_file_select.c
  41. 3 3
      applications/dialogs/dialogs_module_message.c
  42. 2 2
      applications/dialogs/view_holder.c
  43. 1 1
      applications/dolphin/dolphin.c
  44. 1 1
      applications/dolphin/helpers/dolphin_state.c
  45. 1 1
      applications/gpio/gpio_app.c
  46. 1 1
      applications/gpio/scenes/gpio_scene_usb_uart.c
  47. 1 1
      applications/gpio/scenes/gpio_scene_usb_uart_config.c
  48. 1 1
      applications/gpio/usb_uart_bridge.c
  49. 1 1
      applications/gpio/views/gpio_test.c
  50. 1 1
      applications/gpio/views/gpio_usb_uart.c
  51. 1 1
      applications/gui/canvas.c
  52. 1 1
      applications/gui/gui.c
  53. 1 1
      applications/gui/icon_animation.c
  54. 1 1
      applications/gui/modules/button_menu.c
  55. 2 2
      applications/gui/modules/button_panel.c
  56. 1 1
      applications/gui/modules/byte_input.c
  57. 1 1
      applications/gui/modules/dialog.c
  58. 1 1
      applications/gui/modules/dialog_ex.c
  59. 2 2
      applications/gui/modules/empty_screen.c
  60. 5 5
      applications/gui/modules/file_select.c
  61. 1 1
      applications/gui/modules/menu.c
  62. 1 1
      applications/gui/modules/popup.c
  63. 1 1
      applications/gui/modules/submenu.c
  64. 1 1
      applications/gui/modules/text_box.c
  65. 1 1
      applications/gui/modules/text_input.c
  66. 1 1
      applications/gui/modules/validators.c
  67. 1 1
      applications/gui/modules/variable_item_list.c
  68. 1 1
      applications/gui/modules/widget.c
  69. 2 2
      applications/gui/modules/widget_elements/widget_element_button.c
  70. 2 2
      applications/gui/modules/widget_elements/widget_element_frame.c
  71. 2 2
      applications/gui/modules/widget_elements/widget_element_icon.c
  72. 2 2
      applications/gui/modules/widget_elements/widget_element_string.c
  73. 2 2
      applications/gui/modules/widget_elements/widget_element_string_multiline.c
  74. 2 2
      applications/gui/modules/widget_elements/widget_element_text_box.c
  75. 97 65
      applications/gui/scene_manager.c
  76. 4 4
      applications/gui/view.c
  77. 1 1
      applications/gui/view_dispatcher.c
  78. 1 1
      applications/gui/view_port.c
  79. 1 1
      applications/gui/view_stack.c
  80. 16 17
      applications/ibutton/ibutton_app.cpp
  81. 2 2
      applications/input/input.c
  82. 1 1
      applications/irda/cli/irda_cli.cpp
  83. 28 23
      applications/irda/helpers/irda_parser.cpp
  84. 6 3
      applications/irda/helpers/irda_parser.h
  85. 8 11
      applications/irda/irda_app_brute_force.cpp
  86. 2 2
      applications/irda/irda_app_brute_force.h
  87. 9 11
      applications/irda/irda_app_remote_manager.cpp
  88. 1 1
      applications/irda/view/irda_app_brut_view.c
  89. 1 1
      applications/irda_monitor/irda_monitor.c
  90. 16 17
      applications/lfrfid/lfrfid_app.cpp
  91. 1 1
      applications/loader/loader.c
  92. 6 6
      applications/nfc/helpers/nfc_emv_parser.c
  93. 1 1
      applications/nfc/nfc.c
  94. 56 57
      applications/nfc/nfc_device.c
  95. 5 6
      applications/nfc/nfc_worker.c
  96. 1 1
      applications/nfc/views/bank_card.c
  97. 2 2
      applications/notification/notification_app.c
  98. 1 1
      applications/notification/notification_settings_app.c
  99. 2 2
      applications/power/battery_test_app/battery_test_app.c
  100. 1 1
      applications/power/power_service/power.c

+ 1 - 1
applications/archive/archive.c

@@ -13,7 +13,7 @@ bool archive_back_event_callback(void* context) {
 }
 }
 
 
 ArchiveApp* archive_alloc() {
 ArchiveApp* archive_alloc() {
-    ArchiveApp* archive = furi_alloc(sizeof(ArchiveApp));
+    ArchiveApp* archive = malloc(sizeof(ArchiveApp));
 
 
     archive->gui = furi_record_open("gui");
     archive->gui = furi_record_open("gui");
     archive->text_input = text_input_alloc();
     archive->text_input = text_input_alloc();

+ 1 - 1
applications/archive/views/archive_browser_view.c

@@ -305,7 +305,7 @@ bool archive_view_input(InputEvent* event, void* context) {
 }
 }
 
 
 ArchiveBrowserView* browser_alloc() {
 ArchiveBrowserView* browser_alloc() {
-    ArchiveBrowserView* browser = furi_alloc(sizeof(ArchiveBrowserView));
+    ArchiveBrowserView* browser = malloc(sizeof(ArchiveBrowserView));
     browser->view = view_alloc();
     browser->view = view_alloc();
     view_allocate_model(browser->view, ViewModelTypeLocking, sizeof(ArchiveBrowserViewModel));
     view_allocate_model(browser->view, ViewModelTypeLocking, sizeof(ArchiveBrowserViewModel));
     view_set_context(browser->view, browser);
     view_set_context(browser->view, browser);

+ 1 - 1
applications/bad_usb/bad_usb_app.c

@@ -41,7 +41,7 @@ static bool bad_usb_check_assets() {
 }
 }
 
 
 BadUsbApp* bad_usb_app_alloc(char* arg) {
 BadUsbApp* bad_usb_app_alloc(char* arg) {
-    BadUsbApp* app = furi_alloc(sizeof(BadUsbApp));
+    BadUsbApp* app = malloc(sizeof(BadUsbApp));
 
 
     if(arg != NULL) {
     if(arg != NULL) {
         string_t filename;
         string_t filename;

+ 1 - 1
applications/bad_usb/bad_usb_script.c

@@ -524,7 +524,7 @@ static int32_t bad_usb_worker(void* context) {
 BadUsbScript* bad_usb_script_open(string_t file_path) {
 BadUsbScript* bad_usb_script_open(string_t file_path) {
     furi_assert(file_path);
     furi_assert(file_path);
 
 
-    BadUsbScript* bad_usb = furi_alloc(sizeof(BadUsbScript));
+    BadUsbScript* bad_usb = malloc(sizeof(BadUsbScript));
     string_init(bad_usb->file_path);
     string_init(bad_usb->file_path);
     string_set(bad_usb->file_path, file_path);
     string_set(bad_usb->file_path, file_path);
 
 

+ 1 - 1
applications/bad_usb/views/bad_usb_view.c

@@ -115,7 +115,7 @@ static bool bad_usb_input_callback(InputEvent* event, void* context) {
 }
 }
 
 
 BadUsb* bad_usb_alloc() {
 BadUsb* bad_usb_alloc() {
-    BadUsb* bad_usb = furi_alloc(sizeof(BadUsb));
+    BadUsb* bad_usb = malloc(sizeof(BadUsb));
 
 
     bad_usb->view = view_alloc();
     bad_usb->view = view_alloc();
     view_allocate_model(bad_usb->view, ViewModelTypeLocking, sizeof(BadUsbModel));
     view_allocate_model(bad_usb->view, ViewModelTypeLocking, sizeof(BadUsbModel));

+ 1 - 1
applications/bt/bt_debug_app/bt_debug_app.c

@@ -27,7 +27,7 @@ uint32_t bt_debug_start_view(void* context) {
 }
 }
 
 
 BtDebugApp* bt_debug_app_alloc() {
 BtDebugApp* bt_debug_app_alloc() {
-    BtDebugApp* app = furi_alloc(sizeof(BtDebugApp));
+    BtDebugApp* app = malloc(sizeof(BtDebugApp));
 
 
     // Load settings
     // Load settings
     bt_settings_load(&app->settings);
     bt_settings_load(&app->settings);

+ 1 - 1
applications/bt/bt_debug_app/views/bt_carrier_test.c

@@ -130,7 +130,7 @@ static void bt_test_carrier_timer_callback(void* context) {
 }
 }
 
 
 BtCarrierTest* bt_carrier_test_alloc() {
 BtCarrierTest* bt_carrier_test_alloc() {
-    BtCarrierTest* bt_carrier_test = furi_alloc(sizeof(BtCarrierTest));
+    BtCarrierTest* bt_carrier_test = malloc(sizeof(BtCarrierTest));
     bt_carrier_test->bt_test = bt_test_alloc();
     bt_carrier_test->bt_test = bt_test_alloc();
     bt_test_set_context(bt_carrier_test->bt_test, bt_carrier_test);
     bt_test_set_context(bt_carrier_test->bt_test, bt_carrier_test);
     bt_test_set_change_state_callback(
     bt_test_set_change_state_callback(

+ 1 - 1
applications/bt/bt_debug_app/views/bt_packet_test.c

@@ -98,7 +98,7 @@ static void bt_test_packet_timer_callback(void* context) {
 }
 }
 
 
 BtPacketTest* bt_packet_test_alloc() {
 BtPacketTest* bt_packet_test_alloc() {
-    BtPacketTest* bt_packet_test = furi_alloc(sizeof(BtPacketTest));
+    BtPacketTest* bt_packet_test = malloc(sizeof(BtPacketTest));
     bt_packet_test->bt_test = bt_test_alloc();
     bt_packet_test->bt_test = bt_test_alloc();
     bt_test_set_context(bt_packet_test->bt_test, bt_packet_test);
     bt_test_set_context(bt_packet_test->bt_test, bt_packet_test);
     bt_test_set_change_state_callback(
     bt_test_set_change_state_callback(

+ 1 - 1
applications/bt/bt_debug_app/views/bt_test.c

@@ -291,7 +291,7 @@ void bt_test_process_back(BtTest* bt_test) {
 }
 }
 
 
 BtTest* bt_test_alloc() {
 BtTest* bt_test_alloc() {
-    BtTest* bt_test = furi_alloc(sizeof(BtTest));
+    BtTest* bt_test = malloc(sizeof(BtTest));
     bt_test->view = view_alloc();
     bt_test->view = view_alloc();
     view_set_context(bt_test->view, bt_test);
     view_set_context(bt_test->view, bt_test);
     view_allocate_model(bt_test->view, ViewModelTypeLocking, sizeof(BtTestModel));
     view_allocate_model(bt_test->view, ViewModelTypeLocking, sizeof(BtTestModel));

+ 1 - 1
applications/bt/bt_hid_app/bt_hid.c

@@ -54,7 +54,7 @@ void bt_hid_connection_status_changed_callback(BtStatus status, void* context) {
 }
 }
 
 
 BtHid* bt_hid_app_alloc() {
 BtHid* bt_hid_app_alloc() {
-    BtHid* app = furi_alloc(sizeof(BtHid));
+    BtHid* app = malloc(sizeof(BtHid));
 
 
     // Gui
     // Gui
     app->gui = furi_record_open("gui");
     app->gui = furi_record_open("gui");

+ 1 - 1
applications/bt/bt_hid_app/views/bt_hid_keynote.c

@@ -161,7 +161,7 @@ static bool bt_hid_keynote_input_callback(InputEvent* event, void* context) {
 }
 }
 
 
 BtHidKeynote* bt_hid_keynote_alloc() {
 BtHidKeynote* bt_hid_keynote_alloc() {
-    BtHidKeynote* bt_hid_keynote = furi_alloc(sizeof(BtHidKeynote));
+    BtHidKeynote* bt_hid_keynote = malloc(sizeof(BtHidKeynote));
     bt_hid_keynote->view = view_alloc();
     bt_hid_keynote->view = view_alloc();
     view_set_context(bt_hid_keynote->view, bt_hid_keynote);
     view_set_context(bt_hid_keynote->view, bt_hid_keynote);
     view_allocate_model(bt_hid_keynote->view, ViewModelTypeLocking, sizeof(BtHidKeynoteModel));
     view_allocate_model(bt_hid_keynote->view, ViewModelTypeLocking, sizeof(BtHidKeynoteModel));

+ 1 - 1
applications/bt/bt_hid_app/views/bt_hid_media.c

@@ -162,7 +162,7 @@ static bool bt_hid_media_input_callback(InputEvent* event, void* context) {
 }
 }
 
 
 BtHidMedia* bt_hid_media_alloc() {
 BtHidMedia* bt_hid_media_alloc() {
-    BtHidMedia* bt_hid_media = furi_alloc(sizeof(BtHidMedia));
+    BtHidMedia* bt_hid_media = malloc(sizeof(BtHidMedia));
     bt_hid_media->view = view_alloc();
     bt_hid_media->view = view_alloc();
     view_set_context(bt_hid_media->view, bt_hid_media);
     view_set_context(bt_hid_media->view, bt_hid_media);
     view_allocate_model(bt_hid_media->view, ViewModelTypeLocking, sizeof(BtHidMediaModel));
     view_allocate_model(bt_hid_media->view, ViewModelTypeLocking, sizeof(BtHidMediaModel));

+ 1 - 1
applications/bt/bt_service/bt.c

@@ -101,7 +101,7 @@ static void bt_battery_level_changed_callback(const void* _event, void* context)
 }
 }
 
 
 Bt* bt_alloc() {
 Bt* bt_alloc() {
-    Bt* bt = furi_alloc(sizeof(Bt));
+    Bt* bt = malloc(sizeof(Bt));
     // Init default maximum packet size
     // Init default maximum packet size
     bt->max_packet_size = FURI_HAL_BT_SERIAL_PACKET_SIZE_MAX;
     bt->max_packet_size = FURI_HAL_BT_SERIAL_PACKET_SIZE_MAX;
     bt->profile = BtProfileSerial;
     bt->profile = BtProfileSerial;

+ 1 - 1
applications/bt/bt_settings_app/bt_settings_app.c

@@ -13,7 +13,7 @@ static bool bt_settings_back_event_callback(void* context) {
 }
 }
 
 
 BtSettingsApp* bt_settings_app_alloc() {
 BtSettingsApp* bt_settings_app_alloc() {
-    BtSettingsApp* app = furi_alloc(sizeof(BtSettingsApp));
+    BtSettingsApp* app = malloc(sizeof(BtSettingsApp));
 
 
     // Load settings
     // Load settings
     bt_settings_load(&app->settings);
     bt_settings_load(&app->settings);

+ 1 - 1
applications/cli/cli.c

@@ -5,7 +5,7 @@
 #include <loader/loader.h>
 #include <loader/loader.h>
 
 
 Cli* cli_alloc() {
 Cli* cli_alloc() {
-    Cli* cli = furi_alloc(sizeof(Cli));
+    Cli* cli = malloc(sizeof(Cli));
 
 
     CliCommandTree_init(cli->commands);
     CliCommandTree_init(cli->commands);
 
 

+ 3 - 3
applications/crypto/crypto_cli.c

@@ -67,7 +67,7 @@ void crypto_cli_encrypt(Cli* cli, string_t args) {
                 size = size - remain + 16;
                 size = size - remain + 16;
             }
             }
             string_reserve(input, size);
             string_reserve(input, size);
-            uint8_t* output = furi_alloc(size);
+            uint8_t* output = malloc(size);
             if(!furi_hal_crypto_encrypt((const uint8_t*)string_get_cstr(input), output, size)) {
             if(!furi_hal_crypto_encrypt((const uint8_t*)string_get_cstr(input), output, size)) {
                 printf("Failed to encrypt input");
                 printf("Failed to encrypt input");
             } else {
             } else {
@@ -135,8 +135,8 @@ void crypto_cli_decrypt(Cli* cli, string_t args) {
         size_t hex_size = string_size(hex_input);
         size_t hex_size = string_size(hex_input);
         if(hex_size > 0 && hex_size % 2 == 0) {
         if(hex_size > 0 && hex_size % 2 == 0) {
             size_t size = hex_size / 2;
             size_t size = hex_size / 2;
-            uint8_t* input = furi_alloc(size);
-            uint8_t* output = furi_alloc(size);
+            uint8_t* input = malloc(size);
+            uint8_t* output = malloc(size);
 
 
             if(args_read_hex_bytes(hex_input, input, size)) {
             if(args_read_hex_bytes(hex_input, input, size)) {
                 if(furi_hal_crypto_decrypt(input, output, size)) {
                 if(furi_hal_crypto_decrypt(input, output, size)) {

+ 1 - 1
applications/debug_tools/display_test/display_test.c

@@ -121,7 +121,7 @@ static void display_config_set_contrast(VariableItem* item) {
 }
 }
 
 
 DisplayTest* display_test_alloc() {
 DisplayTest* display_test_alloc() {
-    DisplayTest* instance = furi_alloc(sizeof(DisplayTest));
+    DisplayTest* instance = malloc(sizeof(DisplayTest));
 
 
     View* view = NULL;
     View* view = NULL;
 
 

+ 1 - 1
applications/debug_tools/display_test/view_display_test.c

@@ -155,7 +155,7 @@ static void view_display_test_timer_callback(void* context) {
 }
 }
 
 
 ViewDisplayTest* view_display_test_alloc() {
 ViewDisplayTest* view_display_test_alloc() {
-    ViewDisplayTest* instance = furi_alloc(sizeof(ViewDisplayTest));
+    ViewDisplayTest* instance = malloc(sizeof(ViewDisplayTest));
 
 
     instance->view = view_alloc();
     instance->view = view_alloc();
     view_set_context(instance->view, instance);
     view_set_context(instance->view, instance);

+ 3 - 3
applications/debug_tools/uart_echo.c

@@ -178,7 +178,7 @@ static int32_t uart_echo_worker(void* context) {
 }
 }
 
 
 static UartEchoApp* uart_echo_app_alloc() {
 static UartEchoApp* uart_echo_app_alloc() {
-    UartEchoApp* app = furi_alloc(sizeof(UartEchoApp));
+    UartEchoApp* app = malloc(sizeof(UartEchoApp));
 
 
     app->rx_stream = xStreamBufferCreate(2048, 1);
     app->rx_stream = xStreamBufferCreate(2048, 1);
 
 
@@ -201,7 +201,7 @@ static UartEchoApp* uart_echo_app_alloc() {
             for(size_t i = 0; i < LINES_ON_SCREEN; i++) {
             for(size_t i = 0; i < LINES_ON_SCREEN; i++) {
                 model->line = 0;
                 model->line = 0;
                 model->escape = false;
                 model->escape = false;
-                model->list[i] = furi_alloc(sizeof(ListElement));
+                model->list[i] = malloc(sizeof(ListElement));
                 string_init(model->list[i]->text);
                 string_init(model->list[i]->text);
             }
             }
             return true;
             return true;
@@ -265,4 +265,4 @@ int32_t uart_echo_app(void* p) {
     view_dispatcher_run(app->view_dispatcher);
     view_dispatcher_run(app->view_dispatcher);
     uart_echo_app_free(app);
     uart_echo_app_free(app);
     return 0;
     return 0;
-}
+}

+ 1 - 1
applications/debug_tools/usb_test.c

@@ -47,7 +47,7 @@ uint32_t usb_test_exit(void* context) {
 }
 }
 
 
 UsbTestApp* usb_test_app_alloc() {
 UsbTestApp* usb_test_app_alloc() {
-    UsbTestApp* app = furi_alloc(sizeof(UsbTestApp));
+    UsbTestApp* app = malloc(sizeof(UsbTestApp));
 
 
     // Gui
     // Gui
     app->gui = furi_record_open("gui");
     app->gui = furi_record_open("gui");

+ 1 - 1
applications/desktop/animations/animation_manager.c

@@ -258,7 +258,7 @@ static void animation_manager_replace_current_animation(
 }
 }
 
 
 AnimationManager* animation_manager_alloc(void) {
 AnimationManager* animation_manager_alloc(void) {
-    AnimationManager* animation_manager = furi_alloc(sizeof(AnimationManager));
+    AnimationManager* animation_manager = malloc(sizeof(AnimationManager));
     animation_manager->animation_view = bubble_animation_view_alloc();
     animation_manager->animation_view = bubble_animation_view_alloc();
     animation_manager->view_stack = view_stack_alloc();
     animation_manager->view_stack = view_stack_alloc();
     View* animation_view = bubble_animation_get_view(animation_manager->animation_view);
     View* animation_view = bubble_animation_get_view(animation_manager->animation_view);

+ 63 - 66
applications/desktop/animations/animation_storage.c

@@ -1,6 +1,6 @@
 
 
 #include <stdint.h>
 #include <stdint.h>
-#include <flipper_file.h>
+#include <flipper_format/flipper_format.h>
 #include <furi.h>
 #include <furi.h>
 #include <furi/dangerous_defines.h>
 #include <furi/dangerous_defines.h>
 #include <storage/storage.h>
 #include <storage/storage.h>
@@ -30,41 +30,41 @@ static bool animation_storage_load_single_manifest_info(
 
 
     bool result = false;
     bool result = false;
     Storage* storage = furi_record_open("storage");
     Storage* storage = furi_record_open("storage");
-    FlipperFile* file = flipper_file_alloc(storage);
-    flipper_file_set_strict_mode(file, true);
+    FlipperFormat* file = flipper_format_file_alloc(storage);
+    flipper_format_set_strict_mode(file, true);
     string_t read_string;
     string_t read_string;
     string_init(read_string);
     string_init(read_string);
 
 
     do {
     do {
         uint32_t u32value;
         uint32_t u32value;
         if(FSE_OK != storage_sd_status(storage)) break;
         if(FSE_OK != storage_sd_status(storage)) break;
-        if(!flipper_file_open_existing(file, ANIMATION_MANIFEST_FILE)) break;
+        if(!flipper_format_file_open_existing(file, ANIMATION_MANIFEST_FILE)) break;
 
 
-        if(!flipper_file_read_header(file, read_string, &u32value)) break;
+        if(!flipper_format_read_header(file, read_string, &u32value)) break;
         if(string_cmp_str(read_string, "Flipper Animation Manifest")) break;
         if(string_cmp_str(read_string, "Flipper Animation Manifest")) break;
 
 
         manifest_info->name = NULL;
         manifest_info->name = NULL;
 
 
         /* skip other animation names */
         /* skip other animation names */
-        flipper_file_set_strict_mode(file, false);
-        while(flipper_file_read_string(file, "Name", read_string) &&
+        flipper_format_set_strict_mode(file, false);
+        while(flipper_format_read_string(file, "Name", read_string) &&
               string_cmp_str(read_string, name))
               string_cmp_str(read_string, name))
             ;
             ;
         if(string_cmp_str(read_string, name)) break;
         if(string_cmp_str(read_string, name)) break;
-        flipper_file_set_strict_mode(file, true);
+        flipper_format_set_strict_mode(file, true);
 
 
-        manifest_info->name = furi_alloc(string_size(read_string) + 1);
+        manifest_info->name = malloc(string_size(read_string) + 1);
         strcpy((char*)manifest_info->name, string_get_cstr(read_string));
         strcpy((char*)manifest_info->name, string_get_cstr(read_string));
 
 
-        if(!flipper_file_read_uint32(file, "Min butthurt", &u32value, 1)) break;
+        if(!flipper_format_read_uint32(file, "Min butthurt", &u32value, 1)) break;
         manifest_info->min_butthurt = u32value;
         manifest_info->min_butthurt = u32value;
-        if(!flipper_file_read_uint32(file, "Max butthurt", &u32value, 1)) break;
+        if(!flipper_format_read_uint32(file, "Max butthurt", &u32value, 1)) break;
         manifest_info->max_butthurt = u32value;
         manifest_info->max_butthurt = u32value;
-        if(!flipper_file_read_uint32(file, "Min level", &u32value, 1)) break;
+        if(!flipper_format_read_uint32(file, "Min level", &u32value, 1)) break;
         manifest_info->min_level = u32value;
         manifest_info->min_level = u32value;
-        if(!flipper_file_read_uint32(file, "Max level", &u32value, 1)) break;
+        if(!flipper_format_read_uint32(file, "Max level", &u32value, 1)) break;
         manifest_info->max_level = u32value;
         manifest_info->max_level = u32value;
-        if(!flipper_file_read_uint32(file, "Weight", &u32value, 1)) break;
+        if(!flipper_format_read_uint32(file, "Weight", &u32value, 1)) break;
         manifest_info->weight = u32value;
         manifest_info->weight = u32value;
         result = true;
         result = true;
     } while(0);
     } while(0);
@@ -73,8 +73,7 @@ static bool animation_storage_load_single_manifest_info(
         free((void*)manifest_info->name);
         free((void*)manifest_info->name);
     }
     }
     string_clear(read_string);
     string_clear(read_string);
-    flipper_file_close(file);
-    flipper_file_free(file);
+    flipper_format_free(file);
 
 
     furi_record_close("storage");
     furi_record_close("storage");
 
 
@@ -86,9 +85,9 @@ void animation_storage_fill_animation_list(StorageAnimationList_t* animation_lis
     furi_assert(!StorageAnimationList_size(*animation_list));
     furi_assert(!StorageAnimationList_size(*animation_list));
 
 
     Storage* storage = furi_record_open("storage");
     Storage* storage = furi_record_open("storage");
-    FlipperFile* file = flipper_file_alloc(storage);
+    FlipperFormat* file = flipper_format_file_alloc(storage);
     /* Forbid skipping fields */
     /* Forbid skipping fields */
-    flipper_file_set_strict_mode(file, true);
+    flipper_format_set_strict_mode(file, true);
     string_t read_string;
     string_t read_string;
     string_init(read_string);
     string_init(read_string);
 
 
@@ -97,28 +96,28 @@ void animation_storage_fill_animation_list(StorageAnimationList_t* animation_lis
         StorageAnimation* storage_animation = NULL;
         StorageAnimation* storage_animation = NULL;
 
 
         if(FSE_OK != storage_sd_status(storage)) break;
         if(FSE_OK != storage_sd_status(storage)) break;
-        if(!flipper_file_open_existing(file, ANIMATION_MANIFEST_FILE)) break;
-        if(!flipper_file_read_header(file, read_string, &u32value)) break;
+        if(!flipper_format_file_open_existing(file, ANIMATION_MANIFEST_FILE)) break;
+        if(!flipper_format_read_header(file, read_string, &u32value)) break;
         if(string_cmp_str(read_string, "Flipper Animation Manifest")) break;
         if(string_cmp_str(read_string, "Flipper Animation Manifest")) break;
         do {
         do {
-            storage_animation = furi_alloc(sizeof(StorageAnimation));
+            storage_animation = malloc(sizeof(StorageAnimation));
             storage_animation->external = true;
             storage_animation->external = true;
             storage_animation->animation = NULL;
             storage_animation->animation = NULL;
             storage_animation->manifest_info.name = NULL;
             storage_animation->manifest_info.name = NULL;
 
 
-            if(!flipper_file_read_string(file, "Name", read_string)) break;
-            storage_animation->manifest_info.name = furi_alloc(string_size(read_string) + 1);
+            if(!flipper_format_read_string(file, "Name", read_string)) break;
+            storage_animation->manifest_info.name = malloc(string_size(read_string) + 1);
             strcpy((char*)storage_animation->manifest_info.name, string_get_cstr(read_string));
             strcpy((char*)storage_animation->manifest_info.name, string_get_cstr(read_string));
 
 
-            if(!flipper_file_read_uint32(file, "Min butthurt", &u32value, 1)) break;
+            if(!flipper_format_read_uint32(file, "Min butthurt", &u32value, 1)) break;
             storage_animation->manifest_info.min_butthurt = u32value;
             storage_animation->manifest_info.min_butthurt = u32value;
-            if(!flipper_file_read_uint32(file, "Max butthurt", &u32value, 1)) break;
+            if(!flipper_format_read_uint32(file, "Max butthurt", &u32value, 1)) break;
             storage_animation->manifest_info.max_butthurt = u32value;
             storage_animation->manifest_info.max_butthurt = u32value;
-            if(!flipper_file_read_uint32(file, "Min level", &u32value, 1)) break;
+            if(!flipper_format_read_uint32(file, "Min level", &u32value, 1)) break;
             storage_animation->manifest_info.min_level = u32value;
             storage_animation->manifest_info.min_level = u32value;
-            if(!flipper_file_read_uint32(file, "Max level", &u32value, 1)) break;
+            if(!flipper_format_read_uint32(file, "Max level", &u32value, 1)) break;
             storage_animation->manifest_info.max_level = u32value;
             storage_animation->manifest_info.max_level = u32value;
-            if(!flipper_file_read_uint32(file, "Weight", &u32value, 1)) break;
+            if(!flipper_format_read_uint32(file, "Weight", &u32value, 1)) break;
             storage_animation->manifest_info.weight = u32value;
             storage_animation->manifest_info.weight = u32value;
 
 
             StorageAnimationList_push_back(*animation_list, storage_animation);
             StorageAnimationList_push_back(*animation_list, storage_animation);
@@ -128,8 +127,7 @@ void animation_storage_fill_animation_list(StorageAnimationList_t* animation_lis
     } while(0);
     } while(0);
 
 
     string_clear(read_string);
     string_clear(read_string);
-    flipper_file_close(file);
-    flipper_file_free(file);
+    flipper_format_free(file);
 
 
     // add hard-coded animations
     // add hard-coded animations
     for(int i = 0; i < dolphin_internal_size; ++i) {
     for(int i = 0; i < dolphin_internal_size; ++i) {
@@ -162,7 +160,7 @@ StorageAnimation* animation_storage_find_animation(const char* name) {
 
 
     /* look through external animations */
     /* look through external animations */
     if(!storage_animation) {
     if(!storage_animation) {
-        storage_animation = furi_alloc(sizeof(StorageAnimation));
+        storage_animation = malloc(sizeof(StorageAnimation));
         storage_animation->external = true;
         storage_animation->external = true;
 
 
         bool result = false;
         bool result = false;
@@ -288,7 +286,7 @@ static bool animation_storage_load_frames(
     FURI_CONST_ASSIGN(icon->frame_rate, 0);
     FURI_CONST_ASSIGN(icon->frame_rate, 0);
     FURI_CONST_ASSIGN(icon->height, height);
     FURI_CONST_ASSIGN(icon->height, height);
     FURI_CONST_ASSIGN(icon->width, width);
     FURI_CONST_ASSIGN(icon->width, width);
-    icon->frames = furi_alloc(sizeof(const uint8_t*) * icon->frame_count);
+    icon->frames = malloc(sizeof(const uint8_t*) * icon->frame_count);
 
 
     bool frames_ok = false;
     bool frames_ok = false;
     File* file = storage_file_alloc(storage);
     File* file = storage_file_alloc(storage);
@@ -317,7 +315,7 @@ static bool animation_storage_load_frames(
             break;
             break;
         }
         }
 
 
-        FURI_CONST_ASSIGN_PTR(icon->frames[i], furi_alloc(file_info.size));
+        FURI_CONST_ASSIGN_PTR(icon->frames[i], malloc(file_info.size));
         if(storage_file_read(file, (void*)icon->frames[i], file_info.size) != file_info.size) {
         if(storage_file_read(file, (void*)icon->frames[i], file_info.size) != file_info.size) {
             FURI_LOG_E(TAG, "Read failed: \'%s\'", string_get_cstr(filename));
             FURI_LOG_E(TAG, "Read failed: \'%s\'", string_get_cstr(filename));
             break;
             break;
@@ -348,7 +346,7 @@ static bool animation_storage_load_frames(
     return frames_ok;
     return frames_ok;
 }
 }
 
 
-static bool animation_storage_load_bubbles(BubbleAnimation* animation, FlipperFile* ff) {
+static bool animation_storage_load_bubbles(BubbleAnimation* animation, FlipperFormat* ff) {
     uint32_t u32value;
     uint32_t u32value;
     string_t str;
     string_t str;
     string_init(str);
     string_init(str);
@@ -356,7 +354,7 @@ static bool animation_storage_load_bubbles(BubbleAnimation* animation, FlipperFi
     furi_assert(!animation->frame_bubble_sequences);
     furi_assert(!animation->frame_bubble_sequences);
 
 
     do {
     do {
-        if(!flipper_file_read_uint32(ff, "Bubble slots", &u32value, 1)) break;
+        if(!flipper_format_read_uint32(ff, "Bubble slots", &u32value, 1)) break;
         if(u32value > 20) break;
         if(u32value > 20) break;
         animation->frame_bubble_sequences_count = u32value;
         animation->frame_bubble_sequences_count = u32value;
         if(animation->frame_bubble_sequences_count == 0) {
         if(animation->frame_bubble_sequences_count == 0) {
@@ -365,22 +363,22 @@ static bool animation_storage_load_bubbles(BubbleAnimation* animation, FlipperFi
             break;
             break;
         }
         }
         animation->frame_bubble_sequences =
         animation->frame_bubble_sequences =
-            furi_alloc(sizeof(FrameBubble*) * animation->frame_bubble_sequences_count);
+            malloc(sizeof(FrameBubble*) * animation->frame_bubble_sequences_count);
 
 
         uint32_t current_slot = 0;
         uint32_t current_slot = 0;
         for(int i = 0; i < animation->frame_bubble_sequences_count; ++i) {
         for(int i = 0; i < animation->frame_bubble_sequences_count; ++i) {
             FURI_CONST_ASSIGN_PTR(
             FURI_CONST_ASSIGN_PTR(
-                animation->frame_bubble_sequences[i], furi_alloc(sizeof(FrameBubble)));
+                animation->frame_bubble_sequences[i], malloc(sizeof(FrameBubble)));
         }
         }
 
 
         const FrameBubble* bubble = animation->frame_bubble_sequences[0];
         const FrameBubble* bubble = animation->frame_bubble_sequences[0];
         int8_t index = -1;
         int8_t index = -1;
         for(;;) {
         for(;;) {
-            if(!flipper_file_read_uint32(ff, "Slot", &current_slot, 1)) break;
+            if(!flipper_format_read_uint32(ff, "Slot", &current_slot, 1)) break;
             if((current_slot != 0) && (index == -1)) break;
             if((current_slot != 0) && (index == -1)) break;
 
 
             if(current_slot == index) {
             if(current_slot == index) {
-                FURI_CONST_ASSIGN_PTR(bubble->next_bubble, furi_alloc(sizeof(FrameBubble)));
+                FURI_CONST_ASSIGN_PTR(bubble->next_bubble, malloc(sizeof(FrameBubble)));
                 bubble = bubble->next_bubble;
                 bubble = bubble->next_bubble;
             } else if(current_slot == index + 1) {
             } else if(current_slot == index + 1) {
                 ++index;
                 ++index;
@@ -392,27 +390,27 @@ static bool animation_storage_load_bubbles(BubbleAnimation* animation, FlipperFi
             }
             }
             if(index >= animation->frame_bubble_sequences_count) break;
             if(index >= animation->frame_bubble_sequences_count) break;
 
 
-            if(!flipper_file_read_uint32(ff, "X", &u32value, 1)) break;
+            if(!flipper_format_read_uint32(ff, "X", &u32value, 1)) break;
             FURI_CONST_ASSIGN(bubble->bubble.x, u32value);
             FURI_CONST_ASSIGN(bubble->bubble.x, u32value);
-            if(!flipper_file_read_uint32(ff, "Y", &u32value, 1)) break;
+            if(!flipper_format_read_uint32(ff, "Y", &u32value, 1)) break;
             FURI_CONST_ASSIGN(bubble->bubble.y, u32value);
             FURI_CONST_ASSIGN(bubble->bubble.y, u32value);
 
 
-            if(!flipper_file_read_string(ff, "Text", str)) break;
+            if(!flipper_format_read_string(ff, "Text", str)) break;
             if(string_size(str) > 100) break;
             if(string_size(str) > 100) break;
 
 
             string_replace_all_str(str, "\\n", "\n");
             string_replace_all_str(str, "\\n", "\n");
 
 
-            FURI_CONST_ASSIGN_PTR(bubble->bubble.text, furi_alloc(string_size(str) + 1));
+            FURI_CONST_ASSIGN_PTR(bubble->bubble.text, malloc(string_size(str) + 1));
             strcpy((char*)bubble->bubble.text, string_get_cstr(str));
             strcpy((char*)bubble->bubble.text, string_get_cstr(str));
 
 
-            if(!flipper_file_read_string(ff, "AlignH", str)) break;
+            if(!flipper_format_read_string(ff, "AlignH", str)) break;
             if(!animation_storage_cast_align(str, (Align*)&bubble->bubble.align_h)) break;
             if(!animation_storage_cast_align(str, (Align*)&bubble->bubble.align_h)) break;
-            if(!flipper_file_read_string(ff, "AlignV", str)) break;
+            if(!flipper_format_read_string(ff, "AlignV", str)) break;
             if(!animation_storage_cast_align(str, (Align*)&bubble->bubble.align_v)) break;
             if(!animation_storage_cast_align(str, (Align*)&bubble->bubble.align_v)) break;
 
 
-            if(!flipper_file_read_uint32(ff, "StartFrame", &u32value, 1)) break;
+            if(!flipper_format_read_uint32(ff, "StartFrame", &u32value, 1)) break;
             FURI_CONST_ASSIGN(bubble->start_frame, u32value);
             FURI_CONST_ASSIGN(bubble->start_frame, u32value);
-            if(!flipper_file_read_uint32(ff, "EndFrame", &u32value, 1)) break;
+            if(!flipper_format_read_uint32(ff, "EndFrame", &u32value, 1)) break;
             FURI_CONST_ASSIGN(bubble->end_frame, u32value);
             FURI_CONST_ASSIGN(bubble->end_frame, u32value);
         }
         }
         success = (index + 1) == animation->frame_bubble_sequences_count;
         success = (index + 1) == animation->frame_bubble_sequences_count;
@@ -431,15 +429,15 @@ static bool animation_storage_load_bubbles(BubbleAnimation* animation, FlipperFi
 
 
 static BubbleAnimation* animation_storage_load_animation(const char* name) {
 static BubbleAnimation* animation_storage_load_animation(const char* name) {
     furi_assert(name);
     furi_assert(name);
-    BubbleAnimation* animation = furi_alloc(sizeof(BubbleAnimation));
+    BubbleAnimation* animation = malloc(sizeof(BubbleAnimation));
 
 
     uint32_t height = 0;
     uint32_t height = 0;
     uint32_t width = 0;
     uint32_t width = 0;
     uint32_t* u32array = NULL;
     uint32_t* u32array = NULL;
     Storage* storage = furi_record_open("storage");
     Storage* storage = furi_record_open("storage");
-    FlipperFile* ff = flipper_file_alloc(storage);
+    FlipperFormat* ff = flipper_format_file_alloc(storage);
     /* Forbid skipping fields */
     /* Forbid skipping fields */
-    flipper_file_set_strict_mode(ff, true);
+    flipper_format_set_strict_mode(ff, true);
     string_t str;
     string_t str;
     string_init(str);
     string_init(str);
     animation->frame_bubble_sequences = NULL;
     animation->frame_bubble_sequences = NULL;
@@ -451,28 +449,28 @@ static BubbleAnimation* animation_storage_load_animation(const char* name) {
         if(FSE_OK != storage_sd_status(storage)) break;
         if(FSE_OK != storage_sd_status(storage)) break;
 
 
         string_printf(str, ANIMATION_DIR "/%s/" ANIMATION_META_FILE, name);
         string_printf(str, ANIMATION_DIR "/%s/" ANIMATION_META_FILE, name);
-        if(!flipper_file_open_existing(ff, string_get_cstr(str))) break;
-        if(!flipper_file_read_header(ff, str, &u32value)) break;
+        if(!flipper_format_file_open_existing(ff, string_get_cstr(str))) break;
+        if(!flipper_format_read_header(ff, str, &u32value)) break;
         if(string_cmp_str(str, "Flipper Animation")) break;
         if(string_cmp_str(str, "Flipper Animation")) break;
 
 
-        if(!flipper_file_read_uint32(ff, "Width", &width, 1)) break;
-        if(!flipper_file_read_uint32(ff, "Height", &height, 1)) break;
+        if(!flipper_format_read_uint32(ff, "Width", &width, 1)) break;
+        if(!flipper_format_read_uint32(ff, "Height", &height, 1)) break;
 
 
-        if(!flipper_file_read_uint32(ff, "Passive frames", &u32value, 1)) break;
+        if(!flipper_format_read_uint32(ff, "Passive frames", &u32value, 1)) break;
         animation->passive_frames = u32value;
         animation->passive_frames = u32value;
-        if(!flipper_file_read_uint32(ff, "Active frames", &u32value, 1)) break;
+        if(!flipper_format_read_uint32(ff, "Active frames", &u32value, 1)) break;
         animation->active_frames = u32value;
         animation->active_frames = u32value;
 
 
         uint8_t frames = animation->passive_frames + animation->active_frames;
         uint8_t frames = animation->passive_frames + animation->active_frames;
         uint32_t count = 0;
         uint32_t count = 0;
-        if(!flipper_file_get_value_count(ff, "Frames order", &count)) break;
+        if(!flipper_format_get_value_count(ff, "Frames order", &count)) break;
         if(count != frames) {
         if(count != frames) {
             FURI_LOG_E(TAG, "Error loading animation: frames order");
             FURI_LOG_E(TAG, "Error loading animation: frames order");
             break;
             break;
         }
         }
-        u32array = furi_alloc(sizeof(uint32_t) * frames);
-        if(!flipper_file_read_uint32(ff, "Frames order", u32array, frames)) break;
-        animation->frame_order = furi_alloc(sizeof(uint8_t) * frames);
+        u32array = malloc(sizeof(uint32_t) * frames);
+        if(!flipper_format_read_uint32(ff, "Frames order", u32array, frames)) break;
+        animation->frame_order = malloc(sizeof(uint8_t) * frames);
         for(int i = 0; i < frames; ++i) {
         for(int i = 0; i < frames; ++i) {
             FURI_CONST_ASSIGN(animation->frame_order[i], u32array[i]);
             FURI_CONST_ASSIGN(animation->frame_order[i], u32array[i]);
         }
         }
@@ -481,13 +479,13 @@ static BubbleAnimation* animation_storage_load_animation(const char* name) {
         if(!animation_storage_load_frames(storage, name, animation, u32array, width, height))
         if(!animation_storage_load_frames(storage, name, animation, u32array, width, height))
             break;
             break;
 
 
-        if(!flipper_file_read_uint32(ff, "Active cycles", &u32value, 1)) break;
+        if(!flipper_format_read_uint32(ff, "Active cycles", &u32value, 1)) break;
         animation->active_cycles = u32value;
         animation->active_cycles = u32value;
-        if(!flipper_file_read_uint32(ff, "Frame rate", &u32value, 1)) break;
+        if(!flipper_format_read_uint32(ff, "Frame rate", &u32value, 1)) break;
         FURI_CONST_ASSIGN(animation->icon_animation.frame_rate, u32value);
         FURI_CONST_ASSIGN(animation->icon_animation.frame_rate, u32value);
-        if(!flipper_file_read_uint32(ff, "Duration", &u32value, 1)) break;
+        if(!flipper_format_read_uint32(ff, "Duration", &u32value, 1)) break;
         animation->duration = u32value;
         animation->duration = u32value;
-        if(!flipper_file_read_uint32(ff, "Active cooldown", &u32value, 1)) break;
+        if(!flipper_format_read_uint32(ff, "Active cooldown", &u32value, 1)) break;
         animation->active_cooldown = u32value;
         animation->active_cooldown = u32value;
 
 
         if(!animation_storage_load_bubbles(animation, ff)) break;
         if(!animation_storage_load_bubbles(animation, ff)) break;
@@ -495,8 +493,7 @@ static BubbleAnimation* animation_storage_load_animation(const char* name) {
     } while(0);
     } while(0);
 
 
     string_clear(str);
     string_clear(str);
-    flipper_file_close(ff);
-    flipper_file_free(ff);
+    flipper_format_free(ff);
     if(u32array) {
     if(u32array) {
         free(u32array);
         free(u32array);
     }
     }

+ 4 - 4
applications/desktop/animations/views/bubble_animation_view.c

@@ -256,17 +256,17 @@ static Icon* bubble_animation_clone_first_frame(const Icon* icon_orig) {
     furi_assert(icon_orig->frames);
     furi_assert(icon_orig->frames);
     furi_assert(icon_orig->frames[0]);
     furi_assert(icon_orig->frames[0]);
 
 
-    Icon* icon_clone = furi_alloc(sizeof(Icon));
+    Icon* icon_clone = malloc(sizeof(Icon));
     memcpy(icon_clone, icon_orig, sizeof(Icon));
     memcpy(icon_clone, icon_orig, sizeof(Icon));
 
 
-    icon_clone->frames = furi_alloc(sizeof(uint8_t*));
+    icon_clone->frames = malloc(sizeof(uint8_t*));
     /* icon bitmap can be either compressed or not. It is compressed if
     /* icon bitmap can be either compressed or not. It is compressed if
      * compressed size is less than original, so max size for bitmap is
      * compressed size is less than original, so max size for bitmap is
      * uncompressed (width * height) + 1 byte (in uncompressed case)
      * uncompressed (width * height) + 1 byte (in uncompressed case)
      * for compressed header
      * for compressed header
      */
      */
     size_t max_bitmap_size = ROUND_UP_TO(icon_orig->width, 8) * icon_orig->height + 1;
     size_t max_bitmap_size = ROUND_UP_TO(icon_orig->width, 8) * icon_orig->height + 1;
-    FURI_CONST_ASSIGN_PTR(icon_clone->frames[0], furi_alloc(max_bitmap_size));
+    FURI_CONST_ASSIGN_PTR(icon_clone->frames[0], malloc(max_bitmap_size));
     memcpy((void*)icon_clone->frames[0], icon_orig->frames[0], max_bitmap_size);
     memcpy((void*)icon_clone->frames[0], icon_orig->frames[0], max_bitmap_size);
     FURI_CONST_ASSIGN(icon_clone->frame_count, 1);
     FURI_CONST_ASSIGN(icon_clone->frame_count, 1);
 
 
@@ -304,7 +304,7 @@ static void bubble_animation_exit(void* context) {
 }
 }
 
 
 BubbleAnimationView* bubble_animation_view_alloc(void) {
 BubbleAnimationView* bubble_animation_view_alloc(void) {
-    BubbleAnimationView* view = furi_alloc(sizeof(BubbleAnimationView));
+    BubbleAnimationView* view = malloc(sizeof(BubbleAnimationView));
     view->view = view_alloc();
     view->view = view_alloc();
     view->interact_callback = NULL;
     view->interact_callback = NULL;
     view->timer = osTimerNew(bubble_animation_timer_callback, osTimerPeriodic, view, NULL);
     view->timer = osTimerNew(bubble_animation_timer_callback, osTimerPeriodic, view, NULL);

+ 1 - 1
applications/desktop/animations/views/one_shot_animation_view.c

@@ -78,7 +78,7 @@ static bool one_shot_view_input(InputEvent* event, void* context) {
 }
 }
 
 
 OneShotView* one_shot_view_alloc(void) {
 OneShotView* one_shot_view_alloc(void) {
-    OneShotView* view = furi_alloc(sizeof(OneShotView));
+    OneShotView* view = malloc(sizeof(OneShotView));
     view->view = view_alloc();
     view->view = view_alloc();
     view->update_timer =
     view->update_timer =
         xTimerCreate(NULL, 1000, pdTRUE, view, one_shot_view_update_timer_callback);
         xTimerCreate(NULL, 1000, pdTRUE, view, one_shot_view_update_timer_callback);

+ 1 - 1
applications/desktop/desktop.c

@@ -39,7 +39,7 @@ static void desktop_tick_event_callback(void* context) {
 }
 }
 
 
 Desktop* desktop_alloc() {
 Desktop* desktop_alloc() {
-    Desktop* desktop = furi_alloc(sizeof(Desktop));
+    Desktop* desktop = malloc(sizeof(Desktop));
 
 
     desktop->unload_animation_semaphore = osSemaphoreNew(1, 0, NULL);
     desktop->unload_animation_semaphore = osSemaphoreNew(1, 0, NULL);
     desktop->animation_manager = animation_manager_alloc();
     desktop->animation_manager = animation_manager_alloc();

+ 1 - 1
applications/desktop/desktop_settings/desktop_settings_app.c

@@ -19,7 +19,7 @@ static bool desktop_settings_back_event_callback(void* context) {
 }
 }
 
 
 DesktopSettingsApp* desktop_settings_app_alloc() {
 DesktopSettingsApp* desktop_settings_app_alloc() {
-    DesktopSettingsApp* app = furi_alloc(sizeof(DesktopSettingsApp));
+    DesktopSettingsApp* app = malloc(sizeof(DesktopSettingsApp));
 
 
     app->gui = furi_record_open("gui");
     app->gui = furi_record_open("gui");
     app->view_dispatcher = view_dispatcher_alloc();
     app->view_dispatcher = view_dispatcher_alloc();

+ 1 - 1
applications/desktop/desktop_settings/views/desktop_settings_view_pin_setup_howto.c

@@ -55,7 +55,7 @@ void desktop_settings_view_pin_setup_howto_set_callback(
 }
 }
 
 
 DesktopSettingsViewPinSetupHowto* desktop_settings_view_pin_setup_howto_alloc() {
 DesktopSettingsViewPinSetupHowto* desktop_settings_view_pin_setup_howto_alloc() {
-    DesktopSettingsViewPinSetupHowto* view = furi_alloc(sizeof(DesktopSettingsViewPinSetupHowto));
+    DesktopSettingsViewPinSetupHowto* view = malloc(sizeof(DesktopSettingsViewPinSetupHowto));
     view->view = view_alloc();
     view->view = view_alloc();
     view_allocate_model(view->view, ViewModelTypeLockFree, 1);
     view_allocate_model(view->view, ViewModelTypeLockFree, 1);
     view_set_context(view->view, view);
     view_set_context(view->view, view);

+ 1 - 2
applications/desktop/desktop_settings/views/desktop_settings_view_pin_setup_howto2.c

@@ -77,8 +77,7 @@ void desktop_settings_view_pin_setup_howto2_set_ok_callback(
 }
 }
 
 
 DesktopSettingsViewPinSetupHowto2* desktop_settings_view_pin_setup_howto2_alloc() {
 DesktopSettingsViewPinSetupHowto2* desktop_settings_view_pin_setup_howto2_alloc() {
-    DesktopSettingsViewPinSetupHowto2* view =
-        furi_alloc(sizeof(DesktopSettingsViewPinSetupHowto2));
+    DesktopSettingsViewPinSetupHowto2* view = malloc(sizeof(DesktopSettingsViewPinSetupHowto2));
     view->view = view_alloc();
     view->view = view_alloc();
     view_allocate_model(view->view, ViewModelTypeLockFree, 1);
     view_allocate_model(view->view, ViewModelTypeLockFree, 1);
     view_set_context(view->view, view);
     view_set_context(view->view, view);

+ 1 - 1
applications/desktop/scenes/desktop_scene_hw_mismatch.c

@@ -16,7 +16,7 @@ void desktop_scene_hw_mismatch_on_enter(void* context) {
     furi_assert(desktop);
     furi_assert(desktop);
     Popup* popup = desktop->hw_mismatch_popup;
     Popup* popup = desktop->hw_mismatch_popup;
 
 
-    char* text_buffer = furi_alloc(256);
+    char* text_buffer = malloc(256);
     scene_manager_set_scene_state(
     scene_manager_set_scene_state(
         desktop->scene_manager, DesktopSceneHwMismatch, (uint32_t)text_buffer);
         desktop->scene_manager, DesktopSceneHwMismatch, (uint32_t)text_buffer);
 
 

+ 1 - 1
applications/desktop/scenes/desktop_scene_pin_input.c

@@ -80,7 +80,7 @@ void desktop_scene_pin_input_on_enter(void* context) {
     desktop_view_pin_input_set_done_callback(
     desktop_view_pin_input_set_done_callback(
         desktop->pin_input_view, desktop_scene_pin_input_done_callback);
         desktop->pin_input_view, desktop_scene_pin_input_done_callback);
 
 
-    DesktopScenePinInputState* state = furi_alloc(sizeof(DesktopScenePinInputState));
+    DesktopScenePinInputState* state = malloc(sizeof(DesktopScenePinInputState));
     state->timer =
     state->timer =
         xTimerCreate(NULL, 10000, pdFALSE, desktop, desktop_scene_pin_input_timer_callback);
         xTimerCreate(NULL, 10000, pdFALSE, desktop, desktop_scene_pin_input_timer_callback);
     scene_manager_set_scene_state(desktop->scene_manager, DesktopScenePinInput, (uint32_t)state);
     scene_manager_set_scene_state(desktop->scene_manager, DesktopScenePinInput, (uint32_t)state);

+ 1 - 1
applications/desktop/views/desktop_view_debug.c

@@ -150,7 +150,7 @@ bool desktop_debug_input(InputEvent* event, void* context) {
 }
 }
 
 
 DesktopDebugView* desktop_debug_alloc() {
 DesktopDebugView* desktop_debug_alloc() {
-    DesktopDebugView* debug_view = furi_alloc(sizeof(DesktopDebugView));
+    DesktopDebugView* debug_view = malloc(sizeof(DesktopDebugView));
     debug_view->view = view_alloc();
     debug_view->view = view_alloc();
     view_allocate_model(debug_view->view, ViewModelTypeLocking, sizeof(DesktopDebugViewModel));
     view_allocate_model(debug_view->view, ViewModelTypeLocking, sizeof(DesktopDebugViewModel));
     view_set_context(debug_view->view, debug_view);
     view_set_context(debug_view->view, debug_view);

+ 1 - 1
applications/desktop/views/desktop_view_first_start.c

@@ -131,7 +131,7 @@ static void desktop_first_start_exit(void* context) {
 }
 }
 
 
 DesktopFirstStartView* desktop_first_start_alloc() {
 DesktopFirstStartView* desktop_first_start_alloc() {
-    DesktopFirstStartView* instance = furi_alloc(sizeof(DesktopFirstStartView));
+    DesktopFirstStartView* instance = malloc(sizeof(DesktopFirstStartView));
     instance->view = view_alloc();
     instance->view = view_alloc();
     view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(DesktopFirstStartViewModel));
     view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(DesktopFirstStartViewModel));
     view_set_context(instance->view, instance);
     view_set_context(instance->view, instance);

+ 1 - 1
applications/desktop/views/desktop_view_lock_menu.c

@@ -112,7 +112,7 @@ bool desktop_lock_menu_input(InputEvent* event, void* context) {
 }
 }
 
 
 DesktopLockMenuView* desktop_lock_menu_alloc() {
 DesktopLockMenuView* desktop_lock_menu_alloc() {
-    DesktopLockMenuView* lock_menu = furi_alloc(sizeof(DesktopLockMenuView));
+    DesktopLockMenuView* lock_menu = malloc(sizeof(DesktopLockMenuView));
     lock_menu->view = view_alloc();
     lock_menu->view = view_alloc();
     view_allocate_model(lock_menu->view, ViewModelTypeLocking, sizeof(DesktopLockMenuViewModel));
     view_allocate_model(lock_menu->view, ViewModelTypeLocking, sizeof(DesktopLockMenuViewModel));
     view_set_context(lock_menu->view, lock_menu);
     view_set_context(lock_menu->view, lock_menu);

+ 1 - 1
applications/desktop/views/desktop_view_locked.c

@@ -184,7 +184,7 @@ static bool desktop_view_locked_input(InputEvent* event, void* context) {
 }
 }
 
 
 DesktopViewLocked* desktop_view_locked_alloc() {
 DesktopViewLocked* desktop_view_locked_alloc() {
-    DesktopViewLocked* locked_view = furi_alloc(sizeof(DesktopViewLocked));
+    DesktopViewLocked* locked_view = malloc(sizeof(DesktopViewLocked));
     locked_view->view = view_alloc();
     locked_view->view = view_alloc();
     locked_view->timer =
     locked_view->timer =
         xTimerCreate(NULL, 1000 / 16, pdTRUE, locked_view, locked_view_timer_callback);
         xTimerCreate(NULL, 1000 / 16, pdTRUE, locked_view, locked_view_timer_callback);

+ 1 - 1
applications/desktop/views/desktop_view_main.c

@@ -58,7 +58,7 @@ bool desktop_main_input(InputEvent* event, void* context) {
 }
 }
 
 
 DesktopMainView* desktop_main_alloc() {
 DesktopMainView* desktop_main_alloc() {
-    DesktopMainView* main_view = furi_alloc(sizeof(DesktopMainView));
+    DesktopMainView* main_view = malloc(sizeof(DesktopMainView));
 
 
     main_view->view = view_alloc();
     main_view->view = view_alloc();
     view_allocate_model(main_view->view, ViewModelTypeLockFree, 1);
     view_allocate_model(main_view->view, ViewModelTypeLockFree, 1);

+ 1 - 1
applications/desktop/views/desktop_view_pin_input.c

@@ -185,7 +185,7 @@ static void desktop_view_pin_input_exit(void* context) {
 }
 }
 
 
 DesktopViewPinInput* desktop_view_pin_input_alloc(void) {
 DesktopViewPinInput* desktop_view_pin_input_alloc(void) {
-    DesktopViewPinInput* pin_input = furi_alloc(sizeof(DesktopViewPinInput));
+    DesktopViewPinInput* pin_input = malloc(sizeof(DesktopViewPinInput));
     pin_input->view = view_alloc();
     pin_input->view = view_alloc();
     view_allocate_model(pin_input->view, ViewModelTypeLocking, sizeof(DesktopViewPinInputModel));
     view_allocate_model(pin_input->view, ViewModelTypeLocking, sizeof(DesktopViewPinInputModel));
     view_set_context(pin_input->view, pin_input);
     view_set_context(pin_input->view, pin_input);

+ 1 - 1
applications/desktop/views/desktop_view_pin_setup_done.c

@@ -57,7 +57,7 @@ void desktop_view_pin_done_set_callback(
 }
 }
 
 
 DesktopViewPinSetupDone* desktop_view_pin_done_alloc() {
 DesktopViewPinSetupDone* desktop_view_pin_done_alloc() {
-    DesktopViewPinSetupDone* view = furi_alloc(sizeof(DesktopViewPinSetupDone));
+    DesktopViewPinSetupDone* view = malloc(sizeof(DesktopViewPinSetupDone));
     view->view = view_alloc();
     view->view = view_alloc();
     view_allocate_model(view->view, ViewModelTypeLockFree, 1);
     view_allocate_model(view->view, ViewModelTypeLockFree, 1);
     view_set_context(view->view, view);
     view_set_context(view->view, view);

+ 1 - 1
applications/desktop/views/desktop_view_pin_timeout.c

@@ -77,7 +77,7 @@ void desktop_view_pin_timeout_free(DesktopViewPinTimeout* instance) {
 }
 }
 
 
 DesktopViewPinTimeout* desktop_view_pin_timeout_alloc(void) {
 DesktopViewPinTimeout* desktop_view_pin_timeout_alloc(void) {
-    DesktopViewPinTimeout* instance = furi_alloc(sizeof(DesktopViewPinTimeout));
+    DesktopViewPinTimeout* instance = malloc(sizeof(DesktopViewPinTimeout));
     instance->timer = xTimerCreate(
     instance->timer = xTimerCreate(
         NULL, pdMS_TO_TICKS(1000), pdTRUE, instance, desktop_view_pin_timeout_timer_callback);
         NULL, pdMS_TO_TICKS(1000), pdTRUE, instance, desktop_view_pin_timeout_timer_callback);
 
 

+ 1 - 1
applications/dialogs/dialogs.c

@@ -36,4 +36,4 @@ int32_t dialogs_srv(void* p) {
     }
     }
 
 
     return 0;
     return 0;
-}
+}

+ 2 - 3
applications/dialogs/dialogs_module_file_select.c

@@ -25,8 +25,7 @@ bool dialogs_app_process_module_file_select(const DialogsAppMessageDataFileSelec
     bool ret = false;
     bool ret = false;
     Gui* gui = furi_record_open("gui");
     Gui* gui = furi_record_open("gui");
 
 
-    DialogsAppFileSelectContext* file_select_context =
-        furi_alloc(sizeof(DialogsAppFileSelectContext));
+    DialogsAppFileSelectContext* file_select_context = malloc(sizeof(DialogsAppFileSelectContext));
     file_select_context->lock = API_LOCK_INIT_LOCKED();
     file_select_context->lock = API_LOCK_INIT_LOCKED();
 
 
     ViewHolder* view_holder = view_holder_alloc();
     ViewHolder* view_holder = view_holder_alloc();
@@ -57,4 +56,4 @@ bool dialogs_app_process_module_file_select(const DialogsAppMessageDataFileSelec
     furi_record_close("gui");
     furi_record_close("gui");
 
 
     return ret;
     return ret;
-}
+}

+ 3 - 3
applications/dialogs/dialogs_module_message.c

@@ -54,7 +54,7 @@ DialogMessageButton dialogs_app_process_module_message(const DialogsAppMessageDa
     DialogMessageButton ret = DialogMessageButtonBack;
     DialogMessageButton ret = DialogMessageButtonBack;
     Gui* gui = furi_record_open("gui");
     Gui* gui = furi_record_open("gui");
     const DialogMessage* message = data->message;
     const DialogMessage* message = data->message;
-    DialogsAppMessageContext* message_context = furi_alloc(sizeof(DialogsAppMessageContext));
+    DialogsAppMessageContext* message_context = malloc(sizeof(DialogsAppMessageContext));
     message_context->lock = API_LOCK_INIT_LOCKED();
     message_context->lock = API_LOCK_INIT_LOCKED();
 
 
     ViewHolder* view_holder = view_holder_alloc();
     ViewHolder* view_holder = view_holder_alloc();
@@ -100,7 +100,7 @@ DialogMessageButton dialogs_app_process_module_message(const DialogsAppMessageDa
 }
 }
 
 
 DialogMessage* dialog_message_alloc() {
 DialogMessage* dialog_message_alloc() {
-    DialogMessage* message = furi_alloc(sizeof(DialogMessage));
+    DialogMessage* message = malloc(sizeof(DialogMessage));
     return message;
     return message;
 }
 }
 
 
@@ -150,4 +150,4 @@ void dialog_message_set_buttons(
     message->left_button_text = left;
     message->left_button_text = left;
     message->center_button_text = center;
     message->center_button_text = center;
     message->right_button_text = right;
     message->right_button_text = right;
-}
+}

+ 2 - 2
applications/dialogs/view_holder.c

@@ -21,7 +21,7 @@ static void view_holder_draw_callback(Canvas* canvas, void* context);
 static void view_holder_input_callback(InputEvent* event, void* context);
 static void view_holder_input_callback(InputEvent* event, void* context);
 
 
 ViewHolder* view_holder_alloc() {
 ViewHolder* view_holder_alloc() {
-    ViewHolder* view_holder = furi_alloc(sizeof(ViewHolder));
+    ViewHolder* view_holder = malloc(sizeof(ViewHolder));
 
 
     view_holder->view_port = view_port_alloc();
     view_holder->view_port = view_port_alloc();
     view_port_draw_callback_set(view_holder->view_port, view_holder_draw_callback, view_holder);
     view_port_draw_callback_set(view_holder->view_port, view_holder_draw_callback, view_holder);
@@ -147,4 +147,4 @@ static void view_holder_input_callback(InputEvent* event, void* context) {
             }
             }
         }
         }
     }
     }
-}
+}

+ 1 - 1
applications/dolphin/dolphin.c

@@ -74,7 +74,7 @@ void dolphin_clear_limits_timer_callback(TimerHandle_t xTimer) {
 }
 }
 
 
 Dolphin* dolphin_alloc() {
 Dolphin* dolphin_alloc() {
-    Dolphin* dolphin = furi_alloc(sizeof(Dolphin));
+    Dolphin* dolphin = malloc(sizeof(Dolphin));
 
 
     dolphin->state = dolphin_state_alloc();
     dolphin->state = dolphin_state_alloc();
     dolphin->event_queue = osMessageQueueNew(8, sizeof(DolphinEvent), NULL);
     dolphin->event_queue = osMessageQueueNew(8, sizeof(DolphinEvent), NULL);

+ 1 - 1
applications/dolphin/helpers/dolphin_state.c

@@ -17,7 +17,7 @@
 #define BUTTHURT_MIN 0
 #define BUTTHURT_MIN 0
 
 
 DolphinState* dolphin_state_alloc() {
 DolphinState* dolphin_state_alloc() {
-    return furi_alloc(sizeof(DolphinState));
+    return malloc(sizeof(DolphinState));
 }
 }
 
 
 void dolphin_state_free(DolphinState* dolphin_state) {
 void dolphin_state_free(DolphinState* dolphin_state) {

+ 1 - 1
applications/gpio/gpio_app.c

@@ -22,7 +22,7 @@ static void gpio_app_tick_event_callback(void* context) {
 }
 }
 
 
 GpioApp* gpio_app_alloc() {
 GpioApp* gpio_app_alloc() {
-    GpioApp* app = furi_alloc(sizeof(GpioApp));
+    GpioApp* app = malloc(sizeof(GpioApp));
 
 
     app->gui = furi_record_open("gui");
     app->gui = furi_record_open("gui");
 
 

+ 1 - 1
applications/gpio/scenes/gpio_scene_usb_uart.c

@@ -18,7 +18,7 @@ void gpio_scene_usb_uart_on_enter(void* context) {
     GpioApp* app = context;
     GpioApp* app = context;
     uint32_t prev_state = scene_manager_get_scene_state(app->scene_manager, GpioAppViewUsbUart);
     uint32_t prev_state = scene_manager_get_scene_state(app->scene_manager, GpioAppViewUsbUart);
     if(prev_state == 0) {
     if(prev_state == 0) {
-        scene_usb_uart = furi_alloc(sizeof(SceneUsbUartBridge));
+        scene_usb_uart = malloc(sizeof(SceneUsbUartBridge));
         scene_usb_uart->cfg.vcp_ch = 0; // TODO: settings load
         scene_usb_uart->cfg.vcp_ch = 0; // TODO: settings load
         scene_usb_uart->cfg.uart_ch = 0;
         scene_usb_uart->cfg.uart_ch = 0;
         scene_usb_uart->cfg.flow_pins = 0;
         scene_usb_uart->cfg.flow_pins = 0;

+ 1 - 1
applications/gpio/scenes/gpio_scene_usb_uart_config.c

@@ -91,7 +91,7 @@ void gpio_scene_usb_uart_cfg_on_enter(void* context) {
     GpioApp* app = context;
     GpioApp* app = context;
     VariableItemList* var_item_list = app->var_item_list;
     VariableItemList* var_item_list = app->var_item_list;
 
 
-    cfg_set = furi_alloc(sizeof(UsbUartConfig));
+    cfg_set = malloc(sizeof(UsbUartConfig));
     usb_uart_get_config(app->usb_uart_bridge, cfg_set);
     usb_uart_get_config(app->usb_uart_bridge, cfg_set);
 
 
     VariableItem* item;
     VariableItem* item;

+ 1 - 1
applications/gpio/usb_uart_bridge.c

@@ -312,7 +312,7 @@ static void vcp_on_line_config(void* context, struct usb_cdc_line_coding* config
 }
 }
 
 
 UsbUartBridge* usb_uart_enable(UsbUartConfig* cfg) {
 UsbUartBridge* usb_uart_enable(UsbUartConfig* cfg) {
-    UsbUartBridge* usb_uart = furi_alloc(sizeof(UsbUartBridge));
+    UsbUartBridge* usb_uart = malloc(sizeof(UsbUartBridge));
 
 
     memcpy(&(usb_uart->cfg_new), cfg, sizeof(UsbUartConfig));
     memcpy(&(usb_uart->cfg_new), cfg, sizeof(UsbUartConfig));
 
 

+ 1 - 1
applications/gpio/views/gpio_test.c

@@ -96,7 +96,7 @@ static bool gpio_test_process_ok(GpioTest* gpio_test, InputEvent* event) {
 }
 }
 
 
 GpioTest* gpio_test_alloc() {
 GpioTest* gpio_test_alloc() {
-    GpioTest* gpio_test = furi_alloc(sizeof(GpioTest));
+    GpioTest* gpio_test = malloc(sizeof(GpioTest));
 
 
     gpio_test->view = view_alloc();
     gpio_test->view = view_alloc();
     view_allocate_model(gpio_test->view, ViewModelTypeLocking, sizeof(GpioTestModel));
     view_allocate_model(gpio_test->view, ViewModelTypeLocking, sizeof(GpioTestModel));

+ 1 - 1
applications/gpio/views/gpio_usb_uart.c

@@ -102,7 +102,7 @@ static bool gpio_usb_uart_input_callback(InputEvent* event, void* context) {
 }
 }
 
 
 GpioUsbUart* gpio_usb_uart_alloc() {
 GpioUsbUart* gpio_usb_uart_alloc() {
-    GpioUsbUart* usb_uart = furi_alloc(sizeof(GpioUsbUart));
+    GpioUsbUart* usb_uart = malloc(sizeof(GpioUsbUart));
 
 
     usb_uart->view = view_alloc();
     usb_uart->view = view_alloc();
     view_allocate_model(usb_uart->view, ViewModelTypeLocking, sizeof(GpioUsbUartModel));
     view_allocate_model(usb_uart->view, ViewModelTypeLocking, sizeof(GpioUsbUartModel));

+ 1 - 1
applications/gui/canvas.c

@@ -15,7 +15,7 @@ const CanvasFontParameters canvas_font_params[FontTotalNumber] = {
 };
 };
 
 
 Canvas* canvas_init() {
 Canvas* canvas_init() {
-    Canvas* canvas = furi_alloc(sizeof(Canvas));
+    Canvas* canvas = malloc(sizeof(Canvas));
 
 
     furi_hal_power_insomnia_enter();
     furi_hal_power_insomnia_enter();
 
 

+ 1 - 1
applications/gui/gui.c

@@ -417,7 +417,7 @@ void gui_set_lockdown(Gui* gui, bool lockdown) {
 }
 }
 
 
 Gui* gui_alloc() {
 Gui* gui_alloc() {
-    Gui* gui = furi_alloc(sizeof(Gui));
+    Gui* gui = malloc(sizeof(Gui));
     // Thread ID
     // Thread ID
     gui->thread = osThreadGetId();
     gui->thread = osThreadGetId();
     // Allocate mutex
     // Allocate mutex

+ 1 - 1
applications/gui/icon_animation.c

@@ -5,7 +5,7 @@
 
 
 IconAnimation* icon_animation_alloc(const Icon* icon) {
 IconAnimation* icon_animation_alloc(const Icon* icon) {
     furi_assert(icon);
     furi_assert(icon);
-    IconAnimation* instance = furi_alloc(sizeof(IconAnimation));
+    IconAnimation* instance = malloc(sizeof(IconAnimation));
     instance->icon = icon;
     instance->icon = icon;
     instance->timer = osTimerNew(icon_animation_timer_callback, osTimerPeriodic, instance, NULL);
     instance->timer = osTimerNew(icon_animation_timer_callback, osTimerPeriodic, instance, NULL);
     return instance;
     return instance;

+ 1 - 1
applications/gui/modules/button_menu.c

@@ -290,7 +290,7 @@ ButtonMenuItem* button_menu_add_item(
 }
 }
 
 
 ButtonMenu* button_menu_alloc(void) {
 ButtonMenu* button_menu_alloc(void) {
-    ButtonMenu* button_menu = furi_alloc(sizeof(ButtonMenu));
+    ButtonMenu* button_menu = malloc(sizeof(ButtonMenu));
     button_menu->view = view_alloc();
     button_menu->view = view_alloc();
     view_set_orientation(button_menu->view, ViewOrientationVertical);
     view_set_orientation(button_menu->view, ViewOrientationVertical);
     view_set_context(button_menu->view, button_menu);
     view_set_context(button_menu->view, button_menu);

+ 2 - 2
applications/gui/modules/button_panel.c

@@ -65,7 +65,7 @@ static void button_panel_view_draw_callback(Canvas* canvas, void* _model);
 static bool button_panel_view_input_callback(InputEvent* event, void* context);
 static bool button_panel_view_input_callback(InputEvent* event, void* context);
 
 
 ButtonPanel* button_panel_alloc() {
 ButtonPanel* button_panel_alloc() {
-    ButtonPanel* button_panel = furi_alloc(sizeof(ButtonPanel));
+    ButtonPanel* button_panel = malloc(sizeof(ButtonPanel));
     button_panel->view = view_alloc();
     button_panel->view = view_alloc();
     view_set_orientation(button_panel->view, ViewOrientationVertical);
     view_set_orientation(button_panel->view, ViewOrientationVertical);
     view_set_context(button_panel->view, button_panel);
     view_set_context(button_panel->view, button_panel);
@@ -173,7 +173,7 @@ void button_panel_add_item(
             ButtonItem** button_item_ptr =
             ButtonItem** button_item_ptr =
                 button_panel_get_item(model, matrix_place_x, matrix_place_y);
                 button_panel_get_item(model, matrix_place_x, matrix_place_y);
             furi_check(*button_item_ptr == NULL);
             furi_check(*button_item_ptr == NULL);
-            *button_item_ptr = furi_alloc(sizeof(ButtonItem));
+            *button_item_ptr = malloc(sizeof(ButtonItem));
             ButtonItem* button_item = *button_item_ptr;
             ButtonItem* button_item = *button_item_ptr;
             button_item->callback = callback;
             button_item->callback = callback;
             button_item->callback_context = callback_context;
             button_item->callback_context = callback_context;

+ 1 - 1
applications/gui/modules/byte_input.c

@@ -695,7 +695,7 @@ static void byte_input_reset_model_input_data(ByteInputModel* model) {
  * @return ByteInput instance pointer
  * @return ByteInput instance pointer
  */
  */
 ByteInput* byte_input_alloc() {
 ByteInput* byte_input_alloc() {
-    ByteInput* byte_input = furi_alloc(sizeof(ByteInput));
+    ByteInput* byte_input = malloc(sizeof(ByteInput));
     byte_input->view = view_alloc();
     byte_input->view = view_alloc();
     view_set_context(byte_input->view, byte_input);
     view_set_context(byte_input->view, byte_input);
     view_allocate_model(byte_input->view, ViewModelTypeLocking, sizeof(ByteInputModel));
     view_allocate_model(byte_input->view, ViewModelTypeLocking, sizeof(ByteInputModel));

+ 1 - 1
applications/gui/modules/dialog.c

@@ -60,7 +60,7 @@ static bool dialog_view_input_callback(InputEvent* event, void* context) {
 }
 }
 
 
 Dialog* dialog_alloc() {
 Dialog* dialog_alloc() {
-    Dialog* dialog = furi_alloc(sizeof(Dialog));
+    Dialog* dialog = malloc(sizeof(Dialog));
     dialog->view = view_alloc();
     dialog->view = view_alloc();
     view_set_context(dialog->view, dialog);
     view_set_context(dialog->view, dialog);
     view_allocate_model(dialog->view, ViewModelTypeLockFree, sizeof(DialogModel));
     view_allocate_model(dialog->view, ViewModelTypeLockFree, sizeof(DialogModel));

+ 1 - 1
applications/gui/modules/dialog_ex.c

@@ -114,7 +114,7 @@ static bool dialog_ex_view_input_callback(InputEvent* event, void* context) {
 }
 }
 
 
 DialogEx* dialog_ex_alloc() {
 DialogEx* dialog_ex_alloc() {
-    DialogEx* dialog_ex = furi_alloc(sizeof(DialogEx));
+    DialogEx* dialog_ex = malloc(sizeof(DialogEx));
     dialog_ex->view = view_alloc();
     dialog_ex->view = view_alloc();
     view_set_context(dialog_ex->view, dialog_ex);
     view_set_context(dialog_ex->view, dialog_ex);
     view_allocate_model(dialog_ex->view, ViewModelTypeLockFree, sizeof(DialogExModel));
     view_allocate_model(dialog_ex->view, ViewModelTypeLockFree, sizeof(DialogExModel));

+ 2 - 2
applications/gui/modules/empty_screen.c

@@ -14,7 +14,7 @@ static bool empty_screen_view_input_callback(InputEvent* event, void* context) {
 }
 }
 
 
 EmptyScreen* empty_screen_alloc() {
 EmptyScreen* empty_screen_alloc() {
-    EmptyScreen* empty_screen = furi_alloc(sizeof(EmptyScreen));
+    EmptyScreen* empty_screen = malloc(sizeof(EmptyScreen));
     empty_screen->view = view_alloc();
     empty_screen->view = view_alloc();
     view_set_context(empty_screen->view, empty_screen);
     view_set_context(empty_screen->view, empty_screen);
     view_set_draw_callback(empty_screen->view, empty_screen_view_draw_callback);
     view_set_draw_callback(empty_screen->view, empty_screen_view_draw_callback);
@@ -31,4 +31,4 @@ void empty_screen_free(EmptyScreen* empty_screen) {
 View* empty_screen_get_view(EmptyScreen* empty_screen) {
 View* empty_screen_get_view(EmptyScreen* empty_screen) {
     furi_assert(empty_screen);
     furi_assert(empty_screen);
     return empty_screen->view;
     return empty_screen->view;
-}
+}

+ 5 - 5
applications/gui/modules/file_select.c

@@ -181,7 +181,7 @@ static bool file_select_init_inner(FileSelect* file_select) {
 }
 }
 
 
 FileSelect* file_select_alloc() {
 FileSelect* file_select_alloc() {
-    FileSelect* file_select = furi_alloc(sizeof(FileSelect));
+    FileSelect* file_select = malloc(sizeof(FileSelect));
     file_select->view = view_alloc();
     file_select->view = view_alloc();
     file_select->fs_api = furi_record_open("storage");
     file_select->fs_api = furi_record_open("storage");
 
 
@@ -278,7 +278,7 @@ bool file_select_fill_strings(FileSelect* file_select) {
     uint8_t string_counter = 0;
     uint8_t string_counter = 0;
     uint16_t file_counter = 0;
     uint16_t file_counter = 0;
     const uint8_t name_length = 100;
     const uint8_t name_length = 100;
-    char* name = furi_alloc(name_length);
+    char* name = malloc(name_length);
     uint16_t first_file_index = 0;
     uint16_t first_file_index = 0;
 
 
     with_view_model(
     with_view_model(
@@ -346,7 +346,7 @@ bool file_select_fill_count(FileSelect* file_select) {
 
 
     uint16_t file_counter = 0;
     uint16_t file_counter = 0;
     const uint8_t name_length = 100;
     const uint8_t name_length = 100;
-    char* name = furi_alloc(name_length);
+    char* name = malloc(name_length);
 
 
     if(!storage_dir_open(directory, file_select->path)) {
     if(!storage_dir_open(directory, file_select->path)) {
         storage_dir_close(directory);
         storage_dir_close(directory);
@@ -397,7 +397,7 @@ void file_select_set_selected_file_internal(FileSelect* file_select, const char*
     File* directory = storage_file_alloc(file_select->fs_api);
     File* directory = storage_file_alloc(file_select->fs_api);
 
 
     const uint8_t name_length = 100;
     const uint8_t name_length = 100;
-    char* name = furi_alloc(name_length);
+    char* name = malloc(name_length);
     uint16_t file_position = 0;
     uint16_t file_position = 0;
     bool file_found = false;
     bool file_found = false;
 
 
@@ -472,4 +472,4 @@ void file_select_set_selected_file(FileSelect* file_select, const char* filename
     if(!file_select_fill_strings(file_select)) {
     if(!file_select_fill_strings(file_select)) {
         file_select->callback(false, file_select->context);
         file_select->callback(false, file_select->context);
     }
     }
-}
+}

+ 1 - 1
applications/gui/modules/menu.c

@@ -125,7 +125,7 @@ static void menu_exit(void* context) {
 }
 }
 
 
 Menu* menu_alloc() {
 Menu* menu_alloc() {
-    Menu* menu = furi_alloc(sizeof(Menu));
+    Menu* menu = malloc(sizeof(Menu));
     menu->view = view_alloc(menu->view);
     menu->view = view_alloc(menu->view);
     view_set_context(menu->view, menu);
     view_set_context(menu->view, menu);
     view_allocate_model(menu->view, ViewModelTypeLocking, sizeof(MenuModel));
     view_allocate_model(menu->view, ViewModelTypeLocking, sizeof(MenuModel));

+ 1 - 1
applications/gui/modules/popup.c

@@ -108,7 +108,7 @@ void popup_stop_timer(void* context) {
 }
 }
 
 
 Popup* popup_alloc() {
 Popup* popup_alloc() {
-    Popup* popup = furi_alloc(sizeof(Popup));
+    Popup* popup = malloc(sizeof(Popup));
     popup->view = view_alloc();
     popup->view = view_alloc();
     popup->timer = osTimerNew(popup_timer_callback, osTimerOnce, popup, NULL);
     popup->timer = osTimerNew(popup_timer_callback, osTimerOnce, popup, NULL);
     furi_assert(popup->timer);
     furi_assert(popup->timer);

+ 1 - 1
applications/gui/modules/submenu.c

@@ -120,7 +120,7 @@ static bool submenu_view_input_callback(InputEvent* event, void* context) {
 }
 }
 
 
 Submenu* submenu_alloc() {
 Submenu* submenu_alloc() {
-    Submenu* submenu = furi_alloc(sizeof(Submenu));
+    Submenu* submenu = malloc(sizeof(Submenu));
     submenu->view = view_alloc();
     submenu->view = view_alloc();
     view_set_context(submenu->view, submenu);
     view_set_context(submenu->view, submenu);
     view_allocate_model(submenu->view, ViewModelTypeLocking, sizeof(SubmenuModel));
     view_allocate_model(submenu->view, ViewModelTypeLocking, sizeof(SubmenuModel));

+ 1 - 1
applications/gui/modules/text_box.c

@@ -128,7 +128,7 @@ static bool text_box_view_input_callback(InputEvent* event, void* context) {
 }
 }
 
 
 TextBox* text_box_alloc() {
 TextBox* text_box_alloc() {
-    TextBox* text_box = furi_alloc(sizeof(TextBox));
+    TextBox* text_box = malloc(sizeof(TextBox));
     text_box->view = view_alloc();
     text_box->view = view_alloc();
     view_set_context(text_box->view, text_box);
     view_set_context(text_box->view, text_box);
     view_allocate_model(text_box->view, ViewModelTypeLocking, sizeof(TextBoxModel));
     view_allocate_model(text_box->view, ViewModelTypeLocking, sizeof(TextBoxModel));

+ 1 - 1
applications/gui/modules/text_input.c

@@ -410,7 +410,7 @@ void text_input_timer_callback(void* context) {
 }
 }
 
 
 TextInput* text_input_alloc() {
 TextInput* text_input_alloc() {
-    TextInput* text_input = furi_alloc(sizeof(TextInput));
+    TextInput* text_input = malloc(sizeof(TextInput));
     text_input->view = view_alloc();
     text_input->view = view_alloc();
     view_set_context(text_input->view, text_input);
     view_set_context(text_input->view, text_input);
     view_allocate_model(text_input->view, ViewModelTypeLocking, sizeof(TextInputModel));
     view_allocate_model(text_input->view, ViewModelTypeLocking, sizeof(TextInputModel));

+ 1 - 1
applications/gui/modules/validators.c

@@ -28,7 +28,7 @@ bool validator_is_file_callback(const char* text, string_t error, void* context)
 
 
 ValidatorIsFile*
 ValidatorIsFile*
     validator_is_file_alloc_init(const char* app_path_folder, const char* app_extension) {
     validator_is_file_alloc_init(const char* app_path_folder, const char* app_extension) {
-    ValidatorIsFile* instance = furi_alloc(sizeof(ValidatorIsFile));
+    ValidatorIsFile* instance = malloc(sizeof(ValidatorIsFile));
 
 
     instance->app_path_folder = app_path_folder;
     instance->app_path_folder = app_path_folder;
     instance->app_extension = app_extension;
     instance->app_extension = app_extension;

+ 1 - 1
applications/gui/modules/variable_item_list.c

@@ -276,7 +276,7 @@ void variable_item_list_process_ok(VariableItemList* variable_item_list) {
 }
 }
 
 
 VariableItemList* variable_item_list_alloc() {
 VariableItemList* variable_item_list_alloc() {
-    VariableItemList* variable_item_list = furi_alloc(sizeof(VariableItemList));
+    VariableItemList* variable_item_list = malloc(sizeof(VariableItemList));
     variable_item_list->view = view_alloc();
     variable_item_list->view = view_alloc();
     view_set_context(variable_item_list->view, variable_item_list);
     view_set_context(variable_item_list->view, variable_item_list);
     view_allocate_model(
     view_allocate_model(

+ 1 - 1
applications/gui/modules/widget.c

@@ -52,7 +52,7 @@ static bool gui_widget_view_input_callback(InputEvent* event, void* context) {
 }
 }
 
 
 Widget* widget_alloc() {
 Widget* widget_alloc() {
-    Widget* widget = furi_alloc(sizeof(Widget));
+    Widget* widget = malloc(sizeof(Widget));
     widget->view = view_alloc();
     widget->view = view_alloc();
     view_set_context(widget->view, widget);
     view_set_context(widget->view, widget);
     view_allocate_model(widget->view, ViewModelTypeLocking, sizeof(GuiWidgetModel));
     view_allocate_model(widget->view, ViewModelTypeLocking, sizeof(GuiWidgetModel));

+ 2 - 2
applications/gui/modules/widget_elements/widget_element_button.c

@@ -61,14 +61,14 @@ WidgetElement* widget_element_button_create(
     ButtonCallback callback,
     ButtonCallback callback,
     void* context) {
     void* context) {
     // Allocate and init model
     // Allocate and init model
-    GuiButtonModel* model = furi_alloc(sizeof(GuiButtonModel));
+    GuiButtonModel* model = malloc(sizeof(GuiButtonModel));
     model->button_type = button_type;
     model->button_type = button_type;
     model->callback = callback;
     model->callback = callback;
     model->context = context;
     model->context = context;
     string_init_set_str(model->text, text);
     string_init_set_str(model->text, text);
 
 
     // Allocate and init Element
     // Allocate and init Element
-    WidgetElement* gui_button = furi_alloc(sizeof(WidgetElement));
+    WidgetElement* gui_button = malloc(sizeof(WidgetElement));
     gui_button->parent = NULL;
     gui_button->parent = NULL;
     gui_button->input = gui_button_input;
     gui_button->input = gui_button_input;
     gui_button->draw = gui_button_draw;
     gui_button->draw = gui_button_draw;

+ 2 - 2
applications/gui/modules/widget_elements/widget_element_frame.c

@@ -29,7 +29,7 @@ WidgetElement* widget_element_frame_create(
     uint8_t height,
     uint8_t height,
     uint8_t radius) {
     uint8_t radius) {
     // Allocate and init model
     // Allocate and init model
-    GuiFrameModel* model = furi_alloc(sizeof(GuiFrameModel));
+    GuiFrameModel* model = malloc(sizeof(GuiFrameModel));
     model->x = x;
     model->x = x;
     model->y = y;
     model->y = y;
     model->width = width;
     model->width = width;
@@ -37,7 +37,7 @@ WidgetElement* widget_element_frame_create(
     model->radius = radius;
     model->radius = radius;
 
 
     // Allocate and init Element
     // Allocate and init Element
-    WidgetElement* gui_frame = furi_alloc(sizeof(WidgetElement));
+    WidgetElement* gui_frame = malloc(sizeof(WidgetElement));
     gui_frame->parent = NULL;
     gui_frame->parent = NULL;
     gui_frame->input = NULL;
     gui_frame->input = NULL;
     gui_frame->draw = gui_frame_draw;
     gui_frame->draw = gui_frame_draw;

+ 2 - 2
applications/gui/modules/widget_elements/widget_element_icon.c

@@ -27,13 +27,13 @@ WidgetElement* widget_element_icon_create(uint8_t x, uint8_t y, const Icon* icon
     furi_assert(icon);
     furi_assert(icon);
 
 
     // Allocate and init model
     // Allocate and init model
-    GuiIconModel* model = furi_alloc(sizeof(GuiIconModel));
+    GuiIconModel* model = malloc(sizeof(GuiIconModel));
     model->x = x;
     model->x = x;
     model->y = y;
     model->y = y;
     model->icon = icon;
     model->icon = icon;
 
 
     // Allocate and init Element
     // Allocate and init Element
-    WidgetElement* gui_icon = furi_alloc(sizeof(WidgetElement));
+    WidgetElement* gui_icon = malloc(sizeof(WidgetElement));
     gui_icon->parent = NULL;
     gui_icon->parent = NULL;
     gui_icon->input = NULL;
     gui_icon->input = NULL;
     gui_icon->draw = gui_icon_draw;
     gui_icon->draw = gui_icon_draw;

+ 2 - 2
applications/gui/modules/widget_elements/widget_element_string.c

@@ -46,7 +46,7 @@ WidgetElement* widget_element_string_create(
     furi_assert(text);
     furi_assert(text);
 
 
     // Allocate and init model
     // Allocate and init model
-    GuiStringModel* model = furi_alloc(sizeof(GuiStringModel));
+    GuiStringModel* model = malloc(sizeof(GuiStringModel));
     model->x = x;
     model->x = x;
     model->y = y;
     model->y = y;
     model->horizontal = horizontal;
     model->horizontal = horizontal;
@@ -55,7 +55,7 @@ WidgetElement* widget_element_string_create(
     string_init_set_str(model->text, text);
     string_init_set_str(model->text, text);
 
 
     // Allocate and init Element
     // Allocate and init Element
-    WidgetElement* gui_string = furi_alloc(sizeof(WidgetElement));
+    WidgetElement* gui_string = malloc(sizeof(WidgetElement));
     gui_string->parent = NULL;
     gui_string->parent = NULL;
     gui_string->input = NULL;
     gui_string->input = NULL;
     gui_string->draw = gui_string_draw;
     gui_string->draw = gui_string_draw;

+ 2 - 2
applications/gui/modules/widget_elements/widget_element_string_multiline.c

@@ -47,7 +47,7 @@ WidgetElement* widget_element_string_multiline_create(
     furi_assert(text);
     furi_assert(text);
 
 
     // Allocate and init model
     // Allocate and init model
-    GuiStringMultiLineModel* model = furi_alloc(sizeof(GuiStringMultiLineModel));
+    GuiStringMultiLineModel* model = malloc(sizeof(GuiStringMultiLineModel));
     model->x = x;
     model->x = x;
     model->y = y;
     model->y = y;
     model->horizontal = horizontal;
     model->horizontal = horizontal;
@@ -56,7 +56,7 @@ WidgetElement* widget_element_string_multiline_create(
     string_init_set_str(model->text, text);
     string_init_set_str(model->text, text);
 
 
     // Allocate and init Element
     // Allocate and init Element
-    WidgetElement* gui_string = furi_alloc(sizeof(WidgetElement));
+    WidgetElement* gui_string = malloc(sizeof(WidgetElement));
     gui_string->parent = NULL;
     gui_string->parent = NULL;
     gui_string->input = NULL;
     gui_string->input = NULL;
     gui_string->draw = gui_string_multiline_draw;
     gui_string->draw = gui_string_multiline_draw;

+ 2 - 2
applications/gui/modules/widget_elements/widget_element_text_box.c

@@ -50,7 +50,7 @@ WidgetElement* widget_element_text_box_create(
     furi_assert(text);
     furi_assert(text);
 
 
     // Allocate and init model
     // Allocate and init model
-    GuiTextBoxModel* model = furi_alloc(sizeof(GuiTextBoxModel));
+    GuiTextBoxModel* model = malloc(sizeof(GuiTextBoxModel));
     model->x = x;
     model->x = x;
     model->y = y;
     model->y = y;
     model->width = width;
     model->width = width;
@@ -60,7 +60,7 @@ WidgetElement* widget_element_text_box_create(
     string_init_set_str(model->text, text);
     string_init_set_str(model->text, text);
 
 
     // Allocate and init Element
     // Allocate and init Element
-    WidgetElement* gui_string = furi_alloc(sizeof(WidgetElement));
+    WidgetElement* gui_string = malloc(sizeof(WidgetElement));
     gui_string->parent = NULL;
     gui_string->parent = NULL;
     gui_string->input = NULL;
     gui_string->input = NULL;
     gui_string->draw = gui_text_box_draw;
     gui_string->draw = gui_text_box_draw;

+ 97 - 65
applications/gui/scene_manager.c

@@ -4,12 +4,12 @@
 SceneManager* scene_manager_alloc(const SceneManagerHandlers* app_scene_handlers, void* context) {
 SceneManager* scene_manager_alloc(const SceneManagerHandlers* app_scene_handlers, void* context) {
     furi_assert(context);
     furi_assert(context);
 
 
-    SceneManager* scene_manager = furi_alloc(sizeof(SceneManager));
+    SceneManager* scene_manager = malloc(sizeof(SceneManager));
     // Set SceneManager context and scene handlers
     // Set SceneManager context and scene handlers
     scene_manager->context = context;
     scene_manager->context = context;
     scene_manager->scene_handlers = app_scene_handlers;
     scene_manager->scene_handlers = app_scene_handlers;
     // Allocate all scenes
     // Allocate all scenes
-    scene_manager->scene = furi_alloc(sizeof(AppScene) * app_scene_handlers->scene_num);
+    scene_manager->scene = malloc(sizeof(AppScene) * app_scene_handlers->scene_num);
     // Initialize ScaneManager array for navigation
     // Initialize ScaneManager array for navigation
     SceneManagerIdStack_init(scene_manager->scene_id_stack);
     SceneManagerIdStack_init(scene_manager->scene_id_stack);
 
 
@@ -48,9 +48,16 @@ bool scene_manager_handle_custom_event(SceneManager* scene_manager, uint32_t cus
         .type = SceneManagerEventTypeCustom,
         .type = SceneManagerEventTypeCustom,
         .event = custom_event,
         .event = custom_event,
     };
     };
-    uint32_t scene_id = *SceneManagerIdStack_back(scene_manager->scene_id_stack);
-    return scene_manager->scene_handlers->on_event_handlers[scene_id](
-        scene_manager->context, event);
+
+    bool result = false;
+    if(SceneManagerIdStack_size(scene_manager->scene_id_stack) > 0) {
+        uint32_t* scene_id_p = SceneManagerIdStack_back(scene_manager->scene_id_stack);
+        uint32_t scene_id = *scene_id_p;
+        result = scene_manager->scene_handlers->on_event_handlers[scene_id](
+            scene_manager->context, event);
+    }
+
+    return result;
 }
 }
 
 
 bool scene_manager_handle_back_event(SceneManager* scene_manager) {
 bool scene_manager_handle_back_event(SceneManager* scene_manager) {
@@ -59,9 +66,15 @@ bool scene_manager_handle_back_event(SceneManager* scene_manager) {
     SceneManagerEvent event = {
     SceneManagerEvent event = {
         .type = SceneManagerEventTypeBack,
         .type = SceneManagerEventTypeBack,
     };
     };
-    uint32_t scene_id = *SceneManagerIdStack_back(scene_manager->scene_id_stack);
-    bool consumed =
-        scene_manager->scene_handlers->on_event_handlers[scene_id](scene_manager->context, event);
+
+    bool consumed = false;
+    if(SceneManagerIdStack_size(scene_manager->scene_id_stack) > 0) {
+        uint32_t* scene_id_p = SceneManagerIdStack_back(scene_manager->scene_id_stack);
+        uint32_t scene_id = *scene_id_p;
+        consumed = scene_manager->scene_handlers->on_event_handlers[scene_id](
+            scene_manager->context, event);
+    }
+
     if(!consumed) {
     if(!consumed) {
         consumed = scene_manager_previous_scene(scene_manager);
         consumed = scene_manager_previous_scene(scene_manager);
     }
     }
@@ -74,8 +87,12 @@ void scene_manager_handle_tick_event(SceneManager* scene_manager) {
     SceneManagerEvent event = {
     SceneManagerEvent event = {
         .type = SceneManagerEventTypeTick,
         .type = SceneManagerEventTypeTick,
     };
     };
-    uint32_t scene_id = *SceneManagerIdStack_back(scene_manager->scene_id_stack);
-    scene_manager->scene_handlers->on_event_handlers[scene_id](scene_manager->context, event);
+
+    if(SceneManagerIdStack_size(scene_manager->scene_id_stack) > 0) {
+        uint32_t* scene_id_p = SceneManagerIdStack_back(scene_manager->scene_id_stack);
+        uint32_t scene_id = *scene_id_p;
+        scene_manager->scene_handlers->on_event_handlers[scene_id](scene_manager->context, event);
+    }
 }
 }
 
 
 void scene_manager_next_scene(SceneManager* scene_manager, uint32_t next_scene_id) {
 void scene_manager_next_scene(SceneManager* scene_manager, uint32_t next_scene_id) {
@@ -83,7 +100,7 @@ void scene_manager_next_scene(SceneManager* scene_manager, uint32_t next_scene_i
     furi_assert(next_scene_id < scene_manager->scene_handlers->scene_num);
     furi_assert(next_scene_id < scene_manager->scene_handlers->scene_num);
 
 
     // Check if it is not the first scene
     // Check if it is not the first scene
-    if(SceneManagerIdStack_size(scene_manager->scene_id_stack)) {
+    if(SceneManagerIdStack_size(scene_manager->scene_id_stack) > 0) {
         uint32_t cur_scene_id = *SceneManagerIdStack_back(scene_manager->scene_id_stack);
         uint32_t cur_scene_id = *SceneManagerIdStack_back(scene_manager->scene_id_stack);
         scene_manager->scene_handlers->on_exit_handlers[cur_scene_id](scene_manager->context);
         scene_manager->scene_handlers->on_exit_handlers[cur_scene_id](scene_manager->context);
     }
     }
@@ -95,18 +112,22 @@ void scene_manager_next_scene(SceneManager* scene_manager, uint32_t next_scene_i
 bool scene_manager_previous_scene(SceneManager* scene_manager) {
 bool scene_manager_previous_scene(SceneManager* scene_manager) {
     furi_assert(scene_manager);
     furi_assert(scene_manager);
 
 
-    uint32_t cur_scene_id = 0;
-    SceneManagerIdStack_pop_back(&cur_scene_id, scene_manager->scene_id_stack);
+    if(SceneManagerIdStack_size(scene_manager->scene_id_stack) > 0) {
+        uint32_t cur_scene_id = 0;
+        SceneManagerIdStack_pop_back(&cur_scene_id, scene_manager->scene_id_stack);
 
 
-    // Handle exit from start scene separately
-    if(SceneManagerIdStack_size(scene_manager->scene_id_stack) == 0) {
+        // Handle exit from start scene separately
+        if(SceneManagerIdStack_size(scene_manager->scene_id_stack) == 0) {
+            scene_manager->scene_handlers->on_exit_handlers[cur_scene_id](scene_manager->context);
+            return false;
+        }
+        uint32_t prev_scene_id = *SceneManagerIdStack_back(scene_manager->scene_id_stack);
         scene_manager->scene_handlers->on_exit_handlers[cur_scene_id](scene_manager->context);
         scene_manager->scene_handlers->on_exit_handlers[cur_scene_id](scene_manager->context);
+        scene_manager->scene_handlers->on_enter_handlers[prev_scene_id](scene_manager->context);
+        return true;
+    } else {
         return false;
         return false;
     }
     }
-    uint32_t prev_scene_id = *SceneManagerIdStack_back(scene_manager->scene_id_stack);
-    scene_manager->scene_handlers->on_exit_handlers[cur_scene_id](scene_manager->context);
-    scene_manager->scene_handlers->on_enter_handlers[prev_scene_id](scene_manager->context);
-    return true;
 }
 }
 
 
 bool scene_manager_search_and_switch_to_previous_scene(
 bool scene_manager_search_and_switch_to_previous_scene(
@@ -114,48 +135,55 @@ bool scene_manager_search_and_switch_to_previous_scene(
     uint32_t scene_id) {
     uint32_t scene_id) {
     furi_assert(scene_manager);
     furi_assert(scene_manager);
 
 
-    uint32_t prev_scene_id = 0;
-    uint32_t cur_scene_id = *SceneManagerIdStack_back(scene_manager->scene_id_stack);
-    SceneManagerIdStack_it_t scene_it;
-    SceneManagerIdStack_it_last(scene_it, scene_manager->scene_id_stack);
-    // Search scene with given id in navigation stack
-    bool scene_found = false;
-    while(!scene_found) {
-        SceneManagerIdStack_previous(scene_it);
-        if(SceneManagerIdStack_end_p(scene_it)) {
-            return false;
-        }
-        prev_scene_id = *SceneManagerIdStack_ref(scene_it);
-        if(prev_scene_id == scene_id) {
-            scene_found = true;
+    if(SceneManagerIdStack_size(scene_manager->scene_id_stack) > 0) {
+        uint32_t prev_scene_id = 0;
+        uint32_t cur_scene_id = *SceneManagerIdStack_back(scene_manager->scene_id_stack);
+        SceneManagerIdStack_it_t scene_it;
+        SceneManagerIdStack_it_last(scene_it, scene_manager->scene_id_stack);
+        // Search scene with given id in navigation stack
+        bool scene_found = false;
+        while(!scene_found) {
+            SceneManagerIdStack_previous(scene_it);
+            if(SceneManagerIdStack_end_p(scene_it)) {
+                return false;
+            }
+            prev_scene_id = *SceneManagerIdStack_ref(scene_it);
+            if(prev_scene_id == scene_id) {
+                scene_found = true;
+            }
         }
         }
-    }
-    // Remove all scene id from navigation stack
-    SceneManagerIdStack_next(scene_it);
-    SceneManagerIdStack_pop_until(scene_manager->scene_id_stack, scene_it);
+        // Remove all scene id from navigation stack
+        SceneManagerIdStack_next(scene_it);
+        SceneManagerIdStack_pop_until(scene_manager->scene_id_stack, scene_it);
 
 
-    scene_manager->scene_handlers->on_exit_handlers[cur_scene_id](scene_manager->context);
-    scene_manager->scene_handlers->on_enter_handlers[prev_scene_id](scene_manager->context);
+        scene_manager->scene_handlers->on_exit_handlers[cur_scene_id](scene_manager->context);
+        scene_manager->scene_handlers->on_enter_handlers[prev_scene_id](scene_manager->context);
 
 
-    return true;
+        return true;
+    } else {
+        return false;
+    }
 }
 }
 
 
 bool scene_manager_has_previous_scene(SceneManager* scene_manager, uint32_t scene_id) {
 bool scene_manager_has_previous_scene(SceneManager* scene_manager, uint32_t scene_id) {
     furi_assert(scene_manager);
     furi_assert(scene_manager);
     bool scene_found = false;
     bool scene_found = false;
-    uint32_t prev_scene_id;
-    SceneManagerIdStack_it_t scene_it;
-    SceneManagerIdStack_it_last(scene_it, scene_manager->scene_id_stack);
-
-    // Perform search in scene stack
-    while(!scene_found) {
-        SceneManagerIdStack_previous(scene_it);
-        if(SceneManagerIdStack_end_p(scene_it)) {
-            break;
-        }
-        prev_scene_id = *SceneManagerIdStack_ref(scene_it);
-        if(prev_scene_id == scene_id) {
-            scene_found = true;
+
+    if(SceneManagerIdStack_size(scene_manager->scene_id_stack) > 0) {
+        uint32_t prev_scene_id;
+        SceneManagerIdStack_it_t scene_it;
+        SceneManagerIdStack_it_last(scene_it, scene_manager->scene_id_stack);
+
+        // Perform search in scene stack
+        while(!scene_found) {
+            SceneManagerIdStack_previous(scene_it);
+            if(SceneManagerIdStack_end_p(scene_it)) {
+                break;
+            }
+            prev_scene_id = *SceneManagerIdStack_ref(scene_it);
+            if(prev_scene_id == scene_id) {
+                scene_found = true;
+            }
         }
         }
     }
     }
     return scene_found;
     return scene_found;
@@ -167,25 +195,29 @@ bool scene_manager_search_and_switch_to_another_scene(
     furi_assert(scene_manager);
     furi_assert(scene_manager);
     furi_assert(scene_id < scene_manager->scene_handlers->scene_num);
     furi_assert(scene_id < scene_manager->scene_handlers->scene_num);
 
 
-    uint32_t cur_scene_id = *SceneManagerIdStack_back(scene_manager->scene_id_stack);
-    SceneManagerIdStack_it_t scene_it;
-    SceneManagerIdStack_it(scene_it, scene_manager->scene_id_stack);
-    SceneManagerIdStack_next(scene_it);
-    // Remove all scene id from navigation stack until first scene
-    SceneManagerIdStack_pop_until(scene_manager->scene_id_stack, scene_it);
-    // Add next scene
-    SceneManagerIdStack_push_back(scene_manager->scene_id_stack, scene_id);
+    if(SceneManagerIdStack_size(scene_manager->scene_id_stack) > 0) {
+        uint32_t cur_scene_id = *SceneManagerIdStack_back(scene_manager->scene_id_stack);
+        SceneManagerIdStack_it_t scene_it;
+        SceneManagerIdStack_it(scene_it, scene_manager->scene_id_stack);
+        SceneManagerIdStack_next(scene_it);
+        // Remove all scene id from navigation stack until first scene
+        SceneManagerIdStack_pop_until(scene_manager->scene_id_stack, scene_it);
+        // Add next scene
+        SceneManagerIdStack_push_back(scene_manager->scene_id_stack, scene_id);
 
 
-    scene_manager->scene_handlers->on_exit_handlers[cur_scene_id](scene_manager->context);
-    scene_manager->scene_handlers->on_enter_handlers[scene_id](scene_manager->context);
+        scene_manager->scene_handlers->on_exit_handlers[cur_scene_id](scene_manager->context);
+        scene_manager->scene_handlers->on_enter_handlers[scene_id](scene_manager->context);
 
 
-    return true;
+        return true;
+    } else {
+        return false;
+    }
 }
 }
 
 
 void scene_manager_stop(SceneManager* scene_manager) {
 void scene_manager_stop(SceneManager* scene_manager) {
     furi_assert(scene_manager);
     furi_assert(scene_manager);
 
 
-    if(SceneManagerIdStack_size(scene_manager->scene_id_stack)) {
+    if(SceneManagerIdStack_size(scene_manager->scene_id_stack) > 0) {
         uint32_t cur_scene_id = *SceneManagerIdStack_back(scene_manager->scene_id_stack);
         uint32_t cur_scene_id = *SceneManagerIdStack_back(scene_manager->scene_id_stack);
         scene_manager->scene_handlers->on_exit_handlers[cur_scene_id](scene_manager->context);
         scene_manager->scene_handlers->on_exit_handlers[cur_scene_id](scene_manager->context);
     }
     }

+ 4 - 4
applications/gui/view.c

@@ -1,7 +1,7 @@
 #include "view_i.h"
 #include "view_i.h"
 
 
 View* view_alloc() {
 View* view_alloc() {
-    View* view = furi_alloc(sizeof(View));
+    View* view = malloc(sizeof(View));
     view->orientation = ViewOrientationHorizontal;
     view->orientation = ViewOrientationHorizontal;
     return view;
     return view;
 }
 }
@@ -78,12 +78,12 @@ void view_allocate_model(View* view, ViewModelType type, size_t size) {
     furi_assert(view->model == NULL);
     furi_assert(view->model == NULL);
     view->model_type = type;
     view->model_type = type;
     if(view->model_type == ViewModelTypeLockFree) {
     if(view->model_type == ViewModelTypeLockFree) {
-        view->model = furi_alloc(size);
+        view->model = malloc(size);
     } else if(view->model_type == ViewModelTypeLocking) {
     } else if(view->model_type == ViewModelTypeLocking) {
-        ViewModelLocking* model = furi_alloc(sizeof(ViewModelLocking));
+        ViewModelLocking* model = malloc(sizeof(ViewModelLocking));
         model->mutex = osMutexNew(NULL);
         model->mutex = osMutexNew(NULL);
         furi_check(model->mutex);
         furi_check(model->mutex);
-        model->data = furi_alloc(size);
+        model->data = malloc(size);
         view->model = model;
         view->model = model;
     } else {
     } else {
         furi_assert(false);
         furi_assert(false);

+ 1 - 1
applications/gui/view_dispatcher.c

@@ -3,7 +3,7 @@
 #define TAG "ViewDispatcher"
 #define TAG "ViewDispatcher"
 
 
 ViewDispatcher* view_dispatcher_alloc() {
 ViewDispatcher* view_dispatcher_alloc() {
-    ViewDispatcher* view_dispatcher = furi_alloc(sizeof(ViewDispatcher));
+    ViewDispatcher* view_dispatcher = malloc(sizeof(ViewDispatcher));
 
 
     view_dispatcher->view_port = view_port_alloc();
     view_dispatcher->view_port = view_port_alloc();
     view_port_draw_callback_set(
     view_port_draw_callback_set(

+ 1 - 1
applications/gui/view_port.c

@@ -35,7 +35,7 @@ static void view_port_setup_canvas_orientation(const ViewPort* view_port, Canvas
 }
 }
 
 
 ViewPort* view_port_alloc() {
 ViewPort* view_port_alloc() {
-    ViewPort* view_port = furi_alloc(sizeof(ViewPort));
+    ViewPort* view_port = malloc(sizeof(ViewPort));
     view_port->orientation = ViewPortOrientationHorizontal;
     view_port->orientation = ViewPortOrientationHorizontal;
     view_port->is_enabled = true;
     view_port->is_enabled = true;
     return view_port;
     return view_port;

+ 1 - 1
applications/gui/view_stack.c

@@ -62,7 +62,7 @@ static void view_stack_exit(void* context) {
 }
 }
 
 
 ViewStack* view_stack_alloc(void) {
 ViewStack* view_stack_alloc(void) {
-    ViewStack* view_stack = furi_alloc(sizeof(ViewStack));
+    ViewStack* view_stack = malloc(sizeof(ViewStack));
     view_stack->view = view_alloc();
     view_stack->view = view_alloc();
 
 
     view_allocate_model(view_stack->view, ViewModelTypeLocking, sizeof(ViewStackModel));
     view_allocate_model(view_stack->view, ViewModelTypeLocking, sizeof(ViewStackModel));

+ 16 - 17
applications/ibutton/ibutton_app.cpp

@@ -3,7 +3,7 @@
 #include <callback-connector.h>
 #include <callback-connector.h>
 #include <m-string.h>
 #include <m-string.h>
 #include <toolbox/path.h>
 #include <toolbox/path.h>
-#include <flipper_file/flipper_file.h>
+#include <flipper_format/flipper_format.h>
 
 
 const char* iButtonApp::app_folder = "/any/ibutton";
 const char* iButtonApp::app_folder = "/any/ibutton";
 const char* iButtonApp::app_extension = ".ibtn";
 const char* iButtonApp::app_extension = ".ibtn";
@@ -191,7 +191,7 @@ bool iButtonApp::save_key(const char* key_name) {
     // Create ibutton directory if necessary
     // Create ibutton directory if necessary
     make_app_folder();
     make_app_folder();
 
 
-    FlipperFile* file = flipper_file_alloc(storage);
+    FlipperFormat* file = flipper_format_file_alloc(storage);
     string_t key_file_name;
     string_t key_file_name;
     bool result = false;
     bool result = false;
     string_init(key_file_name);
     string_init(key_file_name);
@@ -207,29 +207,29 @@ bool iButtonApp::save_key(const char* key_name) {
         string_printf(key_file_name, "%s/%s%s", app_folder, key.get_name(), app_extension);
         string_printf(key_file_name, "%s/%s%s", app_folder, key.get_name(), app_extension);
 
 
         // Open file for write
         // Open file for write
-        if(!flipper_file_open_always(file, string_get_cstr(key_file_name))) break;
+        if(!flipper_format_file_open_always(file, string_get_cstr(key_file_name))) break;
 
 
         // Write header
         // Write header
-        if(!flipper_file_write_header_cstr(file, iButtonApp::app_filetype, 1)) break;
+        if(!flipper_format_write_header_cstr(file, iButtonApp::app_filetype, 1)) break;
 
 
         // Write key type
         // Write key type
-        if(!flipper_file_write_comment_cstr(file, "Key type can be Cyfral, Dallas or Metakom"))
+        if(!flipper_format_write_comment_cstr(file, "Key type can be Cyfral, Dallas or Metakom"))
             break;
             break;
         const char* key_type = key.get_key_type_string_by_type(key.get_key_type());
         const char* key_type = key.get_key_type_string_by_type(key.get_key_type());
-        if(!flipper_file_write_string_cstr(file, "Key type", key_type)) break;
+        if(!flipper_format_write_string_cstr(file, "Key type", key_type)) break;
 
 
         // Write data
         // Write data
-        if(!flipper_file_write_comment_cstr(
+        if(!flipper_format_write_comment_cstr(
                file, "Data size for Cyfral is 2, for Metakom is 4, for Dallas is 8"))
                file, "Data size for Cyfral is 2, for Metakom is 4, for Dallas is 8"))
             break;
             break;
 
 
-        if(!flipper_file_write_hex(file, "Data", key.get_data(), key.get_type_data_size())) break;
+        if(!flipper_format_write_hex(file, "Data", key.get_data(), key.get_type_data_size()))
+            break;
         result = true;
         result = true;
 
 
     } while(false);
     } while(false);
 
 
-    flipper_file_close(file);
-    flipper_file_free(file);
+    flipper_format_free(file);
 
 
     string_clear(key_file_name);
     string_clear(key_file_name);
 
 
@@ -241,28 +241,28 @@ bool iButtonApp::save_key(const char* key_name) {
 }
 }
 
 
 bool iButtonApp::load_key_data(string_t key_path) {
 bool iButtonApp::load_key_data(string_t key_path) {
-    FlipperFile* file = flipper_file_alloc(storage);
+    FlipperFormat* file = flipper_format_file_alloc(storage);
     bool result = false;
     bool result = false;
     string_t data;
     string_t data;
     string_init(data);
     string_init(data);
 
 
     do {
     do {
-        if(!flipper_file_open_existing(file, string_get_cstr(key_path))) break;
+        if(!flipper_format_file_open_existing(file, string_get_cstr(key_path))) break;
 
 
         // header
         // header
         uint32_t version;
         uint32_t version;
-        if(!flipper_file_read_header(file, data, &version)) break;
+        if(!flipper_format_read_header(file, data, &version)) break;
         if(string_cmp_str(data, iButtonApp::app_filetype) != 0) break;
         if(string_cmp_str(data, iButtonApp::app_filetype) != 0) break;
         if(version != 1) break;
         if(version != 1) break;
 
 
         // key type
         // key type
         iButtonKeyType type;
         iButtonKeyType type;
-        if(!flipper_file_read_string(file, "Key type", data)) break;
+        if(!flipper_format_read_string(file, "Key type", data)) break;
         if(!key.get_key_type_by_type_string(string_get_cstr(data), &type)) break;
         if(!key.get_key_type_by_type_string(string_get_cstr(data), &type)) break;
 
 
         // key data
         // key data
         uint8_t key_data[IBUTTON_KEY_DATA_SIZE] = {0};
         uint8_t key_data[IBUTTON_KEY_DATA_SIZE] = {0};
-        if(!flipper_file_read_hex(file, "Data", key_data, key.get_type_data_size_by_type(type)))
+        if(!flipper_format_read_hex(file, "Data", key_data, key.get_type_data_size_by_type(type)))
             break;
             break;
 
 
         key.set_type(type);
         key.set_type(type);
@@ -271,8 +271,7 @@ bool iButtonApp::load_key_data(string_t key_path) {
         result = true;
         result = true;
     } while(false);
     } while(false);
 
 
-    flipper_file_close(file);
-    flipper_file_free(file);
+    flipper_format_free(file);
     string_clear(data);
     string_clear(data);
 
 
     if(!result) {
     if(!result) {

+ 2 - 2
applications/input/input.c

@@ -66,7 +66,7 @@ const char* input_get_type_name(InputType type) {
 }
 }
 
 
 int32_t input_srv() {
 int32_t input_srv() {
-    input = furi_alloc(sizeof(Input));
+    input = malloc(sizeof(Input));
     input->thread = osThreadGetId();
     input->thread = osThreadGetId();
     input->event_pubsub = furi_pubsub_alloc();
     input->event_pubsub = furi_pubsub_alloc();
     furi_record_create("input_events", input->event_pubsub);
     furi_record_create("input_events", input->event_pubsub);
@@ -78,7 +78,7 @@ int32_t input_srv() {
     }
     }
 #endif
 #endif
 
 
-    input->pin_states = furi_alloc(input_pins_count * sizeof(InputPinState));
+    input->pin_states = malloc(input_pins_count * sizeof(InputPinState));
 
 
     for(size_t i = 0; i < input_pins_count; i++) {
     for(size_t i = 0; i < input_pins_count; i++) {
         GpioPin gpio = {(GPIO_TypeDef*)input_pins[i].port, (uint16_t)input_pins[i].pin};
         GpioPin gpio = {(GPIO_TypeDef*)input_pins[i].port, (uint16_t)input_pins[i].pin};

+ 1 - 1
applications/irda/cli/irda_cli.cpp

@@ -145,7 +145,7 @@ static void irda_cli_start_ir_tx(Cli* cli, string_t args) {
     uint32_t frequency;
     uint32_t frequency;
     float duty_cycle;
     float duty_cycle;
     uint32_t timings_cnt = MAX_TIMINGS_AMOUNT;
     uint32_t timings_cnt = MAX_TIMINGS_AMOUNT;
-    uint32_t* timings = (uint32_t*)furi_alloc(sizeof(uint32_t) * timings_cnt);
+    uint32_t* timings = (uint32_t*)malloc(sizeof(uint32_t) * timings_cnt);
 
 
     if(parse_message(str, &message)) {
     if(parse_message(str, &message)) {
         irda_send(&message, 1);
         irda_send(&message, 1);

+ 28 - 23
applications/irda/helpers/irda_parser.cpp

@@ -4,37 +4,42 @@
 #include "irda/helpers/irda_parser.h"
 #include "irda/helpers/irda_parser.h"
 #include "irda_worker.h"
 #include "irda_worker.h"
 #include "m-string.h"
 #include "m-string.h"
-#include <flipper_file.h>
+#include <flipper_format/flipper_format.h>
 #include <memory>
 #include <memory>
 #include <string>
 #include <string>
 #include <furi_hal_irda.h>
 #include <furi_hal_irda.h>
 
 
 #define TAG "IrdaParser"
 #define TAG "IrdaParser"
 
 
-bool irda_parser_save_signal(FlipperFile* ff, const IrdaAppSignal& signal, const std::string& name) {
+bool irda_parser_save_signal(
+    FlipperFormat* ff,
+    const IrdaAppSignal& signal,
+    const std::string& name) {
     furi_assert(ff);
     furi_assert(ff);
     furi_assert(!name.empty());
     furi_assert(!name.empty());
 
 
     bool result = false;
     bool result = false;
 
 
     do {
     do {
-        if(!flipper_file_write_comment_cstr(ff, "")) break;
-        if(!flipper_file_write_string_cstr(ff, "name", name.c_str())) break;
+        if(!flipper_format_write_comment_cstr(ff, "")) break;
+        if(!flipper_format_write_string_cstr(ff, "name", name.c_str())) break;
         if(signal.is_raw()) {
         if(signal.is_raw()) {
             furi_assert(signal.get_raw_signal().timings_cnt <= MAX_TIMINGS_AMOUNT);
             furi_assert(signal.get_raw_signal().timings_cnt <= MAX_TIMINGS_AMOUNT);
             auto raw_signal = signal.get_raw_signal();
             auto raw_signal = signal.get_raw_signal();
-            if(!flipper_file_write_string_cstr(ff, "type", "raw")) break;
-            if(!flipper_file_write_uint32(ff, "frequency", &raw_signal.frequency, 1)) break;
-            if(!flipper_file_write_float(ff, "duty_cycle", &raw_signal.duty_cycle, 1)) break;
-            if(!flipper_file_write_uint32(ff, "data", raw_signal.timings, raw_signal.timings_cnt))
+            if(!flipper_format_write_string_cstr(ff, "type", "raw")) break;
+            if(!flipper_format_write_uint32(ff, "frequency", &raw_signal.frequency, 1)) break;
+            if(!flipper_format_write_float(ff, "duty_cycle", &raw_signal.duty_cycle, 1)) break;
+            if(!flipper_format_write_uint32(ff, "data", raw_signal.timings, raw_signal.timings_cnt))
                 break;
                 break;
         } else {
         } else {
             auto parsed_signal = signal.get_message();
             auto parsed_signal = signal.get_message();
             const char* protocol_name = irda_get_protocol_name(parsed_signal.protocol);
             const char* protocol_name = irda_get_protocol_name(parsed_signal.protocol);
-            if(!flipper_file_write_string_cstr(ff, "type", "parsed")) break;
-            if(!flipper_file_write_string_cstr(ff, "protocol", protocol_name)) break;
-            if(!flipper_file_write_hex(ff, "address", (uint8_t*)&parsed_signal.address, 4)) break;
-            if(!flipper_file_write_hex(ff, "command", (uint8_t*)&parsed_signal.command, 4)) break;
+            if(!flipper_format_write_string_cstr(ff, "type", "parsed")) break;
+            if(!flipper_format_write_string_cstr(ff, "protocol", protocol_name)) break;
+            if(!flipper_format_write_hex(ff, "address", (uint8_t*)&parsed_signal.address, 4))
+                break;
+            if(!flipper_format_write_hex(ff, "command", (uint8_t*)&parsed_signal.command, 4))
+                break;
         }
         }
         result = true;
         result = true;
     } while(0);
     } while(0);
@@ -42,7 +47,7 @@ bool irda_parser_save_signal(FlipperFile* ff, const IrdaAppSignal& signal, const
     return result;
     return result;
 }
 }
 
 
-bool irda_parser_read_signal(FlipperFile* ff, IrdaAppSignal& signal, std::string& name) {
+bool irda_parser_read_signal(FlipperFormat* ff, IrdaAppSignal& signal, std::string& name) {
     furi_assert(ff);
     furi_assert(ff);
 
 
     bool result = false;
     bool result = false;
@@ -50,31 +55,31 @@ bool irda_parser_read_signal(FlipperFile* ff, IrdaAppSignal& signal, std::string
     string_init(read_string);
     string_init(read_string);
 
 
     do {
     do {
-        if(!flipper_file_read_string(ff, "name", read_string)) break;
+        if(!flipper_format_read_string(ff, "name", read_string)) break;
         name = string_get_cstr(read_string);
         name = string_get_cstr(read_string);
-        if(!flipper_file_read_string(ff, "type", read_string)) break;
+        if(!flipper_format_read_string(ff, "type", read_string)) break;
         if(!string_cmp_str(read_string, "raw")) {
         if(!string_cmp_str(read_string, "raw")) {
             uint32_t* timings = nullptr;
             uint32_t* timings = nullptr;
             uint32_t timings_cnt = 0;
             uint32_t timings_cnt = 0;
             uint32_t frequency = 0;
             uint32_t frequency = 0;
             float duty_cycle = 0;
             float duty_cycle = 0;
 
 
-            if(!flipper_file_read_uint32(ff, "frequency", &frequency, 1)) break;
-            if(!flipper_file_read_float(ff, "duty_cycle", &duty_cycle, 1)) break;
-            if(!flipper_file_get_value_count(ff, "data", &timings_cnt)) break;
+            if(!flipper_format_read_uint32(ff, "frequency", &frequency, 1)) break;
+            if(!flipper_format_read_float(ff, "duty_cycle", &duty_cycle, 1)) break;
+            if(!flipper_format_get_value_count(ff, "data", &timings_cnt)) break;
             if(timings_cnt > MAX_TIMINGS_AMOUNT) break;
             if(timings_cnt > MAX_TIMINGS_AMOUNT) break;
-            timings = (uint32_t*)furi_alloc(sizeof(uint32_t) * timings_cnt);
-            if(flipper_file_read_uint32(ff, "data", timings, timings_cnt)) {
+            timings = (uint32_t*)malloc(sizeof(uint32_t) * timings_cnt);
+            if(flipper_format_read_uint32(ff, "data", timings, timings_cnt)) {
                 signal.set_raw_signal(timings, timings_cnt, frequency, duty_cycle);
                 signal.set_raw_signal(timings, timings_cnt, frequency, duty_cycle);
                 result = true;
                 result = true;
             }
             }
             free(timings);
             free(timings);
         } else if(!string_cmp_str(read_string, "parsed")) {
         } else if(!string_cmp_str(read_string, "parsed")) {
             IrdaMessage parsed_signal;
             IrdaMessage parsed_signal;
-            if(!flipper_file_read_string(ff, "protocol", read_string)) break;
+            if(!flipper_format_read_string(ff, "protocol", read_string)) break;
             parsed_signal.protocol = irda_get_protocol_by_name(string_get_cstr(read_string));
             parsed_signal.protocol = irda_get_protocol_by_name(string_get_cstr(read_string));
-            if(!flipper_file_read_hex(ff, "address", (uint8_t*)&parsed_signal.address, 4)) break;
-            if(!flipper_file_read_hex(ff, "command", (uint8_t*)&parsed_signal.command, 4)) break;
+            if(!flipper_format_read_hex(ff, "address", (uint8_t*)&parsed_signal.address, 4)) break;
+            if(!flipper_format_read_hex(ff, "command", (uint8_t*)&parsed_signal.command, 4)) break;
             if(!irda_parser_is_parsed_signal_valid(&parsed_signal)) break;
             if(!irda_parser_is_parsed_signal_valid(&parsed_signal)) break;
             signal.set_message(&parsed_signal);
             signal.set_message(&parsed_signal);
             result = true;
             result = true;

+ 6 - 3
applications/irda/helpers/irda_parser.h

@@ -1,10 +1,13 @@
 #pragma once
 #pragma once
 
 
 #include "../irda_app_signal.h"
 #include "../irda_app_signal.h"
-#include <flipper_file.h>
+#include <flipper_format/flipper_format.h>
 #include <string>
 #include <string>
 
 
-bool irda_parser_save_signal(FlipperFile* ff, const IrdaAppSignal& signal, const std::string& name);
-bool irda_parser_read_signal(FlipperFile* ff, IrdaAppSignal& signal, std::string& name);
+bool irda_parser_save_signal(
+    FlipperFormat* ff,
+    const IrdaAppSignal& signal,
+    const std::string& name);
+bool irda_parser_read_signal(FlipperFormat* ff, IrdaAppSignal& signal, std::string& name);
 bool irda_parser_is_parsed_signal_valid(const IrdaMessage* signal);
 bool irda_parser_is_parsed_signal_valid(const IrdaMessage* signal);
 bool irda_parser_is_raw_signal_valid(uint32_t frequency, float duty_cycle, uint32_t timings_cnt);
 bool irda_parser_is_raw_signal_valid(uint32_t frequency, float duty_cycle, uint32_t timings_cnt);

+ 8 - 11
applications/irda/irda_app_brute_force.cpp

@@ -16,15 +16,15 @@ bool IrdaAppBruteForce::calculate_messages() {
     bool result = false;
     bool result = false;
 
 
     Storage* storage = static_cast<Storage*>(furi_record_open("storage"));
     Storage* storage = static_cast<Storage*>(furi_record_open("storage"));
-    FlipperFile* ff = flipper_file_alloc(storage);
-    result = flipper_file_open_existing(ff, universal_db_filename);
+    FlipperFormat* ff = flipper_format_file_alloc(storage);
+    result = flipper_format_file_open_existing(ff, universal_db_filename);
 
 
     if(result) {
     if(result) {
         IrdaAppSignal signal;
         IrdaAppSignal signal;
 
 
         string_t signal_name;
         string_t signal_name;
         string_init(signal_name);
         string_init(signal_name);
-        while(flipper_file_read_string(ff, "name", signal_name)) {
+        while(flipper_format_read_string(ff, "name", signal_name)) {
             auto element = records.find(string_get_cstr(signal_name));
             auto element = records.find(string_get_cstr(signal_name));
             if(element != records.cend()) {
             if(element != records.cend()) {
                 ++element->second.amount;
                 ++element->second.amount;
@@ -33,8 +33,7 @@ bool IrdaAppBruteForce::calculate_messages() {
         string_clear(signal_name);
         string_clear(signal_name);
     }
     }
 
 
-    flipper_file_close(ff);
-    flipper_file_free(ff);
+    flipper_format_free(ff);
     furi_record_close("storage");
     furi_record_close("storage");
     return result;
     return result;
 }
 }
@@ -45,8 +44,7 @@ void IrdaAppBruteForce::stop_bruteforce() {
     if(current_record.size()) {
     if(current_record.size()) {
         furi_assert(ff);
         furi_assert(ff);
         current_record.clear();
         current_record.clear();
-        flipper_file_close(ff);
-        flipper_file_free(ff);
+        flipper_format_free(ff);
         furi_record_close("storage");
         furi_record_close("storage");
     }
     }
 }
 }
@@ -84,11 +82,10 @@ bool IrdaAppBruteForce::start_bruteforce(int index, int& record_amount) {
 
 
     if(record_amount) {
     if(record_amount) {
         Storage* storage = static_cast<Storage*>(furi_record_open("storage"));
         Storage* storage = static_cast<Storage*>(furi_record_open("storage"));
-        ff = flipper_file_alloc(storage);
-        result = flipper_file_open_existing(ff, universal_db_filename);
+        ff = flipper_format_file_alloc(storage);
+        result = flipper_format_file_open_existing(ff, universal_db_filename);
         if(!result) {
         if(!result) {
-            flipper_file_close(ff);
-            flipper_file_free(ff);
+            flipper_format_free(ff);
             furi_record_close("storage");
             furi_record_close("storage");
         }
         }
     }
     }

+ 2 - 2
applications/irda/irda_app_brute_force.h

@@ -2,12 +2,12 @@
 
 
 #include <unordered_map>
 #include <unordered_map>
 #include <memory>
 #include <memory>
-#include <flipper_file.h>
+#include <flipper_format/flipper_format.h>
 
 
 class IrdaAppBruteForce {
 class IrdaAppBruteForce {
     const char* universal_db_filename;
     const char* universal_db_filename;
     std::string current_record;
     std::string current_record;
-    FlipperFile* ff;
+    FlipperFormat* ff;
 
 
     typedef struct {
     typedef struct {
         int index;
         int index;

+ 9 - 11
applications/irda/irda_app_remote_manager.cpp

@@ -1,5 +1,5 @@
 #include <file_worker_cpp.h>
 #include <file_worker_cpp.h>
-#include <flipper_file.h>
+#include <flipper_format/flipper_format.h>
 #include "irda_app_remote_manager.h"
 #include "irda_app_remote_manager.h"
 #include "irda/helpers/irda_parser.h"
 #include "irda/helpers/irda_parser.h"
 #include "irda/irda_app_signal.h"
 #include "irda/irda_app_signal.h"
@@ -169,12 +169,12 @@ bool IrdaAppRemoteManager::store(void) {
     if(!file_worker.mkdir(IrdaApp::irda_directory)) return false;
     if(!file_worker.mkdir(IrdaApp::irda_directory)) return false;
 
 
     Storage* storage = static_cast<Storage*>(furi_record_open("storage"));
     Storage* storage = static_cast<Storage*>(furi_record_open("storage"));
-    FlipperFile* ff = flipper_file_alloc(storage);
+    FlipperFormat* ff = flipper_format_file_alloc(storage);
 
 
     FURI_LOG_I("RemoteManager", "store file: \'%s\'", make_full_name(remote->name).c_str());
     FURI_LOG_I("RemoteManager", "store file: \'%s\'", make_full_name(remote->name).c_str());
-    result = flipper_file_open_always(ff, make_full_name(remote->name).c_str());
+    result = flipper_format_file_open_always(ff, make_full_name(remote->name).c_str());
     if(result) {
     if(result) {
-        result = flipper_file_write_header_cstr(ff, "IR signals file", 1);
+        result = flipper_format_write_header_cstr(ff, "IR signals file", 1);
     }
     }
     if(result) {
     if(result) {
         for(const auto& button : remote->buttons) {
         for(const auto& button : remote->buttons) {
@@ -185,8 +185,7 @@ bool IrdaAppRemoteManager::store(void) {
         }
         }
     }
     }
 
 
-    flipper_file_close(ff);
-    flipper_file_free(ff);
+    flipper_format_free(ff);
     furi_record_close("storage");
     furi_record_close("storage");
     return result;
     return result;
 }
 }
@@ -194,15 +193,15 @@ bool IrdaAppRemoteManager::store(void) {
 bool IrdaAppRemoteManager::load(const std::string& remote_name) {
 bool IrdaAppRemoteManager::load(const std::string& remote_name) {
     bool result = false;
     bool result = false;
     Storage* storage = static_cast<Storage*>(furi_record_open("storage"));
     Storage* storage = static_cast<Storage*>(furi_record_open("storage"));
-    FlipperFile* ff = flipper_file_alloc(storage);
+    FlipperFormat* ff = flipper_format_file_alloc(storage);
 
 
     FURI_LOG_I("RemoteManager", "load file: \'%s\'", make_full_name(remote_name).c_str());
     FURI_LOG_I("RemoteManager", "load file: \'%s\'", make_full_name(remote_name).c_str());
-    result = flipper_file_open_existing(ff, make_full_name(remote_name).c_str());
+    result = flipper_format_file_open_existing(ff, make_full_name(remote_name).c_str());
     if(result) {
     if(result) {
         string_t header;
         string_t header;
         string_init(header);
         string_init(header);
         uint32_t version;
         uint32_t version;
-        result = flipper_file_read_header(ff, header, &version);
+        result = flipper_format_read_header(ff, header, &version);
         if(result) {
         if(result) {
             result = !string_cmp_str(header, "IR signals file") && (version == 1);
             result = !string_cmp_str(header, "IR signals file") && (version == 1);
         }
         }
@@ -217,8 +216,7 @@ bool IrdaAppRemoteManager::load(const std::string& remote_name) {
         }
         }
     }
     }
 
 
-    flipper_file_close(ff);
-    flipper_file_free(ff);
+    flipper_format_free(ff);
     furi_record_close("storage");
     furi_record_close("storage");
     return result;
     return result;
 }
 }

+ 1 - 1
applications/irda/view/irda_app_brut_view.c

@@ -76,7 +76,7 @@ void popup_brut_set_progress_max(IrdaAppPopupBrut* popup_brut, uint16_t progress
 }
 }
 
 
 IrdaAppPopupBrut* popup_brut_alloc(void) {
 IrdaAppPopupBrut* popup_brut_alloc(void) {
-    return (IrdaAppPopupBrut*)furi_alloc(sizeof(IrdaAppPopupBrut));
+    return (IrdaAppPopupBrut*)malloc(sizeof(IrdaAppPopupBrut));
 }
 }
 
 
 void popup_brut_free(IrdaAppPopupBrut* popup_brut) {
 void popup_brut_free(IrdaAppPopupBrut* popup_brut) {

+ 1 - 1
applications/irda_monitor/irda_monitor.c

@@ -99,7 +99,7 @@ static void signal_received_callback(void* context, IrdaWorkerSignal* received_s
 int32_t irda_monitor_app(void* p) {
 int32_t irda_monitor_app(void* p) {
     (void)p;
     (void)p;
 
 
-    IrdaMonitor* irda_monitor = furi_alloc(sizeof(IrdaMonitor));
+    IrdaMonitor* irda_monitor = malloc(sizeof(IrdaMonitor));
     irda_monitor->display_text[0] = 0;
     irda_monitor->display_text[0] = 0;
     irda_monitor->event_queue = osMessageQueueNew(1, sizeof(InputEvent), NULL);
     irda_monitor->event_queue = osMessageQueueNew(1, sizeof(InputEvent), NULL);
     irda_monitor->view_port = view_port_alloc();
     irda_monitor->view_port = view_port_alloc();

+ 16 - 17
applications/lfrfid/lfrfid_app.cpp

@@ -17,7 +17,7 @@
 #include "scene/lfrfid_app_scene_delete_success.h"
 #include "scene/lfrfid_app_scene_delete_success.h"
 
 
 #include <toolbox/path.h>
 #include <toolbox/path.h>
-#include <flipper_file/flipper_file.h>
+#include <flipper_format/flipper_format.h>
 
 
 const char* LfRfidApp::app_folder = "/any/lfrfid";
 const char* LfRfidApp::app_folder = "/any/lfrfid";
 const char* LfRfidApp::app_extension = ".rfid";
 const char* LfRfidApp::app_extension = ".rfid";
@@ -119,17 +119,17 @@ bool LfRfidApp::delete_key(RfidKey* key) {
 }
 }
 
 
 bool LfRfidApp::load_key_data(const char* path, RfidKey* key) {
 bool LfRfidApp::load_key_data(const char* path, RfidKey* key) {
-    FlipperFile* file = flipper_file_alloc(storage);
+    FlipperFormat* file = flipper_format_file_alloc(storage);
     bool result = false;
     bool result = false;
     string_t str_result;
     string_t str_result;
     string_init(str_result);
     string_init(str_result);
 
 
     do {
     do {
-        if(!flipper_file_open_existing(file, path)) break;
+        if(!flipper_format_file_open_existing(file, path)) break;
 
 
         // header
         // header
         uint32_t version;
         uint32_t version;
-        if(!flipper_file_read_header(file, str_result, &version)) break;
+        if(!flipper_format_read_header(file, str_result, &version)) break;
         if(string_cmp_str(str_result, app_filetype) != 0) break;
         if(string_cmp_str(str_result, app_filetype) != 0) break;
         if(version != 1) break;
         if(version != 1) break;
 
 
@@ -137,13 +137,14 @@ bool LfRfidApp::load_key_data(const char* path, RfidKey* key) {
         LfrfidKeyType type;
         LfrfidKeyType type;
         RfidKey loaded_key;
         RfidKey loaded_key;
 
 
-        if(!flipper_file_read_string(file, "Key type", str_result)) break;
+        if(!flipper_format_read_string(file, "Key type", str_result)) break;
         if(!lfrfid_key_get_string_type(string_get_cstr(str_result), &type)) break;
         if(!lfrfid_key_get_string_type(string_get_cstr(str_result), &type)) break;
         loaded_key.set_type(type);
         loaded_key.set_type(type);
 
 
         // key data
         // key data
         uint8_t key_data[loaded_key.get_type_data_count()] = {};
         uint8_t key_data[loaded_key.get_type_data_count()] = {};
-        if(!flipper_file_read_hex(file, "Data", key_data, loaded_key.get_type_data_count())) break;
+        if(!flipper_format_read_hex(file, "Data", key_data, loaded_key.get_type_data_count()))
+            break;
         loaded_key.set_data(key_data, loaded_key.get_type_data_count());
         loaded_key.set_data(key_data, loaded_key.get_type_data_count());
 
 
         path_extract_filename_no_ext(path, str_result);
         path_extract_filename_no_ext(path, str_result);
@@ -153,8 +154,7 @@ bool LfRfidApp::load_key_data(const char* path, RfidKey* key) {
         result = true;
         result = true;
     } while(0);
     } while(0);
 
 
-    flipper_file_close(file);
-    flipper_file_free(file);
+    flipper_format_free(file);
     string_clear(str_result);
     string_clear(str_result);
 
 
     if(!result) {
     if(!result) {
@@ -165,27 +165,26 @@ bool LfRfidApp::load_key_data(const char* path, RfidKey* key) {
 }
 }
 
 
 bool LfRfidApp::save_key_data(const char* path, RfidKey* key) {
 bool LfRfidApp::save_key_data(const char* path, RfidKey* key) {
-    FlipperFile* file = flipper_file_alloc(storage);
+    FlipperFormat* file = flipper_format_file_alloc(storage);
     bool result = false;
     bool result = false;
 
 
     do {
     do {
-        if(!flipper_file_open_always(file, path)) break;
-        if(!flipper_file_write_header_cstr(file, app_filetype, 1)) break;
-        if(!flipper_file_write_comment_cstr(file, "Key type can be EM4100, H10301 or I40134"))
+        if(!flipper_format_file_open_always(file, path)) break;
+        if(!flipper_format_write_header_cstr(file, app_filetype, 1)) break;
+        if(!flipper_format_write_comment_cstr(file, "Key type can be EM4100, H10301 or I40134"))
             break;
             break;
-        if(!flipper_file_write_string_cstr(
+        if(!flipper_format_write_string_cstr(
                file, "Key type", lfrfid_key_get_type_string(key->get_type())))
                file, "Key type", lfrfid_key_get_type_string(key->get_type())))
             break;
             break;
-        if(!flipper_file_write_comment_cstr(
+        if(!flipper_format_write_comment_cstr(
                file, "Data size for EM4100 is 5, for H10301 is 3, for I40134 is 3"))
                file, "Data size for EM4100 is 5, for H10301 is 3, for I40134 is 3"))
             break;
             break;
-        if(!flipper_file_write_hex(file, "Data", key->get_data(), key->get_type_data_count()))
+        if(!flipper_format_write_hex(file, "Data", key->get_data(), key->get_type_data_count()))
             break;
             break;
         result = true;
         result = true;
     } while(0);
     } while(0);
 
 
-    flipper_file_close(file);
-    flipper_file_free(file);
+    flipper_format_free(file);
 
 
     if(!result) {
     if(!result) {
         dialog_message_show_storage_error(dialogs, "Cannot save\nkey file");
         dialog_message_show_storage_error(dialogs, "Cannot save\nkey file");

+ 1 - 1
applications/loader/loader.c

@@ -278,7 +278,7 @@ static uint32_t loader_back_to_primary_menu(void* context) {
 }
 }
 
 
 static Loader* loader_alloc() {
 static Loader* loader_alloc() {
-    Loader* instance = furi_alloc(sizeof(Loader));
+    Loader* instance = malloc(sizeof(Loader));
 
 
     instance->application_thread = furi_thread_alloc();
     instance->application_thread = furi_thread_alloc();
     furi_thread_enable_heap_trace(instance->application_thread);
     furi_thread_enable_heap_trace(instance->application_thread);

+ 6 - 6
applications/nfc/helpers/nfc_emv_parser.c

@@ -1,5 +1,5 @@
 #include "nfc_emv_parser.h"
 #include "nfc_emv_parser.h"
-#include <lib/flipper_file/flipper_file.h>
+#include <flipper_format/flipper_format.h>
 
 
 static const char* nfc_resources_header = "Flipper EMV resources";
 static const char* nfc_resources_header = "Flipper EMV resources";
 static const uint32_t nfc_resources_file_version = 1;
 static const uint32_t nfc_resources_file_version = 1;
@@ -10,25 +10,25 @@ static bool nfc_emv_parser_search_data(
     string_t key,
     string_t key,
     string_t data) {
     string_t data) {
     bool parsed = false;
     bool parsed = false;
-    FlipperFile* file = flipper_file_alloc(storage);
+    FlipperFormat* file = flipper_format_file_alloc(storage);
     string_t temp_str;
     string_t temp_str;
     string_init(temp_str);
     string_init(temp_str);
 
 
     do {
     do {
         // Open file
         // Open file
-        if(!flipper_file_open_existing(file, file_name)) break;
+        if(!flipper_format_file_open_existing(file, file_name)) break;
         // Read file header and version
         // Read file header and version
         uint32_t version = 0;
         uint32_t version = 0;
-        if(!flipper_file_read_header(file, temp_str, &version)) break;
+        if(!flipper_format_read_header(file, temp_str, &version)) break;
         if(string_cmp_str(temp_str, nfc_resources_header) ||
         if(string_cmp_str(temp_str, nfc_resources_header) ||
            (version != nfc_resources_file_version))
            (version != nfc_resources_file_version))
             break;
             break;
-        if(!flipper_file_read_string(file, string_get_cstr(key), data)) break;
+        if(!flipper_format_read_string(file, string_get_cstr(key), data)) break;
         parsed = true;
         parsed = true;
     } while(false);
     } while(false);
 
 
     string_clear(temp_str);
     string_clear(temp_str);
-    flipper_file_free(file);
+    flipper_format_free(file);
     return parsed;
     return parsed;
 }
 }
 
 

+ 1 - 1
applications/nfc/nfc.c

@@ -20,7 +20,7 @@ void nfc_tick_event_callback(void* context) {
 }
 }
 
 
 Nfc* nfc_alloc() {
 Nfc* nfc_alloc() {
-    Nfc* nfc = furi_alloc(sizeof(Nfc));
+    Nfc* nfc = malloc(sizeof(Nfc));
 
 
     nfc->worker = nfc_worker_alloc();
     nfc->worker = nfc_worker_alloc();
     nfc->view_dispatcher = view_dispatcher_alloc();
     nfc->view_dispatcher = view_dispatcher_alloc();

+ 56 - 57
applications/nfc/nfc_device.c

@@ -1,14 +1,14 @@
 #include "nfc_device.h"
 #include "nfc_device.h"
 #include "nfc_types.h"
 #include "nfc_types.h"
 
 
-#include <lib/toolbox/path.h>
-#include <lib/flipper_file/flipper_file.h>
+#include <toolbox/path.h>
+#include <flipper_format/flipper_format.h>
 
 
 static const char* nfc_file_header = "Flipper NFC device";
 static const char* nfc_file_header = "Flipper NFC device";
 static const uint32_t nfc_file_version = 2;
 static const uint32_t nfc_file_version = 2;
 
 
 NfcDevice* nfc_device_alloc() {
 NfcDevice* nfc_device_alloc() {
-    NfcDevice* nfc_dev = furi_alloc(sizeof(NfcDevice));
+    NfcDevice* nfc_dev = malloc(sizeof(NfcDevice));
     nfc_dev->storage = furi_record_open("storage");
     nfc_dev->storage = furi_record_open("storage");
     nfc_dev->dialogs = furi_record_open("dialogs");
     nfc_dev->dialogs = furi_record_open("dialogs");
     return nfc_dev;
     return nfc_dev;
@@ -56,7 +56,7 @@ bool nfc_device_parse_format_string(NfcDevice* dev, string_t format_string) {
     return false;
     return false;
 }
 }
 
 
-static bool nfc_device_save_mifare_ul_data(FlipperFile* file, NfcDevice* dev) {
+static bool nfc_device_save_mifare_ul_data(FlipperFormat* file, NfcDevice* dev) {
     bool saved = false;
     bool saved = false;
     MifareUlData* data = &dev->dev_data.mf_ul_data;
     MifareUlData* data = &dev->dev_data.mf_ul_data;
     string_t temp_str;
     string_t temp_str;
@@ -64,22 +64,23 @@ static bool nfc_device_save_mifare_ul_data(FlipperFile* file, NfcDevice* dev) {
 
 
     // Save Mifare Ultralight specific data
     // Save Mifare Ultralight specific data
     do {
     do {
-        if(!flipper_file_write_comment_cstr(file, "Mifare Ultralight specific data")) break;
-        if(!flipper_file_write_hex(file, "Signature", data->signature, sizeof(data->signature)))
+        if(!flipper_format_write_comment_cstr(file, "Mifare Ultralight specific data")) break;
+        if(!flipper_format_write_hex(file, "Signature", data->signature, sizeof(data->signature)))
             break;
             break;
-        if(!flipper_file_write_hex(
+        if(!flipper_format_write_hex(
                file, "Mifare version", (uint8_t*)&data->version, sizeof(data->version)))
                file, "Mifare version", (uint8_t*)&data->version, sizeof(data->version)))
             break;
             break;
         // Write conters and tearing flags data
         // Write conters and tearing flags data
         bool counters_saved = true;
         bool counters_saved = true;
         for(uint8_t i = 0; i < 3; i++) {
         for(uint8_t i = 0; i < 3; i++) {
             string_printf(temp_str, "Counter %d", i);
             string_printf(temp_str, "Counter %d", i);
-            if(!flipper_file_write_uint32(file, string_get_cstr(temp_str), &data->counter[i], 1)) {
+            if(!flipper_format_write_uint32(
+                   file, string_get_cstr(temp_str), &data->counter[i], 1)) {
                 counters_saved = false;
                 counters_saved = false;
                 break;
                 break;
             }
             }
             string_printf(temp_str, "Tearing %d", i);
             string_printf(temp_str, "Tearing %d", i);
-            if(!flipper_file_write_hex(file, string_get_cstr(temp_str), &data->tearing[i], 1)) {
+            if(!flipper_format_write_hex(file, string_get_cstr(temp_str), &data->tearing[i], 1)) {
                 counters_saved = false;
                 counters_saved = false;
                 break;
                 break;
             }
             }
@@ -87,11 +88,11 @@ static bool nfc_device_save_mifare_ul_data(FlipperFile* file, NfcDevice* dev) {
         if(!counters_saved) break;
         if(!counters_saved) break;
         // Write pages data
         // Write pages data
         uint32_t pages_total = data->data_size / 4;
         uint32_t pages_total = data->data_size / 4;
-        if(!flipper_file_write_uint32(file, "Pages total", &pages_total, 1)) break;
+        if(!flipper_format_write_uint32(file, "Pages total", &pages_total, 1)) break;
         bool pages_saved = true;
         bool pages_saved = true;
         for(uint16_t i = 0; i < data->data_size; i += 4) {
         for(uint16_t i = 0; i < data->data_size; i += 4) {
             string_printf(temp_str, "Page %d", i / 4);
             string_printf(temp_str, "Page %d", i / 4);
-            if(!flipper_file_write_hex(file, string_get_cstr(temp_str), &data->data[i], 4)) {
+            if(!flipper_format_write_hex(file, string_get_cstr(temp_str), &data->data[i], 4)) {
                 pages_saved = false;
                 pages_saved = false;
                 break;
                 break;
             }
             }
@@ -104,7 +105,7 @@ static bool nfc_device_save_mifare_ul_data(FlipperFile* file, NfcDevice* dev) {
     return saved;
     return saved;
 }
 }
 
 
-bool nfc_device_load_mifare_ul_data(FlipperFile* file, NfcDevice* dev) {
+bool nfc_device_load_mifare_ul_data(FlipperFormat* file, NfcDevice* dev) {
     bool parsed = false;
     bool parsed = false;
     MifareUlData* data = &dev->dev_data.mf_ul_data;
     MifareUlData* data = &dev->dev_data.mf_ul_data;
     string_t temp_str;
     string_t temp_str;
@@ -112,22 +113,22 @@ bool nfc_device_load_mifare_ul_data(FlipperFile* file, NfcDevice* dev) {
 
 
     do {
     do {
         // Read signature
         // Read signature
-        if(!flipper_file_read_hex(file, "Signature", data->signature, sizeof(data->signature)))
+        if(!flipper_format_read_hex(file, "Signature", data->signature, sizeof(data->signature)))
             break;
             break;
         // Read Mifare version
         // Read Mifare version
-        if(!flipper_file_read_hex(
+        if(!flipper_format_read_hex(
                file, "Mifare version", (uint8_t*)&data->version, sizeof(data->version)))
                file, "Mifare version", (uint8_t*)&data->version, sizeof(data->version)))
             break;
             break;
         // Read counters and tearing flags
         // Read counters and tearing flags
         bool counters_parsed = true;
         bool counters_parsed = true;
         for(uint8_t i = 0; i < 3; i++) {
         for(uint8_t i = 0; i < 3; i++) {
             string_printf(temp_str, "Counter %d", i);
             string_printf(temp_str, "Counter %d", i);
-            if(!flipper_file_read_uint32(file, string_get_cstr(temp_str), &data->counter[i], 1)) {
+            if(!flipper_format_read_uint32(file, string_get_cstr(temp_str), &data->counter[i], 1)) {
                 counters_parsed = false;
                 counters_parsed = false;
                 break;
                 break;
             }
             }
             string_printf(temp_str, "Tearing %d", i);
             string_printf(temp_str, "Tearing %d", i);
-            if(!flipper_file_read_hex(file, string_get_cstr(temp_str), &data->tearing[i], 1)) {
+            if(!flipper_format_read_hex(file, string_get_cstr(temp_str), &data->tearing[i], 1)) {
                 counters_parsed = false;
                 counters_parsed = false;
                 break;
                 break;
             }
             }
@@ -135,12 +136,12 @@ bool nfc_device_load_mifare_ul_data(FlipperFile* file, NfcDevice* dev) {
         if(!counters_parsed) break;
         if(!counters_parsed) break;
         // Read pages
         // Read pages
         uint32_t pages = 0;
         uint32_t pages = 0;
-        if(!flipper_file_read_uint32(file, "Pages total", &pages, 1)) break;
+        if(!flipper_format_read_uint32(file, "Pages total", &pages, 1)) break;
         data->data_size = pages * 4;
         data->data_size = pages * 4;
         bool pages_parsed = true;
         bool pages_parsed = true;
         for(uint16_t i = 0; i < pages; i++) {
         for(uint16_t i = 0; i < pages; i++) {
             string_printf(temp_str, "Page %d", i);
             string_printf(temp_str, "Page %d", i);
-            if(!flipper_file_read_hex(file, string_get_cstr(temp_str), &data->data[i * 4], 4)) {
+            if(!flipper_format_read_hex(file, string_get_cstr(temp_str), &data->data[i * 4], 4)) {
                 pages_parsed = false;
                 pages_parsed = false;
                 break;
                 break;
             }
             }
@@ -153,28 +154,28 @@ bool nfc_device_load_mifare_ul_data(FlipperFile* file, NfcDevice* dev) {
     return parsed;
     return parsed;
 }
 }
 
 
-static bool nfc_device_save_bank_card_data(FlipperFile* file, NfcDevice* dev) {
+static bool nfc_device_save_bank_card_data(FlipperFormat* file, NfcDevice* dev) {
     bool saved = false;
     bool saved = false;
     NfcEmvData* data = &dev->dev_data.emv_data;
     NfcEmvData* data = &dev->dev_data.emv_data;
     uint32_t data_temp = 0;
     uint32_t data_temp = 0;
 
 
     do {
     do {
         // Write Bank card specific data
         // Write Bank card specific data
-        if(!flipper_file_write_comment_cstr(file, "Bank card specific data")) break;
-        if(!flipper_file_write_hex(file, "AID", data->aid, data->aid_len)) break;
-        if(!flipper_file_write_string_cstr(file, "Name", data->name)) break;
-        if(!flipper_file_write_hex(file, "Number", data->number, data->number_len)) break;
+        if(!flipper_format_write_comment_cstr(file, "Bank card specific data")) break;
+        if(!flipper_format_write_hex(file, "AID", data->aid, data->aid_len)) break;
+        if(!flipper_format_write_string_cstr(file, "Name", data->name)) break;
+        if(!flipper_format_write_hex(file, "Number", data->number, data->number_len)) break;
         if(data->exp_mon) {
         if(data->exp_mon) {
             uint8_t exp_data[2] = {data->exp_mon, data->exp_year};
             uint8_t exp_data[2] = {data->exp_mon, data->exp_year};
-            if(!flipper_file_write_hex(file, "Exp data", exp_data, sizeof(exp_data))) break;
+            if(!flipper_format_write_hex(file, "Exp data", exp_data, sizeof(exp_data))) break;
         }
         }
         if(data->country_code) {
         if(data->country_code) {
             data_temp = data->country_code;
             data_temp = data->country_code;
-            if(!flipper_file_write_uint32(file, "Country code", &data_temp, 1)) break;
+            if(!flipper_format_write_uint32(file, "Country code", &data_temp, 1)) break;
         }
         }
         if(data->currency_code) {
         if(data->currency_code) {
             data_temp = data->currency_code;
             data_temp = data->currency_code;
-            if(!flipper_file_write_uint32(file, "Currency code", &data_temp, 1)) break;
+            if(!flipper_format_write_uint32(file, "Currency code", &data_temp, 1)) break;
         }
         }
         saved = true;
         saved = true;
     } while(false);
     } while(false);
@@ -182,7 +183,7 @@ static bool nfc_device_save_bank_card_data(FlipperFile* file, NfcDevice* dev) {
     return saved;
     return saved;
 }
 }
 
 
-bool nfc_device_load_bank_card_data(FlipperFile* file, NfcDevice* dev) {
+bool nfc_device_load_bank_card_data(FlipperFormat* file, NfcDevice* dev) {
     bool parsed = false;
     bool parsed = false;
     NfcEmvData* data = &dev->dev_data.emv_data;
     NfcEmvData* data = &dev->dev_data.emv_data;
     memset(data, 0, sizeof(NfcEmvData));
     memset(data, 0, sizeof(NfcEmvData));
@@ -192,25 +193,25 @@ bool nfc_device_load_bank_card_data(FlipperFile* file, NfcDevice* dev) {
 
 
     do {
     do {
         // Load essential data
         // Load essential data
-        if(!flipper_file_get_value_count(file, "AID", &data_cnt)) break;
+        if(!flipper_format_get_value_count(file, "AID", &data_cnt)) break;
         data->aid_len = data_cnt;
         data->aid_len = data_cnt;
-        if(!flipper_file_read_hex(file, "AID", data->aid, data->aid_len)) break;
-        if(!flipper_file_read_string(file, "Name", temp_str)) break;
+        if(!flipper_format_read_hex(file, "AID", data->aid, data->aid_len)) break;
+        if(!flipper_format_read_string(file, "Name", temp_str)) break;
         strlcpy(data->name, string_get_cstr(temp_str), sizeof(data->name));
         strlcpy(data->name, string_get_cstr(temp_str), sizeof(data->name));
-        if(!flipper_file_get_value_count(file, "Number", &data_cnt)) break;
+        if(!flipper_format_get_value_count(file, "Number", &data_cnt)) break;
         data->number_len = data_cnt;
         data->number_len = data_cnt;
-        if(!flipper_file_read_hex(file, "Number", data->number, data->number_len)) break;
+        if(!flipper_format_read_hex(file, "Number", data->number, data->number_len)) break;
         parsed = true;
         parsed = true;
         // Load optional data
         // Load optional data
         uint8_t exp_data[2] = {};
         uint8_t exp_data[2] = {};
-        if(flipper_file_read_hex(file, "Exp data", exp_data, 2)) {
+        if(flipper_format_read_hex(file, "Exp data", exp_data, 2)) {
             data->exp_mon = exp_data[0];
             data->exp_mon = exp_data[0];
             data->exp_year = exp_data[1];
             data->exp_year = exp_data[1];
         }
         }
-        if(flipper_file_read_uint32(file, "Country code", &data_cnt, 1)) {
+        if(flipper_format_read_uint32(file, "Country code", &data_cnt, 1)) {
             data->country_code = data_cnt;
             data->country_code = data_cnt;
         }
         }
-        if(flipper_file_read_uint32(file, "Currency code", &data_cnt, 1)) {
+        if(flipper_format_read_uint32(file, "Currency code", &data_cnt, 1)) {
             data->currency_code = data_cnt;
             data->currency_code = data_cnt;
         }
         }
     } while(false);
     } while(false);
@@ -233,7 +234,7 @@ static bool nfc_device_save_file(
     furi_assert(dev);
     furi_assert(dev);
 
 
     bool saved = false;
     bool saved = false;
-    FlipperFile* file = flipper_file_alloc(dev->storage);
+    FlipperFormat* file = flipper_format_file_alloc(dev->storage);
     NfcDeviceCommonData* data = &dev->dev_data.nfc_data;
     NfcDeviceCommonData* data = &dev->dev_data.nfc_data;
     string_t temp_str;
     string_t temp_str;
     string_init(temp_str);
     string_init(temp_str);
@@ -244,21 +245,21 @@ static bool nfc_device_save_file(
         // First remove nfc device file if it was saved
         // First remove nfc device file if it was saved
         string_printf(temp_str, "%s/%s%s", folder, dev_name, extension);
         string_printf(temp_str, "%s/%s%s", folder, dev_name, extension);
         // Open file
         // Open file
-        if(!flipper_file_open_always(file, string_get_cstr(temp_str))) break;
+        if(!flipper_format_file_open_always(file, string_get_cstr(temp_str))) break;
         // Write header
         // Write header
-        if(!flipper_file_write_header_cstr(file, nfc_file_header, nfc_file_version)) break;
+        if(!flipper_format_write_header_cstr(file, nfc_file_header, nfc_file_version)) break;
         // Write nfc device type
         // Write nfc device type
-        if(!flipper_file_write_comment_cstr(
+        if(!flipper_format_write_comment_cstr(
                file, "Nfc device type can be UID, Mifare Ultralight, Bank card"))
                file, "Nfc device type can be UID, Mifare Ultralight, Bank card"))
             break;
             break;
         nfc_device_prepare_format_string(dev, temp_str);
         nfc_device_prepare_format_string(dev, temp_str);
-        if(!flipper_file_write_string(file, "Device type", temp_str)) break;
+        if(!flipper_format_write_string(file, "Device type", temp_str)) break;
         // Write UID, ATQA, SAK
         // Write UID, ATQA, SAK
-        if(!flipper_file_write_comment_cstr(file, "UID, ATQA and SAK are common for all formats"))
+        if(!flipper_format_write_comment_cstr(file, "UID, ATQA and SAK are common for all formats"))
             break;
             break;
-        if(!flipper_file_write_hex(file, "UID", data->uid, data->uid_len)) break;
-        if(!flipper_file_write_hex(file, "ATQA", data->atqa, 2)) break;
-        if(!flipper_file_write_hex(file, "SAK", &data->sak, 1)) break;
+        if(!flipper_format_write_hex(file, "UID", data->uid, data->uid_len)) break;
+        if(!flipper_format_write_hex(file, "ATQA", data->atqa, 2)) break;
+        if(!flipper_format_write_hex(file, "SAK", &data->sak, 1)) break;
         // Save more data if necessary
         // Save more data if necessary
         if(dev->format == NfcDeviceSaveFormatMifareUl) {
         if(dev->format == NfcDeviceSaveFormatMifareUl) {
             if(!nfc_device_save_mifare_ul_data(file, dev)) break;
             if(!nfc_device_save_mifare_ul_data(file, dev)) break;
@@ -272,8 +273,7 @@ static bool nfc_device_save_file(
         dialog_message_show_storage_error(dev->dialogs, "Can not save\nkey file");
         dialog_message_show_storage_error(dev->dialogs, "Can not save\nkey file");
     }
     }
     string_clear(temp_str);
     string_clear(temp_str);
-    flipper_file_close(file);
-    flipper_file_free(file);
+    flipper_format_free(file);
     return saved;
     return saved;
 }
 }
 
 
@@ -288,7 +288,7 @@ bool nfc_device_save_shadow(NfcDevice* dev, const char* dev_name) {
 
 
 static bool nfc_device_load_data(NfcDevice* dev, string_t path) {
 static bool nfc_device_load_data(NfcDevice* dev, string_t path) {
     bool parsed = false;
     bool parsed = false;
-    FlipperFile* file = flipper_file_alloc(dev->storage);
+    FlipperFormat* file = flipper_format_file_alloc(dev->storage);
     NfcDeviceCommonData* data = &dev->dev_data.nfc_data;
     NfcDeviceCommonData* data = &dev->dev_data.nfc_data;
     uint32_t data_cnt = 0;
     uint32_t data_cnt = 0;
     string_t temp_str;
     string_t temp_str;
@@ -304,26 +304,26 @@ static bool nfc_device_load_data(NfcDevice* dev, string_t path) {
             storage_common_stat(dev->storage, string_get_cstr(temp_str), NULL) == FSE_OK;
             storage_common_stat(dev->storage, string_get_cstr(temp_str), NULL) == FSE_OK;
         // Open shadow file if it exists. If not - open original
         // Open shadow file if it exists. If not - open original
         if(dev->shadow_file_exist) {
         if(dev->shadow_file_exist) {
-            if(!flipper_file_open_existing(file, string_get_cstr(temp_str))) break;
+            if(!flipper_format_file_open_existing(file, string_get_cstr(temp_str))) break;
         } else {
         } else {
-            if(!flipper_file_open_existing(file, string_get_cstr(path))) break;
+            if(!flipper_format_file_open_existing(file, string_get_cstr(path))) break;
         }
         }
         // Read and verify file header
         // Read and verify file header
         uint32_t version = 0;
         uint32_t version = 0;
-        if(!flipper_file_read_header(file, temp_str, &version)) break;
+        if(!flipper_format_read_header(file, temp_str, &version)) break;
         if(string_cmp_str(temp_str, nfc_file_header) || (version != nfc_file_version)) {
         if(string_cmp_str(temp_str, nfc_file_header) || (version != nfc_file_version)) {
             depricated_version = true;
             depricated_version = true;
             break;
             break;
         }
         }
         // Read Nfc device type
         // Read Nfc device type
-        if(!flipper_file_read_string(file, "Device type", temp_str)) break;
+        if(!flipper_format_read_string(file, "Device type", temp_str)) break;
         if(!nfc_device_parse_format_string(dev, temp_str)) break;
         if(!nfc_device_parse_format_string(dev, temp_str)) break;
         // Read and parse UID, ATQA and SAK
         // Read and parse UID, ATQA and SAK
-        if(!flipper_file_get_value_count(file, "UID", &data_cnt)) break;
+        if(!flipper_format_get_value_count(file, "UID", &data_cnt)) break;
         data->uid_len = data_cnt;
         data->uid_len = data_cnt;
-        if(!flipper_file_read_hex(file, "UID", data->uid, data->uid_len)) break;
-        if(!flipper_file_read_hex(file, "ATQA", data->atqa, 2)) break;
-        if(!flipper_file_read_hex(file, "SAK", &data->sak, 1)) break;
+        if(!flipper_format_read_hex(file, "UID", data->uid, data->uid_len)) break;
+        if(!flipper_format_read_hex(file, "ATQA", data->atqa, 2)) break;
+        if(!flipper_format_read_hex(file, "SAK", &data->sak, 1)) break;
         // Parse other data
         // Parse other data
         if(dev->format == NfcDeviceSaveFormatMifareUl) {
         if(dev->format == NfcDeviceSaveFormatMifareUl) {
             if(!nfc_device_load_mifare_ul_data(file, dev)) break;
             if(!nfc_device_load_mifare_ul_data(file, dev)) break;
@@ -342,8 +342,7 @@ static bool nfc_device_load_data(NfcDevice* dev, string_t path) {
     }
     }
 
 
     string_clear(temp_str);
     string_clear(temp_str);
-    flipper_file_close(file);
-    flipper_file_free(file);
+    flipper_format_free(file);
     return parsed;
     return parsed;
 }
 }
 
 

+ 5 - 6
applications/nfc/nfc_worker.c

@@ -8,18 +8,17 @@
 /***************************** NFC Worker API *******************************/
 /***************************** NFC Worker API *******************************/
 
 
 NfcWorker* nfc_worker_alloc() {
 NfcWorker* nfc_worker_alloc() {
-    NfcWorker* nfc_worker = furi_alloc(sizeof(NfcWorker));
+    NfcWorker* nfc_worker = malloc(sizeof(NfcWorker));
     // Worker thread attributes
     // Worker thread attributes
     nfc_worker->thread_attr.name = "NfcWorker";
     nfc_worker->thread_attr.name = "NfcWorker";
     nfc_worker->thread_attr.stack_size = 8192;
     nfc_worker->thread_attr.stack_size = 8192;
     nfc_worker->callback = NULL;
     nfc_worker->callback = NULL;
     nfc_worker->context = NULL;
     nfc_worker->context = NULL;
     // Initialize rfal
     // Initialize rfal
-    if(!furi_hal_nfc_is_busy()) {
-        nfc_worker_change_state(nfc_worker, NfcWorkerStateReady);
-    } else {
-        nfc_worker_change_state(nfc_worker, NfcWorkerStateBroken);
+    while(furi_hal_nfc_is_busy()) {
+        osDelay(10);
     }
     }
+    nfc_worker_change_state(nfc_worker, NfcWorkerStateReady);
 
 
     return nfc_worker;
     return nfc_worker;
 }
 }
@@ -41,7 +40,7 @@ void nfc_worker_start(
     void* context) {
     void* context) {
     furi_assert(nfc_worker);
     furi_assert(nfc_worker);
     furi_assert(dev_data);
     furi_assert(dev_data);
-    while(nfc_worker->state != NfcWorkerStateReady) {
+    while(furi_hal_nfc_is_busy()) {
         osDelay(10);
         osDelay(10);
     }
     }
 
 

+ 1 - 1
applications/nfc/views/bank_card.c

@@ -7,7 +7,7 @@ struct BankCard {
 };
 };
 
 
 BankCard* bank_card_alloc() {
 BankCard* bank_card_alloc() {
-    BankCard* bank_card = furi_alloc(sizeof(BankCard));
+    BankCard* bank_card = malloc(sizeof(BankCard));
     bank_card->widget = widget_alloc();
     bank_card->widget = widget_alloc();
     return bank_card;
     return bank_card;
 }
 }

+ 2 - 2
applications/notification/notification_app.c

@@ -403,7 +403,7 @@ static void input_event_callback(const void* value, void* context) {
 
 
 // App alloc
 // App alloc
 static NotificationApp* notification_app_alloc() {
 static NotificationApp* notification_app_alloc() {
-    NotificationApp* app = furi_alloc(sizeof(NotificationApp));
+    NotificationApp* app = malloc(sizeof(NotificationApp));
     app->queue = osMessageQueueNew(8, sizeof(NotificationAppMessage), NULL);
     app->queue = osMessageQueueNew(8, sizeof(NotificationAppMessage), NULL);
     app->display_timer = osTimerNew(notification_display_timer, osTimerOnce, app, NULL);
     app->display_timer = osTimerNew(notification_display_timer, osTimerOnce, app, NULL);
 
 
@@ -482,4 +482,4 @@ int32_t notification_srv(void* p) {
     }
     }
 
 
     return 0;
     return 0;
-};
+};

+ 1 - 1
applications/notification/notification_settings_app.c

@@ -221,4 +221,4 @@ int32_t notification_settings_app(void* p) {
     notification_message_save_settings(app->notification);
     notification_message_save_settings(app->notification);
     free_settings(app);
     free_settings(app);
     return 0;
     return 0;
-}
+}

+ 2 - 2
applications/power/battery_test_app/battery_test_app.c

@@ -32,7 +32,7 @@ static void battery_test_battery_info_update_model(void* context) {
 }
 }
 
 
 BatteryTestApp* battery_test_alloc() {
 BatteryTestApp* battery_test_alloc() {
-    BatteryTestApp* app = furi_alloc(sizeof(BatteryTestApp));
+    BatteryTestApp* app = malloc(sizeof(BatteryTestApp));
 
 
     // Records
     // Records
     app->gui = furi_record_open("gui");
     app->gui = furi_record_open("gui");
@@ -97,4 +97,4 @@ int32_t battery_test_app(void* p) {
     power_enable_low_battery_level_notification(app->power, true);
     power_enable_low_battery_level_notification(app->power, true);
     battery_test_free(app);
     battery_test_free(app);
     return 0;
     return 0;
-}
+}

+ 1 - 1
applications/power/power_service/power.c

@@ -32,7 +32,7 @@ static ViewPort* power_battery_view_port_alloc(Power* power) {
 }
 }
 
 
 Power* power_alloc() {
 Power* power_alloc() {
-    Power* power = furi_alloc(sizeof(Power));
+    Power* power = malloc(sizeof(Power));
 
 
     // Records
     // Records
     power->notification = furi_record_open("notification");
     power->notification = furi_record_open("notification");

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů