Skip to content

Commit 576174a

Browse files
committed
upd magspoof
1 parent 66ef95b commit 576174a

File tree

8 files changed

+32
-2
lines changed

8 files changed

+32
-2
lines changed

non_catalog_apps/magspoof_flipper/application.fam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ App(
1212
],
1313
provides=[],
1414
stack_size=6 * 1024,
15-
order=64, # keep it at the bottom of the list while still WIP
15+
order=64,
1616
fap_icon="icons/mag_10px.png",
1717
fap_category="GPIO",
1818
fap_icon_assets="icons",
@@ -21,4 +21,5 @@ App(
2121
fap_description="Enables wireless transmission of magstripe data",
2222
fap_author="Zachary Weiss",
2323
fap_weburl="https://github.com/zacharyweiss/magspoof_flipper",
24+
fap_file_assets="resources",
2425
)
Loading

non_catalog_apps/magspoof_flipper/mag.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ int32_t mag_app(void* p) {
157157
}
158158

159159
mag_make_app_folder(mag);
160+
mag_migrate_and_copy_files(mag);
160161

161162
// Enable 5v power, multiple attempts to avoid issues with power chip protection false triggering
162163
uint8_t attempts = 0;
@@ -199,6 +200,29 @@ void mag_make_app_folder(Mag* mag) {
199200
}
200201
}
201202

203+
void mag_migrate_and_copy_files(Mag* mag) {
204+
furi_assert(mag);
205+
Storage* storage = mag->storage;
206+
207+
storage_common_migrate(storage, EXT_PATH("magspoof"), STORAGE_APP_DATA_PATH_PREFIX);
208+
storage_common_migrate(storage, EXT_PATH("mag"), STORAGE_APP_DATA_PATH_PREFIX);
209+
210+
if(!storage_common_exists(storage, APP_DATA_PATH(MAG_EXAMPLE_FILE_1))) {
211+
storage_common_copy(
212+
storage, APP_ASSETS_PATH(MAG_EXAMPLE_FILE_1), APP_DATA_PATH(MAG_EXAMPLE_FILE_1));
213+
}
214+
215+
if(!storage_common_exists(storage, APP_DATA_PATH(MAG_EXAMPLE_FILE_2))) {
216+
storage_common_copy(
217+
storage, APP_ASSETS_PATH(MAG_EXAMPLE_FILE_2), APP_DATA_PATH(MAG_EXAMPLE_FILE_2));
218+
}
219+
220+
if(!storage_common_exists(storage, APP_DATA_PATH(MAG_EXAMPLE_FILE_3))) {
221+
storage_common_copy(
222+
storage, APP_ASSETS_PATH(MAG_EXAMPLE_FILE_3), APP_DATA_PATH(MAG_EXAMPLE_FILE_3));
223+
}
224+
}
225+
202226
void mag_text_store_set(Mag* mag, const char* text, ...) {
203227
furi_assert(mag);
204228
va_list args;

non_catalog_apps/magspoof_flipper/mag_device.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88
#include "mag_icons.h"
99
#include "helpers/mag_types.h"
1010

11-
1211
#define MAG_DEV_NAME_MAX_LEN 22
1312
#define MAG_DEV_TRACKS 3
1413

1514
#define MAG_APP_FOLDER STORAGE_APP_DATA_PATH_PREFIX
1615
#define MAG_APP_EXTENSION ".mag"
1716

17+
#define MAG_EXAMPLE_FILE_1 "TestMagstripe.mag"
18+
#define MAG_EXAMPLE_FILE_2 "SamyExpiredCard.mag"
19+
#define MAG_EXAMPLE_FILE_3 "SamyExampleImage.mag"
20+
1821
typedef void (*MagLoadingCallback)(void* context, bool state);
1922

2023
typedef struct {

non_catalog_apps/magspoof_flipper/mag_i.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ void mag_show_loading_popup(void* context, bool show);
102102

103103
void mag_make_app_folder(Mag* mag);
104104

105+
void mag_migrate_and_copy_files(Mag* mag);
106+
105107
void mag_popup_timeout_callback(void* context);
106108

107109
void mag_widget_callback(GuiButtonType result, InputType type, void* context);

0 commit comments

Comments
 (0)