mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-13 13:09:49 +04:00
[FL-3953] Application chaining (#4105)
* feat: app chaining * add `launch_current_app_after_deferred`, remove `get_referring_application` * fix naming * new api * fix f18 * fix deferred launches after errors * fix: memory leak * Updater: MIN_GAP_PAGES = 0 * loader: loader_get_application_launch_path doc * loader: fix freeze * loader: reject mlib, reduce code size * loader: generic synchronous call, reduce size * loader: reject furi_string, reduce size * apps: debug: removed order field from manifests since it is no longer meaningful --------- Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com> Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
32
applications/services/loader/loader_queue.c
Normal file
32
applications/services/loader/loader_queue.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "loader_queue.h"
|
||||
|
||||
void loader_queue_item_clear(LoaderDeferredLaunchRecord* item) {
|
||||
free(item->args);
|
||||
free(item->name_or_path);
|
||||
}
|
||||
|
||||
bool loader_queue_pop(LoaderLaunchQueue* queue, LoaderDeferredLaunchRecord* item) {
|
||||
if(!queue->item_cnt) return false;
|
||||
|
||||
*item = queue->items[0];
|
||||
queue->item_cnt--;
|
||||
memmove(
|
||||
&queue->items[0], &queue->items[1], queue->item_cnt * sizeof(LoaderDeferredLaunchRecord));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool loader_queue_push(LoaderLaunchQueue* queue, LoaderDeferredLaunchRecord* item) {
|
||||
if(queue->item_cnt == LOADER_QUEUE_MAX_SIZE) return false;
|
||||
|
||||
queue->items[queue->item_cnt] = *item;
|
||||
queue->item_cnt++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void loader_queue_clear(LoaderLaunchQueue* queue) {
|
||||
for(size_t i = 0; i < queue->item_cnt; i++)
|
||||
loader_queue_item_clear(&queue->items[i]);
|
||||
queue->item_cnt = 0;
|
||||
}
|
||||
Reference in New Issue
Block a user