Skip to content

Commit

Permalink
upd magspoof
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed May 3, 2024
1 parent 66ef95b commit 576174a
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 2 deletions.
3 changes: 2 additions & 1 deletion non_catalog_apps/magspoof_flipper/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ App(
],
provides=[],
stack_size=6 * 1024,
order=64, # keep it at the bottom of the list while still WIP
order=64,
fap_icon="icons/mag_10px.png",
fap_category="GPIO",
fap_icon_assets="icons",
Expand All @@ -21,4 +21,5 @@ App(
fap_description="Enables wireless transmission of magstripe data",
fap_author="Zachary Weiss",
fap_weburl="https://github.com/zacharyweiss/magspoof_flipper",
fap_file_assets="resources",
)
Binary file modified non_catalog_apps/magspoof_flipper/icons/mag_10px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions non_catalog_apps/magspoof_flipper/mag.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ int32_t mag_app(void* p) {
}

mag_make_app_folder(mag);
mag_migrate_and_copy_files(mag);

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

void mag_migrate_and_copy_files(Mag* mag) {
furi_assert(mag);
Storage* storage = mag->storage;

storage_common_migrate(storage, EXT_PATH("magspoof"), STORAGE_APP_DATA_PATH_PREFIX);
storage_common_migrate(storage, EXT_PATH("mag"), STORAGE_APP_DATA_PATH_PREFIX);

if(!storage_common_exists(storage, APP_DATA_PATH(MAG_EXAMPLE_FILE_1))) {
storage_common_copy(
storage, APP_ASSETS_PATH(MAG_EXAMPLE_FILE_1), APP_DATA_PATH(MAG_EXAMPLE_FILE_1));
}

if(!storage_common_exists(storage, APP_DATA_PATH(MAG_EXAMPLE_FILE_2))) {
storage_common_copy(
storage, APP_ASSETS_PATH(MAG_EXAMPLE_FILE_2), APP_DATA_PATH(MAG_EXAMPLE_FILE_2));
}

if(!storage_common_exists(storage, APP_DATA_PATH(MAG_EXAMPLE_FILE_3))) {
storage_common_copy(
storage, APP_ASSETS_PATH(MAG_EXAMPLE_FILE_3), APP_DATA_PATH(MAG_EXAMPLE_FILE_3));
}
}

void mag_text_store_set(Mag* mag, const char* text, ...) {
furi_assert(mag);
va_list args;
Expand Down
5 changes: 4 additions & 1 deletion non_catalog_apps/magspoof_flipper/mag_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
#include "mag_icons.h"
#include "helpers/mag_types.h"


#define MAG_DEV_NAME_MAX_LEN 22
#define MAG_DEV_TRACKS 3

#define MAG_APP_FOLDER STORAGE_APP_DATA_PATH_PREFIX
#define MAG_APP_EXTENSION ".mag"

#define MAG_EXAMPLE_FILE_1 "TestMagstripe.mag"
#define MAG_EXAMPLE_FILE_2 "SamyExpiredCard.mag"
#define MAG_EXAMPLE_FILE_3 "SamyExampleImage.mag"

typedef void (*MagLoadingCallback)(void* context, bool state);

typedef struct {
Expand Down
2 changes: 2 additions & 0 deletions non_catalog_apps/magspoof_flipper/mag_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ void mag_show_loading_popup(void* context, bool show);

void mag_make_app_folder(Mag* mag);

void mag_migrate_and_copy_files(Mag* mag);

void mag_popup_timeout_callback(void* context);

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

0 comments on commit 576174a

Please sign in to comment.