mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 16:48:35 -07:00
Migrate files and load MNTM settings on SD insert
I don't fully like how I made this work, bu I don't see a better way without restructuring a lot of things and losing behavior compatibility
This commit is contained in:
@@ -10,6 +10,9 @@ void namespoof_init(void) {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
|
||||
const char* prev_custom_name = version_get_custom_name(NULL);
|
||||
bool applied_new_name = false;
|
||||
|
||||
do {
|
||||
uint32_t version;
|
||||
if(!flipper_format_file_open_existing(file, NAMESPOOF_PATH)) break;
|
||||
@@ -20,8 +23,17 @@ void namespoof_init(void) {
|
||||
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);
|
||||
applied_new_name = true;
|
||||
} while(false);
|
||||
|
||||
if(prev_custom_name) {
|
||||
if(!applied_new_name) {
|
||||
version_set_custom_name(NULL, NULL);
|
||||
furi_hal_version_init();
|
||||
}
|
||||
free((void*)prev_custom_name);
|
||||
}
|
||||
|
||||
flipper_format_free(file);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
furi_string_free(str);
|
||||
|
||||
Reference in New Issue
Block a user