Skip to content

Commit f6e0d0f

Browse files
committed
Test Many Changes By Willy-JL
1 parent 9a5f939 commit f6e0d0f

File tree

64 files changed

+225
-115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+225
-115
lines changed

ReadMe.md

Lines changed: 4 additions & 2 deletions

applications/external/dolphintrainer/dolphintrainer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ int32_t dolphin_trainer_app(void* p) {
108108

109109
bool running = true;
110110
bool success = saved_struct_load(
111-
"/int/.dolphin.state", &stateLocal->data, sizeof(DolphinStoreData), 0xD0, 0x01);
111+
DOLPHIN_STATE_PATH, &stateLocal->data, sizeof(DolphinStoreData), 0xD0, 0x01);
112112
if(!success) {
113113
running = false;
114114
}
@@ -118,7 +118,7 @@ int32_t dolphin_trainer_app(void* p) {
118118
if(event.type == InputTypePress) {
119119
if(event.key == InputKeyOk && btnIndex == 3) {
120120
bool result = saved_struct_save(
121-
"/int/.dolphin.state", &stateLocal->data, sizeof(DolphinStoreData), 0xD0, 0x01);
121+
DOLPHIN_STATE_PATH, &stateLocal->data, sizeof(DolphinStoreData), 0xD0, 0x01);
122122
if(result) {
123123
furi_delay_ms(100);
124124
furi_hal_power_reset();

applications/main/archive/helpers/archive_favorites.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ bool archive_favorites_read(void* context) {
140140

141141
bool result = storage_file_open(file, ARCHIVE_FAV_PATH, FSAM_READ, FSOM_OPEN_EXISTING);
142142

143+
if(!result) {
144+
storage_file_close(file);
145+
storage_common_copy(storage, ARCHIVE_FAV_OLD_PATH, ARCHIVE_FAV_PATH);
146+
storage_common_remove(storage, ARCHIVE_FAV_OLD_PATH);
147+
result = storage_file_open(file, ARCHIVE_FAV_PATH, FSAM_READ, FSOM_OPEN_EXISTING);
148+
}
149+
143150
if(result) {
144151
while(1) {
145152
if(!archive_favorites_read_line(file, buffer)) {

applications/main/archive/helpers/archive_favorites.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
#include <storage/storage.h>
44

5-
#define ARCHIVE_FAV_PATH ANY_PATH("favorites.txt")
6-
#define ARCHIVE_FAV_TEMP_PATH ANY_PATH("favorites.tmp")
5+
#define ARCHIVE_FAV_OLD_PATH EXT_PATH("favorites.txt")
6+
#define ARCHIVE_FAV_PATH CFG_PATH("favorites.txt")
7+
#define ARCHIVE_FAV_TEMP_PATH CFG_PATH("favorites.tmp")
78

89
uint16_t archive_favorites_count(void* context);
910
bool archive_favorites_read(void* context);

applications/main/fap_loader/fap_loader_app.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ bool fap_loader_load_name_and_icon(
3737

3838
bool load_success = false;
3939

40-
if(preload_res == FlipperApplicationPreloadStatusSuccess) {
40+
if(preload_res == FlipperApplicationPreloadStatusSuccess || preload_res == FlipperApplicationPreloadStatusApiMismatch) {
4141
const FlipperApplicationManifest* manifest = flipper_application_get_manifest(app);
4242
if(manifest->has_icon) {
4343
memcpy(*icon_ptr, manifest->icon, FAP_MANIFEST_MAX_ICON_SIZE);

applications/main/u2f/u2f_app.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "u2f_data.h"
33
#include <furi.h>
44
#include <furi_hal.h>
5+
#include <storage/storage.h>
56

67
static bool u2f_app_custom_event_callback(void* context, uint32_t event) {
78
furi_assert(context);
@@ -27,6 +28,11 @@ U2fApp* u2f_app_alloc() {
2728
app->gui = furi_record_open(RECORD_GUI);
2829
app->notifications = furi_record_open(RECORD_NOTIFICATION);
2930

31+
Storage* storage = furi_record_open(RECORD_STORAGE);
32+
storage_common_copy(storage, U2F_CNT_OLD_FILE, U2F_CNT_FILE);
33+
storage_common_copy(storage, U2F_KEY_OLD_FILE, U2F_KEY_FILE);
34+
furi_record_close(RECORD_STORAGE);
35+
3036
app->view_dispatcher = view_dispatcher_alloc();
3137
app->scene_manager = scene_manager_alloc(&u2f_scene_handlers, app);
3238
view_dispatcher_enable_queue(app->view_dispatcher);

applications/main/u2f/u2f_data.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77

88
#define TAG "U2F"
99

10-
#define U2F_DATA_FOLDER ANY_PATH("u2f/")
11-
#define U2F_CERT_FILE U2F_DATA_FOLDER "assets/cert.der"
12-
#define U2F_CERT_KEY_FILE U2F_DATA_FOLDER "assets/cert_key.u2f"
13-
#define U2F_KEY_FILE U2F_DATA_FOLDER "key.u2f"
14-
#define U2F_CNT_FILE U2F_DATA_FOLDER "cnt.u2f"
15-
1610
#define U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_FACTORY 2
1711
#define U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE 11
1812

applications/main/u2f/u2f_data.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ extern "C" {
66

77
#include <furi.h>
88

9+
#define U2F_DATA_FOLDER EXT_PATH("u2f/")
10+
#define U2F_CERT_FILE U2F_DATA_FOLDER "assets/cert.der"
11+
#define U2F_CERT_KEY_FILE U2F_DATA_FOLDER "assets/cert_key.u2f"
12+
#define U2F_KEY_OLD_FILE U2F_DATA_FOLDER "key.u2f"
13+
#define U2F_CNT_OLD_FILE U2F_DATA_FOLDER "cnt.u2f"
14+
#define U2F_KEY_FILE INT_PATH(".key.u2f")
15+
#define U2F_CNT_FILE INT_PATH(".cnt.u2f")
16+
917
bool u2f_data_check(bool cert_only);
1018

1119
bool u2f_data_cert_check();

applications/services/bt/bt_service/bt.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ Bt* bt_alloc() {
120120
bt_settings_save(&bt->bt_settings);
121121
}
122122
// Keys storage
123+
Storage* storage = furi_record_open(RECORD_STORAGE);
124+
storage_common_copy(storage, BT_KEYS_STORAGE_OLD_PATH, BT_KEYS_STORAGE_PATH);
125+
storage_common_remove(storage, BT_KEYS_STORAGE_OLD_PATH);
126+
furi_record_close(RECORD_STORAGE);
123127
bt->keys_storage = bt_keys_storage_alloc(BT_KEYS_STORAGE_PATH);
124128
// Alloc queue
125129
bt->message_queue = furi_message_queue_alloc(8, sizeof(BtMessage));
@@ -376,7 +380,7 @@ int32_t bt_srv(void* p) {
376380
UNUSED(p);
377381
Bt* bt = bt_alloc();
378382

379-
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
383+
if(!furi_hal_is_normal_boot()) {
380384
FURI_LOG_W(TAG, "Skipping start in special boot mode");
381385
ble_glue_wait_for_c2_start(FURI_HAL_BT_C2_START_TIMEOUT);
382386
furi_record_create(RECORD_BT, bt);

applications/services/bt/bt_service/bt_i.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
#include <bt/bt_settings.h>
1919
#include <bt/bt_service/bt_keys_storage.h>
2020

21-
#include "bt_keys_filename.h"
22-
23-
#define BT_KEYS_STORAGE_PATH INT_PATH(BT_KEYS_STORAGE_FILE_NAME)
21+
#define BT_KEYS_STORAGE_OLD_PATH INT_PATH(".bt.keys")
22+
#define BT_KEYS_STORAGE_PATH CFG_PATH("bt.keys")
2423

2524
#define BT_API_UNLOCK_EVENT (1UL << 0)
2625

applications/services/bt/bt_service/bt_keys_filename.h

Lines changed: 0 additions & 3 deletions
This file was deleted.

applications/services/bt/bt_settings.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,27 @@
44
#include <lib/toolbox/saved_struct.h>
55
#include <storage/storage.h>
66

7-
#define BT_SETTINGS_PATH INT_PATH(BT_SETTINGS_FILE_NAME)
7+
#define BT_SETTINGS_OLD_PATH INT_PATH(".bt.settings")
8+
#define BT_SETTINGS_PATH CFG_PATH("bt.settings")
89
#define BT_SETTINGS_VERSION (0)
910
#define BT_SETTINGS_MAGIC (0x19)
1011

1112
bool bt_settings_load(BtSettings* bt_settings) {
1213
furi_assert(bt_settings);
1314

14-
return saved_struct_load(
15+
bool ret = saved_struct_load(
1516
BT_SETTINGS_PATH, bt_settings, sizeof(BtSettings), BT_SETTINGS_MAGIC, BT_SETTINGS_VERSION);
17+
18+
if(!ret) {
19+
Storage* storage = furi_record_open(RECORD_STORAGE);
20+
storage_common_copy(storage, BT_SETTINGS_OLD_PATH, BT_SETTINGS_PATH);
21+
storage_common_remove(storage, BT_SETTINGS_OLD_PATH);
22+
furi_record_close(RECORD_STORAGE);
23+
ret = saved_struct_load(
24+
BT_SETTINGS_PATH, bt_settings, sizeof(BtSettings), BT_SETTINGS_MAGIC, BT_SETTINGS_VERSION);
25+
}
26+
27+
return ret;
1628
}
1729

1830
bool bt_settings_save(BtSettings* bt_settings) {

applications/services/bt/bt_settings.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#pragma once
22

3-
#include "bt_settings_filename.h"
4-
53
#include <stdint.h>
64
#include <stdbool.h>
75

applications/services/bt/bt_settings_filename.h

Lines changed: 0 additions & 3 deletions
This file was deleted.

applications/services/cli/cli.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ int32_t cli_srv(void* p) {
460460
furi_thread_set_stdout_callback(NULL);
461461
}
462462

463-
if(furi_hal_rtc_get_boot_mode() == FuriHalRtcBootModeNormal) {
463+
if(furi_hal_is_normal_boot()) {
464464
cli_session_open(cli, &cli_vcp);
465465
} else {
466466
FURI_LOG_W(TAG, "Skipping start in special boot mode");

applications/services/desktop/desktop.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,18 @@ static bool desktop_check_file_flag(const char* flag_path) {
550550
int32_t desktop_srv(void* p) {
551551
UNUSED(p);
552552

553-
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
553+
if(!furi_hal_is_normal_boot()) {
554554
FURI_LOG_W("Desktop", "Desktop load skipped. Device is in special startup mode.");
555555
} else {
556+
557+
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagResetPin)) {
558+
Storage* storage = furi_record_open(RECORD_STORAGE);
559+
storage_common_remove(storage, DESKTOP_SETTINGS_PATH);
560+
storage_common_remove(storage, DESKTOP_SETTINGS_OLD_PATH);
561+
furi_record_close(RECORD_STORAGE);
562+
furi_hal_rtc_reset_flag(FuriHalRtcFlagResetPin);
563+
}
564+
556565
Desktop* desktop = desktop_alloc();
557566

558567
bool loaded = DESKTOP_SETTINGS_LOAD(&desktop->settings);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
desktop_#include "desktop_settings.h"
2+
3+
bool DESKTOP_SETTINGS_SAVE(DesktopSettings* x) {
4+
return saved_struct_save(
5+
DESKTOP_SETTINGS_PATH, x, sizeof(DesktopSettings), DESKTOP_SETTINGS_MAGIC, DESKTOP_SETTINGS_VER);
6+
}
7+
8+
bool DESKTOP_SETTINGS_LOAD(DesktopSettings* x) {
9+
bool ret = saved_struct_load(
10+
DESKTOP_SETTINGS_PATH, x, sizeof(DesktopSettings), DESKTOP_SETTINGS_MAGIC, DESKTOP_SETTINGS_VER);
11+
12+
if(!ret) {
13+
Storage* storage = furi_record_open(RECORD_STORAGE);
14+
storage_common_copy(storage, DESKTOP_SETTINGS_OLD_PATH, DESKTOP_SETTINGS_PATH);
15+
storage_common_remove(storage, DESKTOP_SETTINGS_OLD_PATH);
16+
furi_record_close(RECORD_STORAGE);
17+
ret = saved_struct_load(
18+
DESKTOP_SETTINGS_PATH, x, sizeof(DesktopSettings), DESKTOP_SETTINGS_MAGIC, DESKTOP_SETTINGS_VER);
19+
}
20+
21+
return ret;
22+
}

applications/services/desktop/desktop_settings.h

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#pragma once
22

3-
#include "desktop_settings_filename.h"
4-
53
#include <furi_hal.h>
64
#include <stdint.h>
75
#include <stdbool.h>
@@ -10,28 +8,13 @@
108

119
#define DESKTOP_SETTINGS_VER (8)
1210

13-
#define DESKTOP_SETTINGS_PATH INT_PATH(DESKTOP_SETTINGS_FILE_NAME)
11+
#define DESKTOP_SETTINGS_OLD_PATH INT_PATH(".desktop.settings")
12+
#define DESKTOP_SETTINGS_PATH CFG_PATH("desktop.settings")
1413
#define DESKTOP_SETTINGS_MAGIC (0x17)
1514
#define PIN_MAX_LENGTH 12
1615

1716
#define DESKTOP_SETTINGS_RUN_PIN_SETUP_ARG "run_pin_setup"
1817

19-
#define DESKTOP_SETTINGS_SAVE(x) \
20-
saved_struct_save( \
21-
DESKTOP_SETTINGS_PATH, \
22-
(x), \
23-
sizeof(DesktopSettings), \
24-
DESKTOP_SETTINGS_MAGIC, \
25-
DESKTOP_SETTINGS_VER)
26-
27-
#define DESKTOP_SETTINGS_LOAD(x) \
28-
saved_struct_load( \
29-
DESKTOP_SETTINGS_PATH, \
30-
(x), \
31-
sizeof(DesktopSettings), \
32-
DESKTOP_SETTINGS_MAGIC, \
33-
DESKTOP_SETTINGS_VER)
34-
3518
#define MAX_PIN_SIZE 10
3619
#define MIN_PIN_SIZE 4
3720
#define MAX_APP_LENGTH 128
@@ -77,3 +60,7 @@ typedef struct {
7760
bool rpc_icon;
7861
bool auto_lock_with_pin;
7962
} DesktopSettings;
63+
64+
bool DESKTOP_SETTINGS_SAVE(DesktopSettings* x);
65+
66+
bool DESKTOP_SETTINGS_LOAD(DesktopSettings* x);

applications/services/desktop/desktop_settings_filename.h

Lines changed: 0 additions & 3 deletions
This file was deleted.

applications/services/desktop/helpers/slideshow_filename.h

Lines changed: 0 additions & 3 deletions
This file was deleted.

applications/services/desktop/views/desktop_view_slideshow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "desktop_events.h"
66
#include "../helpers/slideshow_filename.h"
77

8-
#define SLIDESHOW_FS_PATH INT_PATH(SLIDESHOW_FILE_NAME)
8+
#define SLIDESHOW_FS_PATH EXT_PATH(".slideshow")
99

1010
typedef struct DesktopSlideshowView DesktopSlideshowView;
1111

applications/services/dolphin/dolphin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ static void dolphin_update_clear_limits_timer_period(Dolphin* dolphin) {
168168
int32_t dolphin_srv(void* p) {
169169
UNUSED(p);
170170

171-
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
171+
if(!furi_hal_is_normal_boot()) {
172172
FURI_LOG_W(TAG, "Skipping start in special boot mode");
173173
return 0;
174174
}

applications/services/dolphin/helpers/dolphin_state.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "dolphin_state.h"
22
#include "dolphin/helpers/dolphin_deed.h"
3-
#include "dolphin_state_filename.h"
43

54
#include <stdint.h>
65
#include <storage/storage.h>
@@ -11,7 +10,7 @@
1110

1211
#define TAG "DolphinState"
1312

14-
#define DOLPHIN_STATE_PATH INT_PATH(DOLPHIN_STATE_FILE_NAME)
13+
#define DOLPHIN_STATE_OLD_PATH INT_PATH(".dolphin.state")
1514
#define DOLPHIN_STATE_HEADER_MAGIC 0xD0
1615
#define DOLPHIN_STATE_HEADER_VERSION 0x01
1716

@@ -93,6 +92,19 @@ bool dolphin_state_load(DolphinState* dolphin_state) {
9392
DOLPHIN_STATE_HEADER_MAGIC,
9493
DOLPHIN_STATE_HEADER_VERSION);
9594

95+
if(!success) {
96+
Storage* storage = furi_record_open(RECORD_STORAGE);
97+
storage_common_copy(storage, DOLPHIN_STATE_OLD_PATH, DOLPHIN_STATE_PATH);
98+
storage_common_remove(storage, DOLPHIN_STATE_OLD_PATH);
99+
furi_record_close(RECORD_STORAGE);
100+
success = saved_struct_load(
101+
DOLPHIN_STATE_PATH,
102+
&dolphin_state->data,
103+
sizeof(DolphinStoreData),
104+
DOLPHIN_STATE_HEADER_MAGIC,
105+
DOLPHIN_STATE_HEADER_VERSION);
106+
}
107+
96108
if(success) {
97109
if((dolphin_state->data.butthurt > BUTTHURT_MAX) ||
98110
(dolphin_state->data.butthurt < BUTTHURT_MIN)) {

applications/services/dolphin/helpers/dolphin_state.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include <stdint.h>
66
#include <time.h>
77

8+
#define DOLPHIN_STATE_PATH CFG_PATH("dolphin.state")
9+
810
#ifdef __cplusplus
911
extern "C" {
1012
#endif

applications/services/dolphin/helpers/dolphin_state_filename.h

Lines changed: 0 additions & 3 deletions
This file was deleted.

applications/services/namechangersrv/namechangersrv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
int32_t namechanger_on_system_start(void* p) {
77
UNUSED(p);
8-
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
8+
if(!furi_hal_is_normal_boot()) {
99
FURI_LOG_W(TAG, "NameChangerSRV load skipped. Device is in special startup mode.");
1010
} else {
1111
Storage* storage = furi_record_open(RECORD_STORAGE);

applications/services/power/power_service/power.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ static void power_check_battery_level_change(Power* power) {
513513
int32_t power_srv(void* p) {
514514
UNUSED(p);
515515

516-
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
516+
if(!furi_hal_is_normal_boot()) {
517517
FURI_LOG_W(TAG, "Skipping start in special boot mode");
518518
return 0;
519519
}

0 commit comments

Comments
 (0)