From c097a1717c6c9a8f1a540cdb12f49c587b0e6c3b Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Sun, 5 Mar 2023 02:30:50 +0000 Subject: [PATCH] Move xtreme settings file to sd card --- applications/services/xtreme/settings.c | 9 +++++++-- applications/services/xtreme/settings.h | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/applications/services/xtreme/settings.c b/applications/services/xtreme/settings.c index 881ab8950..bfc3629f4 100644 --- a/applications/services/xtreme/settings.c +++ b/applications/services/xtreme/settings.c @@ -14,9 +14,10 @@ XtremeSettings* XTREME_SETTINGS() { void XTREME_SETTINGS_LOAD() { if(xtreme_settings == NULL) { xtreme_settings = malloc(sizeof(XtremeSettings)); - bool loaded; + bool loaded = false; + bool skip = furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal; - if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) { + if(skip) { FURI_LOG_W(TAG, "Load skipped. Device is in special startup mode."); loaded = false; } else { @@ -29,6 +30,10 @@ void XTREME_SETTINGS_LOAD() { } if(!loaded) { + if(!skip) { + storage_simply_remove(furi_record_open(RECORD_STORAGE), XTREME_SETTINGS_PATH_OLD); + furi_record_close(RECORD_STORAGE); + } memset(xtreme_settings, 0, sizeof(XtremeSettings)); strlcpy(xtreme_settings->asset_pack, "", MAX_PACK_NAME_LEN); // SFW xtreme_settings->anim_speed = 100; // 100% diff --git a/applications/services/xtreme/settings.h b/applications/services/xtreme/settings.h index 76df60e66..562a37c73 100644 --- a/applications/services/xtreme/settings.h +++ b/applications/services/xtreme/settings.h @@ -16,7 +16,8 @@ extern "C" { #define MAX_PACK_NAME_LEN 32 #define XTREME_SETTINGS_VERSION (5) -#define XTREME_SETTINGS_PATH INT_PATH(XTREME_SETTINGS_FILE_NAME) +#define XTREME_SETTINGS_PATH_OLD INT_PATH(XTREME_SETTINGS_FILE_NAME) +#define XTREME_SETTINGS_PATH EXT_PATH(XTREME_SETTINGS_FILE_NAME) #define XTREME_SETTINGS_MAGIC (0x69) // Some settings function backwards (logically) in