boot loops & null dereference error fixed

namechanger application was updated thanks to ESurge and application now works without issues :D
This commit is contained in:
jbohack
2023-01-06 23:51:29 -05:00
parent 76c8489797
commit 73164d6c32
2 changed files with 162 additions and 141 deletions

View File

@@ -28,7 +28,8 @@ static void desktop_loader_callback(const void* message, void* context) {
if (event->type == LoaderEventTypeApplicationStarted) {
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopGlobalBeforeAppStarted);
} else if(event->type == LoaderEventTypeApplicationStopped) {
}
else if (event->type == LoaderEventTypeApplicationStopped) {
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopGlobalAfterAppFinished);
}
}
@@ -65,7 +66,8 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) {
if (desktop->settings.pin_code.length > 0) {
desktop_pin_lock(&desktop->settings);
desktop_lock(desktop);
} else {
}
else {
desktop_lock(desktop);
}
}
@@ -151,7 +153,6 @@ void desktop_set_sfw_mode_state(Desktop* desktop, bool enabled) {
desktop_main_set_sfw_mode_state(desktop->main_view, enabled);
animation_manager_set_sfw_mode_state(desktop->animation_manager, enabled);
desktop->settings.sfw_mode = enabled;
DESKTOP_SETTINGS_SAVE(&desktop->settings);
}
Desktop* desktop_alloc() {
@@ -326,6 +327,13 @@ static bool desktop_check_file_flag(const char* flag_path) {
int32_t desktop_srv(void* p) {
UNUSED(p);
if (furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal)
{
FURI_LOG_W("Desktop", "Desktop load skipped. Device is in special startup mode.");
}
else
{
Desktop* desktop = desktop_alloc();
bool loaded = DESKTOP_SETTINGS_LOAD(&desktop->settings);
@@ -347,7 +355,8 @@ int32_t desktop_srv(void* p) {
if (!loader_is_locked(desktop->loader)) {
desktop_auto_lock_arm(desktop);
}
} else {
}
else {
desktop_lock(desktop);
}
@@ -365,6 +374,7 @@ int32_t desktop_srv(void* p) {
view_dispatcher_run(desktop->view_dispatcher);
desktop_free(desktop);
}
return 0;
}

View File

@@ -4,6 +4,12 @@
#include <flipper_format/flipper_format.h>
void namechanger_on_system_start() {
if (furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal)
{
FURI_LOG_W(TAG, "NameChangerSRV load skipped. Device is in special startup mode.");
}
else
{
Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* file = flipper_format_file_alloc(storage);
@@ -67,7 +73,8 @@ void namechanger_on_system_start() {
// Write comments
if (!flipper_format_write_comment_cstr(
file, "Changing the value below will change your FlipperZero device name.")) {
file,
"Changing the value below will change your FlipperZero device name.")) {
break;
}
@@ -95,7 +102,8 @@ void namechanger_on_system_start() {
if (!res) {
FURI_LOG_E(TAG, "Save failed.");
}
} else {
}
else {
if (!furi_string_size(data)) {
//Empty file - get default name and write to file.
FlipperFormat* file = flipper_format_file_alloc(storage);
@@ -109,7 +117,8 @@ void namechanger_on_system_start() {
}
// Write header
if(!flipper_format_write_header_cstr(file, furi_string_get_cstr(NAMEHEADER), 1)) {
if (!flipper_format_write_header_cstr(
file, furi_string_get_cstr(NAMEHEADER), 1)) {
break;
}
@@ -145,7 +154,8 @@ void namechanger_on_system_start() {
if (!res) {
FURI_LOG_E(TAG, "Save failed.");
}
} else {
}
else {
char newdata[9];
snprintf(newdata, 9, "%s", furi_string_get_cstr(data));
//set name from file
@@ -158,3 +168,4 @@ void namechanger_on_system_start() {
furi_string_free(filepath);
furi_record_close(RECORD_STORAGE);
}
}