mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-07 19:01:54 -07:00
FAPP(TM) support
This commit is contained in:
@@ -366,8 +366,15 @@ static LoaderStatus loader_do_start_by_name(
|
||||
{
|
||||
const FlipperInternalApplication* app = loader_find_application_by_name(name);
|
||||
if(app) {
|
||||
loader_start_internal_app(loader, app, args);
|
||||
status = loader_make_success_status(error_message);
|
||||
if(app->app == NULL) {
|
||||
// FAPP support
|
||||
status = loader_start_external_app(
|
||||
loader, furi_record_open(RECORD_STORAGE), app->appid, args, error_message);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
} else {
|
||||
loader_start_internal_app(loader, app, args);
|
||||
status = loader_make_success_status(error_message);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -495,4 +502,4 @@ int32_t loader_srv(void* p) {
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class FlipperAppType(Enum):
|
||||
SERVICE = "Service"
|
||||
SYSTEM = "System"
|
||||
APP = "App"
|
||||
FAPP = "Fapp"
|
||||
DEBUG = "Debug"
|
||||
ARCHIVE = "Archive"
|
||||
SETTINGS = "Settings"
|
||||
@@ -375,6 +376,14 @@ class ApplicationsCGenerator:
|
||||
def get_app_descr(self, app: FlipperApplication):
|
||||
if app.apptype == FlipperAppType.STARTUP:
|
||||
return app.entry_point
|
||||
if app.apptype == FlipperAppType.FAPP:
|
||||
return f"""
|
||||
{{.app = NULL,
|
||||
.name = "{app.name}",
|
||||
.appid = "/ext/apps/.Main/{app.appid}.fap",
|
||||
.stack_size = 0,
|
||||
.icon = {f"&{app.icon}" if app.icon else "NULL"},
|
||||
.flags = {'|'.join(f"FlipperInternalApplicationFlag{flag}" for flag in app.flags)}}}"""
|
||||
return f"""
|
||||
{{.app = {app.entry_point},
|
||||
.name = "{app.name}",
|
||||
@@ -395,11 +404,11 @@ class ApplicationsCGenerator:
|
||||
)
|
||||
entry_type, entry_block = self.APP_TYPE_MAP[apptype]
|
||||
contents.append(f"const {entry_type} {entry_block}[] = {{")
|
||||
contents.append(
|
||||
",\n".join(
|
||||
map(self.get_app_descr, self.buildset.get_apps_of_type(apptype))
|
||||
)
|
||||
)
|
||||
apps = self.buildset.get_apps_of_type(apptype)
|
||||
if apptype is FlipperAppType.APP:
|
||||
apps += self.buildset.get_apps_of_type(FlipperAppType.FAPP)
|
||||
apps.sort(key=lambda app: app.order)
|
||||
contents.append(",\n".join(map(self.get_app_descr, apps)))
|
||||
contents.append("};")
|
||||
contents.append(
|
||||
f"const size_t {entry_block}_COUNT = COUNT_OF({entry_block});"
|
||||
|
||||
@@ -179,7 +179,7 @@ class AppBuilder:
|
||||
deployable = False
|
||||
app_artifacts.dist_entries.append((deployable, fal_path))
|
||||
else:
|
||||
fap_path = f"apps/{self.app.fap_category}/{app_artifacts.compact.name}"
|
||||
fap_path = f"apps/{'.Main' if self.app.apptype == FlipperAppType.FAPP else self.app.fap_category}/{app_artifacts.compact.name}"
|
||||
app_artifacts.dist_entries.append(
|
||||
(self.app.is_default_deployable, fap_path)
|
||||
)
|
||||
|
||||
@@ -65,6 +65,7 @@ class FlipperExtAppBuildArtifacts:
|
||||
|
||||
|
||||
apps_to_build_as_faps = [
|
||||
FlipperAppType.FAPP,
|
||||
FlipperAppType.PLUGIN,
|
||||
FlipperAppType.EXTERNAL,
|
||||
FlipperAppType.DEBUG,
|
||||
|
||||
Reference in New Issue
Block a user