Skip to content

Commit

Permalink
Bump version, new file icon, small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyweiss committed Jan 31, 2023
1 parent c643942 commit 982a926
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 26 deletions.
40 changes: 20 additions & 20 deletions helpers/mag_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,24 +346,24 @@ void mag_spoof_bitwise(Mag* mag) {
uint8_t byte = i / 8;
uint8_t bitmask = 1 << (7 - (i % 8));
/* this comment is mostly for zw's convenience:
*
* bits are stored in their arrays like on a card (LSB first). This is not how usually bits are stored in a
* byte, with the MSB first. the var bitmask creates the pattern to iterate through each bit, LSB first, like so
* 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01, 0x80... masking bits one by one from the current byte
*
* i've chosen this LSB approach since bits and bytes are hard enough to visualize with the 5/8 and 7/8 encoding
* MSR uses. It's a biiit more complicated to process, but visualizing it with printf or a debugger is
* infinitely easier
*
* Encoding the following pairs of 5 bits as 5/8: A1234 B1234 C1234 D1234
* using this LSB format looks like: A1234B12 34C1234D 12340000
* using the MSB format, looks like: 21B4321A D4321C43 00004321
* this means reading each byte backwards when printing/debugging, and the jumping 16 bits ahead, reading 8 more
* bits backward, jumping 16 more bits ahead.
*
* I find this much more convenient for debugging, with the tiny incovenience of reading the bits in reverse
* order. THus, the reason for the bitmask above
*/
*
* bits are stored in their arrays like on a card (LSB first). This is not how usually bits are stored in a
* byte, with the MSB first. the var bitmask creates the pattern to iterate through each bit, LSB first, like so
* 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01, 0x80... masking bits one by one from the current byte
*
* i've chosen this LSB approach since bits and bytes are hard enough to visualize with the 5/8 and 7/8 encoding
* MSR uses. It's a biiit more complicated to process, but visualizing it with printf or a debugger is
* infinitely easier
*
* Encoding the following pairs of 5 bits as 5/8: A1234 B1234 C1234 D1234
* using this LSB format looks like: A1234B12 34C1234D 12340000
* using the MSB format, looks like: 21B4321A D4321C43 00004321
* this means reading each byte backwards when printing/debugging, and the jumping 16 bits ahead, reading 8 more
* bits backward, jumping 16 more bits ahead.
*
* I find this much more convenient for debugging, with the tiny incovenience of reading the bits in reverse
* order. THus, the reason for the bitmask above
*/

bit = !!(bits_t1_manchester[byte] & bitmask);

Expand Down Expand Up @@ -404,7 +404,7 @@ void mag_spoof_bitwise(Mag* mag) {
FURI_CRITICAL_EXIT();
free(data1);
free(data2);
tx_reset(setting);
tx_deinit(setting);
}

// due for deprecation
Expand Down Expand Up @@ -460,7 +460,7 @@ void mag_spoof(Mag* mag) {
FURI_CRITICAL_EXIT();

// Reset configured TX method
if(!tx_reset(setting)) break;
if(!tx_deinit(setting)) break;
spoofed = true;
} while(0);

Expand Down
2 changes: 1 addition & 1 deletion helpers/mag_types.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#define MAG_VERSION_APP "0.01"
#define MAG_VERSION_APP "0.02"
#define MAG_DEVELOPER "Zachary Weiss"
#define MAG_GITHUB "github.com/zacharyweiss/magspoof_flipper"

Expand Down
Binary file added icons/mag_file_10px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/mag_file_1_10px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion mag_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ bool mag_file_select(MagDevice* mag_dev) {
mag_app_folder = furi_string_alloc_set(MAG_APP_FOLDER);

DialogsFileBrowserOptions browser_options;
dialog_file_browser_set_basic_options(&browser_options, MAG_APP_EXTENSION, &I_mag_10px);
dialog_file_browser_set_basic_options(&browser_options, MAG_APP_EXTENSION, &I_mag_file_10px);
browser_options.base_path = MAG_APP_FOLDER;

bool res = dialog_file_browser_show(
Expand Down
7 changes: 4 additions & 3 deletions scenes/mag_scene_emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void mag_scene_emulate_on_enter(void* context) {

// TODO: Display other relevant config settings (namely RFID vs GPIO)?

widget_add_icon_element(widget, 1, 1, &I_mag_10px);
widget_add_icon_element(widget, 2, 1, &I_mag_file_10px);
widget_add_string_element(
widget, 13, 2, AlignLeft, AlignTop, FontPrimary, furi_string_get_cstr(tmp_str));
furi_string_reset(tmp_str);
Expand All @@ -28,10 +28,11 @@ void mag_scene_emulate_on_enter(void* context) {
if(is_active_one | is_active_two | is_active_both) {
furi_string_cat_printf(
tmp_str,
"Track %d:%s%s\n\n",
"Track %d:%s%s%s",
(i + 1),
furi_string_empty(trackstr) ? " " : "\n",
furi_string_empty(trackstr) ? "< empty >" : furi_string_get_cstr(trackstr));
furi_string_empty(trackstr) ? "< empty >" : furi_string_get_cstr(trackstr),
(i + 1 == MAG_DEV_TRACKS) ? "\n" : "\n\n");
}
}

Expand Down
2 changes: 1 addition & 1 deletion scenes/mag_scene_saved_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void mag_scene_saved_info_on_enter(void* context) {
// Use strlcpy instead perhaps, to truncate to screen width, then add ellipses if needed?
furi_string_printf(tmp_str, "%s\r\n", mag->mag_dev->dev_name);

widget_add_icon_element(widget, 1, 1, &I_mag_10px);
widget_add_icon_element(widget, 2, 1, &I_mag_file_10px);
widget_add_string_element(
widget, 13, 2, AlignLeft, AlignTop, FontPrimary, furi_string_get_cstr(tmp_str));
furi_string_reset(tmp_str);
Expand Down

0 comments on commit 982a926

Please sign in to comment.