Skip to content

Commit

Permalink
Merge branch 'RogueMaster:420' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
tkerby authored Dec 17, 2023
2 parents 2ba28e2 + 55e9ceb commit 5f29a85
Show file tree
Hide file tree
Showing 638 changed files with 14,767 additions and 11,621 deletions.
Binary file added .blank_files/MjK_blank_128x64/frame_0.bm
Binary file not shown.
Binary file added .blank_files/MjK_blank_128x64/frame_1.bm
Binary file not shown.
14 changes: 14 additions & 0 deletions .blank_files/MjK_blank_128x64/meta.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Filetype: Flipper Animation
Version: 1

Width: 128
Height: 64
Passive frames: 2
Active frames: 1
Frames order: 0 1 0
Active cycles: 1
Frame rate: 1
Duration: 3600
Active cooldown: 1

Bubble slots: 0
9 changes: 9 additions & 0 deletions .blank_files/manifest_None.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Filetype: Flipper Animation Manifest
Version: 1

Name: MjK_blank_128x64
Min butthurt: 0
Max butthurt: 14
Min level: 1
Max level: 30
Weight: 99
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
*.cmd eol=crlf
*.txt eol=crlf
*.ir eol=crlf
ReadMe.md merge=ours
26 changes: 17 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
## Warning!!! Please read this before installing!!!
**This release has some unresolved issues:**
**This release has some unresolved issues, if any of those affects your daily usage, stay at 065 release or wait for next releases:** <br>
**Issues from this list will be fixed in next releases**
### Known NFC app regressions and issues:
- Mifare Classic with custom UID add manually option was temporarily removed (Unleashed)
- Mifare Mini clones reading is broken (OFW)
- Mifare Classic dict attack fast skip causes glitches/incorrect reading (OFW)
- Mifare Mini clones reading is broken (original mini working fine) (OFW)
- Mifare Classic dict attack fast skip (multiple presses on OK button) causes glitches/incorrect reading (OFW)
- EMV simple data parser was removed with protocol with refactoring (OFW)
- NFC V(Slix), Mifare Classic Emulation issues (unconfirmed) (OFW)
- Mifare Classic Emulation slow response (unconfirmed) (OFW)
- Option to unlock Slix-L (NFC V) with preset or custom password was removed with refactoring (OFW)
- NFC CLI was removed with refactoring (OFW)
### Some apps that was made for old nfc stack is now not compatible with the new API and require complete remake:
**If you want to help with making this apps work again please send PR to the repo at link below**
- Current list of affected apps: https://github.com/xMasterX/all-the-plugins/tree/dev/apps_broken_by_last_refactors
Expand All @@ -15,16 +17,23 @@
## New changes
* NFC: Added new parsers for transport cards - Umarsh, Kazan, Moscow, Metromoney(Tbilisi), and fixes for OFW parsers (by @assasinfil and @Leptopt1los) (special thanks for users who provided various dumps of those cards for research)
* NFC: Added simple key name display to UI to fix regression
* NFC: Add keys to mf_classic_dict (by @hnlcory | PR #660)
* NFC: Add Saflok and MyKey KDFs (by @noproto | PR #662)
* NFC: social_moscow parser verification collisions fix (by @Leptopt1los)
* iButton: Fix UI text - protocol name getting out of screen bounds when key name is too large, and other related issues (by @krolchonok | PR #649)
* SubGHz: Fixed feature naming in menu
* SubGHz: Added honeywell protocol [(by @htotoo)](https://github.com/Flipper-XFW/Xtreme-Firmware/commit/ceee551befa0cb8fd8514a4f8a1250fd9e0997ee)
* SubGHz: Add 303.9 Mhz to default frequency list
* SubGHz: Fix Keeloq decoding order bug (random switch to HCS101 or anmotors)
* SubGHz: Fix secplus v1 key display issue
* API: Add new get function for varitemlist (by @Willy-JL)
* Misc code cleanup
* Apps: **Bluetooth Remote / USB Keyboard & Mouse** - `Movie` and `PTT` modes by @hryamzik
* Apps: **BLE Spam app** updated to latest version (New devices support, + Menu by holding Start) (by @Willy-JL) -> (app can be found in builds ` `, `e`, `n`, `r`)
* Apps: **NFC Magic** - Gen4 Actions (option to fix card with broken config) (by @Leptopt1los and @xMasterX)
* Apps: **Check out Apps updates by following** [this link](https://github.com/xMasterX/all-the-plugins/commits/dev)
* OFW: NFC fixes
* OFW: nfc: m1k-based Aime (non-AIC) card support
* OFW: SubGhz: fix count bit for detect gate_tx protocol
* OFW: Fixed a zero allocation error when reading an iso15693 nfc tag with no additional blocks.
* OFW: Ntag21x write
Expand Down Expand Up @@ -66,9 +75,8 @@
* OFW: fbt: glob & git improvements
* OFW: FastFAP: human readable error log

### Thanks to the UNLEASHED sponsors for our UNLEASHED changes:
Pathfinder [Count Zero cDc],
callmezimbra, Quen0n, MERRON, grvpvl (lvpvrg), art_col, ThurstonWaffles, Moneron, UterGrooll, LUCFER, Northpirate, zloepuzo, T.Rat, Alexey B., ionelife, ...
and all other great people who supported our project and me (xMasterX), thanks to you all!
### Thanks to the UNLEASHED sponsors for supporting UNLEASHED changes!

### THANKS TO ALL RM SPONSORS FOR BEING AWESOME! THANK YOU TO THE COMMUNITY THAT KEEPS GROWING OUR PROJECT!
### THANKS TO ALL RM SPONSORS FOR BEING AWESOME!

# MOST OF ALL, THANK YOU TO THE COMMUNITY THAT KEEPS GROWING OUR PROJECT!
75 changes: 32 additions & 43 deletions ReadMe.md

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions applications/external/atomicdiceroller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,19 @@ button | function
**Ok** *[short short]* | Roll the dice
**Left** *[long press]* | Set CRC32 as hash method
**Right** *[long press]* | Set MD5 as hash method
**Up** *[long press]* | Set 0-1 as output range (coin flipper)
**Down** *[long press]* | Set 1-6 as output range (dice roller)
**Back** *[long press]* | Exit

If you don't want to build this application, just simply copy **flipper_atomicdiceroller.fap** on your **Flipper Zero**

Build has been made with official toolchain, **API Mismatch** error may appear if you are using custom firmware. You can bypass this error but the program may crash.

## Changelog

* 2023-12-13
* Output range can be selected, other range will be added later
* MD5 library is now a local library because this library has been removed in the toolchain

* 2023-08-05
* Initial release
173 changes: 146 additions & 27 deletions applications/external/atomicdiceroller/flipper_atomicdiceroller.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <furi_hal_power.h>
#include <locale/locale.h>
#include <toolbox/crc32_calc.h>
#include <lib/toolbox/md5.h>
#include "md5.h"

#define SCREEN_SIZE_X 128
#define SCREEN_SIZE_Y 64
Expand All @@ -32,10 +32,12 @@ typedef struct {
typedef struct {
FuriMutex* mutex;
uint32_t cps;
uint32_t diceAvailiable;
uint8_t diceAvailiable;
uint8_t dice;
uint8_t method;
uint8_t pause;
uint8_t tickCounter;
uint8_t range;
} mutexStruct;

static void draw_callback(Canvas* canvas, void* ctx) {
Expand All @@ -50,18 +52,70 @@ static void draw_callback(Canvas* canvas, void* ctx) {
snprintf(buffer, sizeof(buffer), "%ld cps", mutexDraw.cps);
canvas_draw_str_aligned(canvas, 0, 10, AlignLeft, AlignBottom, buffer);

snprintf(buffer, sizeof(buffer), "%lu/64", mutexDraw.diceAvailiable);
snprintf(buffer, sizeof(buffer), "%u/64", mutexDraw.diceAvailiable);
canvas_draw_str_aligned(canvas, SCREEN_SIZE_X, 10, AlignRight, AlignBottom, buffer);

if(mutexDraw.method == 0) {
if(mutexDraw.tickCounter < 2) {
buffer[0] = '-';
buffer[1] = '-';
buffer[2] = '-';
buffer[3] = '\0';
} else if(mutexDraw.tickCounter < 4) {
buffer[0] = '+';
buffer[1] = '-';
buffer[2] = '-';
buffer[3] = '\0';
} else if(mutexDraw.tickCounter < 6) {
buffer[0] = '+';
buffer[1] = '+';
buffer[2] = '-';
buffer[3] = '\0';
} else {
buffer[0] = '+';
buffer[1] = '+';
buffer[2] = '+';
buffer[3] = '\0';
}
} else {
if(mutexDraw.tickCounter < 8) {
buffer[0] = '-';
buffer[1] = '-';
buffer[2] = '-';
buffer[3] = '\0';
} else if(mutexDraw.tickCounter < 16) {
buffer[0] = '+';
buffer[1] = '-';
buffer[2] = '-';
buffer[3] = '\0';
} else if(mutexDraw.tickCounter < 24) {
buffer[0] = '+';
buffer[1] = '+';
buffer[2] = '-';
buffer[3] = '\0';
} else {
buffer[0] = '+';
buffer[1] = '+';
buffer[2] = '+';
buffer[3] = '\0';
}
}
canvas_draw_str_aligned(canvas, SCREEN_SIZE_X - 5, 20, AlignRight, AlignBottom, buffer);

if(mutexDraw.method == 0)
canvas_draw_str_aligned(canvas, 0, 20, AlignLeft, AlignBottom, "Hash: CRC32");
canvas_draw_str_aligned(canvas, 0, 22, AlignLeft, AlignBottom, "Hash: CRC32");
else
canvas_draw_str_aligned(canvas, 0, 20, AlignLeft, AlignBottom, "Hash: MD5");
canvas_draw_str_aligned(canvas, 0, 22, AlignLeft, AlignBottom, "Hash: MD5");

if(mutexDraw.dice != 0 && mutexDraw.pause == 0) {
if(mutexDraw.range == 0)
canvas_draw_str_aligned(canvas, 0, 34, AlignLeft, AlignBottom, "Range: 0-1");
else
canvas_draw_str_aligned(canvas, 0, 34, AlignLeft, AlignBottom, "Range: 1-6");

if(mutexDraw.pause == 0) {
canvas_set_font(canvas, FontBigNumbers);
snprintf(buffer, sizeof(buffer), "%u", mutexDraw.dice);
canvas_draw_str_aligned(canvas, SCREEN_SIZE_X / 2, 50, AlignCenter, AlignBottom, buffer);
canvas_draw_str_aligned(canvas, SCREEN_SIZE_X / 2, 54, AlignCenter, AlignBottom, buffer);
}
}

Expand Down Expand Up @@ -114,6 +168,8 @@ int32_t flipper_atomicdiceroller_app() {
mutexVal.dice = 0;
mutexVal.diceAvailiable = 0;
mutexVal.method = 0;
mutexVal.tickCounter = 0;
mutexVal.range = 0;
uint32_t counter = 0;

mutexVal.mutex = furi_mutex_alloc(FuriMutexTypeNormal);
Expand All @@ -137,12 +193,8 @@ int32_t flipper_atomicdiceroller_app() {
FuriTimer* timerPause = furi_timer_alloc(clock_tick_pause, FuriTimerTypePeriodic, event_queue);

// ENABLE 5V pin
// Enable 5v power, multiple attempts to avoid issues with power chip protection false triggering
uint8_t attempts = 0;
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
furi_hal_power_enable_otg();
furi_delay_ms(10);
}
furi_hal_power_enable_otg();

uint8_t diceBuffer[64];
for(uint8_t i = 0; i < 64; i++) diceBuffer[i] = 0;

Expand All @@ -152,6 +204,7 @@ int32_t flipper_atomicdiceroller_app() {
uint8_t tickCounter = 0;
uint32_t CRC32 = 0;
uint8_t method = 0;
uint8_t range = 0;

// MD5
md5_context* md5_ctx = malloc(sizeof(md5_context));
Expand Down Expand Up @@ -198,8 +251,9 @@ int32_t flipper_atomicdiceroller_app() {
tickCounter = 0;
furi_mutex_acquire(mutexVal.mutex, FuriWaitForever);
mutexVal.method = 0;
mutexVal.dice = 0;
mutexVal.pause = 1;
mutexVal.diceAvailiable = 0;
mutexVal.tickCounter = 0;
furi_mutex_release(mutexVal.mutex);
screenRefresh = 1;
}
Expand All @@ -213,8 +267,41 @@ int32_t flipper_atomicdiceroller_app() {
tickCounter = 0;
furi_mutex_acquire(mutexVal.mutex, FuriWaitForever);
mutexVal.method = 1;
mutexVal.dice = 0;
mutexVal.pause = 1;
mutexVal.diceAvailiable = 0;
mutexVal.tickCounter = 0;
furi_mutex_release(mutexVal.mutex);
screenRefresh = 1;
}
} else if(event.input.key == InputKeyUp && event.input.type == InputTypeLong) {
if(range > 0) {
range--;
diceBufferPositionWrite = 0;
diceBufferPositionRead = 0;
diceBufferCounter = 0;
md5_starts(md5_ctx);
tickCounter = 0;
furi_mutex_acquire(mutexVal.mutex, FuriWaitForever);
mutexVal.pause = 1;
mutexVal.diceAvailiable = 0;
mutexVal.tickCounter = 0;
mutexVal.range = range;
furi_mutex_release(mutexVal.mutex);
screenRefresh = 1;
}
} else if(event.input.key == InputKeyDown && event.input.type == InputTypeLong) {
if(range < 1) {
range++;
diceBufferPositionWrite = 0;
diceBufferPositionRead = 0;
diceBufferCounter = 0;
md5_starts(md5_ctx);
tickCounter = 0;
furi_mutex_acquire(mutexVal.mutex, FuriWaitForever);
mutexVal.pause = 1;
mutexVal.diceAvailiable = 0;
mutexVal.tickCounter = 0;
mutexVal.range = range;
furi_mutex_release(mutexVal.mutex);
screenRefresh = 1;
}
Expand All @@ -223,6 +310,7 @@ int32_t flipper_atomicdiceroller_app() {
} else if(event.type == ClockEventTypeTick) {
furi_mutex_acquire(mutexVal.mutex, FuriWaitForever);
mutexVal.cps = counter;
mutexVal.tickCounter = tickCounter;
furi_mutex_release(mutexVal.mutex);

counter = 0;
Expand All @@ -249,13 +337,9 @@ int32_t flipper_atomicdiceroller_app() {
tickCounter++;

if(tickCounter == 8) {
uint8_t localDice = CRC32 & 0b111;

if(localDice == 0 || localDice == 7) {
localDice = (diceBuffer[diceBufferPositionRead] >> 3) & 0b111;
}
if(range == 0) {
uint8_t localDice = CRC32 & 0b1;

if(localDice >= 1 && localDice <= 6) {
diceBuffer[diceBufferPositionWrite] = localDice;
diceBufferCounter++;
if(diceBufferPositionWrite != 63)
Expand All @@ -268,6 +352,27 @@ int32_t flipper_atomicdiceroller_app() {
furi_mutex_release(mutexVal.mutex);

screenRefresh = 1;
} else if(range == 1) {
uint8_t localDice = CRC32 & 0b111;

if(localDice == 0 || localDice == 7) {
localDice = (diceBuffer[diceBufferPositionRead] >> 3) & 0b111;
}

if(localDice >= 1 && localDice <= 6) {
diceBuffer[diceBufferPositionWrite] = localDice;
diceBufferCounter++;
if(diceBufferPositionWrite != 63)
diceBufferPositionWrite++;
else
diceBufferPositionWrite = 0;

furi_mutex_acquire(mutexVal.mutex, FuriWaitForever);
mutexVal.diceAvailiable = diceBufferCounter;
furi_mutex_release(mutexVal.mutex);

screenRefresh = 1;
}
}

CRC32 = 0;
Expand All @@ -290,8 +395,8 @@ int32_t flipper_atomicdiceroller_app() {
uint8_t localDice = 0;

for(uint8_t i = 0; i < 16; i++) {
localDice = hash[i] & 0b111;
if(localDice >= 1 && localDice <= 6) {
if(range == 0) {
localDice = hash[i] & 0b1;
diceBuffer[diceBufferPositionWrite] = localDice;
diceBufferCounter++;
if(diceBufferPositionWrite != 63)
Expand All @@ -305,6 +410,23 @@ int32_t flipper_atomicdiceroller_app() {

screenRefresh = 1;
break;
} else if(range == 1) {
localDice = hash[i] & 0b111;
if(localDice >= 1 && localDice <= 6) {
diceBuffer[diceBufferPositionWrite] = localDice;
diceBufferCounter++;
if(diceBufferPositionWrite != 63)
diceBufferPositionWrite++;
else
diceBufferPositionWrite = 0;

furi_mutex_acquire(mutexVal.mutex, FuriWaitForever);
mutexVal.diceAvailiable = diceBufferCounter;
furi_mutex_release(mutexVal.mutex);

screenRefresh = 1;
break;
}
}
}

Expand All @@ -330,10 +452,7 @@ int32_t flipper_atomicdiceroller_app() {

furi_record_close(RECORD_NOTIFICATION);

// Disable 5v power
if(furi_hal_power_is_otg_enabled()) {
furi_hal_power_disable_otg();
}
furi_hal_power_disable_otg();

furi_hal_gpio_disable_int_callback(&gpio_ext_pa7);
furi_hal_gpio_remove_int_callback(&gpio_ext_pa7);
Expand Down
Loading

0 comments on commit 5f29a85

Please sign in to comment.