2022-09-25 17:11:29 +03:00
|
|
|
#include "application_manifest.h"
|
|
|
|
|
2023-02-07 19:33:05 +03:00
|
|
|
#include <furi_hal_version.h>
|
2024-03-25 13:53:32 +03:00
|
|
|
#include <furi.h>
|
2023-02-07 19:33:05 +03:00
|
|
|
|
2022-09-25 17:11:29 +03:00
|
|
|
bool flipper_application_manifest_is_valid(const FlipperApplicationManifest* manifest) {
|
2024-03-25 13:53:32 +03:00
|
|
|
furi_check(manifest);
|
|
|
|
|
2022-09-25 17:11:29 +03:00
|
|
|
if((manifest->base.manifest_magic != FAP_MANIFEST_MAGIC) ||
|
|
|
|
(manifest->base.manifest_version != FAP_MANIFEST_SUPPORTED_VERSION)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2023-09-11 09:23:00 +03:00
|
|
|
bool flipper_application_manifest_is_too_old(
|
2022-09-25 17:11:29 +03:00
|
|
|
const FlipperApplicationManifest* manifest,
|
|
|
|
const ElfApiInterface* api_interface) {
|
2024-03-25 13:53:32 +03:00
|
|
|
furi_check(manifest);
|
|
|
|
furi_check(api_interface);
|
|
|
|
|
2023-09-11 09:23:00 +03:00
|
|
|
if(manifest->base.api_version.major < api_interface->api_version_major /* ||
|
|
|
|
manifest->base.api_version.minor > app->api_interface->api_version_minor */) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool flipper_application_manifest_is_too_new(
|
|
|
|
const FlipperApplicationManifest* manifest,
|
|
|
|
const ElfApiInterface* api_interface) {
|
2024-03-25 13:53:32 +03:00
|
|
|
furi_check(manifest);
|
|
|
|
furi_check(api_interface);
|
|
|
|
|
2023-09-11 09:23:00 +03:00
|
|
|
if(manifest->base.api_version.major > api_interface->api_version_major /* ||
|
2022-09-25 17:11:29 +03:00
|
|
|
manifest->base.api_version.minor > app->api_interface->api_version_minor */) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2023-02-07 19:33:05 +03:00
|
|
|
|
|
|
|
bool flipper_application_manifest_is_target_compatible(const FlipperApplicationManifest* manifest) {
|
2024-03-25 13:53:32 +03:00
|
|
|
furi_check(manifest);
|
|
|
|
|
2023-02-07 19:33:05 +03:00
|
|
|
const Version* version = furi_hal_version_get_firmware_version();
|
|
|
|
return version_get_target(version) == manifest->base.hardware_target_id;
|
|
|
|
}
|