40 lines
1.2 KiB
Zig
40 lines
1.2 KiB
Zig
|
const std = @import("std");
|
||
|
const mem = std.mem;
|
||
|
|
||
|
const MANIFEST_MAGIC: u32 = 0x52474448;
|
||
|
const API_VERSION: u32 = 0x00480001; // API_VERSION 72.1
|
||
|
|
||
|
const FlipperManifestBase = extern struct {
|
||
|
manifest_magic: u32 align(1),
|
||
|
manifest_version: u32 align(1),
|
||
|
api_version: u32 align(1),
|
||
|
hardware_target_id: u16 align(1),
|
||
|
};
|
||
|
|
||
|
const FlipperApplicationManifestV1 = extern struct {
|
||
|
base: FlipperManifestBase,
|
||
|
stack_size: u16 align(1),
|
||
|
app_version: u32 align(1),
|
||
|
name: [32]u8 align(1),
|
||
|
has_icon: u8 align(1),
|
||
|
icon: [32]u8 align(1),
|
||
|
};
|
||
|
|
||
|
const FlipperApplicationManifest = FlipperApplicationManifestV1;
|
||
|
|
||
|
pub fn createApplicationManifest(stack_size: u16, app_version: u32, comptime name: [*:0]const u8, has_icon: u8, icon: ?[32]u8) FlipperApplicationManifest {
|
||
|
return FlipperApplicationManifest{
|
||
|
.base = FlipperManifestBase{
|
||
|
.manifest_magic = MANIFEST_MAGIC,
|
||
|
.manifest_version = 1,
|
||
|
.api_version = API_VERSION,
|
||
|
.hardware_target_id = 7,
|
||
|
},
|
||
|
.stack_size = stack_size,
|
||
|
.app_version = app_version,
|
||
|
.name = (mem.span(name) ++ mem.zeroes([32 - mem.len(name)]u8)).*,
|
||
|
.has_icon = has_icon,
|
||
|
.icon = icon orelse mem.zeroes([32]u8),
|
||
|
};
|
||
|
}
|