mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 19:58:36 -07:00
* Original pointer can be const * Back to const icons * Missed this one * Simpler string alloc * Single allocation and header struct for static icons * Shared allocation and meta struct for animated icons * Only try to load if dir exists * Restructure momentum lib * Use some internal headers * Swap icons at draw * Properly init and free, no more original in icon struct
29 lines
905 B
C
29 lines
905 B
C
#include "namespoof.h"
|
|
|
|
#include <flipper_format/flipper_format.h>
|
|
#include <furi_hal_version.h>
|
|
|
|
#define TAG "NameSpoof"
|
|
|
|
void namespoof_init(void) {
|
|
FuriString* str = furi_string_alloc();
|
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
|
FlipperFormat* file = flipper_format_file_alloc(storage);
|
|
|
|
do {
|
|
uint32_t version;
|
|
if(!flipper_format_file_open_existing(file, NAMESPOOF_PATH)) break;
|
|
if(!flipper_format_read_header(file, str, &version)) break;
|
|
if(furi_string_cmp_str(str, NAMESPOOF_HEADER)) break;
|
|
if(version != NAMESPOOF_VERSION) break;
|
|
|
|
if(!flipper_format_read_string(file, "Name", str)) break;
|
|
version_set_custom_name(NULL, strdup(furi_string_get_cstr(str)));
|
|
furi_hal_version_set_name(NULL);
|
|
} while(false);
|
|
|
|
flipper_format_free(file);
|
|
furi_record_close(RECORD_STORAGE);
|
|
furi_string_free(str);
|
|
}
|