Skip to content

Commit

Permalink
Get rid of laod_path when dealing with non-seader save
Browse files Browse the repository at this point in the history
  • Loading branch information
bettse committed Aug 25, 2024
1 parent 018f9f6 commit 881263d
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions seader_credential.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ bool seader_credential_save_mfc(SeaderCredential* cred, const char* name) {
uint8_t empty_block[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint8_t pacs_block[16] = {0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

bool use_load_path = true;
bool saved = false;
FlipperFormat* file = flipper_format_file_alloc(cred->storage);
FuriString* temp_str;
Expand All @@ -209,15 +208,8 @@ bool seader_credential_save_mfc(SeaderCredential* cred, const char* name) {
memcpy(pacs_block + 8, &swapped, sizeof(swapped));

do {
if(use_load_path && !furi_string_empty(cred->load_path)) {
// Get directory name
path_extract_dirname(furi_string_get_cstr(cred->load_path), temp_str);
// Make path to file to save
furi_string_cat_printf(temp_str, "/%s%s", name, SEADER_APP_MFC_EXTENSION);
} else {
furi_string_printf(
temp_str, "%s/%s%s", SEADER_APP_MFC_FOLDER, name, SEADER_APP_MFC_EXTENSION);
}
furi_string_printf(
temp_str, "%s/%s%s", SEADER_APP_MFC_FOLDER, name, SEADER_APP_MFC_EXTENSION);

FURI_LOG_D(TAG, "Save as MFC [%s]", furi_string_get_cstr(temp_str));

Expand Down Expand Up @@ -395,7 +387,6 @@ bool seader_credential_save_picopass(SeaderCredential* cred, const char* name) {
uint8_t aia[PICOPASS_BLOCK_LEN] = {0xFF, 0xff, 0xff, 0xff, 0xFF, 0xFf, 0xff, 0xFF};
uint8_t pacs_cfg[PICOPASS_BLOCK_LEN] = {0x03, 0x03, 0x03, 0x03, 0x00, 0x03, 0xe0, 0x14};

bool use_load_path = true;
bool saved = false;
bool withSIO = cred->save_format == SeaderCredentialSaveFormatSR;
if(withSIO) {
Expand All @@ -406,14 +397,7 @@ bool seader_credential_save_picopass(SeaderCredential* cred, const char* name) {
FuriString* temp_str = furi_string_alloc();

storage_simply_mkdir(cred->storage, EXT_PATH("apps_data/picopass"));
if(use_load_path && !furi_string_empty(cred->load_path)) {
// Get directory name
path_extract_dirname(furi_string_get_cstr(cred->load_path), temp_str);
// Make path to file to save
furi_string_cat_printf(temp_str, "/%s%s", name, ".picopass");
} else {
furi_string_printf(temp_str, "%s/%s%s", EXT_PATH("apps_data/picopass"), name, ".picopass");
}
furi_string_printf(temp_str, "%s/%s%s", EXT_PATH("apps_data/picopass"), name, ".picopass");

FURI_LOG_D(TAG, "Save as Picopass [%s]", furi_string_get_cstr(temp_str));
uint64_t sentinel = 1ULL << cred->bit_length;
Expand Down

0 comments on commit 881263d

Please sign in to comment.