diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_error.c b/applications/main/bad_usb/scenes/bad_usb_scene_error.c index 8a50a2df8..4d4aa268b 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_error.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_error.c @@ -1,5 +1,5 @@ #include "../bad_usb_app_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" typedef enum { BadUsbCustomEventErrorBack, @@ -17,8 +17,6 @@ static void void bad_usb_scene_error_on_enter(void* context) { BadUsbApp* app = context; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); if(app->error == BadUsbAppErrorNoFiles) { widget_add_icon_element(app->widget, 0, 0, &I_SDQuestion_35x43); @@ -34,7 +32,7 @@ void bad_usb_scene_error_on_enter(void* context) { app->widget, GuiButtonTypeLeft, "Back", bad_usb_scene_error_event_callback, app); } else if(app->error == BadUsbAppErrorCloseRpc) { widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { widget_add_string_multiline_element( app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nis active!"); widget_add_string_multiline_element( @@ -60,7 +58,6 @@ void bad_usb_scene_error_on_enter(void* context) { } view_dispatcher_switch_to_view(app->view_dispatcher, BadUsbAppViewError); - free(settings); } bool bad_usb_scene_error_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/bad_usb/views/bad_usb_view.c b/applications/main/bad_usb/views/bad_usb_view.c index b700bc023..388f4e1a8 100644 --- a/applications/main/bad_usb/views/bad_usb_view.c +++ b/applications/main/bad_usb/views/bad_usb_view.c @@ -3,7 +3,7 @@ #include #include #include -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" #define MAX_NAME_LEN 64 @@ -28,8 +28,7 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { elements_string_fit_width(canvas, disp_str, 128 - 2); canvas_set_font(canvas, FontSecondary); canvas_draw_str(canvas, 2, 8, furi_string_get_cstr(disp_str)); - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); + XtremeSettings* xtreme_settings = malloc(sizeof(XtremeSettings)); if(strlen(model->layout) == 0) { furi_string_set(disp_str, "(default)"); @@ -50,7 +49,7 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { if((model->state.state == BadUsbStateIdle) || (model->state.state == BadUsbStateDone) || (model->state.state == BadUsbStateNotConnected)) { - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { elements_button_center(canvas, "Start"); } else { elements_button_center(canvas, "Cum"); @@ -69,7 +68,7 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { if(model->state.state == BadUsbStateNotConnected) { canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18); canvas_set_font(canvas, FontPrimary); - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Connect to"); canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "a device"); } else { @@ -79,7 +78,7 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { } else if(model->state.state == BadUsbStateWillRun) { canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18); canvas_set_font(canvas, FontPrimary); - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will run"); } else { canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will cum"); @@ -147,7 +146,6 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { } furi_string_free(disp_str); - free(settings); } static bool bad_usb_input_callback(InputEvent* event, void* context) { diff --git a/applications/main/ibutton/scenes/ibutton_scene_delete_success.c b/applications/main/ibutton/scenes/ibutton_scene_delete_success.c index f543ceeb2..42ad4b5e9 100644 --- a/applications/main/ibutton/scenes/ibutton_scene_delete_success.c +++ b/applications/main/ibutton/scenes/ibutton_scene_delete_success.c @@ -1,5 +1,5 @@ #include "../ibutton_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" static void ibutton_scene_delete_success_popup_callback(void* context) { iButton* ibutton = context; @@ -9,10 +9,8 @@ static void ibutton_scene_delete_success_popup_callback(void* context) { void ibutton_scene_delete_success_on_enter(void* context) { iButton* ibutton = context; Popup* popup = ibutton->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62_sfw); } else { popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62); @@ -25,7 +23,6 @@ void ibutton_scene_delete_success_on_enter(void* context) { popup_enable_timeout(popup); view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewPopup); - free(settings); } bool ibutton_scene_delete_success_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/ibutton/scenes/ibutton_scene_read.c b/applications/main/ibutton/scenes/ibutton_scene_read.c index 4dbbed352..49accd130 100644 --- a/applications/main/ibutton/scenes/ibutton_scene_read.c +++ b/applications/main/ibutton/scenes/ibutton_scene_read.c @@ -1,6 +1,6 @@ #include "../ibutton_i.h" #include -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" static void ibutton_scene_read_callback(void* context) { iButton* ibutton = context; @@ -12,12 +12,10 @@ void ibutton_scene_read_on_enter(void* context) { Popup* popup = ibutton->popup; iButtonKey* key = ibutton->key; iButtonWorker* worker = ibutton->key_worker; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); popup_set_header(popup, "iButton", 95, 26, AlignCenter, AlignBottom); popup_set_text(popup, "Waiting\nfor key ...", 95, 30, AlignCenter, AlignTop); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 5, &I_DolphinWait_61x59_sfw); } else { popup_set_icon(popup, 0, 5, &I_DolphinWait_61x59); @@ -30,7 +28,6 @@ void ibutton_scene_read_on_enter(void* context) { ibutton_worker_read_start(worker, key); ibutton_notification_message(ibutton, iButtonNotificationMessageReadStart); - free(settings); } bool ibutton_scene_read_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/ibutton/scenes/ibutton_scene_save_success.c b/applications/main/ibutton/scenes/ibutton_scene_save_success.c index 02c6abe2b..7bf002010 100644 --- a/applications/main/ibutton/scenes/ibutton_scene_save_success.c +++ b/applications/main/ibutton/scenes/ibutton_scene_save_success.c @@ -1,5 +1,5 @@ #include "../ibutton_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" static void ibutton_scene_save_success_popup_callback(void* context) { iButton* ibutton = context; @@ -9,10 +9,8 @@ static void ibutton_scene_save_success_popup_callback(void* context) { void ibutton_scene_save_success_on_enter(void* context) { iButton* ibutton = context; Popup* popup = ibutton->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw); } else { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59); @@ -25,7 +23,6 @@ void ibutton_scene_save_success_on_enter(void* context) { popup_enable_timeout(popup); view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewPopup); - free(settings); } bool ibutton_scene_save_success_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/ibutton/scenes/ibutton_scene_write_success.c b/applications/main/ibutton/scenes/ibutton_scene_write_success.c index 3d461018c..2907935bc 100644 --- a/applications/main/ibutton/scenes/ibutton_scene_write_success.c +++ b/applications/main/ibutton/scenes/ibutton_scene_write_success.c @@ -1,5 +1,5 @@ #include "../ibutton_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" static void ibutton_scene_write_success_popup_callback(void* context) { iButton* ibutton = context; @@ -10,10 +10,8 @@ static void ibutton_scene_write_success_popup_callback(void* context) { void ibutton_scene_write_success_on_enter(void* context) { iButton* ibutton = context; Popup* popup = ibutton->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 12, &I_iButtonDolphinVerySuccess_108x52_sfw); } else { popup_set_icon(popup, 0, 12, &I_iButtonDolphinVerySuccess_108x52); @@ -28,7 +26,6 @@ void ibutton_scene_write_success_on_enter(void* context) { view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewPopup); ibutton_notification_message(ibutton, iButtonNotificationMessageSuccess); ibutton_notification_message(ibutton, iButtonNotificationMessageGreenOn); - free(settings); } bool ibutton_scene_write_success_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/infrared/scenes/infrared_scene_edit_rename_done.c b/applications/main/infrared/scenes/infrared_scene_edit_rename_done.c index 056c97db6..a1615a3ac 100644 --- a/applications/main/infrared/scenes/infrared_scene_edit_rename_done.c +++ b/applications/main/infrared/scenes/infrared_scene_edit_rename_done.c @@ -1,13 +1,11 @@ #include "../infrared_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" void infrared_scene_edit_rename_done_on_enter(void* context) { Infrared* infrared = context; Popup* popup = infrared->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw); } else { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59); @@ -20,7 +18,6 @@ void infrared_scene_edit_rename_done_on_enter(void* context) { popup_enable_timeout(popup); view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewPopup); - free(settings); } bool infrared_scene_edit_rename_done_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/infrared/scenes/infrared_scene_learn_done.c b/applications/main/infrared/scenes/infrared_scene_learn_done.c index a66445efe..c83c35356 100644 --- a/applications/main/infrared/scenes/infrared_scene_learn_done.c +++ b/applications/main/infrared/scenes/infrared_scene_learn_done.c @@ -1,13 +1,11 @@ #include "../infrared_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" void infrared_scene_learn_done_on_enter(void* context) { Infrared* infrared = context; Popup* popup = infrared->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw); if(infrared->app_state.is_learning_new_remote) { popup_set_header(popup, "New remote\ncreated!", 0, 0, AlignLeft, AlignTop); @@ -24,7 +22,6 @@ void infrared_scene_learn_done_on_enter(void* context) { popup_enable_timeout(popup); view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewPopup); - free(settings); } bool infrared_scene_learn_done_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/infrared/scenes/infrared_scene_learn_success.c b/applications/main/infrared/scenes/infrared_scene_learn_success.c index 82ced17c2..0e53ab96f 100644 --- a/applications/main/infrared/scenes/infrared_scene_learn_success.c +++ b/applications/main/infrared/scenes/infrared_scene_learn_success.c @@ -1,5 +1,5 @@ #include "../infrared_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" static void infrared_scene_learn_success_dialog_result_callback(DialogExResult result, void* context) { @@ -11,8 +11,6 @@ void infrared_scene_learn_success_on_enter(void* context) { Infrared* infrared = context; DialogEx* dialog_ex = infrared->dialog_ex; InfraredSignal* signal = infrared->received_signal; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); infrared_play_notification_message(infrared, InfraredNotificationMessageGreenOn); @@ -50,7 +48,7 @@ void infrared_scene_learn_success_on_enter(void* context) { dialog_ex_set_left_button_text(dialog_ex, "Retry"); dialog_ex_set_right_button_text(dialog_ex, "Save"); dialog_ex_set_center_button_text(dialog_ex, "Send"); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { dialog_ex_set_icon(dialog_ex, 0, 1, &I_DolphinReadingSuccess_59x63_sfw); } else { dialog_ex_set_icon(dialog_ex, 0, 1, &I_DolphinReadingSuccess_59x63); @@ -60,7 +58,6 @@ void infrared_scene_learn_success_on_enter(void* context) { dialog_ex_enable_extended_events(dialog_ex); view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewDialogEx); - free(settings); } bool infrared_scene_learn_success_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_clear_t5577.c b/applications/main/lfrfid/scenes/lfrfid_scene_clear_t5577.c index 565655080..ca08544d6 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_clear_t5577.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_clear_t5577.c @@ -1,6 +1,6 @@ #include "../lfrfid_i.h" #include "../helpers/rfid_writer.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" static void writer_initialize(T55xxTiming* t55xxtiming) { t55xxtiming->wait_time = 400; @@ -15,8 +15,6 @@ static void lfrfid_clear_t5577_password_and_config_to_EM(LfRfid* app) { T55xxTiming* t55xxtiming = malloc(sizeof(T55xxTiming)); Popup* popup = app->popup; char curr_buf[32] = {}; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); //TODO: use .txt file in resourses for passwords. const uint32_t default_passwords[] = { @@ -45,7 +43,7 @@ static void lfrfid_clear_t5577_password_and_config_to_EM(LfRfid* app) { writer_initialize(t55xxtiming); popup_set_header(popup, "Removing\npassword", 90, 36, AlignCenter, AlignCenter); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61_sfw); } else { popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61); @@ -67,20 +65,17 @@ static void lfrfid_clear_t5577_password_and_config_to_EM(LfRfid* app) { notification_message(app->notifications, &sequence_blink_stop); popup_reset(app->popup); free(t55xxtiming); - free(settings); } void lfrfid_scene_clear_t5577_on_enter(void* context) { LfRfid* app = context; Popup* popup = app->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); lfrfid_clear_t5577_password_and_config_to_EM(app); notification_message(app->notifications, &sequence_success); popup_set_header(popup, "Done!", 94, 10, AlignCenter, AlignTop); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 7, &I_RFIDDolphinSuccess_108x57_sfw); } else { popup_set_icon(popup, 0, 7, &I_RFIDDolphinSuccess_108x57); @@ -92,7 +87,6 @@ void lfrfid_scene_clear_t5577_on_enter(void* context) { view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); notification_message_block(app->notifications, &sequence_set_green_255); - free(settings); } bool lfrfid_scene_clear_t5577_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_delete_success.c b/applications/main/lfrfid/scenes/lfrfid_scene_delete_success.c index 94e5a684e..274147eec 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_delete_success.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_delete_success.c @@ -1,13 +1,11 @@ #include "../lfrfid_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" void lfrfid_scene_delete_success_on_enter(void* context) { LfRfid* app = context; Popup* popup = app->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62_sfw); } else { popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62); @@ -19,7 +17,6 @@ void lfrfid_scene_delete_success_on_enter(void* context) { popup_enable_timeout(popup); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); - free(settings); } bool lfrfid_scene_delete_success_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_emulate.c b/applications/main/lfrfid/scenes/lfrfid_scene_emulate.c index 4bc3ceb22..923a6a8ba 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_emulate.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_emulate.c @@ -1,11 +1,9 @@ #include "../lfrfid_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" void lfrfid_scene_emulate_on_enter(void* context) { LfRfid* app = context; Popup* popup = app->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); popup_set_header(popup, "Emulating", 89, 30, AlignCenter, AlignTop); if(!furi_string_empty(app->file_name)) { @@ -19,7 +17,7 @@ void lfrfid_scene_emulate_on_enter(void* context) { AlignCenter, AlignTop); } - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61_sfw); } else { popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61); @@ -30,7 +28,6 @@ void lfrfid_scene_emulate_on_enter(void* context) { notification_message(app->notifications, &sequence_blink_start_magenta); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); - free(settings); } bool lfrfid_scene_emulate_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_raw_read.c b/applications/main/lfrfid/scenes/lfrfid_scene_raw_read.c index b8da7e04c..f56ef8684 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_raw_read.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_raw_read.c @@ -1,5 +1,5 @@ #include "../lfrfid_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" #define RAW_READ_TIME 5000 @@ -29,13 +29,11 @@ static void timer_callback(void* context) { void lfrfid_scene_raw_read_on_enter(void* context) { LfRfid* app = context; Popup* popup = app->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); LfRfidReadRawState* state = malloc(sizeof(LfRfidReadRawState)); scene_manager_set_scene_state(app->scene_manager, LfRfidSceneRawRead, (uint32_t)state); state->string_file_name = furi_string_alloc(); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 3, &I_RFIDDolphinReceive_97x61_sfw); } else { popup_set_icon(popup, 0, 3, &I_RFIDDolphinReceive_97x61); @@ -64,7 +62,6 @@ void lfrfid_scene_raw_read_on_enter(void* context) { state->is_psk = false; state->error = false; - free(settings); } bool lfrfid_scene_raw_read_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_rpc.c b/applications/main/lfrfid/scenes/lfrfid_scene_rpc.c index 4b0f52d49..5b102ff1a 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_rpc.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_rpc.c @@ -1,15 +1,13 @@ #include "../lfrfid_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" void lfrfid_scene_rpc_on_enter(void* context) { LfRfid* app = context; Popup* popup = app->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); popup_set_header(popup, "LF RFID", 89, 42, AlignCenter, AlignBottom); popup_set_text(popup, "RPC mode", 89, 44, AlignCenter, AlignTop); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 12, &I_RFIDDolphinSend_97x61_sfw); } else { popup_set_icon(popup, 0, 12, &I_RFIDDolphinSend_97x61); @@ -20,7 +18,6 @@ void lfrfid_scene_rpc_on_enter(void* context) { notification_message(app->notifications, &sequence_display_backlight_on); app->rpc_state = LfRfidRpcStateIdle; - free(settings); } bool lfrfid_scene_rpc_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_save_success.c b/applications/main/lfrfid/scenes/lfrfid_scene_save_success.c index 5521bb0f7..2367f4ccd 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_save_success.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_save_success.c @@ -1,15 +1,13 @@ #include "../lfrfid_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" void lfrfid_scene_save_success_on_enter(void* context) { LfRfid* app = context; Popup* popup = app->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); // Clear state of data enter scene scene_manager_set_scene_state(app->scene_manager, LfRfidSceneSaveData, 0); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw); } else { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59); @@ -21,7 +19,6 @@ void lfrfid_scene_save_success_on_enter(void* context) { popup_enable_timeout(popup); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); - free(settings); } bool lfrfid_scene_save_success_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_write.c b/applications/main/lfrfid/scenes/lfrfid_scene_write.c index 549e2f9a3..79c74413d 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_write.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_write.c @@ -1,5 +1,5 @@ #include "../lfrfid_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" static void lfrfid_write_callback(LFRFIDWorkerWriteResult result, void* context) { LfRfid* app = context; @@ -21,8 +21,6 @@ static void lfrfid_write_callback(LFRFIDWorkerWriteResult result, void* context) void lfrfid_scene_write_on_enter(void* context) { LfRfid* app = context; Popup* popup = app->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); popup_set_header(popup, "Writing", 89, 30, AlignCenter, AlignTop); if(!furi_string_empty(app->file_name)) { @@ -36,7 +34,7 @@ void lfrfid_scene_write_on_enter(void* context) { AlignCenter, AlignTop); } - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61_sfw); } else { popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61); @@ -51,7 +49,6 @@ void lfrfid_scene_write_on_enter(void* context) { lfrfid_worker_write_start( app->lfworker, (LFRFIDProtocol)app->protocol_id, lfrfid_write_callback, app); notification_message(app->notifications, &sequence_blink_start_magenta); - free(settings); } bool lfrfid_scene_write_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_write_success.c b/applications/main/lfrfid/scenes/lfrfid_scene_write_success.c index 27552f417..807a975b2 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_write_success.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_write_success.c @@ -1,14 +1,12 @@ #include "../lfrfid_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" void lfrfid_scene_write_success_on_enter(void* context) { LfRfid* app = context; Popup* popup = app->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); popup_set_header(popup, "Successfully\nwritten!", 94, 3, AlignCenter, AlignTop); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 6, &I_RFIDDolphinSuccess_108x57_sfw); } else { popup_set_icon(popup, 0, 6, &I_RFIDDolphinSuccess_108x57); @@ -20,7 +18,6 @@ void lfrfid_scene_write_success_on_enter(void* context) { view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); notification_message_block(app->notifications, &sequence_set_green_255); - free(settings); } bool lfrfid_scene_write_success_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/nfc/scenes/nfc_scene_delete_success.c b/applications/main/nfc/scenes/nfc_scene_delete_success.c index 5da15f91f..c2d76a464 100644 --- a/applications/main/nfc/scenes/nfc_scene_delete_success.c +++ b/applications/main/nfc/scenes/nfc_scene_delete_success.c @@ -1,5 +1,5 @@ #include "../nfc_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" void nfc_scene_delete_success_popup_callback(void* context) { Nfc* nfc = context; @@ -8,12 +8,10 @@ void nfc_scene_delete_success_popup_callback(void* context) { void nfc_scene_delete_success_on_enter(void* context) { Nfc* nfc = context; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); // Setup view Popup* popup = nfc->popup; - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62_sfw); } else { popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62); @@ -24,7 +22,6 @@ void nfc_scene_delete_success_on_enter(void* context) { popup_set_callback(popup, nfc_scene_delete_success_popup_callback); popup_enable_timeout(popup); view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup); - free(settings); } bool nfc_scene_delete_success_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/nfc/scenes/nfc_scene_emulate_nfcv.c b/applications/main/nfc/scenes/nfc_scene_emulate_nfcv.c index d9d3db9da..fd9faca08 100644 --- a/applications/main/nfc/scenes/nfc_scene_emulate_nfcv.c +++ b/applications/main/nfc/scenes/nfc_scene_emulate_nfcv.c @@ -1,5 +1,5 @@ #include "../nfc_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" #define NFC_SCENE_EMULATE_NFCV_LOG_SIZE_MAX (100) @@ -38,10 +38,7 @@ static void nfc_scene_emulate_nfcv_widget_config(Nfc* nfc, bool data_received) { FuriString* info_str; info_str = furi_string_alloc(); - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { widget_add_icon_element(widget, 0, 3, &I_RFIDDolphinSend_97x61_sfw); } else { widget_add_icon_element(widget, 0, 3, &I_RFIDDolphinSend_97x61); @@ -64,7 +61,6 @@ static void nfc_scene_emulate_nfcv_widget_config(Nfc* nfc, bool data_received) { widget_add_button_element( widget, GuiButtonTypeCenter, "Log", nfc_scene_emulate_nfcv_widget_callback, nfc); } - free(settings); } void nfc_scene_emulate_nfcv_on_enter(void* context) { diff --git a/applications/main/nfc/scenes/nfc_scene_emulate_uid.c b/applications/main/nfc/scenes/nfc_scene_emulate_uid.c index e935ad18c..44fe5ead2 100644 --- a/applications/main/nfc/scenes/nfc_scene_emulate_uid.c +++ b/applications/main/nfc/scenes/nfc_scene_emulate_uid.c @@ -1,5 +1,5 @@ #include "../nfc_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" #define NFC_SCENE_EMULATE_UID_LOG_SIZE_MAX (200) @@ -37,10 +37,8 @@ static void nfc_scene_emulate_uid_widget_config(Nfc* nfc, bool data_received) { widget_reset(widget); FuriString* info_str; info_str = furi_string_alloc(); - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { widget_add_icon_element(widget, 0, 3, &I_NFC_dolphin_emulation_47x61_sfw); } else { widget_add_icon_element(widget, 0, 3, &I_NFC_dolphin_emulation_47x61); @@ -61,7 +59,6 @@ static void nfc_scene_emulate_uid_widget_config(Nfc* nfc, bool data_received) { widget_add_button_element( widget, GuiButtonTypeCenter, "Log", nfc_scene_emulate_uid_widget_callback, nfc); } - free(settings); } void nfc_scene_emulate_uid_on_enter(void* context) { diff --git a/applications/main/nfc/scenes/nfc_scene_mf_classic_emulate.c b/applications/main/nfc/scenes/nfc_scene_mf_classic_emulate.c index 3a0b597e9..83c757a34 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_classic_emulate.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_classic_emulate.c @@ -1,5 +1,5 @@ #include "../nfc_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" #define NFC_MF_CLASSIC_DATA_NOT_CHANGED (0UL) #define NFC_MF_CLASSIC_DATA_CHANGED (1UL) @@ -15,8 +15,6 @@ bool nfc_mf_classic_emulate_worker_callback(NfcWorkerEvent event, void* context) void nfc_scene_mf_classic_emulate_on_enter(void* context) { Nfc* nfc = context; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); // Setup view Popup* popup = nfc->popup; @@ -26,7 +24,7 @@ void nfc_scene_mf_classic_emulate_on_enter(void* context) { } else { nfc_text_store_set(nfc, "MIFARE\nClassic"); } - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 3, &I_NFC_dolphin_emulation_47x61_sfw); } else { popup_set_icon(popup, 0, 3, &I_NFC_dolphin_emulation_47x61); @@ -42,7 +40,6 @@ void nfc_scene_mf_classic_emulate_on_enter(void* context) { nfc_mf_classic_emulate_worker_callback, nfc); nfc_blink_emulate_start(nfc); - free(settings); } bool nfc_scene_mf_classic_emulate_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/nfc/scenes/nfc_scene_mf_classic_update_success.c b/applications/main/nfc/scenes/nfc_scene_mf_classic_update_success.c index 9bd354c85..8e7e80fd7 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_classic_update_success.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_classic_update_success.c @@ -1,6 +1,6 @@ #include "../nfc_i.h" #include -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" void nfc_scene_mf_classic_update_success_popup_callback(void* context) { Nfc* nfc = context; @@ -10,13 +10,11 @@ void nfc_scene_mf_classic_update_success_popup_callback(void* context) { void nfc_scene_mf_classic_update_success_on_enter(void* context) { Nfc* nfc = context; DOLPHIN_DEED(DolphinDeedNfcSave); - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); notification_message(nfc->notifications, &sequence_success); Popup* popup = nfc->popup; - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw); } else { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59); @@ -28,7 +26,6 @@ void nfc_scene_mf_classic_update_success_on_enter(void* context) { popup_enable_timeout(popup); view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup); - free(settings); } bool nfc_scene_mf_classic_update_success_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/nfc/scenes/nfc_scene_mf_classic_write_success.c b/applications/main/nfc/scenes/nfc_scene_mf_classic_write_success.c index 25656c072..3485aa17a 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_classic_write_success.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_classic_write_success.c @@ -1,6 +1,6 @@ #include "../nfc_i.h" #include -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" void nfc_scene_mf_classic_write_success_popup_callback(void* context) { Nfc* nfc = context; @@ -10,13 +10,11 @@ void nfc_scene_mf_classic_write_success_popup_callback(void* context) { void nfc_scene_mf_classic_write_success_on_enter(void* context) { Nfc* nfc = context; DOLPHIN_DEED(DolphinDeedNfcSave); - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); notification_message(nfc->notifications, &sequence_success); Popup* popup = nfc->popup; - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw); } else { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59); @@ -28,7 +26,6 @@ void nfc_scene_mf_classic_write_success_on_enter(void* context) { popup_enable_timeout(popup); view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup); - free(settings); } bool nfc_scene_mf_classic_write_success_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/nfc/scenes/nfc_scene_mf_ultralight_emulate.c b/applications/main/nfc/scenes/nfc_scene_mf_ultralight_emulate.c index 7e8a899a4..aad01cdf1 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_ultralight_emulate.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_ultralight_emulate.c @@ -1,6 +1,6 @@ #include "../nfc_i.h" #include -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" #define NFC_SCENE_MF_ULTRALIGHT_EMULATE_LOG_SIZE_MAX (200) @@ -66,10 +66,7 @@ void nfc_scene_mf_ultralight_emulate_widget_config(Nfc* nfc, bool auth_attempted FuriString* info_str; info_str = furi_string_alloc(); - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { widget_add_icon_element(widget, 0, 3, &I_NFC_dolphin_emulation_47x61_sfw); } else { widget_add_icon_element(widget, 0, 3, &I_NFC_dolphin_emulation_47x61); @@ -92,15 +89,12 @@ void nfc_scene_mf_ultralight_emulate_widget_config(Nfc* nfc, bool auth_attempted nfc_scene_mf_ultralight_emulate_widget_callback, nfc); } - free(settings); } void nfc_scene_mf_ultralight_emulate_on_enter(void* context) { Nfc* nfc = context; uint32_t state = scene_manager_get_scene_state(nfc->scene_manager, NfcSceneMfUltralightEmulate); - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); // Setup Widget nfc_scene_mf_ultralight_emulate_widget_config(nfc, false); @@ -123,7 +117,7 @@ void nfc_scene_mf_ultralight_emulate_on_enter(void* context) { } else { nfc_text_store_set(nfc, "MIFARE\nNTAG"); } - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 3, &I_NFC_dolphin_emulation_47x61_sfw); } else { popup_set_icon(popup, 0, 3, &I_NFC_dolphin_emulation_47x61); @@ -143,7 +137,6 @@ void nfc_scene_mf_ultralight_emulate_on_enter(void* context) { nfc_mf_ultralight_emulate_worker_callback, nfc); nfc_blink_emulate_start(nfc); - free(settings); } bool nfc_scene_mf_ultralight_emulate_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/nfc/scenes/nfc_scene_restore_original.c b/applications/main/nfc/scenes/nfc_scene_restore_original.c index b87c2f790..e2ea843a5 100644 --- a/applications/main/nfc/scenes/nfc_scene_restore_original.c +++ b/applications/main/nfc/scenes/nfc_scene_restore_original.c @@ -1,5 +1,5 @@ #include "../nfc_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" void nfc_scene_restore_original_popup_callback(void* context) { Nfc* nfc = context; @@ -8,12 +8,10 @@ void nfc_scene_restore_original_popup_callback(void* context) { void nfc_scene_restore_original_on_enter(void* context) { Nfc* nfc = context; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); // Setup view Popup* popup = nfc->popup; - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw); } else { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59); @@ -24,7 +22,6 @@ void nfc_scene_restore_original_on_enter(void* context) { popup_set_callback(popup, nfc_scene_restore_original_popup_callback); popup_enable_timeout(popup); view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup); - free(settings); } bool nfc_scene_restore_original_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/nfc/scenes/nfc_scene_rpc.c b/applications/main/nfc/scenes/nfc_scene_rpc.c index 9bd55577d..2360bd719 100644 --- a/applications/main/nfc/scenes/nfc_scene_rpc.c +++ b/applications/main/nfc/scenes/nfc_scene_rpc.c @@ -1,16 +1,14 @@ #include "../nfc_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" void nfc_scene_rpc_on_enter(void* context) { Nfc* nfc = context; Popup* popup = nfc->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); popup_set_header(popup, "NFC", 89, 42, AlignCenter, AlignBottom); popup_set_text(popup, "RPC mode", 89, 44, AlignCenter, AlignTop); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 12, &I_NFC_dolphin_emulation_47x61_sfw); } else { popup_set_icon(popup, 0, 12, &I_NFC_dolphin_emulation_47x61); @@ -19,7 +17,6 @@ void nfc_scene_rpc_on_enter(void* context) { view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup); notification_message(nfc->notifications, &sequence_display_backlight_on); - free(settings); } static bool nfc_scene_rpc_emulate_callback(NfcWorkerEvent event, void* context) { diff --git a/applications/main/nfc/scenes/nfc_scene_save_success.c b/applications/main/nfc/scenes/nfc_scene_save_success.c index 58b7d1bf4..e9a701119 100644 --- a/applications/main/nfc/scenes/nfc_scene_save_success.c +++ b/applications/main/nfc/scenes/nfc_scene_save_success.c @@ -1,5 +1,5 @@ #include "../nfc_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" void nfc_scene_save_success_popup_callback(void* context) { Nfc* nfc = context; @@ -8,12 +8,10 @@ void nfc_scene_save_success_popup_callback(void* context) { void nfc_scene_save_success_on_enter(void* context) { Nfc* nfc = context; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); // Setup view Popup* popup = nfc->popup; - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw); } else { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59); @@ -24,7 +22,6 @@ void nfc_scene_save_success_on_enter(void* context) { popup_set_callback(popup, nfc_scene_save_success_popup_callback); popup_enable_timeout(popup); view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup); - free(settings); } bool nfc_scene_save_success_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/subghz/scenes/subghz_scene_delete_success.c b/applications/main/subghz/scenes/subghz_scene_delete_success.c index e30eda785..701fa1e7e 100644 --- a/applications/main/subghz/scenes/subghz_scene_delete_success.c +++ b/applications/main/subghz/scenes/subghz_scene_delete_success.c @@ -1,6 +1,6 @@ #include "../subghz_i.h" #include "../helpers/subghz_custom_event.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" void subghz_scene_delete_success_popup_callback(void* context) { SubGhz* subghz = context; @@ -10,12 +10,10 @@ void subghz_scene_delete_success_popup_callback(void* context) { void subghz_scene_delete_success_on_enter(void* context) { SubGhz* subghz = context; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); // Setup view Popup* popup = subghz->popup; - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62_sfw); } else { popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62); @@ -26,7 +24,6 @@ void subghz_scene_delete_success_on_enter(void* context) { popup_set_callback(popup, subghz_scene_delete_success_popup_callback); popup_enable_timeout(popup); view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdPopup); - free(settings); } bool subghz_scene_delete_success_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/subghz/scenes/subghz_scene_rpc.c b/applications/main/subghz/scenes/subghz_scene_rpc.c index 12a5787ad..2e2f53356 100644 --- a/applications/main/subghz/scenes/subghz_scene_rpc.c +++ b/applications/main/subghz/scenes/subghz_scene_rpc.c @@ -1,7 +1,7 @@ #include "../subghz_i.h" #include #include -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" typedef enum { SubGhzRpcStateIdle, @@ -11,12 +11,10 @@ typedef enum { void subghz_scene_rpc_on_enter(void* context) { SubGhz* subghz = context; Popup* popup = subghz->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); popup_set_header(popup, "Sub-GHz", 89, 42, AlignCenter, AlignBottom); popup_set_text(popup, "RPC mode", 89, 44, AlignCenter, AlignTop); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 0, 12, &I_RFIDDolphinSend_97x61_sfw); } else { popup_set_icon(popup, 0, 12, &I_RFIDDolphinSend_97x61); @@ -27,7 +25,6 @@ void subghz_scene_rpc_on_enter(void* context) { scene_manager_set_scene_state(subghz->scene_manager, SubGhzSceneRpc, SubGhzRpcStateIdle); notification_message(subghz->notifications, &sequence_display_backlight_on); - free(settings); } bool subghz_scene_rpc_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/subghz/scenes/subghz_scene_save_success.c b/applications/main/subghz/scenes/subghz_scene_save_success.c index 76e30d088..24e35e711 100644 --- a/applications/main/subghz/scenes/subghz_scene_save_success.c +++ b/applications/main/subghz/scenes/subghz_scene_save_success.c @@ -1,6 +1,6 @@ #include "../subghz_i.h" #include "../helpers/subghz_custom_event.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" void subghz_scene_save_success_popup_callback(void* context) { SubGhz* subghz = context; @@ -9,12 +9,10 @@ void subghz_scene_save_success_popup_callback(void* context) { void subghz_scene_save_success_on_enter(void* context) { SubGhz* subghz = context; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); // Setup view Popup* popup = subghz->popup; - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw); } else { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59); @@ -25,7 +23,6 @@ void subghz_scene_save_success_on_enter(void* context) { popup_set_callback(popup, subghz_scene_save_success_popup_callback); popup_enable_timeout(popup); view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdPopup); - free(settings); } bool subghz_scene_save_success_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/subghz/views/receiver.c b/applications/main/subghz/views/receiver.c index 637ca8632..d42b45b28 100644 --- a/applications/main/subghz/views/receiver.c +++ b/applications/main/subghz/views/receiver.c @@ -7,7 +7,7 @@ #include #include -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" #define FRAME_HEIGHT 12 #define MAX_LEN_PX 111 @@ -195,8 +195,7 @@ void subghz_view_receiver_draw(Canvas* canvas, SubGhzViewReceiverModel* model) { canvas_clear(canvas); canvas_set_color(canvas, ColorBlack); canvas_set_font(canvas, FontSecondary); - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); + XtremeSettings* xtreme_settings = malloc(sizeof(XtremeSettings)); if(model->mode == SubGhzViewReceiverModeLive) { elements_button_left(canvas, "Config"); @@ -234,7 +233,7 @@ void subghz_view_receiver_draw(Canvas* canvas, SubGhzViewReceiverModel* model) { if(model->history_item == 0) { if(model->mode == SubGhzViewReceiverModeLive) { - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { canvas_draw_icon(canvas, 0, 0, &I_Scanning_123x52_sfw); } else { canvas_draw_icon(canvas, 0, 0, &I_Scanning_123x52); @@ -244,7 +243,7 @@ void subghz_view_receiver_draw(Canvas* canvas, SubGhzViewReceiverModel* model) { canvas_draw_line(canvas, 46, 51, 125, 51); canvas_set_font(canvas, FontSecondary); } else { - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { canvas_draw_icon(canvas, 0, 0, &I_Scanning_123x52_sfw); } else { canvas_draw_icon(canvas, 0, 0, &I_Scanning_123x52); @@ -302,7 +301,6 @@ void subghz_view_receiver_draw(Canvas* canvas, SubGhzViewReceiverModel* model) { canvas_draw_str(canvas, 96, 62, furi_string_get_cstr(model->history_stat_str)); } break; } - free(settings); } static void subghz_view_receiver_timer_callback(void* context) { diff --git a/applications/main/u2f/scenes/u2f_scene_error.c b/applications/main/u2f/scenes/u2f_scene_error.c index a4cfd3819..670b022ca 100644 --- a/applications/main/u2f/scenes/u2f_scene_error.c +++ b/applications/main/u2f/scenes/u2f_scene_error.c @@ -1,5 +1,5 @@ #include "../u2f_app_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" static void u2f_scene_error_event_callback(GuiButtonType result, InputType type, void* context) { furi_assert(context); @@ -12,8 +12,6 @@ static void u2f_scene_error_event_callback(GuiButtonType result, InputType type, void u2f_scene_error_on_enter(void* context) { U2fApp* app = context; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); if(app->error == U2fAppErrorNoFiles) { widget_add_icon_element(app->widget, 0, 0, &I_SDQuestion_35x43); @@ -29,7 +27,7 @@ void u2f_scene_error_on_enter(void* context) { app->widget, GuiButtonTypeLeft, "Back", u2f_scene_error_event_callback, app); } else if(app->error == U2fAppErrorCloseRpc) { widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { widget_add_string_multiline_element( app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nis active!"); widget_add_string_multiline_element( @@ -55,7 +53,6 @@ void u2f_scene_error_on_enter(void* context) { } view_dispatcher_switch_to_view(app->view_dispatcher, U2fAppViewError); - free(settings); } bool u2f_scene_error_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/main/u2f/views/u2f_view.c b/applications/main/u2f/views/u2f_view.c index 77b6a288e..412603162 100644 --- a/applications/main/u2f/views/u2f_view.c +++ b/applications/main/u2f/views/u2f_view.c @@ -1,7 +1,7 @@ #include "u2f_view.h" #include #include -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" struct U2fView { View* view; @@ -15,14 +15,13 @@ typedef struct { static void u2f_view_draw_callback(Canvas* canvas, void* _model) { U2fModel* model = _model; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); + XtremeSettings* xtreme_settings = malloc(sizeof(XtremeSettings)); canvas_draw_icon(canvas, 8, 14, &I_Drive_112x35); canvas_set_font(canvas, FontSecondary); if(model->display_msg == U2fMsgNotConnected) { - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { canvas_draw_icon(canvas, 22, 15, &I_Connect_me_62x31_sfw); canvas_draw_str_aligned( canvas, 128 / 2, 3, AlignCenter, AlignTop, "Connect to a device"); @@ -32,7 +31,7 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) { canvas, 128 / 2, 3, AlignCenter, AlignTop, "Plug me in d-daddy"); } } else if(model->display_msg == U2fMsgIdle) { - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { canvas_draw_icon(canvas, 22, 15, &I_Connected_62x31_sfw); canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Connected!"); } else { @@ -40,7 +39,7 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) { canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Connected!"); } } else if(model->display_msg == U2fMsgRegister) { - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { elements_button_center(canvas, "OK"); canvas_draw_icon(canvas, 22, 15, &I_Auth_62x31_sfw); canvas_draw_str_aligned( @@ -52,7 +51,7 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) { canvas, 128 / 2, 3, AlignCenter, AlignTop, "Press CUM to register"); } } else if(model->display_msg == U2fMsgAuth) { - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { elements_button_center(canvas, "OK"); canvas_draw_icon(canvas, 22, 15, &I_Auth_62x31_sfw); canvas_draw_str_aligned( @@ -64,7 +63,7 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) { canvas, 128 / 2, 3, AlignCenter, AlignTop, "Press CUM to authenticate"); } } else if(model->display_msg == U2fMsgSuccess) { - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { canvas_draw_icon(canvas, 22, 15, &I_Connected_62x31_sfw); canvas_draw_str_aligned( canvas, 128 / 2, 3, AlignCenter, AlignTop, "Authentication successful!"); @@ -73,7 +72,7 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) { canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Cum released~"); } } else if(model->display_msg == U2fMsgError) { - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { canvas_draw_icon(canvas, 22, 15, &I_Error_62x31_sfw); canvas_draw_str_aligned( canvas, 128 / 2, 3, AlignCenter, AlignTop, "Certificate error"); @@ -82,7 +81,6 @@ static void u2f_view_draw_callback(Canvas* canvas, void* _model) { canvas_draw_str_aligned(canvas, 128 / 2, 3, AlignCenter, AlignTop, "Unable to cum"); } } - free(settings); } static bool u2f_view_input_callback(InputEvent* event, void* context) { diff --git a/applications/plugins/dap_link/dap_link.c b/applications/plugins/dap_link/dap_link.c index 15f3ce771..99d1a2f76 100644 --- a/applications/plugins/dap_link/dap_link.c +++ b/applications/plugins/dap_link/dap_link.c @@ -16,7 +16,7 @@ #include #include "DAP_Link_icons.h" -#include "../../settings/desktop_settings/desktop_settings_app.h" +#include "../../settings/xtreme_settings/xtreme_settings.h" /***************************************************************************/ /****************************** DAP COMMON *********************************/ @@ -484,13 +484,11 @@ DapConfig* dap_app_get_config(DapApp* app) { int32_t dap_link_app(void* p) { UNUSED(p); - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); if(furi_hal_usb_is_locked()) { DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS); DialogMessage* message = dialog_message_alloc(); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { dialog_message_set_header( message, "Connection\nis active!", 3, 2, AlignLeft, AlignTop); dialog_message_set_text( @@ -514,7 +512,6 @@ int32_t dap_link_app(void* p) { dialog_message_show(dialogs, message); dialog_message_free(message); furi_record_close(RECORD_DIALOGS); - free(settings); return -1; } diff --git a/applications/plugins/dice/dice.c b/applications/plugins/dice/dice.c index 92fd09a38..a87677b5f 100644 --- a/applications/plugins/dice/dice.c +++ b/applications/plugins/dice/dice.c @@ -5,7 +5,7 @@ #include #include #include -#include "applications/settings/desktop_settings/desktop_settings_app.h" +#include "applications/settings/xtreme_settings/xtreme_settings.h" #define TAG "Dice Roller" @@ -480,6 +480,8 @@ int32_t dice_app(void* p) { gui_add_view_port(gui, view_port, GuiLayerFullscreen); furi_timer_start(timer, furi_kernel_get_tick_frequency()); + XtremeSettings* xtreme_settings = malloc(sizeof(XtremeSettings)); + // Main loop PluginEvent event; for(bool processing = true; processing;) { @@ -510,7 +512,7 @@ int32_t dice_app(void* p) { } else if(plugin_state->diceSelect == 20) { plugin_state->diceSelect = 100; } else if(plugin_state->diceSelect == 100) { - if(plugin_state->desktop_settings->is_sfwmode) { + if(xtreme_settings->sfw_mode) { plugin_state->diceSelect = 231; } else { plugin_state->diceSelect = 230; @@ -524,7 +526,7 @@ int32_t dice_app(void* p) { } else if(plugin_state->diceSelect == 229) { plugin_state->diceSelect = 228; } else if(plugin_state->diceSelect == 228) { - if(plugin_state->desktop_settings->is_sfwmode) { + if(xtreme_settings->sfw_mode) { plugin_state->diceSelect = 59; } else { plugin_state->diceSelect = 232; diff --git a/applications/plugins/pocsag_pager/views/pocsag_pager_receiver.c b/applications/plugins/pocsag_pager/views/pocsag_pager_receiver.c index c452e5fe9..aca5eb880 100644 --- a/applications/plugins/pocsag_pager/views/pocsag_pager_receiver.c +++ b/applications/plugins/pocsag_pager/views/pocsag_pager_receiver.c @@ -7,7 +7,7 @@ #include #include -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" #define FRAME_HEIGHT 12 #define MAX_LEN_PX 112 @@ -181,8 +181,7 @@ void pcsg_view_receiver_draw(Canvas* canvas, PCSGReceiverModel* model) { FuriString* str_buff; str_buff = furi_string_alloc(); - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); + XtremeSettings* xtreme_settings = malloc(sizeof(XtremeSettings)); PCSGReceiverMenuItem* item_menu; @@ -209,7 +208,7 @@ void pcsg_view_receiver_draw(Canvas* canvas, PCSGReceiverModel* model) { canvas_set_color(canvas, ColorBlack); if(model->history_item == 0) { - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { canvas_draw_icon(canvas, 0, 0, &I_Scanning_123x52_sfw); } else { canvas_draw_icon(canvas, 0, 0, &I_Scanning_123x52); @@ -235,7 +234,7 @@ void pcsg_view_receiver_draw(Canvas* canvas, PCSGReceiverModel* model) { canvas_draw_icon(canvas, 65, 42, &I_Pin_back_arrow_10x8); canvas_draw_icon(canvas, 80, 42, &I_Pin_back_arrow_10x8); canvas_draw_icon(canvas, 95, 42, &I_Pin_back_arrow_10x8); - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { canvas_draw_icon(canvas, 16, 13, &I_WarningDolphin_45x42_sfw); } else { canvas_draw_icon(canvas, 16, 13, &I_WarningDolphin_45x42); @@ -252,7 +251,6 @@ void pcsg_view_receiver_draw(Canvas* canvas, PCSGReceiverModel* model) { canvas_draw_str(canvas, 96, 62, furi_string_get_cstr(model->history_stat_str)); break; } - free(settings); } static void pcsg_view_receiver_timer_callback(void* context) { diff --git a/applications/plugins/unitemp/views/General_view.c b/applications/plugins/unitemp/views/General_view.c index 02e416fb2..c2da49b3d 100644 --- a/applications/plugins/unitemp/views/General_view.c +++ b/applications/plugins/unitemp/views/General_view.c @@ -19,7 +19,7 @@ #include "unitemp_icons.h" #include -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" static View* view; @@ -170,9 +170,7 @@ static void _draw_singleSensor(Canvas* canvas, Sensor* sensor, const uint8_t pos } static void _draw_view_noSensors(Canvas* canvas) { - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { canvas_draw_icon(canvas, 7, 17, &I_sherlok_53x45_sfw); } else { canvas_draw_icon(canvas, 7, 17, &I_sherlok_53x45); @@ -191,7 +189,6 @@ static void _draw_view_noSensors(Canvas* canvas) { canvas_draw_str(canvas, x, y + 18, "press OK"); canvas_draw_icon(canvas, x + 37, y + 10, &I_Ok_btn_9x9); - free(settings); } static void _draw_view_sensorsList(Canvas* canvas) { diff --git a/applications/plugins/weather_station/views/weather_station_receiver.c b/applications/plugins/weather_station/views/weather_station_receiver.c index cfcdac9fb..3f7b6abbd 100644 --- a/applications/plugins/weather_station/views/weather_station_receiver.c +++ b/applications/plugins/weather_station/views/weather_station_receiver.c @@ -7,7 +7,7 @@ #include #include -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" #define FRAME_HEIGHT 12 #define MAX_LEN_PX 112 @@ -178,8 +178,7 @@ void ws_view_receiver_draw(Canvas* canvas, WSReceiverModel* model) { FuriString* str_buff; str_buff = furi_string_alloc(); - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); + XtremeSettings* xtreme_settings = malloc(sizeof(XtremeSettings)); WSReceiverMenuItem* item_menu; @@ -205,7 +204,7 @@ void ws_view_receiver_draw(Canvas* canvas, WSReceiverModel* model) { canvas_set_color(canvas, ColorBlack); if(model->history_item == 0) { - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { canvas_draw_icon(canvas, 0, 0, &I_Scanning_123x52_sfw); } else { canvas_draw_icon(canvas, 0, 0, &I_Scanning_123x52); @@ -231,7 +230,7 @@ void ws_view_receiver_draw(Canvas* canvas, WSReceiverModel* model) { canvas_draw_icon(canvas, 65, 42, &I_Pin_back_arrow_10x8); canvas_draw_icon(canvas, 80, 42, &I_Pin_back_arrow_10x8); canvas_draw_icon(canvas, 95, 42, &I_Pin_back_arrow_10x8); - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { canvas_draw_icon(canvas, 16, 13, &I_WarningDolphin_45x42_sfw); } else { canvas_draw_icon(canvas, 16, 13, &I_WarningDolphin_45x42); @@ -248,7 +247,6 @@ void ws_view_receiver_draw(Canvas* canvas, WSReceiverModel* model) { canvas_draw_str(canvas, 96, 62, furi_string_get_cstr(model->history_stat_str)); break; } - free(settings); } static void ws_view_receiver_timer_callback(void* context) { diff --git a/applications/services/bt/bt_service/bt.c b/applications/services/bt/bt_service/bt.c index e341544b3..13df73da7 100644 --- a/applications/services/bt/bt_service/bt.c +++ b/applications/services/bt/bt_service/bt.c @@ -5,7 +5,7 @@ #include #include #include -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" #define TAG "BtSrv" @@ -36,9 +36,7 @@ static void bt_pin_code_view_port_draw_callback(Canvas* canvas, void* context) { furi_assert(context); Bt* bt = context; char pin_code_info[24]; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { canvas_draw_icon(canvas, 0, 0, &I_BLE_Pairing_128x64_sfw); } else { canvas_draw_icon(canvas, 0, 0, &I_BLE_Pairing_128x64); @@ -46,7 +44,6 @@ static void bt_pin_code_view_port_draw_callback(Canvas* canvas, void* context) { snprintf(pin_code_info, sizeof(pin_code_info), "Pairing code\n%06lu", bt->pin_code); elements_multiline_text_aligned(canvas, 64, 4, AlignCenter, AlignTop, pin_code_info); elements_button_left(canvas, "Quit"); - free(settings); } static void bt_pin_code_view_port_input_callback(InputEvent* event, void* context) { @@ -83,12 +80,10 @@ static void bt_pin_code_hide(Bt* bt) { static bool bt_pin_code_verify_event_handler(Bt* bt, uint32_t pin) { furi_assert(bt); - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); notification_message(bt->notification, &sequence_display_backlight_on); FuriString* pin_str; - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { dialog_message_set_icon(bt->dialog_message, &I_BLE_Pairing_128x64_sfw, 0, 0); } else { dialog_message_set_icon(bt->dialog_message, &I_BLE_Pairing_128x64, 0, 0); @@ -100,7 +95,6 @@ static bool bt_pin_code_verify_event_handler(Bt* bt, uint32_t pin) { DialogMessageButton button = dialog_message_show(bt->dialogs, bt->dialog_message); furi_string_free(pin_str); return button == DialogMessageButtonCenter; - free(settings); } static void bt_battery_level_changed_callback(const void* _event, void* context) { diff --git a/applications/services/desktop/animations/animation_manager.c b/applications/services/desktop/animations/animation_manager.c index 702bddc99..857bedff2 100644 --- a/applications/services/desktop/animations/animation_manager.c +++ b/applications/services/desktop/animations/animation_manager.c @@ -13,7 +13,6 @@ #include "animation_storage.h" #include "animation_manager.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" #include "../../../settings/xtreme_settings/xtreme_settings.h" #define TAG "AnimationManager" @@ -55,7 +54,6 @@ struct AnimationManager { FuriString* freezed_animation_name; int32_t freezed_animation_time_left; ViewStack* view_stack; - bool sfw_mode; }; static StorageAnimation* @@ -566,8 +564,6 @@ static void animation_manager_switch_to_one_shot_view(AnimationManager* animatio Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN); DolphinStats stats = dolphin_stats(dolphin); furi_record_close(RECORD_DOLPHIN); - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); animation_manager->one_shot_view = one_shot_view_alloc(); one_shot_view_set_interact_callback( @@ -576,7 +572,7 @@ static void animation_manager_switch_to_one_shot_view(AnimationManager* animatio View* next_view = one_shot_view_get_view(animation_manager->one_shot_view); view_stack_remove_view(animation_manager->view_stack, prev_view); view_stack_add_view(animation_manager->view_stack, next_view); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { if(stats.level <= 20) { one_shot_view_start_animation( animation_manager->one_shot_view, &A_Levelup1_128x64_sfw); @@ -589,7 +585,6 @@ static void animation_manager_switch_to_one_shot_view(AnimationManager* animatio } else { one_shot_view_start_animation(animation_manager->one_shot_view, &A_Levelup1_128x64); } - free(settings); } static void animation_manager_switch_to_animation_view(AnimationManager* animation_manager) { diff --git a/applications/services/desktop/animations/animation_storage.c b/applications/services/desktop/animations/animation_storage.c index c1dcdffc3..daf0af2d3 100644 --- a/applications/services/desktop/animations/animation_storage.c +++ b/applications/services/desktop/animations/animation_storage.c @@ -11,7 +11,7 @@ #include "animation_storage_i.h" #include #include -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" #define ANIMATION_META_FILE "meta.txt" #define ANIMATION_DIR EXT_PATH("dolphin") #define TAG "AnimationStorage" @@ -28,10 +28,7 @@ static void animation_storage_free_animation(BubbleAnimation** storage_animation static BubbleAnimation* animation_storage_load_animation(const char* name); void animation_handler_beta() { - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { snprintf(ANIMATION_MANIFEST_FILE, sizeof(ANIMATION_DIR), "%s", ANIMATION_DIR); FURI_LOG_I(TAG, "SFW Manifest selected"); strcat(ANIMATION_MANIFEST_FILE, "/sfw/manifest.txt"); @@ -40,7 +37,6 @@ void animation_handler_beta() { FURI_LOG_I(TAG, "NSFW Manifest selected"); strcat(ANIMATION_MANIFEST_FILE, "/nsfw/manifest.txt"); } - free(settings); } static bool animation_storage_load_single_manifest_info( diff --git a/applications/services/desktop/desktop.c b/applications/services/desktop/desktop.c index e43e6e6e0..7840cd00a 100644 --- a/applications/services/desktop/desktop.c +++ b/applications/services/desktop/desktop.c @@ -140,12 +140,6 @@ void desktop_unlock(Desktop* desktop) { desktop_auto_lock_arm(desktop); } -void desktop_set_sfw_mode_state(Desktop* desktop, bool enabled) { - desktop->settings.sfw_mode = enabled; - DESKTOP_SETTINGS_SAVE(&desktop->settings); - animation_manager_new_idle_process(desktop->animation_manager); -} - Desktop* desktop_alloc() { Desktop* desktop = malloc(sizeof(Desktop)); @@ -322,8 +316,6 @@ int32_t desktop_srv(void* p) { DESKTOP_SETTINGS_SAVE(&desktop->settings); } - desktop_main_set_sfw_mode_state(desktop->main_view, desktop->settings.sfw_mode); - scene_manager_next_scene(desktop->scene_manager, DesktopSceneMain); desktop_pin_lock_init(&desktop->settings); diff --git a/applications/services/desktop/desktop_i.h b/applications/services/desktop/desktop_i.h index 007c50f36..2bb0d683f 100644 --- a/applications/services/desktop/desktop_i.h +++ b/applications/services/desktop/desktop_i.h @@ -75,4 +75,3 @@ Desktop* desktop_alloc(); void desktop_free(Desktop* desktop); void desktop_lock(Desktop* desktop); void desktop_unlock(Desktop* desktop); -void desktop_set_sfw_mode_state(Desktop* desktop, bool enabled); diff --git a/applications/services/desktop/desktop_settings.h b/applications/services/desktop/desktop_settings.h index 55d8640f5..50de5a819 100644 --- a/applications/services/desktop/desktop_settings.h +++ b/applications/services/desktop/desktop_settings.h @@ -62,6 +62,4 @@ typedef struct { uint8_t is_locked; uint32_t auto_lock_delay_ms; uint8_t displayBatteryPercentage; - bool is_sfwmode; - uint8_t sfw_mode; } DesktopSettings; diff --git a/applications/services/desktop/scenes/desktop_scene_fault.c b/applications/services/desktop/scenes/desktop_scene_fault.c index 79dedbe59..b0904c2b9 100644 --- a/applications/services/desktop/scenes/desktop_scene_fault.c +++ b/applications/services/desktop/scenes/desktop_scene_fault.c @@ -1,7 +1,7 @@ #include #include "../desktop_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" #define DesktopFaultEventExit 0x00FF00FF @@ -13,12 +13,9 @@ void desktop_scene_fault_callback(void* context) { void desktop_scene_fault_on_enter(void* context) { Desktop* desktop = (Desktop*)context; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - Popup* popup = desktop->hw_mismatch_popup; popup_set_context(popup, desktop); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_header( popup, "Flipper crashed\n but has been rebooted", @@ -40,7 +37,6 @@ void desktop_scene_fault_on_enter(void* context) { popup_set_text(popup, message, 60, 37 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignCenter); popup_set_callback(popup, desktop_scene_fault_callback); view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewIdHwMismatch); - free(settings); } bool desktop_scene_fault_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/services/desktop/scenes/desktop_scene_lock_menu.c b/applications/services/desktop/scenes/desktop_scene_lock_menu.c index d56cabb30..c0bbff0ad 100644 --- a/applications/services/desktop/scenes/desktop_scene_lock_menu.c +++ b/applications/services/desktop/scenes/desktop_scene_lock_menu.c @@ -26,7 +26,6 @@ void desktop_scene_lock_menu_on_enter(void* context) { scene_manager_set_scene_state(desktop->scene_manager, DesktopSceneLockMenu, 0); desktop_lock_menu_set_callback(desktop->lock_menu, desktop_scene_lock_menu_callback, desktop); desktop_lock_menu_set_pin_state(desktop->lock_menu, desktop->settings.pin_code.length > 0); - desktop_lock_menu_set_sfw_mode_state(desktop->lock_menu, desktop->settings.sfw_mode); desktop_lock_menu_set_idx(desktop->lock_menu, 0); view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewIdLockMenu); @@ -90,16 +89,8 @@ bool desktop_scene_lock_menu_on_event(void* context, SceneManagerEvent event) { furi_record_close(RECORD_POWER); break; - case DesktopLockMenuEventSFWModeOn: - desktop_set_sfw_mode_state(desktop, true); - scene_manager_search_and_switch_to_previous_scene( - desktop->scene_manager, DesktopSceneMain); - break; - case DesktopLockMenuEventSFWModeOff: - desktop_set_sfw_mode_state(desktop, false); - scene_manager_search_and_switch_to_previous_scene( - desktop->scene_manager, DesktopSceneMain); - break; + case DesktopLockMenuEventXtremeSettings: + break; // TODO: open settings app default: break; } @@ -111,4 +102,4 @@ bool desktop_scene_lock_menu_on_event(void* context, SceneManagerEvent event) { void desktop_scene_lock_menu_on_exit(void* context) { UNUSED(context); -} \ No newline at end of file +} diff --git a/applications/services/desktop/views/desktop_events.h b/applications/services/desktop/views/desktop_events.h index 82ca43c4c..a17114ad2 100644 --- a/applications/services/desktop/views/desktop_events.h +++ b/applications/services/desktop/views/desktop_events.h @@ -43,8 +43,7 @@ typedef enum { DesktopLockMenuEventPinLock, DesktopLockMenuEventPinLockShutdown, DesktopLockMenuEventExit, - DesktopLockMenuEventSFWModeOn, - DesktopLockMenuEventSFWModeOff, + DesktopLockMenuEventXtremeSettings, DesktopAnimationEventCheckAnimation, DesktopAnimationEventNewIdleAnimation, diff --git a/applications/services/desktop/views/desktop_view_lock_menu.c b/applications/services/desktop/views/desktop_view_lock_menu.c index 698c26505..e6a0cac76 100644 --- a/applications/services/desktop/views/desktop_view_lock_menu.c +++ b/applications/services/desktop/views/desktop_view_lock_menu.c @@ -5,7 +5,7 @@ #include "../desktop_i.h" #include "desktop_view_lock_menu.h" -#include "applications/settings/desktop_settings/desktop_settings_app.h" +#include "../../../settings/xtreme_settings/xtreme_settings.h" #define LOCK_MENU_ITEMS_NB 5 @@ -13,7 +13,7 @@ typedef enum { DesktopLockMenuIndexLock, DesktopLockMenuIndexPinLock, DesktopLockMenuIndexPinLockShutdown, - DesktopLockMenuIndexSFW, + DesktopLockMenuIndexXtremeSettings, DesktopLockMenuIndexTotalCount } DesktopLockMenuIndex; @@ -36,11 +36,6 @@ void desktop_lock_menu_set_pin_state(DesktopLockMenuView* lock_menu, bool pin_is true); } -void desktop_lock_menu_set_sfw_mode_state(DesktopLockMenuView* lock_menu, bool sfw_mode) { - with_view_model( - lock_menu->view, DesktopLockMenuViewModel * model, { model->sfw_mode = sfw_mode; }, true); -} - void desktop_lock_menu_set_idx(DesktopLockMenuView* lock_menu, uint8_t idx) { furi_assert(idx < DesktopLockMenuIndexTotalCount); with_view_model( @@ -72,11 +67,11 @@ void desktop_lock_menu_draw_callback(Canvas* canvas, void* model) { } else { str = "Set PIN + Off"; } - } else if(i == DesktopLockMenuIndexSFW) { - if(m->sfw_mode) { - str = "NSFW Mode"; + } else if(i == DesktopLockMenuIndexXtremeSettings) { + if(XTREME_SETTINGS()->sfw_mode) { + str = "Xtreme Settings"; } else { - str = "SFW Mode"; + str = "Kink Center"; } } @@ -100,7 +95,6 @@ bool desktop_lock_menu_input_callback(InputEvent* event, void* context) { DesktopLockMenuView* lock_menu = context; uint8_t idx = 0; bool consumed = false; - bool sfw_mode = false; bool update = false; with_view_model( @@ -127,7 +121,6 @@ bool desktop_lock_menu_input_callback(InputEvent* event, void* context) { } } idx = model->idx; - sfw_mode = model->sfw_mode; }, update); @@ -139,16 +132,10 @@ bool desktop_lock_menu_input_callback(InputEvent* event, void* context) { } else if((idx == DesktopLockMenuIndexPinLockShutdown) && (event->type == InputTypeShort)) { lock_menu->callback(DesktopLockMenuEventPinLockShutdown, lock_menu->context); // } else if((idx == DesktopLockMenuIndexGameMode) && (event->type == InputTypeShort)) { - // desktop_view_lock_menu_sfwmode_changed(1); // DOLPHIN_DEED(getRandomDeed()); // lock_menu->callback(DesktopLockMenuEventExit, lock_menu->context); - } else if(idx == DesktopLockMenuIndexSFW) { - // DOLPHIN_DEED(getRandomDeed()); - if((sfw_mode == false) && (event->type == InputTypeShort)) { - lock_menu->callback(DesktopLockMenuEventSFWModeOn, lock_menu->context); - } else if((sfw_mode == true) && (event->type == InputTypeShort)) { - lock_menu->callback(DesktopLockMenuEventSFWModeOff, lock_menu->context); - } + } else if((idx == DesktopLockMenuIndexXtremeSettings) && (event->type == InputTypeShort)) { + lock_menu->callback(DesktopLockMenuEventXtremeSettings, lock_menu->context); } consumed = true; } diff --git a/applications/services/desktop/views/desktop_view_lock_menu.h b/applications/services/desktop/views/desktop_view_lock_menu.h index b05ef25ae..da144d1f3 100644 --- a/applications/services/desktop/views/desktop_view_lock_menu.h +++ b/applications/services/desktop/views/desktop_view_lock_menu.h @@ -18,7 +18,6 @@ struct DesktopLockMenuView { typedef struct { uint8_t idx; bool pin_is_set; - bool sfw_mode; } DesktopLockMenuViewModel; void desktop_lock_menu_set_callback( @@ -28,7 +27,6 @@ void desktop_lock_menu_set_callback( View* desktop_lock_menu_get_view(DesktopLockMenuView* lock_menu); void desktop_lock_menu_set_pin_state(DesktopLockMenuView* lock_menu, bool pin_is_set); -void desktop_lock_menu_set_sfw_mode_state(DesktopLockMenuView* lock_menu, bool sfw_mode); void desktop_lock_menu_set_idx(DesktopLockMenuView* lock_menu, uint8_t idx); DesktopLockMenuView* desktop_lock_menu_alloc(); void desktop_lock_menu_free(DesktopLockMenuView* lock_menu); diff --git a/applications/services/desktop/views/desktop_view_main.c b/applications/services/desktop/views/desktop_view_main.c index c3bb92555..d71b20129 100644 --- a/applications/services/desktop/views/desktop_view_main.c +++ b/applications/services/desktop/views/desktop_view_main.c @@ -14,7 +14,6 @@ struct DesktopMainView { DesktopMainViewCallback callback; void* context; TimerHandle_t poweroff_timer; - bool sfw_mode; }; #define DESKTOP_MAIN_VIEW_POWEROFF_TIMEOUT 2000 @@ -39,11 +38,6 @@ View* desktop_main_get_view(DesktopMainView* main_view) { return main_view->view; } -void desktop_main_set_sfw_mode_state(DesktopMainView* main_view, bool sfw_mode) { - furi_assert(main_view); - main_view->sfw_mode = sfw_mode; -} - bool desktop_main_input_callback(InputEvent* event, void* context) { furi_assert(event); furi_assert(context); @@ -110,4 +104,4 @@ void desktop_main_free(DesktopMainView* main_view) { view_free(main_view->view); furi_timer_free(main_view->poweroff_timer); free(main_view); -} \ No newline at end of file +} diff --git a/applications/services/desktop/views/desktop_view_main.h b/applications/services/desktop/views/desktop_view_main.h index bf4f918bf..329d95486 100644 --- a/applications/services/desktop/views/desktop_view_main.h +++ b/applications/services/desktop/views/desktop_view_main.h @@ -13,6 +13,5 @@ void desktop_main_set_callback( void* context); View* desktop_main_get_view(DesktopMainView* main_view); -void desktop_main_set_sfw_mode_state(DesktopMainView* main_view, bool sfw_mode); DesktopMainView* desktop_main_alloc(); void desktop_main_free(DesktopMainView* main_view); diff --git a/applications/settings/bt_settings_app/scenes/bt_settings_scene_forget_dev_success.c b/applications/settings/bt_settings_app/scenes/bt_settings_scene_forget_dev_success.c index 79651a976..34d5de16a 100644 --- a/applications/settings/bt_settings_app/scenes/bt_settings_scene_forget_dev_success.c +++ b/applications/settings/bt_settings_app/scenes/bt_settings_scene_forget_dev_success.c @@ -1,6 +1,6 @@ #include "../bt_settings_app.h" #include "furi_hal_bt.h" -#include "../../desktop_settings/desktop_settings_app.h" +#include "../../xtreme_settings/xtreme_settings.h" void bt_settings_app_scene_forget_dev_success_popup_callback(void* context) { BtSettingsApp* app = context; @@ -10,10 +10,8 @@ void bt_settings_app_scene_forget_dev_success_popup_callback(void* context) { void bt_settings_scene_forget_dev_success_on_enter(void* context) { BtSettingsApp* app = context; Popup* popup = app->popup; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw); } else { popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59); @@ -24,7 +22,6 @@ void bt_settings_scene_forget_dev_success_on_enter(void* context) { popup_set_callback(popup, bt_settings_app_scene_forget_dev_success_popup_callback); popup_enable_timeout(popup); view_dispatcher_switch_to_view(app->view_dispatcher, BtSettingsAppViewPopup); - free(settings); } bool bt_settings_scene_forget_dev_success_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_disable.c b/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_disable.c index 4b183251b..78088155a 100644 --- a/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_disable.c +++ b/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_disable.c @@ -6,6 +6,7 @@ #include "../desktop_settings_app.h" #include #include "desktop_settings_scene.h" +#include "../../xtreme_settings/xtreme_settings.h" #define SCENE_EVENT_EXIT (0U) @@ -21,12 +22,10 @@ void desktop_settings_scene_pin_disable_on_enter(void* context) { app->settings.pin_code.length = 0; memset(app->settings.pin_code.data, '0', sizeof(app->settings.pin_code.data)); DESKTOP_SETTINGS_SAVE(&app->settings); - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); popup_set_context(app->popup, app); popup_set_callback(app->popup, pin_disable_back_callback); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { popup_set_icon(app->popup, 0, 2, &I_DolphinMafia_115x62_sfw); } else { popup_set_icon(app->popup, 0, 2, &I_DolphinMafia_115x62); @@ -35,7 +34,6 @@ void desktop_settings_scene_pin_disable_on_enter(void* context) { popup_set_timeout(app->popup, 1500); popup_enable_timeout(app->popup); view_dispatcher_switch_to_view(app->view_dispatcher, DesktopSettingsAppViewIdPopup); - free(settings); } bool desktop_settings_scene_pin_disable_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/settings/dolphin_passport/passport.c b/applications/settings/dolphin_passport/passport.c index c18455dbf..84f081215 100644 --- a/applications/settings/dolphin_passport/passport.c +++ b/applications/settings/dolphin_passport/passport.c @@ -6,7 +6,7 @@ #include #include #include "dolphin/dolphin.h" -#include "../desktop_settings/desktop_settings_app.h" +#include "../xtreme_settings/xtreme_settings.h" #include "math.h" #define MOODS_TOTAL 3 @@ -60,15 +60,14 @@ static void render_callback(Canvas* canvas, void* _ctx) { PassportContext* ctx = _ctx; DolphinStats* stats = ctx->stats; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); + XtremeSettings* xtreme_settings = malloc(sizeof(XtremeSettings)); char level_str[20]; char xp_str[12]; char mood_str[32]; uint8_t mood = 0; - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { if(stats->butthurt <= 4) { mood = 0; snprintf(mood_str, 20, "Mood: Happy"); @@ -109,7 +108,7 @@ static void render_callback(Canvas* canvas, void* _ctx) { } // multipass - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { canvas_draw_icon(canvas, 0, 0, &I_passport_DB_sfw); } else { canvas_draw_icon(canvas, 0, 0, &I_passport_DB); @@ -118,7 +117,7 @@ static void render_callback(Canvas* canvas, void* _ctx) { // portrait furi_assert((stats->level > 0) && (stats->level <= DOLPHIN_LEVEL_COUNT + 1)); uint16_t tmpLvl = 0; - if(settings->sfw_mode) { + if(xtreme_settings->sfw_mode) { canvas_draw_icon(canvas, 11, 2, portraits_sfw[mood][tmpLvl]); } else { canvas_draw_icon(canvas, 11, 2, portraits[mood][tmpLvl]); @@ -148,8 +147,6 @@ static void render_callback(Canvas* canvas, void* _ctx) { canvas_draw_icon(canvas, 52, 51, &I_Ok_btn_9x9); canvas_draw_str( canvas, ctx->progress_total ? 37 : 36, 59, ctx->progress_total ? "Lvl" : "Tot"); - - free(settings); } int32_t passport_app(void* p) { diff --git a/applications/settings/power_settings_app/scenes/power_settings_scene_power_off.c b/applications/settings/power_settings_app/scenes/power_settings_scene_power_off.c index 43d429692..b8a40a67f 100644 --- a/applications/settings/power_settings_app/scenes/power_settings_scene_power_off.c +++ b/applications/settings/power_settings_app/scenes/power_settings_scene_power_off.c @@ -1,5 +1,5 @@ #include "../power_settings_app.h" -#include "../../desktop_settings/desktop_settings_app.h" +#include "../../xtreme_settings/xtreme_settings.h" void power_settings_scene_power_off_dialog_callback(DialogExResult result, void* context) { furi_assert(context); @@ -11,11 +11,8 @@ void power_settings_scene_power_off_on_enter(void* context) { PowerSettingsApp* app = context; DialogEx* dialog = app->dialog; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - dialog_ex_set_header(dialog, "Turn Off Device?", 64, 2, AlignCenter, AlignTop); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { dialog_ex_set_text( dialog, " I will be\nwaiting for\n you here", 78, 16, AlignLeft, AlignTop); dialog_ex_set_icon(dialog, 21, 13, &I_Cry_dolph_55x52_sfw); @@ -30,7 +27,6 @@ void power_settings_scene_power_off_on_enter(void* context) { dialog_ex_set_context(dialog, app); view_dispatcher_switch_to_view(app->view_dispatcher, PowerSettingsAppViewDialog); - free(settings); } bool power_settings_scene_power_off_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/settings/storage_settings/scenes/storage_settings_scene_unmounted.c b/applications/settings/storage_settings/scenes/storage_settings_scene_unmounted.c index 4d8f81f9e..3c37327cd 100644 --- a/applications/settings/storage_settings/scenes/storage_settings_scene_unmounted.c +++ b/applications/settings/storage_settings/scenes/storage_settings_scene_unmounted.c @@ -1,5 +1,5 @@ #include "../storage_settings.h" -#include "../../desktop_settings/desktop_settings_app.h" +#include "../../xtreme_settings/xtreme_settings.h" static void storage_settings_scene_unmounted_dialog_callback(DialogExResult result, void* context) { @@ -12,11 +12,9 @@ void storage_settings_scene_unmounted_on_enter(void* context) { StorageSettings* app = context; FS_Error error = storage_sd_unmount(app->fs_api); DialogEx* dialog_ex = app->dialog_ex; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); dialog_ex_set_center_button_text(dialog_ex, "OK"); - if(settings->sfw_mode) { + if(XTREME_SETTINGS()->sfw_mode) { dialog_ex_set_icon(dialog_ex, 72, 17, &I_DolphinCommon_56x48_sfw); } else { dialog_ex_set_icon(dialog_ex, 72, 17, &I_DolphinCommon_56x48); @@ -36,7 +34,6 @@ void storage_settings_scene_unmounted_on_enter(void* context) { dialog_ex_set_result_callback(dialog_ex, storage_settings_scene_unmounted_dialog_callback); view_dispatcher_switch_to_view(app->view_dispatcher, StorageSettingsViewDialogEx); - free(settings); } bool storage_settings_scene_unmounted_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/settings/xtreme_settings/scenes/xtreme_settings_scene_start.c b/applications/settings/xtreme_settings/scenes/xtreme_settings_scene_start.c index 0fe6d70f4..2cd2d0172 100644 --- a/applications/settings/xtreme_settings/scenes/xtreme_settings_scene_start.c +++ b/applications/settings/xtreme_settings/scenes/xtreme_settings_scene_start.c @@ -2,6 +2,13 @@ #include #include +static void xtreme_settings_scene_start_base_mode_changed(VariableItem* item) { + bool value = variable_item_get_current_value_index(item); + variable_item_set_current_value_text(item, value ? "SFW" : "NSFW"); + XTREME_SETTINGS()->sfw_mode = value; + XTREME_SETTINGS_SAVE(); +} + #define CYCLE_ANIMS_COUNT 13 const char* const cycle_anims_names[CYCLE_ANIMS_COUNT] = { "OFF", @@ -99,6 +106,15 @@ void xtreme_settings_scene_start_on_enter(void* context) { flipper_format_free(subghz_range); furi_record_close(RECORD_STORAGE); + item = variable_item_list_add( + var_item_list, + "Graphics", + 2, + xtreme_settings_scene_start_base_mode_changed, + app); + variable_item_set_current_value_index(item, xtreme->sfw_mode); + variable_item_set_current_value_text(item, xtreme->sfw_mode ? "SFW" : "NSFW"); + item = variable_item_list_add( var_item_list, "Cycle Anims", diff --git a/applications/settings/xtreme_settings/xtreme_settings.h b/applications/settings/xtreme_settings/xtreme_settings.h index 4bf0aa880..c1f457c42 100644 --- a/applications/settings/xtreme_settings/xtreme_settings.h +++ b/applications/settings/xtreme_settings/xtreme_settings.h @@ -15,7 +15,7 @@ typedef struct { int32_t cycle_anims; bool unlock_anims; - // uint8_t sfw_mode; + uint8_t sfw_mode; } XtremeSettings; XtremeSettings* XTREME_SETTINGS();