New namespoof implementation

This commit is contained in:
Willy-JL
2023-05-10 12:19:01 +01:00
parent 33ff8e4506
commit 640637ce60
14 changed files with 50 additions and 224 deletions

View File

@@ -69,28 +69,15 @@ bool xtreme_app_apply(XtremeApp* app) {
if(app->save_name) {
if(strcmp(app->device_name, "") == 0) {
storage_simply_remove(storage, NAMECHANGER_PATH);
storage_simply_remove(storage, NAMESPOOF_PATH);
} else {
FlipperFormat* file = flipper_format_file_alloc(storage);
do {
if(!flipper_format_file_open_always(file, NAMECHANGER_PATH)) break;
if(!flipper_format_write_header_cstr(file, NAMECHANGER_HEADER, 1)) break;
if(!flipper_format_write_comment_cstr(
file, "Changing the value below will change your FlipperZero device name."))
if(!flipper_format_file_open_always(file, NAMESPOOF_PATH)) break;
if(!flipper_format_write_header_cstr(file, NAMESPOOF_HEADER, NAMESPOOF_VERSION))
break;
if(!flipper_format_write_comment_cstr(
file,
"Note: This is limited to 8 characters using the following: a-z, A-Z, 0-9, and _"))
break;
if(!flipper_format_write_comment_cstr(
file, "It cannot contain any other characters."))
break;
if(!flipper_format_write_string_cstr(file, "Name", app->device_name)) break;
} while(0);
flipper_format_free(file);
@@ -262,7 +249,7 @@ XtremeApp* xtreme_app_alloc() {
furi_hal_subghz_get_extend_settings(&app->subghz_extend, &app->subghz_bypass);
strlcpy(app->device_name, furi_hal_version_get_name_ptr(), NAMECHANGER_TEXT_STORE_SIZE);
strlcpy(app->device_name, furi_hal_version_get_name_ptr(), FURI_HAL_VERSION_ARRAY_NAME_LENGTH);
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
DolphinStats stats = dolphin_stats(dolphin);