Embed assets in elf file (#2466)

* FBT: file_assets generator
* Elf file: process manifest section externally
* FBT, file_assets generator: add assets signature
* Storage: assets path alias
* Flipper application: assets unpacker
* Apps, Storage: use '/data' alias for apps data
* Storage: copy file to file
* Assets: log flag, fixes
* Update f18 api
* Assets: asserts
* Assets: fix signature_data check
* App assets: example
* Example assets: fix folder structure in readme
* Assets: fix error handling
* Assets builder: use ansii instead of utf-8, use .fapassets section instead of .fapfiles, add assets path to signature
* Elf file: comment strange places
* Storage: totaly optimized storage_file_copy_to_file
This commit is contained in:
Sergey Gavrilov
2023-03-09 18:01:53 +03:00
committed by GitHub
parent 50ef5deefc
commit 4fd043398a
22 changed files with 937 additions and 113 deletions

View File

@@ -9,6 +9,7 @@
#define MAX_NAME_LENGTH 256
#define MAX_EXT_LEN 16
#define FILE_BUFFER_SIZE 512
#define TAG "StorageAPI"
@@ -251,6 +252,26 @@ bool storage_file_exists(Storage* storage, const char* path) {
return exist;
}
bool storage_file_copy_to_file(File* source, File* destination, uint32_t size) {
uint8_t* buffer = malloc(FILE_BUFFER_SIZE);
while(size) {
uint32_t read_size = size > FILE_BUFFER_SIZE ? FILE_BUFFER_SIZE : size;
if(storage_file_read(source, buffer, read_size) != read_size) {
break;
}
if(storage_file_write(destination, buffer, read_size) != read_size) {
break;
}
size -= read_size;
}
free(buffer);
return size == 0;
}
/****************** DIR ******************/
static bool storage_dir_open_internal(File* file, const char* path) {