From 83c0f941df309d412234172a328d80bf4d79793b Mon Sep 17 00:00:00 2001 From: jbohack Date: Fri, 30 Dec 2022 15:08:12 -0500 Subject: [PATCH] NFC_dolphin_emulation_47x61 sfw support --- .../main/nfc/scenes/nfc_scene_emulate_uid.c | 11 ++++++++++- .../nfc/scenes/nfc_scene_mf_classic_emulate.c | 11 ++++++++++- .../nfc/scenes/nfc_scene_mf_ultralight_emulate.c | 11 ++++++++++- applications/main/nfc/scenes/nfc_scene_rpc.c | 12 ++++++++++-- .../NFC/NFC_dolphin_emulation_47x61_sfw.png | Bin 0 -> 1541 bytes 5 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 assets/icons/NFC/NFC_dolphin_emulation_47x61_sfw.png diff --git a/applications/main/nfc/scenes/nfc_scene_emulate_uid.c b/applications/main/nfc/scenes/nfc_scene_emulate_uid.c index 7316eebe0..eec43c92c 100644 --- a/applications/main/nfc/scenes/nfc_scene_emulate_uid.c +++ b/applications/main/nfc/scenes/nfc_scene_emulate_uid.c @@ -1,4 +1,5 @@ #include "../nfc_i.h" +#include "../../../settings/desktop_settings/desktop_settings_app.h" #define NFC_SCENE_EMULATE_UID_LOG_SIZE_MAX (200) @@ -36,8 +37,15 @@ 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); - widget_add_icon_element(widget, 0, 3, &I_NFC_dolphin_emulation_47x61); + if (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); + } widget_add_string_element(widget, 57, 13, AlignLeft, AlignTop, FontPrimary, "Emulating UID"); if(strcmp(nfc->dev->dev_name, "") != 0) { furi_string_printf(info_str, "%s", nfc->dev->dev_name); @@ -54,6 +62,7 @@ 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 8c0f493e1..0fa624ad9 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_classic_emulate.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_classic_emulate.c @@ -1,4 +1,5 @@ #include "../nfc_i.h" +#include "../../../settings/desktop_settings/desktop_settings_app.h" #define NFC_MF_CLASSIC_DATA_NOT_CHANGED (0UL) #define NFC_MF_CLASSIC_DATA_CHANGED (1UL) @@ -14,6 +15,8 @@ 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; @@ -23,7 +26,12 @@ void nfc_scene_mf_classic_emulate_on_enter(void* context) { } else { nfc_text_store_set(nfc, "MIFARE\nClassic"); } - popup_set_icon(popup, 0, 3, &I_NFC_dolphin_emulation_47x61); + if (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); + } popup_set_text(popup, nfc->text_store, 90, 28, AlignCenter, AlignTop); // Setup and start worker @@ -35,6 +43,7 @@ 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_ultralight_emulate.c b/applications/main/nfc/scenes/nfc_scene_mf_ultralight_emulate.c index 9d8f17f9a..ca25b48c1 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_ultralight_emulate.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_ultralight_emulate.c @@ -1,4 +1,5 @@ #include "../nfc_i.h" +#include "../../../settings/desktop_settings/desktop_settings_app.h" #define NFC_MF_UL_DATA_NOT_CHANGED (0UL) #define NFC_MF_UL_DATA_CHANGED (1UL) @@ -14,6 +15,8 @@ bool nfc_mf_ultralight_emulate_worker_callback(NfcWorkerEvent event, void* conte void nfc_scene_mf_ultralight_emulate_on_enter(void* context) { Nfc* nfc = context; + DesktopSettings* settings = malloc(sizeof(DesktopSettings)); + DESKTOP_SETTINGS_LOAD(settings); // Setup view MfUltralightType type = nfc->dev->dev_data.mf_ul_data.type; @@ -28,7 +31,12 @@ void nfc_scene_mf_ultralight_emulate_on_enter(void* context) { } else { nfc_text_store_set(nfc, "MIFARE\nNTAG"); } - popup_set_icon(popup, 0, 3, &I_NFC_dolphin_emulation_47x61); + if (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); + } popup_set_text(popup, nfc->text_store, 90, 28, AlignCenter, AlignTop); // Setup and start worker @@ -40,6 +48,7 @@ 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_rpc.c b/applications/main/nfc/scenes/nfc_scene_rpc.c index 60d01a30d..e0da1317c 100644 --- a/applications/main/nfc/scenes/nfc_scene_rpc.c +++ b/applications/main/nfc/scenes/nfc_scene_rpc.c @@ -1,17 +1,25 @@ #include "../nfc_i.h" +#include "../../../settings/desktop_settings/desktop_settings_app.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); - - popup_set_icon(popup, 0, 12, &I_NFC_dolphin_emulation_47x61); + if (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); + } 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/assets/icons/NFC/NFC_dolphin_emulation_47x61_sfw.png b/assets/icons/NFC/NFC_dolphin_emulation_47x61_sfw.png new file mode 100644 index 0000000000000000000000000000000000000000..1783531285bed514517fc0821501e718359dd765 GIT binary patch literal 1541 zcmaJ>eM}Q)7{3ZaLqs>76Ex1V5{uLJ`hl&zQLyxiR4J5Flue0VuU9zXKDZvVFu$in zjZPV|k*WB>lBo=wab{s;0v4vrHgq6yL6|@s=rj(*ZALe`w+OgD#xD2qyib0=-}CW4 z_wKW%tO^gC8wNp8xH$>4fiD6cy*LQG!v-3sLy!oej7F>3XoNYQby0aF1bI7aN-wPT zSzjw@m}hD^wN~8M!%5Suc^yp$% z;LAJvZZ<7U;$}9n&swkday_9{j$6k|(n<`UWz^qKx;6aE!&&NN(Msv}w)zef+FQ1w zPdX)Tbt_@>_j_ z1g4yN$-3nhg@rScIaE?HPo@{A*oop?Lg$pk$HB2)6bR6yfWuxok8z`3y<}7u1$MxV zNZ?V3kgJ!xNGj7}g^esv!dkgfMko{tSgVthPF&?syKrI|tWv0yh!WgdnNo|Y)TmMi zk6jWFkaxOJ8D8>lEl2;>9^cDOUul8V6b|{|}|<3A9_V zkuUT8Phq#ch$9gj>1GRf0_>e@Q6LnD8hH{ISl-U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