FAPP(TM) support

This commit is contained in:
Willy-JL
2023-06-25 22:39:15 +01:00
parent 888e325fa7
commit 71d1c1d0f1
4 changed files with 26 additions and 9 deletions
+14 -5
View File
@@ -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});"