Option to preload extmainapps or not

This commit is contained in:
Willy-JL
2023-05-28 17:03:23 +01:00
parent 5a5c7b6fb0
commit 33b8519202
4 changed files with 5 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ App(
appid="gpio",
name="GPIO",
apptype=FlipperAppType.EXTMAINAPP,
preload=True,
entry_point="gpio_app",
cdefines=["APP_GPIO"],
requires=["gui"],

View File

@@ -2,6 +2,7 @@ App(
appid="ibutton",
name="iButton",
apptype=FlipperAppType.EXTMAINAPP,
preload=True,
targets=["f7"],
entry_point="ibutton_app",
cdefines=["APP_IBUTTON"],

View File

@@ -151,7 +151,7 @@ static Loader* loader_alloc() {
if(furi_hal_is_normal_boot()) {
Storage* storage = furi_record_open(RECORD_STORAGE);
for(size_t i = 0; i < FLIPPER_APPS_COUNT; i++) {
if(FLIPPER_APPS[i].app != NULL) continue;
if(FLIPPER_APPS[i].app != NULL || FLIPPER_APPS[i].stack_size != 1) continue;
if(storage_common_exists(storage, FLIPPER_APPS[i].appid)) {
void* preload = loader_preload(storage, FLIPPER_APPS[i].appid);
FLIPPER_APPS[i].preload = preload;

View File

@@ -42,6 +42,7 @@ class FlipperApplication:
appid: str
apptype: FlipperAppType
preload: Optional[bool] = False
name: Optional[str] = ""
entry_point: Optional[str] = None
flags: List[str] = field(default_factory=lambda: ["Default"])
@@ -373,7 +374,7 @@ class ApplicationsCGenerator:
{{.app = NULL,
.name = "{app.name}",
.appid = "/ext/apps/.Main/{app.appid}.fap",
.stack_size = 0,
.stack_size = {1 if app.preload else 0},
.icon = {f"&{app.icon}" if app.icon else "NULL"},
.flags = {'|'.join(f"FlipperApplicationFlag{flag}" for flag in app.flags)}}}"""
return f"""