mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-16 04:24:45 -07:00
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:
@@ -28,7 +28,8 @@ static void desktop_loader_callback(const void* message, void* context) {
|
|||||||
|
|
||||||
if (event->type == LoaderEventTypeApplicationStarted) {
|
if (event->type == LoaderEventTypeApplicationStarted) {
|
||||||
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopGlobalBeforeAppStarted);
|
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);
|
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) {
|
if (desktop->settings.pin_code.length > 0) {
|
||||||
desktop_pin_lock(&desktop->settings);
|
desktop_pin_lock(&desktop->settings);
|
||||||
desktop_lock(desktop);
|
desktop_lock(desktop);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
desktop_lock(desktop);
|
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);
|
desktop_main_set_sfw_mode_state(desktop->main_view, enabled);
|
||||||
animation_manager_set_sfw_mode_state(desktop->animation_manager, enabled);
|
animation_manager_set_sfw_mode_state(desktop->animation_manager, enabled);
|
||||||
desktop->settings.sfw_mode = enabled;
|
desktop->settings.sfw_mode = enabled;
|
||||||
DESKTOP_SETTINGS_SAVE(&desktop->settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Desktop* desktop_alloc() {
|
Desktop* desktop_alloc() {
|
||||||
@@ -326,6 +327,13 @@ static bool desktop_check_file_flag(const char* flag_path) {
|
|||||||
|
|
||||||
int32_t desktop_srv(void* p) {
|
int32_t desktop_srv(void* p) {
|
||||||
UNUSED(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();
|
Desktop* desktop = desktop_alloc();
|
||||||
|
|
||||||
bool loaded = DESKTOP_SETTINGS_LOAD(&desktop->settings);
|
bool loaded = DESKTOP_SETTINGS_LOAD(&desktop->settings);
|
||||||
@@ -347,7 +355,8 @@ int32_t desktop_srv(void* p) {
|
|||||||
if (!loader_is_locked(desktop->loader)) {
|
if (!loader_is_locked(desktop->loader)) {
|
||||||
desktop_auto_lock_arm(desktop);
|
desktop_auto_lock_arm(desktop);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
desktop_lock(desktop);
|
desktop_lock(desktop);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,6 +374,7 @@ int32_t desktop_srv(void* p) {
|
|||||||
|
|
||||||
view_dispatcher_run(desktop->view_dispatcher);
|
view_dispatcher_run(desktop->view_dispatcher);
|
||||||
desktop_free(desktop);
|
desktop_free(desktop);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,12 @@
|
|||||||
#include <flipper_format/flipper_format.h>
|
#include <flipper_format/flipper_format.h>
|
||||||
|
|
||||||
void namechanger_on_system_start() {
|
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);
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||||
|
|
||||||
@@ -67,7 +73,8 @@ void namechanger_on_system_start() {
|
|||||||
|
|
||||||
// Write comments
|
// Write comments
|
||||||
if (!flipper_format_write_comment_cstr(
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +102,8 @@ void namechanger_on_system_start() {
|
|||||||
if (!res) {
|
if (!res) {
|
||||||
FURI_LOG_E(TAG, "Save failed.");
|
FURI_LOG_E(TAG, "Save failed.");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (!furi_string_size(data)) {
|
if (!furi_string_size(data)) {
|
||||||
//Empty file - get default name and write to file.
|
//Empty file - get default name and write to file.
|
||||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||||
@@ -109,7 +117,8 @@ void namechanger_on_system_start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write header
|
// 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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +154,8 @@ void namechanger_on_system_start() {
|
|||||||
if (!res) {
|
if (!res) {
|
||||||
FURI_LOG_E(TAG, "Save failed.");
|
FURI_LOG_E(TAG, "Save failed.");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
char newdata[9];
|
char newdata[9];
|
||||||
snprintf(newdata, 9, "%s", furi_string_get_cstr(data));
|
snprintf(newdata, 9, "%s", furi_string_get_cstr(data));
|
||||||
//set name from file
|
//set name from file
|
||||||
@@ -158,3 +168,4 @@ void namechanger_on_system_start() {
|
|||||||
furi_string_free(filepath);
|
furi_string_free(filepath);
|
||||||
furi_record_close(RECORD_STORAGE);
|
furi_record_close(RECORD_STORAGE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user