Parcourir la source

moved into base_pack folder

MX il y a 2 ans
Parent
commit
c7ea2ec176
100 fichiers modifiés avec 0 ajouts et 8465 suppressions
  1. 0 14
      main_apps_sources/arkanoid/application.fam
  2. BIN
      main_apps_sources/arkanoid/arkanoid_10px.png
  3. 0 479
      main_apps_sources/arkanoid/arkanoid_game.c
  4. BIN
      main_apps_sources/arkanoid/img/1.png
  5. BIN
      main_apps_sources/arkanoid/img/2.png
  6. 0 22
      main_apps_sources/barcode_gen/LICENSE
  7. 0 88
      main_apps_sources/barcode_gen/README.md
  8. 0 16
      main_apps_sources/barcode_gen/application.fam
  9. 0 348
      main_apps_sources/barcode_gen/barcode_app.c
  10. 0 88
      main_apps_sources/barcode_gen/barcode_app.h
  11. 0 22
      main_apps_sources/barcode_gen/barcode_encoding_files/codabar_encodings.txt
  12. 0 202
      main_apps_sources/barcode_gen/barcode_encoding_files/code128_encodings.txt
  13. 0 106
      main_apps_sources/barcode_gen/barcode_encoding_files/code128c_encodings.txt
  14. 0 44
      main_apps_sources/barcode_gen/barcode_encoding_files/code39_encodings.txt
  15. 0 147
      main_apps_sources/barcode_gen/barcode_utils.c
  16. 0 55
      main_apps_sources/barcode_gen/barcode_utils.h
  17. 0 532
      main_apps_sources/barcode_gen/barcode_validator.c
  18. 0 15
      main_apps_sources/barcode_gen/barcode_validator.h
  19. 0 22
      main_apps_sources/barcode_gen/encoding_tables/codabar_encodings.txt
  20. 0 202
      main_apps_sources/barcode_gen/encoding_tables/code128_encodings.txt
  21. 0 106
      main_apps_sources/barcode_gen/encoding_tables/code128c_encodings.txt
  22. 0 44
      main_apps_sources/barcode_gen/encoding_tables/code39_encodings.txt
  23. 0 52
      main_apps_sources/barcode_gen/encodings.c
  24. 0 6
      main_apps_sources/barcode_gen/encodings.h
  25. BIN
      main_apps_sources/barcode_gen/images/barcode_10.png
  26. BIN
      main_apps_sources/barcode_gen/img/1.png
  27. BIN
      main_apps_sources/barcode_gen/img/2.png
  28. BIN
      main_apps_sources/barcode_gen/img/3.png
  29. BIN
      main_apps_sources/barcode_gen/img/Codabar Data Example.png
  30. BIN
      main_apps_sources/barcode_gen/img/Creating Barcode.png
  31. BIN
      main_apps_sources/barcode_gen/img/Flipper Barcode.png
  32. BIN
      main_apps_sources/barcode_gen/img/Flipper Box Barcode.png
  33. BIN
      main_apps_sources/barcode_gen/screenshots/Codabar Data Example.png
  34. BIN
      main_apps_sources/barcode_gen/screenshots/Creating Barcode.png
  35. BIN
      main_apps_sources/barcode_gen/screenshots/Flipper Barcode.png
  36. BIN
      main_apps_sources/barcode_gen/screenshots/Flipper Box Barcode.png
  37. 0 510
      main_apps_sources/barcode_gen/views/barcode_view.c
  38. 0 23
      main_apps_sources/barcode_gen/views/barcode_view.h
  39. 0 494
      main_apps_sources/barcode_gen/views/create_view.c
  40. 0 46
      main_apps_sources/barcode_gen/views/create_view.h
  41. 0 66
      main_apps_sources/barcode_gen/views/message_view.c
  42. 0 22
      main_apps_sources/barcode_gen/views/message_view.h
  43. 0 22
      main_apps_sources/bomberduck/LICENSE
  44. 0 2
      main_apps_sources/bomberduck/README.md
  45. 0 17
      main_apps_sources/bomberduck/application.fam
  46. BIN
      main_apps_sources/bomberduck/assets/bomb0.png
  47. BIN
      main_apps_sources/bomberduck/assets/bomb1.png
  48. BIN
      main_apps_sources/bomberduck/assets/bomb2.png
  49. BIN
      main_apps_sources/bomberduck/assets/box.png
  50. BIN
      main_apps_sources/bomberduck/assets/end.png
  51. BIN
      main_apps_sources/bomberduck/assets/enemy1.png
  52. BIN
      main_apps_sources/bomberduck/assets/enemyleft.png
  53. BIN
      main_apps_sources/bomberduck/assets/enemyright.png
  54. BIN
      main_apps_sources/bomberduck/assets/explore.png
  55. BIN
      main_apps_sources/bomberduck/assets/playerleft.png
  56. BIN
      main_apps_sources/bomberduck/assets/playerright.png
  57. BIN
      main_apps_sources/bomberduck/assets/unbreakbox.png
  58. BIN
      main_apps_sources/bomberduck/bomb.png
  59. 0 647
      main_apps_sources/bomberduck/bomberduck.c
  60. BIN
      main_apps_sources/bomberduck/img/1.png
  61. BIN
      main_apps_sources/bomberduck/img/2.png
  62. 0 4
      main_apps_sources/doom/.gitignore
  63. 0 10
      main_apps_sources/doom/README.md
  64. 0 18
      main_apps_sources/doom/application.fam
  65. 0 331
      main_apps_sources/doom/assets.c
  66. 0 108
      main_apps_sources/doom/assets.h
  67. BIN
      main_apps_sources/doom/assets/door2.png
  68. BIN
      main_apps_sources/doom/assets/door_inv.png
  69. BIN
      main_apps_sources/doom/assets/fire_inv.png
  70. BIN
      main_apps_sources/doom/assets/fireball_inv.png
  71. BIN
      main_apps_sources/doom/assets/fireball_mask_inv.png
  72. BIN
      main_apps_sources/doom/assets/gradient_inv.png
  73. BIN
      main_apps_sources/doom/assets/gun_inv.png
  74. BIN
      main_apps_sources/doom/assets/gun_mask_inv.png
  75. BIN
      main_apps_sources/doom/assets/imp_inv.png
  76. BIN
      main_apps_sources/doom/assets/imp_mask_inv.png
  77. BIN
      main_apps_sources/doom/assets/item_inv.png
  78. BIN
      main_apps_sources/doom/assets/item_mask_inv.png
  79. BIN
      main_apps_sources/doom/assets/logo_inv.png
  80. 0 91
      main_apps_sources/doom/constants.h
  81. 0 280
      main_apps_sources/doom/display.h
  82. 0 1104
      main_apps_sources/doom/doom.c
  83. BIN
      main_apps_sources/doom/doom_10px.png
  84. 0 504
      main_apps_sources/doom/doom_music_player_worker.c
  85. 0 44
      main_apps_sources/doom/doom_music_player_worker.h
  86. 0 42
      main_apps_sources/doom/entities.c
  87. 0 56
      main_apps_sources/doom/entities.h
  88. BIN
      main_apps_sources/doom/img/1.png
  89. BIN
      main_apps_sources/doom/img/2.png
  90. BIN
      main_apps_sources/doom/img/3.png
  91. 0 188
      main_apps_sources/doom/level.h
  92. 0 34
      main_apps_sources/doom/sound.h
  93. 0 33
      main_apps_sources/doom/types.c
  94. 0 36
      main_apps_sources/doom/types.h
  95. 0 674
      main_apps_sources/dtmf_dolphin/LICENSE
  96. 0 18
      main_apps_sources/dtmf_dolphin/README.md
  97. 0 18
      main_apps_sources/dtmf_dolphin/application.fam
  98. 0 89
      main_apps_sources/dtmf_dolphin/dtmf_dolphin.c
  99. 0 270
      main_apps_sources/dtmf_dolphin/dtmf_dolphin_audio.c
  100. 0 54
      main_apps_sources/dtmf_dolphin/dtmf_dolphin_audio.h

+ 0 - 14
main_apps_sources/arkanoid/application.fam

@@ -1,14 +0,0 @@
-App(
-    appid="arkanoid",
-    name="Arkanoid",
-    apptype=FlipperAppType.EXTERNAL,
-    entry_point="arkanoid_game_app",
-    requires=["gui"],
-    stack_size=1 * 1024,
-    order=30,
-    fap_icon="arkanoid_10px.png",
-    fap_category="Games",
-    fap_author="@xMasterX & @gotnull",
-    fap_version="1.0",
-    fap_description="Arkanoid Game",
-)

BIN
main_apps_sources/arkanoid/arkanoid_10px.png


+ 0 - 479
main_apps_sources/arkanoid/arkanoid_game.c

@@ -1,479 +0,0 @@
-#include <furi.h>
-#include <gui/gui.h>
-#include <input/input.h>
-#include <stdlib.h>
-#include <gui/view.h>
-#include <notification/notification.h>
-#include <notification/notification_messages.h>
-#include <dolphin/dolphin.h>
-
-#define TAG "Arkanoid"
-
-#define FLIPPER_LCD_WIDTH 128
-#define FLIPPER_LCD_HEIGHT 64
-#define MAX_SPEED 3
-
-typedef enum { EventTypeTick, EventTypeKey } EventType;
-
-typedef struct {
-    //Brick Bounds used in collision detection
-    int leftBrick;
-    int rightBrick;
-    int topBrick;
-    int bottomBrick;
-    bool isHit[4][13]; //Array of if bricks are hit or not
-} BrickState;
-
-typedef struct {
-    int dx; //Initial movement of ball
-    int dy; //Initial movement of ball
-    int xb; //Balls starting possition
-    int yb; //Balls starting possition
-    bool released; //If the ball has been released by the player
-    //Ball Bounds used in collision detection
-    int leftBall;
-    int rightBall;
-    int topBall;
-    int bottomBall;
-} BallState;
-
-typedef struct {
-    FuriMutex* mutex;
-    BallState ball_state;
-    BrickState brick_state;
-    NotificationApp* notify;
-    unsigned int COLUMNS; //Columns of bricks
-    unsigned int ROWS; //Rows of bricks
-    bool initialDraw; //If the inital draw has happened
-    int xPaddle; //X position of paddle
-    char text[16]; //General string buffer
-    bool bounced; //Used to fix double bounce glitch
-    int lives; //Amount of lives
-    int level; //Current level
-    unsigned int score; //Score for the game
-    unsigned int brickCount; //Amount of bricks hit
-    int tick; //Tick counter
-    bool gameStarted; // Did the game start?
-    int speed; // Ball speed
-} ArkanoidState;
-
-typedef struct {
-    EventType type;
-    InputEvent input;
-} GameEvent;
-
-static const NotificationSequence sequence_short_sound = {
-    &message_note_c5,
-    &message_delay_50,
-    &message_sound_off,
-    NULL,
-};
-
-// generate number in range [min,max)
-int rand_range(int min, int max) {
-    return min + rand() % (max - min);
-}
-
-void move_ball(Canvas* canvas, ArkanoidState* st) {
-    st->tick++;
-
-    int current_speed = abs(st->speed - 1 - MAX_SPEED);
-    if(st->tick % current_speed != 0 && st->tick % (current_speed + 1) != 0) {
-        return;
-    }
-
-    if(st->ball_state.released) {
-        //Move ball
-        if(abs(st->ball_state.dx) == 2) {
-            st->ball_state.xb += st->ball_state.dx / 2;
-            // 2x speed is really 1.5 speed
-            if((st->tick / current_speed) % 2 == 0) st->ball_state.xb += st->ball_state.dx / 2;
-        } else {
-            st->ball_state.xb += st->ball_state.dx;
-        }
-        st->ball_state.yb = st->ball_state.yb + st->ball_state.dy;
-
-        //Set bounds
-        st->ball_state.leftBall = st->ball_state.xb;
-        st->ball_state.rightBall = st->ball_state.xb + 2;
-        st->ball_state.topBall = st->ball_state.yb;
-        st->ball_state.bottomBall = st->ball_state.yb + 2;
-
-        //Bounce off top edge
-        if(st->ball_state.yb <= 0) {
-            st->ball_state.yb = 2;
-            st->ball_state.dy = -st->ball_state.dy;
-        }
-
-        //Lose a life if bottom edge hit
-        if(st->ball_state.yb >= FLIPPER_LCD_HEIGHT) {
-            canvas_draw_frame(canvas, st->xPaddle, FLIPPER_LCD_HEIGHT - 1, 11, 1);
-            st->xPaddle = 54;
-            st->ball_state.yb = 60;
-            st->ball_state.released = false;
-            st->lives--;
-            st->gameStarted = false;
-
-            if(rand_range(0, 2) == 0) {
-                st->ball_state.dx = 1;
-            } else {
-                st->ball_state.dx = -1;
-            }
-        }
-
-        //Bounce off left side
-        if(st->ball_state.xb <= 0) {
-            st->ball_state.xb = 2;
-            st->ball_state.dx = -st->ball_state.dx;
-        }
-
-        //Bounce off right side
-        if(st->ball_state.xb >= FLIPPER_LCD_WIDTH - 2) {
-            st->ball_state.xb = FLIPPER_LCD_WIDTH - 4;
-            st->ball_state.dx = -st->ball_state.dx;
-            // arduboy.tunes.tone(523, 250);
-        }
-
-        //Bounce off paddle
-        if(st->ball_state.xb + 1 >= st->xPaddle && st->ball_state.xb <= st->xPaddle + 12 &&
-           st->ball_state.yb + 2 >= FLIPPER_LCD_HEIGHT - 1 &&
-           st->ball_state.yb <= FLIPPER_LCD_HEIGHT) {
-            st->ball_state.dy = -st->ball_state.dy;
-            st->ball_state.dx =
-                ((st->ball_state.xb - (st->xPaddle + 6)) / 3); //Applies spin on the ball
-            // prevent straight bounce, but not prevent roguuemaster from stealing
-            if(st->ball_state.dx == 0) {
-                st->ball_state.dx = (rand_range(0, 2) == 1) ? 1 : -1;
-            }
-        }
-
-        //Bounce off Bricks
-        for(unsigned int row = 0; row < st->ROWS; row++) {
-            for(unsigned int column = 0; column < st->COLUMNS; column++) {
-                if(!st->brick_state.isHit[row][column]) {
-                    //Sets Brick bounds
-                    st->brick_state.leftBrick = 10 * column;
-                    st->brick_state.rightBrick = 10 * column + 10;
-                    st->brick_state.topBrick = 6 * row + 1;
-                    st->brick_state.bottomBrick = 6 * row + 7;
-
-                    //If A collison has occured
-                    if(st->ball_state.topBall <= st->brick_state.bottomBrick &&
-                       st->ball_state.bottomBall >= st->brick_state.topBrick &&
-                       st->ball_state.leftBall <= st->brick_state.rightBrick &&
-                       st->ball_state.rightBall >= st->brick_state.leftBrick) {
-                        st->score += st->level;
-                        // Blink led when we hit some brick
-                        notification_message(st->notify, &sequence_short_sound);
-                        //notification_message(st->notify, &sequence_blink_white_100);
-
-                        st->brickCount++;
-                        st->brick_state.isHit[row][column] = true;
-                        canvas_draw_frame(canvas, 10 * column, 2 + 6 * row, 8, 4);
-
-                        //Vertical collision
-                        if(st->ball_state.bottomBall > st->brick_state.bottomBrick ||
-                           st->ball_state.topBall < st->brick_state.topBrick) {
-                            //Only bounce once each ball move
-                            if(!st->bounced) {
-                                st->ball_state.dy = -st->ball_state.dy;
-                                st->ball_state.yb += st->ball_state.dy;
-                                st->bounced = true;
-                            }
-                        }
-
-                        //Hoizontal collision
-                        if(st->ball_state.leftBall < st->brick_state.leftBrick ||
-                           st->ball_state.rightBall > st->brick_state.rightBrick) {
-                            //Only bounce once brick each ball move
-                            if(!st->bounced) {
-                                st->ball_state.dx = -st->ball_state.dx;
-                                st->ball_state.xb += st->ball_state.dx;
-                                st->bounced = true;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        //Reset Bounce
-        st->bounced = false;
-    } else {
-        //Ball follows paddle
-        st->ball_state.xb = st->xPaddle + 5;
-    }
-}
-
-void draw_lives(Canvas* canvas, ArkanoidState* arkanoid_state) {
-    if(arkanoid_state->lives == 3) {
-        canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 7);
-        canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 7);
-        canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 8);
-        canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 8);
-
-        canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 11);
-        canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 11);
-        canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 12);
-        canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 12);
-
-        canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 15);
-        canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 15);
-        canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 16);
-        canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 16);
-    } else if(arkanoid_state->lives == 2) {
-        canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 7);
-        canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 7);
-        canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 8);
-        canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 8);
-
-        canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 11);
-        canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 11);
-        canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 12);
-        canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 12);
-    } else {
-        canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 7);
-        canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 7);
-        canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 8);
-        canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 8);
-    }
-}
-
-void draw_score(Canvas* canvas, ArkanoidState* arkanoid_state) {
-    snprintf(arkanoid_state->text, sizeof(arkanoid_state->text), "%u", arkanoid_state->score);
-    canvas_draw_str_aligned(
-        canvas,
-        FLIPPER_LCD_WIDTH - 2,
-        FLIPPER_LCD_HEIGHT - 6,
-        AlignRight,
-        AlignBottom,
-        arkanoid_state->text);
-}
-
-void draw_ball(Canvas* canvas, ArkanoidState* ast) {
-    canvas_draw_dot(canvas, ast->ball_state.xb, ast->ball_state.yb);
-    canvas_draw_dot(canvas, ast->ball_state.xb + 1, ast->ball_state.yb);
-    canvas_draw_dot(canvas, ast->ball_state.xb, ast->ball_state.yb + 1);
-    canvas_draw_dot(canvas, ast->ball_state.xb + 1, ast->ball_state.yb + 1);
-
-    move_ball(canvas, ast);
-}
-
-void draw_paddle(Canvas* canvas, ArkanoidState* arkanoid_state) {
-    canvas_draw_frame(canvas, arkanoid_state->xPaddle, FLIPPER_LCD_HEIGHT - 1, 11, 1);
-}
-
-void reset_level(Canvas* canvas, ArkanoidState* arkanoid_state) {
-    //Undraw paddle
-    canvas_draw_frame(canvas, arkanoid_state->xPaddle, FLIPPER_LCD_HEIGHT - 1, 11, 1);
-
-    //Undraw ball
-    canvas_draw_dot(canvas, arkanoid_state->ball_state.xb, arkanoid_state->ball_state.yb);
-    canvas_draw_dot(canvas, arkanoid_state->ball_state.xb + 1, arkanoid_state->ball_state.yb);
-    canvas_draw_dot(canvas, arkanoid_state->ball_state.xb, arkanoid_state->ball_state.yb + 1);
-    canvas_draw_dot(canvas, arkanoid_state->ball_state.xb + 1, arkanoid_state->ball_state.yb + 1);
-
-    //Alter various variables to reset the game
-    arkanoid_state->xPaddle = 54;
-    arkanoid_state->ball_state.yb = 60;
-    arkanoid_state->brickCount = 0;
-    arkanoid_state->ball_state.released = false;
-    arkanoid_state->gameStarted = false;
-
-    // Reset all brick hit states
-    for(unsigned int row = 0; row < arkanoid_state->ROWS; row++) {
-        for(unsigned int column = 0; column < arkanoid_state->COLUMNS; column++) {
-            arkanoid_state->brick_state.isHit[row][column] = false;
-        }
-    }
-}
-
-static void arkanoid_state_init(ArkanoidState* arkanoid_state) {
-    // Init notification
-    arkanoid_state->notify = furi_record_open(RECORD_NOTIFICATION);
-
-    // Set the initial game state
-    arkanoid_state->COLUMNS = 13;
-    arkanoid_state->ROWS = 4;
-    arkanoid_state->ball_state.dx = -1;
-    arkanoid_state->ball_state.dy = -1;
-    arkanoid_state->speed = 2;
-    arkanoid_state->bounced = false;
-    arkanoid_state->lives = 3;
-    arkanoid_state->level = 1;
-    arkanoid_state->score = 0;
-    arkanoid_state->COLUMNS = 13;
-    arkanoid_state->COLUMNS = 13;
-
-    // Reset initial state
-    arkanoid_state->initialDraw = false;
-    arkanoid_state->gameStarted = false;
-}
-
-static void arkanoid_draw_callback(Canvas* const canvas, void* ctx) {
-    furi_assert(ctx);
-    ArkanoidState* arkanoid_state = ctx;
-    furi_mutex_acquire(arkanoid_state->mutex, FuriWaitForever);
-
-    //Initial level draw
-    if(!arkanoid_state->initialDraw) {
-        arkanoid_state->initialDraw = true;
-
-        // Set default font for text
-        canvas_set_font(canvas, FontSecondary);
-
-        //Draws the new level
-        reset_level(canvas, arkanoid_state);
-    }
-
-    //Draws new bricks and resets their values
-    for(unsigned int row = 0; row < arkanoid_state->ROWS; row++) {
-        for(unsigned int column = 0; column < arkanoid_state->COLUMNS; column++) {
-            if(!arkanoid_state->brick_state.isHit[row][column]) {
-                canvas_draw_frame(canvas, 10 * column, 2 + 6 * row, 8, 4);
-            }
-        }
-    }
-
-    if(arkanoid_state->lives > 0) {
-        draw_paddle(canvas, arkanoid_state);
-        draw_ball(canvas, arkanoid_state);
-        draw_score(canvas, arkanoid_state);
-        draw_lives(canvas, arkanoid_state);
-
-        if(arkanoid_state->brickCount == arkanoid_state->ROWS * arkanoid_state->COLUMNS) {
-            arkanoid_state->level++;
-            reset_level(canvas, arkanoid_state);
-        }
-    } else {
-        reset_level(canvas, arkanoid_state);
-        arkanoid_state->initialDraw = false;
-        arkanoid_state->lives = 3;
-        arkanoid_state->score = 0;
-    }
-
-    furi_mutex_release(arkanoid_state->mutex);
-}
-
-static void arkanoid_input_callback(InputEvent* input_event, FuriMessageQueue* event_queue) {
-    furi_assert(event_queue);
-
-    GameEvent event = {.type = EventTypeKey, .input = *input_event};
-    furi_message_queue_put(event_queue, &event, FuriWaitForever);
-}
-
-static void arkanoid_update_timer_callback(FuriMessageQueue* event_queue) {
-    furi_assert(event_queue);
-
-    GameEvent event = {.type = EventTypeTick};
-    furi_message_queue_put(event_queue, &event, 0);
-}
-
-int32_t arkanoid_game_app(void* p) {
-    UNUSED(p);
-    int32_t return_code = 0;
-
-    FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(GameEvent));
-
-    ArkanoidState* arkanoid_state = malloc(sizeof(ArkanoidState));
-    arkanoid_state_init(arkanoid_state);
-
-    arkanoid_state->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
-    if(!arkanoid_state->mutex) {
-        FURI_LOG_E(TAG, "Cannot create mutex\r\n");
-        return_code = 255;
-        goto free_and_exit;
-    }
-
-    // Set system callbacks
-    ViewPort* view_port = view_port_alloc();
-    view_port_draw_callback_set(view_port, arkanoid_draw_callback, arkanoid_state);
-    view_port_input_callback_set(view_port, arkanoid_input_callback, event_queue);
-
-    FuriTimer* timer =
-        furi_timer_alloc(arkanoid_update_timer_callback, FuriTimerTypePeriodic, event_queue);
-    furi_timer_start(timer, furi_kernel_get_tick_frequency() / 22);
-
-    // Open GUI and register view_port
-    Gui* gui = furi_record_open(RECORD_GUI);
-    gui_add_view_port(gui, view_port, GuiLayerFullscreen);
-
-    // Call dolphin deed on game start
-    dolphin_deed(DolphinDeedPluginGameStart);
-
-    GameEvent event;
-    for(bool processing = true; processing;) {
-        FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);
-        furi_mutex_acquire(arkanoid_state->mutex, FuriWaitForever);
-
-        if(event_status == FuriStatusOk) {
-            // Key events
-            if(event.type == EventTypeKey) {
-                if(event.input.type == InputTypePress || event.input.type == InputTypeLong ||
-                   event.input.type == InputTypeRepeat) {
-                    switch(event.input.key) {
-                    case InputKeyBack:
-                        processing = false;
-                        break;
-                    case InputKeyRight:
-                        if(arkanoid_state->xPaddle < FLIPPER_LCD_WIDTH - 12) {
-                            arkanoid_state->xPaddle += 8;
-                        }
-                        break;
-                    case InputKeyLeft:
-                        if(arkanoid_state->xPaddle > 0) {
-                            arkanoid_state->xPaddle -= 8;
-                        }
-                        break;
-                    case InputKeyUp:
-                        if(arkanoid_state->speed < MAX_SPEED) {
-                            arkanoid_state->speed++;
-                        }
-                        break;
-                    case InputKeyDown:
-                        if(arkanoid_state->speed > 1) {
-                            arkanoid_state->speed--;
-                        }
-                        break;
-                    case InputKeyOk:
-                        if(arkanoid_state->gameStarted == false) {
-                            //Release ball if FIRE pressed
-                            arkanoid_state->ball_state.released = true;
-
-                            //Apply random direction to ball on release
-                            if(rand_range(0, 2) == 0) {
-                                arkanoid_state->ball_state.dx = 1;
-                            } else {
-                                arkanoid_state->ball_state.dx = -1;
-                            }
-
-                            //Makes sure the ball heads upwards
-                            arkanoid_state->ball_state.dy = -1;
-                            //start the game flag
-                            arkanoid_state->gameStarted = true;
-                        }
-                        break;
-                    default:
-                        break;
-                    }
-                }
-            }
-        }
-
-        view_port_update(view_port);
-        furi_mutex_release(arkanoid_state->mutex);
-    }
-    furi_timer_free(timer);
-    view_port_enabled_set(view_port, false);
-    gui_remove_view_port(gui, view_port);
-    furi_record_close(RECORD_GUI);
-    furi_record_close(RECORD_NOTIFICATION);
-    view_port_free(view_port);
-    furi_mutex_free(arkanoid_state->mutex);
-
-free_and_exit:
-    free(arkanoid_state);
-    furi_message_queue_free(event_queue);
-
-    return return_code;
-}

BIN
main_apps_sources/arkanoid/img/1.png


BIN
main_apps_sources/arkanoid/img/2.png


+ 0 - 22
main_apps_sources/barcode_gen/LICENSE

@@ -1,22 +0,0 @@
-
-MIT License
-
-Copyright (c) 2023 Alan Tsui
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.

+ 0 - 88
main_apps_sources/barcode_gen/README.md

@@ -1,88 +0,0 @@
-<p align="center">
-	<h1 align="center">Barcode Generator</h1>  
-  <p align="center">
-
-A barcode generator for the Flipper Zero that supports **UPC-A**, **EAN-8**, **EAN-13**, **Code-39**, **Codabar**, and **Code-128**[1]
-</p>
-
-Note: Barcode save locations have been moved from `/barcodes` to `/apps_data/barcodes`
-
-## Table of Contents
-- [Table of Contents](#table-of-contents)
-- [Installing](#installing)
-- [Building](#building)
-- [Usage](#usage)
-  - [Creating a barcode](#creating-a-barcode)
-  - [Editing a barcode](#editing-a-barcode)
-  - [Deleting a barcode](#deleting-a-barcode)
-  - [Viewing a barcode](#viewing-a-barcode)
-- [Screenshots](#screenshots)
-- [Credits](#credits)
-
-
-## Installing
-1) Download the `.zip` file from the release section
-2) Extract/unzip the `.zip` file onto your computer
-3) Open qFlipper and go to the file manager
-4) Navigate to the `apps` folder
-5) Drag & drop the `.fap` file into the `apps` folder
-6) Navigate back to the root folder of the SD card and create the folder `apps_data`, if not already there
-7) Navigate into `apps_data` and create another folder called `barcode_data`
-8) Navigate into `barcode_data`
-9) Drag & drop the encoding txts (`code39_encodings.txt`, `code128_encodings.txt` & `codabar_encodings.txt`) into the `barcode_data` folder
-
-## Building
-1) Clone the [flipperzero-firmware](https://github.com/flipperdevices/flipperzero-firmware) repository or a firmware of your choice
-2) Clone this repository and put it in the `applications_user` folder
-3) Build this app by using the command `./fbt fap_Barcode_App`
-4) Copy the `.fap` from `build\f7-firmware-D\.extapps\Barcode_App.fap` to `apps\Misc` using the qFlipper app
-5) While still in the qFlipper app, navigate to the root folder of the SD card and create the folder `apps_data`, if not already there
-6) Navigate into `apps_data` and create another folder called `barcode_data`
-7) Navigate into `barcode_data`
-8) Drag & drop the encoding txts (`code39_encodings.txt`, `code128_encodings.txt` & `codabar_encodings.txt`) from the `encoding_tables` folder in this repository into the `barcode_data` folder
-
-## Usage
-
-### Creating a barcode
-1) To create a barcode click on `Create Barcode`
-2) Next select your type using the left and right arrows
-3) Enter your filename and then your barcode data
-4) Click save
-
-**Note**: For Codabar barcodes, you must manually add the start and stop codes to the barcode data
-Start/Stop codes can be A, B, C, or D
-For example, if you wanted to represent `1234` as a barcode you will need to enter something like `A1234A`. (You can replace the letters A with either A, B, C, or D)
-
-![Codabar Data Example](screenshots/Codabar%20Data%20Example.png "Codabar Data Example")
-
-### Editing a barcode
-1) To edit a barcode click on `Edit Barcode`
-2) Next select the barcode file you want to edit
-3) Edit the type, name, or data
-4) Click save
-
-### Deleting a barcode
-1) To delete a barcode click on `Edit Barcode`
-2) Next select the barcode file you want to delete
-3) Scroll all the way to the bottom
-4) Click delete
-
-### Viewing a barcode
-1) To view a barcode click on `Load Barcode`
-2) Next select the barcode file you want to view
-
-## Screenshots
-![Barcode Create Screen](screenshots/Creating%20Barcode.png "Barcode Create Screen")
-
-![Flipper Code-128 Barcode](screenshots/Flipper%20Barcode.png "Flipper Code-128 Barcode")
-
-![Flipper Box EAN-13 Barcode](screenshots/Flipper%20Box%20Barcode.png "Flipper Box EAN-13 Barcode")
-
-## Credits
-
-- [Kingal1337](https://github.com/Kingal1337) - Developer
-- [Z0wl](https://github.com/Z0wl) - Added Code128-C Support
-- [@teeebor](https://github.com/teeebor) - Menu Code Snippet
-
-
-[1] - supports Set B (only the characters from 0-94). Also supports Set C

+ 0 - 16
main_apps_sources/barcode_gen/application.fam

@@ -1,16 +0,0 @@
-App(
-    appid="barcode_app",
-    name="Barcode App",
-    apptype=FlipperAppType.EXTERNAL,
-    entry_point="barcode_main",
-    requires=["gui", "storage"],
-    stack_size=2 * 1024,
-    fap_category="Tools",
-    fap_icon="images/barcode_10.png",
-    fap_icon_assets="images",
-    fap_file_assets="barcode_encoding_files",
-    fap_author="@Kingal1337",
-    fap_weburl="https://github.com/Kingal1337/flipper-barcode-generator",
-    fap_version="1.1",
-    fap_description="App allows you to display various barcodes on flipper screen",
-)

+ 0 - 348
main_apps_sources/barcode_gen/barcode_app.c

@@ -1,348 +0,0 @@
-#include "barcode_app.h"
-
-#include "barcode_app_icons.h"
-
-/**
- * Opens a file browser dialog and returns the filepath of the selected file
- * 
- * @param folder  the folder to view when the browser opens
- * @param file_path a string pointer for the file_path when a file is selected, 
- *                  file_path will be the folder path is nothing is selected
- * @returns true if a file is selected
-*/
-static bool select_file(const char* folder, FuriString* file_path) {
-    DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
-    DialogsFileBrowserOptions browser_options;
-    dialog_file_browser_set_basic_options(&browser_options, "", &I_barcode_10);
-    browser_options.base_path = DEFAULT_USER_BARCODES;
-    furi_string_set(file_path, folder);
-
-    bool res = dialog_file_browser_show(dialogs, file_path, file_path, &browser_options);
-
-    furi_record_close(RECORD_DIALOGS);
-
-    return res;
-}
-
-/**
- * Reads the data from a file and stores them in the FuriStrings raw_type and raw_data
-*/
-ErrorCode read_raw_data(FuriString* file_path, FuriString* raw_type, FuriString* raw_data) {
-    //Open Storage
-    Storage* storage = furi_record_open(RECORD_STORAGE);
-    FlipperFormat* ff = flipper_format_file_alloc(storage);
-
-    ErrorCode reason = OKCode;
-
-    if(!flipper_format_file_open_existing(ff, furi_string_get_cstr(file_path))) {
-        FURI_LOG_E(TAG, "Could not open file %s", furi_string_get_cstr(file_path));
-        reason = FileOpening;
-    } else {
-        if(!flipper_format_read_string(ff, "Type", raw_type)) {
-            FURI_LOG_E(TAG, "Could not read \"Type\" string");
-            reason = InvalidFileData;
-        }
-        if(!flipper_format_read_string(ff, "Data", raw_data)) {
-            FURI_LOG_E(TAG, "Could not read \"Data\" string");
-            reason = InvalidFileData;
-        }
-    }
-
-    //Close Storage
-    flipper_format_free(ff);
-    furi_record_close(RECORD_STORAGE);
-
-    return reason;
-}
-
-/**
- * Gets the file name from a file path
- * @param file_path  the file path
- * @param file_name  the FuriString to store the file name
- * @param remove_extension  true if the extension should be removed, otherwise false
-*/
-bool get_file_name_from_path(FuriString* file_path, FuriString* file_name, bool remove_extension) {
-    if(file_path == NULL || file_name == NULL) {
-        return false;
-    }
-    uint32_t slash_index = furi_string_search_rchar(file_path, '/', 0);
-    if(slash_index == FURI_STRING_FAILURE || slash_index >= (furi_string_size(file_path) - 1)) {
-        return false;
-    }
-
-    furi_string_set(file_name, file_path);
-    furi_string_right(file_name, slash_index + 1);
-    if(remove_extension) {
-        uint32_t ext_index = furi_string_search_rchar(file_name, '.', 0);
-        if(ext_index != FURI_STRING_FAILURE && ext_index < (furi_string_size(file_path))) {
-            furi_string_left(file_name, ext_index);
-        }
-    }
-
-    return true;
-}
-
-/**
- * Creates the barcode folder
-*/
-void init_folder() {
-    Storage* storage = furi_record_open(RECORD_STORAGE);
-    FURI_LOG_I(TAG, "Creating barcodes folder");
-    if(storage_simply_mkdir(storage, DEFAULT_USER_BARCODES)) {
-        FURI_LOG_I(TAG, "Barcodes folder successfully created!");
-    } else {
-        FURI_LOG_I(TAG, "Barcodes folder already exists.");
-    }
-    furi_record_close(RECORD_STORAGE);
-}
-
-void select_barcode_item(BarcodeApp* app) {
-    FuriString* file_path = furi_string_alloc();
-    FuriString* raw_type = furi_string_alloc();
-    FuriString* raw_data = furi_string_alloc();
-
-    //this determines if the data was read correctly or if the
-    bool loaded_success = true;
-    ErrorCode reason = OKCode;
-
-    bool file_selected = select_file(DEFAULT_USER_BARCODES, file_path);
-    if(file_selected) {
-        FURI_LOG_I(TAG, "The file selected is %s", furi_string_get_cstr(file_path));
-        Barcode* barcode = app->barcode_view;
-
-        reason = read_raw_data(file_path, raw_type, raw_data);
-        if(reason != OKCode) {
-            loaded_success = false;
-            FURI_LOG_E(TAG, "Could not read data correctly");
-        }
-
-        //Free the data from the previous barcode
-        barcode_free_model(barcode);
-
-        with_view_model(
-            barcode->view,
-            BarcodeModel * model,
-            {
-                model->file_path = furi_string_alloc_set(file_path);
-
-                model->data = malloc(sizeof(BarcodeData));
-                model->data->valid = loaded_success;
-
-                if(loaded_success) {
-                    model->data->raw_data = furi_string_alloc_set(raw_data);
-                    model->data->correct_data = furi_string_alloc();
-
-                    model->data->type_obj = get_type(raw_type);
-
-                    barcode_loader(model->data);
-                } else {
-                    model->data->reason = reason;
-                }
-            },
-            true);
-
-        view_dispatcher_switch_to_view(app->view_dispatcher, BarcodeView);
-    }
-
-    furi_string_free(raw_type);
-    furi_string_free(raw_data);
-    furi_string_free(file_path);
-}
-
-void edit_barcode_item(BarcodeApp* app) {
-    FuriString* file_path = furi_string_alloc();
-    FuriString* file_name = furi_string_alloc();
-    FuriString* raw_type = furi_string_alloc();
-    FuriString* raw_data = furi_string_alloc();
-
-    //this determines if the data was read correctly or if the
-    ErrorCode reason = OKCode;
-
-    bool file_selected = select_file(DEFAULT_USER_BARCODES, file_path);
-    if(file_selected) {
-        FURI_LOG_I(TAG, "The file selected is %s", furi_string_get_cstr(file_path));
-        CreateView* create_view_object = app->create_view;
-
-        reason = read_raw_data(file_path, raw_type, raw_data);
-        if(reason != OKCode) {
-            FURI_LOG_E(TAG, "Could not read data correctly");
-            with_view_model(
-                app->message_view->view,
-                MessageViewModel * model,
-                { model->message = get_error_code_message(reason); },
-                true);
-
-            view_dispatcher_switch_to_view(
-                create_view_object->barcode_app->view_dispatcher, MessageErrorView);
-
-        } else {
-            BarcodeTypeObj* type_obj = get_type(raw_type);
-            if(type_obj->type == UNKNOWN) {
-                type_obj = barcode_type_objs[0];
-            }
-            get_file_name_from_path(file_path, file_name, true);
-
-            create_view_free_model(create_view_object);
-            with_view_model(
-                create_view_object->view,
-                CreateViewModel * model,
-                {
-                    model->selected_menu_item = 0;
-                    model->barcode_type = type_obj;
-                    model->file_path = furi_string_alloc_set(file_path);
-                    model->file_name = furi_string_alloc_set(file_name);
-                    model->barcode_data = furi_string_alloc_set(raw_data);
-                    model->mode = EditMode;
-                },
-                true);
-            view_dispatcher_switch_to_view(app->view_dispatcher, CreateBarcodeView);
-        }
-    }
-
-    furi_string_free(raw_type);
-    furi_string_free(raw_data);
-    furi_string_free(file_name);
-    furi_string_free(file_path);
-}
-
-void create_barcode_item(BarcodeApp* app) {
-    CreateView* create_view_object = app->create_view;
-
-    create_view_free_model(create_view_object);
-
-    with_view_model(
-        create_view_object->view,
-        CreateViewModel * model,
-        {
-            model->selected_menu_item = 0;
-            model->barcode_type = barcode_type_objs[0];
-            model->file_path = furi_string_alloc();
-            model->file_name = furi_string_alloc();
-            model->barcode_data = furi_string_alloc();
-            model->mode = NewMode;
-        },
-        true);
-    view_dispatcher_switch_to_view(app->view_dispatcher, CreateBarcodeView);
-}
-
-void submenu_callback(void* context, uint32_t index) {
-    furi_assert(context);
-
-    BarcodeApp* app = context;
-
-    if(index == SelectBarcodeItem) {
-        select_barcode_item(app);
-    } else if(index == EditBarcodeItem) {
-        edit_barcode_item(app);
-    } else if(index == CreateBarcodeItem) {
-        create_barcode_item(app);
-    }
-}
-
-uint32_t create_view_callback(void* context) {
-    UNUSED(context);
-    return CreateBarcodeView;
-}
-
-uint32_t main_menu_callback(void* context) {
-    UNUSED(context);
-    return MainMenuView;
-}
-
-uint32_t exit_callback(void* context) {
-    UNUSED(context);
-    return VIEW_NONE;
-}
-
-void free_app(BarcodeApp* app) {
-    FURI_LOG_I(TAG, "Freeing Data");
-
-    init_folder();
-    free_types();
-
-    view_dispatcher_remove_view(app->view_dispatcher, TextInputView);
-    text_input_free(app->text_input);
-
-    view_dispatcher_remove_view(app->view_dispatcher, MessageErrorView);
-    message_view_free(app->message_view);
-
-    view_dispatcher_remove_view(app->view_dispatcher, MainMenuView);
-    submenu_free(app->main_menu);
-
-    view_dispatcher_remove_view(app->view_dispatcher, CreateBarcodeView);
-    create_view_free(app->create_view);
-
-    view_dispatcher_remove_view(app->view_dispatcher, BarcodeView);
-    barcode_free(app->barcode_view);
-
-    //free the dispatcher
-    view_dispatcher_free(app->view_dispatcher);
-
-    furi_message_queue_free(app->event_queue);
-
-    furi_record_close(RECORD_GUI);
-    app->gui = NULL;
-
-    free(app);
-}
-
-int32_t barcode_main(void* p) {
-    UNUSED(p);
-    BarcodeApp* app = malloc(sizeof(BarcodeApp));
-    init_types();
-    app->event_queue = furi_message_queue_alloc(8, sizeof(InputEvent));
-
-    // Register view port in GUI
-    app->gui = furi_record_open(RECORD_GUI);
-
-    app->view_dispatcher = view_dispatcher_alloc();
-    view_dispatcher_enable_queue(app->view_dispatcher);
-    view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
-
-    app->main_menu = submenu_alloc();
-    submenu_add_item(app->main_menu, "Load Barcode", SelectBarcodeItem, submenu_callback, app);
-    view_set_previous_callback(submenu_get_view(app->main_menu), exit_callback);
-    view_dispatcher_add_view(app->view_dispatcher, MainMenuView, submenu_get_view(app->main_menu));
-
-    submenu_add_item(app->main_menu, "Edit Barcode", EditBarcodeItem, submenu_callback, app);
-
-    /*****************************
-     * Creating Text Input View
-     ******************************/
-    app->text_input = text_input_alloc();
-    view_set_previous_callback(text_input_get_view(app->text_input), create_view_callback);
-    view_dispatcher_add_view(
-        app->view_dispatcher, TextInputView, text_input_get_view(app->text_input));
-
-    /*****************************
-     * Creating Message View
-     ******************************/
-    app->message_view = message_view_allocate(app);
-    view_dispatcher_add_view(
-        app->view_dispatcher, MessageErrorView, message_get_view(app->message_view));
-
-    /*****************************
-     * Creating Create View
-     ******************************/
-    app->create_view = create_view_allocate(app);
-    submenu_add_item(app->main_menu, "Create Barcode", CreateBarcodeItem, submenu_callback, app);
-    view_set_previous_callback(create_get_view(app->create_view), main_menu_callback);
-    view_dispatcher_add_view(
-        app->view_dispatcher, CreateBarcodeView, create_get_view(app->create_view));
-
-    /*****************************
-     * Creating Barcode View
-     ******************************/
-    app->barcode_view = barcode_view_allocate(app);
-    view_set_previous_callback(barcode_get_view(app->barcode_view), main_menu_callback);
-    view_dispatcher_add_view(
-        app->view_dispatcher, BarcodeView, barcode_get_view(app->barcode_view));
-
-    //switch view to submenu and run dispatcher
-    view_dispatcher_switch_to_view(app->view_dispatcher, MainMenuView);
-    view_dispatcher_run(app->view_dispatcher);
-
-    free_app(app);
-
-    return 0;
-}

+ 0 - 88
main_apps_sources/barcode_gen/barcode_app.h

@@ -1,88 +0,0 @@
-#pragma once
-#include <furi.h>
-#include <furi_hal.h>
-
-#include <gui/gui.h>
-#include <input/input.h>
-#include <dialogs/dialogs.h>
-#include <gui/view_dispatcher.h>
-#include <gui/modules/submenu.h>
-#include <gui/modules/text_input.h>
-#include <gui/modules/text_input.h>
-
-#include <flipper_format/flipper_format.h>
-
-#include "barcode_utils.h"
-
-#define TAG "BARCODE"
-#define VERSION "1.1"
-#define FILE_VERSION "1"
-
-#define TEXT_BUFFER_SIZE 128
-
-#define BARCODE_HEIGHT 50
-#define BARCODE_Y_START 3
-
-//the folder where the codabar encoding table is located
-#define CODABAR_DICT_FILE_PATH APP_ASSETS_PATH("codabar_encodings.txt")
-
-//the folder where the code 39 encoding table is located
-#define CODE39_DICT_FILE_PATH APP_ASSETS_PATH("code39_encodings.txt")
-
-//the folder where the code 128 encoding table is located
-#define CODE128_DICT_FILE_PATH APP_ASSETS_PATH("code128_encodings.txt")
-
-//the folder where the code 128 C encoding table is located
-#define CODE128C_DICT_FILE_PATH APP_ASSETS_PATH("code128c_encodings.txt")
-
-//the folder where the user stores their barcodes
-#define DEFAULT_USER_BARCODES EXT_PATH("apps_data/barcodes")
-
-//The extension barcode files use
-#define BARCODE_EXTENSION ".txt"
-#define BARCODE_EXTENSION_LENGTH 4
-
-#include "views/barcode_view.h"
-#include "views/create_view.h"
-#include "views/message_view.h"
-#include "barcode_validator.h"
-
-typedef struct BarcodeApp BarcodeApp;
-
-struct BarcodeApp {
-    Submenu* main_menu;
-    ViewDispatcher* view_dispatcher;
-    Gui* gui;
-
-    FuriMessageQueue* event_queue;
-
-    CreateView* create_view;
-    Barcode* barcode_view;
-
-    MessageView* message_view;
-    TextInput* text_input;
-};
-
-enum SubmenuItems {
-    SelectBarcodeItem,
-    EditBarcodeItem,
-
-    CreateBarcodeItem
-};
-
-enum Views {
-    TextInputView,
-    MessageErrorView,
-    MainMenuView,
-    CreateBarcodeView,
-
-    BarcodeView
-};
-
-void submenu_callback(void* context, uint32_t index);
-
-uint32_t main_menu_callback(void* context);
-
-uint32_t exit_callback(void* context);
-
-int32_t barcode_main(void* p);

+ 0 - 22
main_apps_sources/barcode_gen/barcode_encoding_files/codabar_encodings.txt

@@ -1,22 +0,0 @@
-# alternates between bars and spaces, always begins with bar
-# 0 for narrow, 1 for wide
-0: 0000011
-1: 0000110
-2: 0001001
-3: 1100000
-4: 0010010
-5: 1000010
-6: 0100001
-7: 0100100
-8: 0110000
-9: 1001000
--: 0001100
-$: 0011000
-:: 1000101
-/: 1010001
-.: 1010100
-+: 0010101
-A: 0011010
-B: 0101001
-C: 0001011
-D: 0001110

+ 0 - 202
main_apps_sources/barcode_gen/barcode_encoding_files/code128_encodings.txt

@@ -1,202 +0,0 @@
- : 00
-!: 01
-": 02
-#: 03
-$: 04
-%: 05
-&: 06
-': 07
-(: 08
-): 09
-*: 10
-+: 11
-,: 12
--: 13
-.: 14
-/: 15
-0: 16
-1: 17
-2: 18
-3: 19
-4: 20
-5: 21
-6: 22
-7: 23
-8: 24
-9: 25
-:: 26
-;: 27
-<: 28
-=: 29
->: 30
-?: 31
-@: 32
-A: 33
-B: 34
-C: 35
-D: 36
-E: 37
-F: 38
-G: 39
-H: 40
-I: 41
-J: 42
-K: 43
-L: 44
-M: 45
-N: 46
-O: 47
-P: 48
-Q: 49
-R: 50
-S: 51
-T: 52
-U: 53
-V: 54
-W: 55
-X: 56
-Y: 57
-Z: 58
-[: 59
-\: 60
-]: 61
-^: 62
-_: 63
-`: 64
-a: 65
-b: 66
-c: 67
-d: 68
-e: 69
-f: 70
-g: 71
-h: 72
-i: 73
-j: 74
-k: 75
-l: 76
-m: 77
-n: 78
-o: 79
-p: 80
-q: 81
-r: 82
-s: 83
-t: 84
-u: 85
-v: 86
-w: 87
-x: 88
-y: 89
-z: 90
-{: 91
-|: 92
-}: 93
-~: 94
-
-00: 11011001100
-01: 11001101100
-02: 11001100110
-03: 10010011000
-04: 10010001100
-05: 10001001100
-06: 10011001000
-07: 10011000100
-08: 10001100100
-09: 11001001000
-10: 11001000100
-11: 11000100100
-12: 10110011100
-13: 10011011100
-14: 10011001110
-15: 10111001100
-16: 10011101100
-17: 10011100110
-18: 11001110010
-19: 11001011100
-20: 11001001110
-21: 11011100100
-22: 11001110100
-23: 11101101110
-24: 11101001100
-25: 11100101100
-26: 11100100110
-27: 11101100100
-28: 11100110100
-29: 11100110010
-30: 11011011000
-31: 11011000110
-32: 11000110110
-33: 10100011000
-34: 10001011000
-35: 10001000110
-36: 10110001000
-37: 10001101000
-38: 10001100010
-39: 11010001000
-40: 11000101000
-41: 11000100010
-42: 10110111000
-43: 10110001110
-44: 10001101110
-45: 10111011000
-46: 10111000110
-47: 10001110110
-48: 11101110110
-49: 11010001110
-50: 11000101110
-51: 11011101000
-52: 11011100010
-53: 11011101110
-54: 11101011000
-55: 11101000110
-56: 11100010110
-57: 11101101000
-58: 11101100010
-59: 11100011010
-60: 11101111010
-61: 11001000010
-62: 11110001010
-63: 10100110000
-64: 10100001100
-65: 10010110000
-66: 10010000110
-67: 10000101100
-68: 10000100110
-69: 10110010000
-70: 10110000100
-71: 10011010000
-72: 10011000010
-73: 10000110100
-74: 10000110010
-75: 11000010010
-76: 11001010000
-77: 11110111010
-78: 11000010100
-79: 10001111010
-80: 10100111100
-81: 10010111100
-82: 10010011110
-83: 10111100100
-84: 10011110100
-85: 10011110010
-86: 11110100100
-87: 11110010100
-88: 11110010010
-89: 11011011110
-90: 11011110110
-91: 11110110110
-92: 10101111000
-93: 10100011110
-94: 10001011110
-95: 10111101000
-96: 10111100010
-97: 11110101000
-98: 11110100010
-99: 10111011110
-100: 10111101110
-101: 11101011110
-102: 11110101110
-103: 11010000100
-104: 11010010000
-105: 11010011100

+ 0 - 106
main_apps_sources/barcode_gen/barcode_encoding_files/code128c_encodings.txt

@@ -1,106 +0,0 @@
-00: 11011001100
-01: 11001101100
-02: 11001100110
-03: 10010011000
-04: 10010001100
-05: 10001001100
-06: 10011001000
-07: 10011000100
-08: 10001100100
-09: 11001001000
-10: 11001000100
-11: 11000100100
-12: 10110011100
-13: 10011011100
-14: 10011001110
-15: 10111001100
-16: 10011101100
-17: 10011100110
-18: 11001110010
-19: 11001011100
-20: 11001001110
-21: 11011100100
-22: 11001110100
-23: 11101101110
-24: 11101001100
-25: 11100101100
-26: 11100100110
-27: 11101100100
-28: 11100110100
-29: 11100110010
-30: 11011011000
-31: 11011000110
-32: 11000110110
-33: 10100011000
-34: 10001011000
-35: 10001000110
-36: 10110001000
-37: 10001101000
-38: 10001100010
-39: 11010001000
-40: 11000101000
-41: 11000100010
-42: 10110111000
-43: 10110001110
-44: 10001101110
-45: 10111011000
-46: 10111000110
-47: 10001110110
-48: 11101110110
-49: 11010001110
-50: 11000101110
-51: 11011101000
-52: 11011100010
-53: 11011101110
-54: 11101011000
-55: 11101000110
-56: 11100010110
-57: 11101101000
-58: 11101100010
-59: 11100011010
-60: 11101111010
-61: 11001000010
-62: 11110001010
-63: 10100110000
-64: 10100001100
-65: 10010110000
-66: 10010000110
-67: 10000101100
-68: 10000100110
-69: 10110010000
-70: 10110000100
-71: 10011010000
-72: 10011000010
-73: 10000110100
-74: 10000110010
-75: 11000010010
-76: 11001010000
-77: 11110111010
-78: 11000010100
-79: 10001111010
-80: 10100111100
-81: 10010111100
-82: 10010011110
-83: 10111100100
-84: 10011110100
-85: 10011110010
-86: 11110100100
-87: 11110010100
-88: 11110010010
-89: 11011011110
-90: 11011110110
-91: 11110110110
-92: 10101111000
-93: 10100011110
-94: 10001011110
-95: 10111101000
-96: 10111100010
-97: 11110101000
-98: 11110100010
-99: 10111011110
-100: 10111101110
-101: 11101011110
-102: 11110101110
-103: 11010000100
-104: 11010010000
-105: 11010011100

+ 0 - 44
main_apps_sources/barcode_gen/barcode_encoding_files/code39_encodings.txt

@@ -1,44 +0,0 @@
-0: 000110100
-1: 100100001
-2: 001100001
-3: 101100000
-4: 000110001
-5: 100110000
-6: 001110000
-7: 000100101
-8: 100100100
-9: 001100100
-A: 100001001
-B: 001001001
-C: 101001000
-D: 000011001
-E: 100011000
-F: 001011000
-G: 000001101
-H: 100001100
-I: 001001100
-J: 000011100
-K: 100000011
-L: 001000011
-M: 101000010
-N: 000010011
-O: 100010010
-P: 001010010
-Q: 000000111
-R: 100000110
-S: 001000110
-T: 000010110
-U: 110000001
-V: 011000001
-W: 111000000
-X: 010010001
-Y: 110010000
-Z: 011010000
--: 010000101
-.: 110000100
- : 011000100
-*: 010010100
-$: 010101000
-/: 010100010
-+: 010001010
-%: 000101010

+ 0 - 147
main_apps_sources/barcode_gen/barcode_utils.c

@@ -1,147 +0,0 @@
-#include "barcode_utils.h"
-
-BarcodeTypeObj* barcode_type_objs[NUMBER_OF_BARCODE_TYPES] = {NULL};
-
-void init_types() {
-    BarcodeTypeObj* upc_a = malloc(sizeof(BarcodeTypeObj));
-    upc_a->name = "UPC-A";
-    upc_a->type = UPCA;
-    upc_a->min_digits = 11;
-    upc_a->max_digits = 12;
-    upc_a->start_pos = 16;
-    barcode_type_objs[UPCA] = upc_a;
-
-    BarcodeTypeObj* ean_8 = malloc(sizeof(BarcodeTypeObj));
-    ean_8->name = "EAN-8";
-    ean_8->type = EAN8;
-    ean_8->min_digits = 7;
-    ean_8->max_digits = 8;
-    ean_8->start_pos = 32;
-    barcode_type_objs[EAN8] = ean_8;
-
-    BarcodeTypeObj* ean_13 = malloc(sizeof(BarcodeTypeObj));
-    ean_13->name = "EAN-13";
-    ean_13->type = EAN13;
-    ean_13->min_digits = 12;
-    ean_13->max_digits = 13;
-    ean_13->start_pos = 16;
-    barcode_type_objs[EAN13] = ean_13;
-
-    BarcodeTypeObj* code_39 = malloc(sizeof(BarcodeTypeObj));
-    code_39->name = "CODE-39";
-    code_39->type = CODE39;
-    code_39->min_digits = 1;
-    code_39->max_digits = -1;
-    code_39->start_pos = 0;
-    barcode_type_objs[CODE39] = code_39;
-
-    BarcodeTypeObj* code_128 = malloc(sizeof(BarcodeTypeObj));
-    code_128->name = "CODE-128";
-    code_128->type = CODE128;
-    code_128->min_digits = 1;
-    code_128->max_digits = -1;
-    code_128->start_pos = 0;
-    barcode_type_objs[CODE128] = code_128;
-
-    BarcodeTypeObj* code_128c = malloc(sizeof(BarcodeTypeObj));
-    code_128c->name = "CODE-128C";
-    code_128c->type = CODE128C;
-    code_128c->min_digits = 2;
-    code_128c->max_digits = -1;
-    code_128c->start_pos = 0;
-    barcode_type_objs[CODE128C] = code_128c;
-
-    BarcodeTypeObj* codabar = malloc(sizeof(BarcodeTypeObj));
-    codabar->name = "Codabar";
-    codabar->type = CODABAR;
-    codabar->min_digits = 1;
-    codabar->max_digits = -1;
-    codabar->start_pos = 0;
-    barcode_type_objs[CODABAR] = codabar;
-
-    BarcodeTypeObj* unknown = malloc(sizeof(BarcodeTypeObj));
-    unknown->name = "Unknown";
-    unknown->type = UNKNOWN;
-    unknown->min_digits = 0;
-    unknown->max_digits = 0;
-    unknown->start_pos = 0;
-    barcode_type_objs[UNKNOWN] = unknown;
-}
-
-void free_types() {
-    for(int i = 0; i < NUMBER_OF_BARCODE_TYPES; i++) {
-        free(barcode_type_objs[i]);
-    }
-}
-
-BarcodeTypeObj* get_type(FuriString* type_string) {
-    if(furi_string_cmp_str(type_string, "UPC-A") == 0) {
-        return barcode_type_objs[UPCA];
-    }
-    if(furi_string_cmp_str(type_string, "EAN-8") == 0) {
-        return barcode_type_objs[EAN8];
-    }
-    if(furi_string_cmp_str(type_string, "EAN-13") == 0) {
-        return barcode_type_objs[EAN13];
-    }
-    if(furi_string_cmp_str(type_string, "CODE-39") == 0) {
-        return barcode_type_objs[CODE39];
-    }
-    if(furi_string_cmp_str(type_string, "CODE-128") == 0) {
-        return barcode_type_objs[CODE128];
-    }
-    if(furi_string_cmp_str(type_string, "CODE-128C") == 0) {
-        return barcode_type_objs[CODE128C];
-    }
-    if(furi_string_cmp_str(type_string, "Codabar") == 0) {
-        return barcode_type_objs[CODABAR];
-    }
-
-    return barcode_type_objs[UNKNOWN];
-}
-
-const char* get_error_code_name(ErrorCode error_code) {
-    switch(error_code) {
-    case WrongNumberOfDigits:
-        return "Wrong Number Of Digits";
-    case InvalidCharacters:
-        return "Invalid Characters";
-    case UnsupportedType:
-        return "Unsupported Type";
-    case FileOpening:
-        return "File Opening Error";
-    case InvalidFileData:
-        return "Invalid File Data";
-    case MissingEncodingTable:
-        return "Missing Encoding Table";
-    case EncodingTableError:
-        return "Encoding Table Error";
-    case OKCode:
-        return "OK";
-    default:
-        return "Unknown Code";
-    };
-}
-
-const char* get_error_code_message(ErrorCode error_code) {
-    switch(error_code) {
-    case WrongNumberOfDigits:
-        return "Wrong # of characters";
-    case InvalidCharacters:
-        return "Invalid characters";
-    case UnsupportedType:
-        return "Unsupported barcode type";
-    case FileOpening:
-        return "Could not open file";
-    case InvalidFileData:
-        return "Invalid file data";
-    case MissingEncodingTable:
-        return "Missing encoding table";
-    case EncodingTableError:
-        return "Encoding table error";
-    case OKCode:
-        return "OK";
-    default:
-        return "Could not read barcode data";
-    };
-}

+ 0 - 55
main_apps_sources/barcode_gen/barcode_utils.h

@@ -1,55 +0,0 @@
-
-#pragma once
-#include <furi.h>
-#include <furi_hal.h>
-
-#define NUMBER_OF_BARCODE_TYPES 8
-
-typedef enum {
-    WrongNumberOfDigits, //There is too many or too few digits in the barcode
-    InvalidCharacters, //The barcode contains invalid characters
-    UnsupportedType, //the barcode type is not supported
-    FileOpening, //A problem occurred when opening the barcode data file
-    InvalidFileData, //One of the key in the file doesn't exist or there is a typo
-    MissingEncodingTable, //The encoding table txt for the barcode type is missing
-    EncodingTableError, //Something is wrong with the encoding table, probably missing data or typo
-    OKCode
-} ErrorCode;
-
-typedef enum {
-    UPCA,
-    EAN8,
-    EAN13,
-    CODE39,
-    CODE128,
-    CODE128C,
-    CODABAR,
-
-    UNKNOWN
-} BarcodeType;
-
-typedef struct {
-    char* name; //The name of the barcode type
-    BarcodeType type; //The barcode type enum
-    int min_digits; //the minimum number of digits
-    int max_digits; //the maximum number of digits
-    int start_pos; //where to start drawing the barcode, set to -1 to dynamically draw barcode
-} BarcodeTypeObj;
-
-typedef struct {
-    BarcodeTypeObj* type_obj;
-    int check_digit; //A place to store the check digit
-    FuriString* raw_data; //the data directly from the file
-    FuriString* correct_data; //the corrected/processed data
-    bool valid; //true if the raw data is correctly formatted, such as correct num of digits, valid characters, etc.
-    ErrorCode reason; //the reason why this barcode is invalid
-} BarcodeData;
-
-//All available barcode types
-extern BarcodeTypeObj* barcode_type_objs[NUMBER_OF_BARCODE_TYPES];
-
-void init_types();
-void free_types();
-BarcodeTypeObj* get_type(FuriString* type_string);
-const char* get_error_code_name(ErrorCode error_code);
-const char* get_error_code_message(ErrorCode error_code);

+ 0 - 532
main_apps_sources/barcode_gen/barcode_validator.c

@@ -1,532 +0,0 @@
-#include "barcode_validator.h"
-
-void barcode_loader(BarcodeData* barcode_data) {
-    switch(barcode_data->type_obj->type) {
-    case UPCA:
-    case EAN8:
-    case EAN13:
-        ean_upc_loader(barcode_data);
-        break;
-    case CODE39:
-        code_39_loader(barcode_data);
-        break;
-    case CODE128:
-        code_128_loader(barcode_data);
-        break;
-    case CODE128C:
-        code_128c_loader(barcode_data);
-        break;
-    case CODABAR:
-        codabar_loader(barcode_data);
-        break;
-    case UNKNOWN:
-        barcode_data->reason = UnsupportedType;
-        barcode_data->valid = false;
-    default:
-        break;
-    }
-}
-
-/**
- * Calculates the check digit of a barcode if they have one
- * @param barcode_data the barcode data
- * @returns a check digit or -1 for either an invalid 
-*/
-int calculate_check_digit(BarcodeData* barcode_data) {
-    int check_digit = -1;
-    switch(barcode_data->type_obj->type) {
-    case UPCA:
-    case EAN8:
-    case EAN13:
-        check_digit = calculate_ean_upc_check_digit(barcode_data);
-        break;
-    case CODE39:
-    case CODE128:
-    case CODE128C:
-    case CODABAR:
-    case UNKNOWN:
-    default:
-        break;
-    }
-
-    return check_digit;
-}
-
-/**
- * Calculates the check digit of barcode types UPC-A, EAN-8, & EAN-13
-*/
-int calculate_ean_upc_check_digit(BarcodeData* barcode_data) {
-    int check_digit = 0;
-    int odd = 0;
-    int even = 0;
-
-    int length = barcode_data->type_obj->min_digits;
-
-    //Get sum of odd digits
-    for(int i = 0; i < length; i += 2) {
-        odd += furi_string_get_char(barcode_data->raw_data, i) - '0';
-    }
-
-    //Get sum of even digits
-    for(int i = 1; i < length; i += 2) {
-        even += furi_string_get_char(barcode_data->raw_data, i) - '0';
-    }
-
-    if(barcode_data->type_obj->type == EAN13) {
-        check_digit = even * 3 + odd;
-    } else {
-        check_digit = odd * 3 + even;
-    }
-
-    check_digit = check_digit % 10;
-
-    return (10 - check_digit) % 10;
-}
-
-/**
- * Loads and validates Barcode Types EAN-8, EAN-13, and UPC-A
- * barcode_data and its strings should already be allocated;
-*/
-void ean_upc_loader(BarcodeData* barcode_data) {
-    int barcode_length = furi_string_size(barcode_data->raw_data);
-
-    int min_digits = barcode_data->type_obj->min_digits;
-    int max_digit = barcode_data->type_obj->max_digits;
-
-    //check the length of the barcode
-    if(barcode_length < min_digits || barcode_length > max_digit) {
-        barcode_data->reason = WrongNumberOfDigits;
-        barcode_data->valid = false;
-        return;
-    }
-
-    //checks if the barcode contains any characters that aren't a number
-    for(int i = 0; i < barcode_length; i++) {
-        char character = furi_string_get_char(barcode_data->raw_data, i);
-        int digit = character - '0'; //convert the number into an int (also the index)
-        if(digit < 0 || digit > 9) {
-            barcode_data->reason = InvalidCharacters;
-            barcode_data->valid = false;
-            return;
-        }
-    }
-
-    int check_digit = calculate_check_digit(barcode_data);
-    char check_digit_char = check_digit + '0';
-
-    barcode_data->check_digit = check_digit;
-
-    //if the barcode length is at max length then we will verify if the check digit is correct
-    if(barcode_length == max_digit) {
-        //append the raw_data to the correct data string
-        furi_string_cat(barcode_data->correct_data, barcode_data->raw_data);
-
-        //append the check digit to the correct data string
-        furi_string_set_char(barcode_data->correct_data, min_digits, check_digit_char);
-    }
-    //if the barcode length is at min length, we will calculate the check digit
-    if(barcode_length == min_digits) {
-        //append the raw_data to the correct data string
-        furi_string_cat(barcode_data->correct_data, barcode_data->raw_data);
-
-        //append the check digit to the correct data string
-        furi_string_push_back(barcode_data->correct_data, check_digit_char);
-    }
-}
-
-void code_39_loader(BarcodeData* barcode_data) {
-    int barcode_length = furi_string_size(barcode_data->raw_data);
-
-    int min_digits = barcode_data->type_obj->min_digits;
-
-    //check the length of the barcode, must contain atleast a character,
-    //this can have as many characters as it wants, it might not fit on the screen
-    if(barcode_length < min_digits) {
-        barcode_data->reason = WrongNumberOfDigits;
-        barcode_data->valid = false;
-        return;
-    }
-
-    FuriString* barcode_bits = furi_string_alloc();
-    FuriString* temp_string = furi_string_alloc();
-
-    //add starting and ending *
-    if(!furi_string_start_with(barcode_data->raw_data, "*")) {
-        furi_string_push_back(temp_string, '*');
-        furi_string_cat(temp_string, barcode_data->raw_data);
-        furi_string_set(barcode_data->raw_data, temp_string);
-    }
-
-    if(!furi_string_end_with(barcode_data->raw_data, "*")) {
-        furi_string_push_back(barcode_data->raw_data, '*');
-    }
-
-    furi_string_free(temp_string);
-    barcode_length = furi_string_size(barcode_data->raw_data);
-
-    //Open Storage
-    Storage* storage = furi_record_open(RECORD_STORAGE);
-    FlipperFormat* ff = flipper_format_file_alloc(storage);
-
-    if(!flipper_format_file_open_existing(ff, CODE39_DICT_FILE_PATH)) {
-        FURI_LOG_E(TAG, "Could not open file %s", CODE39_DICT_FILE_PATH);
-        barcode_data->reason = MissingEncodingTable;
-        barcode_data->valid = false;
-    } else {
-        FuriString* char_bits = furi_string_alloc();
-        for(int i = 0; i < barcode_length; i++) {
-            char barcode_char = toupper(furi_string_get_char(barcode_data->raw_data, i));
-
-            //convert a char into a string so it used in flipper_format_read_string
-            char current_character[2];
-            snprintf(current_character, 2, "%c", barcode_char);
-
-            if(!flipper_format_read_string(ff, current_character, char_bits)) {
-                FURI_LOG_E(TAG, "Could not read \"%c\" string", barcode_char);
-                barcode_data->reason = InvalidCharacters;
-                barcode_data->valid = false;
-                break;
-            } else {
-                FURI_LOG_I(
-                    TAG, "\"%c\" string: %s", barcode_char, furi_string_get_cstr(char_bits));
-                furi_string_cat(barcode_bits, char_bits);
-            }
-            flipper_format_rewind(ff);
-        }
-        furi_string_free(char_bits);
-    }
-
-    //Close Storage
-    flipper_format_free(ff);
-    furi_record_close(RECORD_STORAGE);
-
-    furi_string_cat(barcode_data->correct_data, barcode_bits);
-    furi_string_free(barcode_bits);
-}
-
-/**
- * Loads a code 128 barcode
- * 
- * Only supports character set B
-*/
-void code_128_loader(BarcodeData* barcode_data) {
-    int barcode_length = furi_string_size(barcode_data->raw_data);
-
-    //the start code for character set B
-    int start_code_value = 104;
-
-    //The bits for the start code
-    const char* start_code_bits = "11010010000";
-
-    //The bits for the stop code
-    const char* stop_code_bits = "1100011101011";
-
-    int min_digits = barcode_data->type_obj->min_digits;
-
-    /**
-     * A sum of all of the characters values
-     * Ex: 
-     * Barcode Data : ABC
-     * A has a value of 33
-     * B has a value of 34
-     * C has a value of 35
-     * 
-     * the checksum_adder would be (33 * 1) + (34 * 2) + (35 * 3) + 104 = 310
-     * 
-     * Add 104 since we are using set B
-     */
-    int checksum_adder = start_code_value;
-    /**
-     * Checksum digits is the number of characters it has read so far
-     * In the above example the checksum_digits would be 3
-    */
-    int checksum_digits = 0;
-
-    //the calculated check digit
-    int final_check_digit = 0;
-
-    //check the length of the barcode, must contain atleast a character,
-    //this can have as many characters as it wants, it might not fit on the screen
-    if(barcode_length < min_digits) {
-        barcode_data->reason = WrongNumberOfDigits;
-        barcode_data->valid = false;
-        return;
-    }
-
-    //Open Storage
-    Storage* storage = furi_record_open(RECORD_STORAGE);
-    FlipperFormat* ff = flipper_format_file_alloc(storage);
-
-    FuriString* barcode_bits = furi_string_alloc();
-
-    //add the start code
-    furi_string_cat(barcode_bits, start_code_bits);
-
-    if(!flipper_format_file_open_existing(ff, CODE128_DICT_FILE_PATH)) {
-        FURI_LOG_E(TAG, "Could not open file %s", CODE128_DICT_FILE_PATH);
-        barcode_data->reason = MissingEncodingTable;
-        barcode_data->valid = false;
-    } else {
-        FuriString* value = furi_string_alloc();
-        FuriString* char_bits = furi_string_alloc();
-        for(int i = 0; i < barcode_length; i++) {
-            char barcode_char = furi_string_get_char(barcode_data->raw_data, i);
-
-            //convert a char into a string so it used in flipper_format_read_string
-            char current_character[2];
-            snprintf(current_character, 2, "%c", barcode_char);
-
-            //get the value of the character
-            if(!flipper_format_read_string(ff, current_character, value)) {
-                FURI_LOG_E(TAG, "Could not read \"%c\" string", barcode_char);
-                barcode_data->reason = InvalidCharacters;
-                barcode_data->valid = false;
-                break;
-            }
-            //using the value of the character, get the characters bits
-            if(!flipper_format_read_string(ff, furi_string_get_cstr(value), char_bits)) {
-                FURI_LOG_E(TAG, "Could not read \"%c\" string", barcode_char);
-                barcode_data->reason = EncodingTableError;
-                barcode_data->valid = false;
-                break;
-            } else {
-                //add the bits to the full barcode
-                furi_string_cat(barcode_bits, char_bits);
-
-                //calculate the checksum
-                checksum_digits += 1;
-                checksum_adder += (atoi(furi_string_get_cstr(value)) * checksum_digits);
-
-                FURI_LOG_D(
-                    TAG,
-                    "\"%c\" string: %s : %s : %d : %d : %d",
-                    barcode_char,
-                    furi_string_get_cstr(char_bits),
-                    furi_string_get_cstr(value),
-                    checksum_digits,
-                    (atoi(furi_string_get_cstr(value)) * checksum_digits),
-                    checksum_adder);
-            }
-            //bring the file pointer back to the beginning
-            flipper_format_rewind(ff);
-        }
-
-        //calculate the check digit and convert it into a c string for lookup in the encoding table
-        final_check_digit = checksum_adder % 103;
-        int length = snprintf(NULL, 0, "%d", final_check_digit);
-        char* final_check_digit_string = malloc(length + 1);
-        snprintf(final_check_digit_string, length + 1, "%d", final_check_digit);
-
-        //after the checksum has been calculated, add the bits to the full barcode
-        if(!flipper_format_read_string(ff, final_check_digit_string, char_bits)) {
-            FURI_LOG_E(TAG, "Could not read \"%s\" string", final_check_digit_string);
-            barcode_data->reason = EncodingTableError;
-            barcode_data->valid = false;
-        } else {
-            //add the check digit bits to the full barcode
-            furi_string_cat(barcode_bits, char_bits);
-
-            FURI_LOG_D(
-                TAG,
-                "\"%s\" string: %s",
-                final_check_digit_string,
-                furi_string_get_cstr(char_bits));
-        }
-
-        free(final_check_digit_string);
-        furi_string_free(value);
-        furi_string_free(char_bits);
-    }
-
-    //add the stop code
-    furi_string_cat(barcode_bits, stop_code_bits);
-
-    //Close Storage
-    flipper_format_free(ff);
-    furi_record_close(RECORD_STORAGE);
-
-    furi_string_cat(barcode_data->correct_data, barcode_bits);
-    furi_string_free(barcode_bits);
-}
-
-/**
- * Loads a code 128 C barcode
-*/
-void code_128c_loader(BarcodeData* barcode_data) {
-    int barcode_length = furi_string_size(barcode_data->raw_data);
-
-    //the start code for character set C
-    int start_code_value = 105;
-
-    //The bits for the start code
-    const char* start_code_bits = "11010011100";
-
-    //The bits for the stop code
-    const char* stop_code_bits = "1100011101011";
-
-    int min_digits = barcode_data->type_obj->min_digits;
-
-    int checksum_adder = start_code_value;
-    int checksum_digits = 0;
-
-    //the calculated check digit
-    int final_check_digit = 0;
-
-    // check the length of the barcode, must contain atleast 2 character,
-    // this can have as many characters as it wants, it might not fit on the screen
-    // code 128 C: the length must be even
-    if((barcode_length < min_digits) || (barcode_length & 1)) {
-        barcode_data->reason = WrongNumberOfDigits;
-        barcode_data->valid = false;
-        return;
-    }
-    //Open Storage
-    Storage* storage = furi_record_open(RECORD_STORAGE);
-    FlipperFormat* ff = flipper_format_file_alloc(storage);
-
-    FuriString* barcode_bits = furi_string_alloc();
-
-    //add the start code
-    furi_string_cat(barcode_bits, start_code_bits);
-
-    if(!flipper_format_file_open_existing(ff, CODE128C_DICT_FILE_PATH)) {
-        FURI_LOG_E(TAG, "c128c Could not open file %s", CODE128C_DICT_FILE_PATH);
-        barcode_data->reason = MissingEncodingTable;
-        barcode_data->valid = false;
-    } else {
-        FuriString* value = furi_string_alloc();
-        FuriString* char_bits = furi_string_alloc();
-        for(int i = 0; i < barcode_length; i += 2) {
-            char barcode_char1 = furi_string_get_char(barcode_data->raw_data, i);
-            char barcode_char2 = furi_string_get_char(barcode_data->raw_data, i + 1);
-            FURI_LOG_I(TAG, "c128c bc1='%c' bc2='%c'", barcode_char1, barcode_char2);
-
-            char current_chars[4];
-            snprintf(current_chars, 3, "%c%c", barcode_char1, barcode_char2);
-            FURI_LOG_I(TAG, "c128c current_chars='%s'", current_chars);
-
-            //using the value of the characters, get the characters bits
-            if(!flipper_format_read_string(ff, current_chars, char_bits)) {
-                FURI_LOG_E(TAG, "c128c Could not read \"%s\" string", current_chars);
-                barcode_data->reason = EncodingTableError;
-                barcode_data->valid = false;
-                break;
-            } else {
-                //add the bits to the full barcode
-                furi_string_cat(barcode_bits, char_bits);
-
-                // calculate the checksum
-                checksum_digits += 1;
-                checksum_adder += (atoi(current_chars) * checksum_digits);
-
-                FURI_LOG_I(
-                    TAG,
-                    "c128c \"%s\" string: %s : %s : %d : %d : %d",
-                    current_chars,
-                    furi_string_get_cstr(char_bits),
-                    furi_string_get_cstr(value),
-                    checksum_digits,
-                    (atoi(furi_string_get_cstr(value)) * checksum_digits),
-                    checksum_adder);
-            }
-            //bring the file pointer back to the begining
-            flipper_format_rewind(ff);
-        }
-        //calculate the check digit and convert it into a c string for lookup in the encoding table
-        final_check_digit = checksum_adder % 103;
-        FURI_LOG_I(TAG, "c128c finale_check_digit=%d", final_check_digit);
-
-        int length = snprintf(NULL, 0, "%d", final_check_digit);
-        if(final_check_digit < 100) length = 2;
-        char* final_check_digit_string = malloc(length + 1);
-        snprintf(final_check_digit_string, length + 1, "%02d", final_check_digit);
-
-        //after the checksum has been calculated, add the bits to the full barcode
-        if(!flipper_format_read_string(ff, final_check_digit_string, char_bits)) {
-            FURI_LOG_E(TAG, "c128c cksum Could not read \"%s\" string", final_check_digit_string);
-            barcode_data->reason = EncodingTableError;
-            barcode_data->valid = false;
-        } else {
-            //add the check digit bits to the full barcode
-            furi_string_cat(barcode_bits, char_bits);
-
-            FURI_LOG_I(
-                TAG,
-                "check digit \"%s\" string: %s",
-                final_check_digit_string,
-                furi_string_get_cstr(char_bits));
-        }
-
-        free(final_check_digit_string);
-        furi_string_free(value);
-        furi_string_free(char_bits);
-    }
-
-    //add the stop code
-    furi_string_cat(barcode_bits, stop_code_bits);
-
-    //Close Storage
-    flipper_format_free(ff);
-    furi_record_close(RECORD_STORAGE);
-
-    FURI_LOG_I(TAG, "c128c %s", furi_string_get_cstr(barcode_bits));
-    furi_string_cat(barcode_data->correct_data, barcode_bits);
-    furi_string_free(barcode_bits);
-}
-
-void codabar_loader(BarcodeData* barcode_data) {
-    int barcode_length = furi_string_size(barcode_data->raw_data);
-
-    int min_digits = barcode_data->type_obj->min_digits;
-
-    //check the length of the barcode, must contain atleast a character,
-    //this can have as many characters as it wants, it might not fit on the screen
-    if(barcode_length < min_digits) {
-        barcode_data->reason = WrongNumberOfDigits;
-        barcode_data->valid = false;
-        return;
-    }
-
-    FuriString* barcode_bits = furi_string_alloc();
-
-    barcode_length = furi_string_size(barcode_data->raw_data);
-
-    //Open Storage
-    Storage* storage = furi_record_open(RECORD_STORAGE);
-    FlipperFormat* ff = flipper_format_file_alloc(storage);
-
-    if(!flipper_format_file_open_existing(ff, CODABAR_DICT_FILE_PATH)) {
-        FURI_LOG_E(TAG, "Could not open file %s", CODABAR_DICT_FILE_PATH);
-        barcode_data->reason = MissingEncodingTable;
-        barcode_data->valid = false;
-    } else {
-        FuriString* char_bits = furi_string_alloc();
-        for(int i = 0; i < barcode_length; i++) {
-            char barcode_char = toupper(furi_string_get_char(barcode_data->raw_data, i));
-
-            //convert a char into a string so it used in flipper_format_read_string
-            char current_character[2];
-            snprintf(current_character, 2, "%c", barcode_char);
-
-            if(!flipper_format_read_string(ff, current_character, char_bits)) {
-                FURI_LOG_E(TAG, "Could not read \"%c\" string", barcode_char);
-                barcode_data->reason = InvalidCharacters;
-                barcode_data->valid = false;
-                break;
-            } else {
-                FURI_LOG_I(
-                    TAG, "\"%c\" string: %s", barcode_char, furi_string_get_cstr(char_bits));
-                furi_string_cat(barcode_bits, char_bits);
-            }
-            flipper_format_rewind(ff);
-        }
-        furi_string_free(char_bits);
-    }
-
-    //Close Storage
-    flipper_format_free(ff);
-    furi_record_close(RECORD_STORAGE);
-
-    furi_string_cat(barcode_data->correct_data, barcode_bits);
-    furi_string_free(barcode_bits);
-}

+ 0 - 15
main_apps_sources/barcode_gen/barcode_validator.h

@@ -1,15 +0,0 @@
-#pragma once
-
-#include "barcode_app.h"
-
-int calculate_check_digit(BarcodeData* barcode_data);
-int calculate_ean_upc_check_digit(BarcodeData* barcode_data);
-void ean_upc_loader(BarcodeData* barcode_data);
-void upc_a_loader(BarcodeData* barcode_data);
-void ean_8_loader(BarcodeData* barcode_data);
-void ean_13_loader(BarcodeData* barcode_data);
-void code_39_loader(BarcodeData* barcode_data);
-void code_128_loader(BarcodeData* barcode_data);
-void code_128c_loader(BarcodeData* barcode_data);
-void codabar_loader(BarcodeData* barcode_data);
-void barcode_loader(BarcodeData* barcode_data);

+ 0 - 22
main_apps_sources/barcode_gen/encoding_tables/codabar_encodings.txt

@@ -1,22 +0,0 @@
-# alternates between bars and spaces, always begins with bar
-# 0 for narrow, 1 for wide
-0: 0000011
-1: 0000110
-2: 0001001
-3: 1100000
-4: 0010010
-5: 1000010
-6: 0100001
-7: 0100100
-8: 0110000
-9: 1001000
--: 0001100
-$: 0011000
-:: 1000101
-/: 1010001
-.: 1010100
-+: 0010101
-A: 0011010
-B: 0101001
-C: 0001011
-D: 0001110

+ 0 - 202
main_apps_sources/barcode_gen/encoding_tables/code128_encodings.txt

@@ -1,202 +0,0 @@
- : 00
-!: 01
-": 02
-#: 03
-$: 04
-%: 05
-&: 06
-': 07
-(: 08
-): 09
-*: 10
-+: 11
-,: 12
--: 13
-.: 14
-/: 15
-0: 16
-1: 17
-2: 18
-3: 19
-4: 20
-5: 21
-6: 22
-7: 23
-8: 24
-9: 25
-:: 26
-;: 27
-<: 28
-=: 29
->: 30
-?: 31
-@: 32
-A: 33
-B: 34
-C: 35
-D: 36
-E: 37
-F: 38
-G: 39
-H: 40
-I: 41
-J: 42
-K: 43
-L: 44
-M: 45
-N: 46
-O: 47
-P: 48
-Q: 49
-R: 50
-S: 51
-T: 52
-U: 53
-V: 54
-W: 55
-X: 56
-Y: 57
-Z: 58
-[: 59
-\: 60
-]: 61
-^: 62
-_: 63
-`: 64
-a: 65
-b: 66
-c: 67
-d: 68
-e: 69
-f: 70
-g: 71
-h: 72
-i: 73
-j: 74
-k: 75
-l: 76
-m: 77
-n: 78
-o: 79
-p: 80
-q: 81
-r: 82
-s: 83
-t: 84
-u: 85
-v: 86
-w: 87
-x: 88
-y: 89
-z: 90
-{: 91
-|: 92
-}: 93
-~: 94
-
-00: 11011001100
-01: 11001101100
-02: 11001100110
-03: 10010011000
-04: 10010001100
-05: 10001001100
-06: 10011001000
-07: 10011000100
-08: 10001100100
-09: 11001001000
-10: 11001000100
-11: 11000100100
-12: 10110011100
-13: 10011011100
-14: 10011001110
-15: 10111001100
-16: 10011101100
-17: 10011100110
-18: 11001110010
-19: 11001011100
-20: 11001001110
-21: 11011100100
-22: 11001110100
-23: 11101101110
-24: 11101001100
-25: 11100101100
-26: 11100100110
-27: 11101100100
-28: 11100110100
-29: 11100110010
-30: 11011011000
-31: 11011000110
-32: 11000110110
-33: 10100011000
-34: 10001011000
-35: 10001000110
-36: 10110001000
-37: 10001101000
-38: 10001100010
-39: 11010001000
-40: 11000101000
-41: 11000100010
-42: 10110111000
-43: 10110001110
-44: 10001101110
-45: 10111011000
-46: 10111000110
-47: 10001110110
-48: 11101110110
-49: 11010001110
-50: 11000101110
-51: 11011101000
-52: 11011100010
-53: 11011101110
-54: 11101011000
-55: 11101000110
-56: 11100010110
-57: 11101101000
-58: 11101100010
-59: 11100011010
-60: 11101111010
-61: 11001000010
-62: 11110001010
-63: 10100110000
-64: 10100001100
-65: 10010110000
-66: 10010000110
-67: 10000101100
-68: 10000100110
-69: 10110010000
-70: 10110000100
-71: 10011010000
-72: 10011000010
-73: 10000110100
-74: 10000110010
-75: 11000010010
-76: 11001010000
-77: 11110111010
-78: 11000010100
-79: 10001111010
-80: 10100111100
-81: 10010111100
-82: 10010011110
-83: 10111100100
-84: 10011110100
-85: 10011110010
-86: 11110100100
-87: 11110010100
-88: 11110010010
-89: 11011011110
-90: 11011110110
-91: 11110110110
-92: 10101111000
-93: 10100011110
-94: 10001011110
-95: 10111101000
-96: 10111100010
-97: 11110101000
-98: 11110100010
-99: 10111011110
-100: 10111101110
-101: 11101011110
-102: 11110101110
-103: 11010000100
-104: 11010010000
-105: 11010011100

+ 0 - 106
main_apps_sources/barcode_gen/encoding_tables/code128c_encodings.txt

@@ -1,106 +0,0 @@
-00: 11011001100
-01: 11001101100
-02: 11001100110
-03: 10010011000
-04: 10010001100
-05: 10001001100
-06: 10011001000
-07: 10011000100
-08: 10001100100
-09: 11001001000
-10: 11001000100
-11: 11000100100
-12: 10110011100
-13: 10011011100
-14: 10011001110
-15: 10111001100
-16: 10011101100
-17: 10011100110
-18: 11001110010
-19: 11001011100
-20: 11001001110
-21: 11011100100
-22: 11001110100
-23: 11101101110
-24: 11101001100
-25: 11100101100
-26: 11100100110
-27: 11101100100
-28: 11100110100
-29: 11100110010
-30: 11011011000
-31: 11011000110
-32: 11000110110
-33: 10100011000
-34: 10001011000
-35: 10001000110
-36: 10110001000
-37: 10001101000
-38: 10001100010
-39: 11010001000
-40: 11000101000
-41: 11000100010
-42: 10110111000
-43: 10110001110
-44: 10001101110
-45: 10111011000
-46: 10111000110
-47: 10001110110
-48: 11101110110
-49: 11010001110
-50: 11000101110
-51: 11011101000
-52: 11011100010
-53: 11011101110
-54: 11101011000
-55: 11101000110
-56: 11100010110
-57: 11101101000
-58: 11101100010
-59: 11100011010
-60: 11101111010
-61: 11001000010
-62: 11110001010
-63: 10100110000
-64: 10100001100
-65: 10010110000
-66: 10010000110
-67: 10000101100
-68: 10000100110
-69: 10110010000
-70: 10110000100
-71: 10011010000
-72: 10011000010
-73: 10000110100
-74: 10000110010
-75: 11000010010
-76: 11001010000
-77: 11110111010
-78: 11000010100
-79: 10001111010
-80: 10100111100
-81: 10010111100
-82: 10010011110
-83: 10111100100
-84: 10011110100
-85: 10011110010
-86: 11110100100
-87: 11110010100
-88: 11110010010
-89: 11011011110
-90: 11011110110
-91: 11110110110
-92: 10101111000
-93: 10100011110
-94: 10001011110
-95: 10111101000
-96: 10111100010
-97: 11110101000
-98: 11110100010
-99: 10111011110
-100: 10111101110
-101: 11101011110
-102: 11110101110
-103: 11010000100
-104: 11010010000
-105: 11010011100

+ 0 - 44
main_apps_sources/barcode_gen/encoding_tables/code39_encodings.txt

@@ -1,44 +0,0 @@
-0: 000110100
-1: 100100001
-2: 001100001
-3: 101100000
-4: 000110001
-5: 100110000
-6: 001110000
-7: 000100101
-8: 100100100
-9: 001100100
-A: 100001001
-B: 001001001
-C: 101001000
-D: 000011001
-E: 100011000
-F: 001011000
-G: 000001101
-H: 100001100
-I: 001001100
-J: 000011100
-K: 100000011
-L: 001000011
-M: 101000010
-N: 000010011
-O: 100010010
-P: 001010010
-Q: 000000111
-R: 100000110
-S: 001000110
-T: 000010110
-U: 110000001
-V: 011000001
-W: 111000000
-X: 010010001
-Y: 110010000
-Z: 011010000
--: 010000101
-.: 110000100
- : 011000100
-*: 010010100
-$: 010101000
-/: 010100010
-+: 010001010
-%: 000101010

+ 0 - 52
main_apps_sources/barcode_gen/encodings.c

@@ -1,52 +0,0 @@
-#include "encodings.h"
-
-const char EAN_13_STRUCTURE_CODES[10][6] = {
-    "LLLLLL",
-    "LLGLGG",
-    "LLGGLG",
-    "LLGGGL",
-    "LGLLGG",
-    "LGGLLG",
-    "LGGGLL",
-    "LGLGLG",
-    "LGLGGL",
-    "LGGLGL"};
-
-const char UPC_EAN_L_CODES[10][8] = {
-    "0001101", // 0
-    "0011001", // 1
-    "0010011", // 2
-    "0111101", // 3
-    "0100011", // 4
-    "0110001", // 5
-    "0101111", // 6
-    "0111011", // 7
-    "0110111", // 8
-    "0001011" // 9
-};
-
-const char EAN_G_CODES[10][8] = {
-    "0100111", // 0
-    "0110011", // 1
-    "0011011", // 2
-    "0100001", // 3
-    "0011101", // 4
-    "0111001", // 5
-    "0000101", // 6
-    "0010001", // 7
-    "0001001", // 8
-    "0010111" // 9
-};
-
-const char UPC_EAN_R_CODES[10][8] = {
-    "1110010", // 0
-    "1100110", // 1
-    "1101100", // 2
-    "1000010", // 3
-    "1011100", // 4
-    "1001110", // 5
-    "1010000", // 6
-    "1000100", // 7
-    "1001000", // 8
-    "1110100" // 9
-};

+ 0 - 6
main_apps_sources/barcode_gen/encodings.h

@@ -1,6 +0,0 @@
-#pragma once
-
-extern const char EAN_13_STRUCTURE_CODES[10][6];
-extern const char UPC_EAN_L_CODES[10][8];
-extern const char EAN_G_CODES[10][8];
-extern const char UPC_EAN_R_CODES[10][8];

BIN
main_apps_sources/barcode_gen/images/barcode_10.png


BIN
main_apps_sources/barcode_gen/img/1.png


BIN
main_apps_sources/barcode_gen/img/2.png


BIN
main_apps_sources/barcode_gen/img/3.png


BIN
main_apps_sources/barcode_gen/img/Codabar Data Example.png


BIN
main_apps_sources/barcode_gen/img/Creating Barcode.png


BIN
main_apps_sources/barcode_gen/img/Flipper Barcode.png


BIN
main_apps_sources/barcode_gen/img/Flipper Box Barcode.png


BIN
main_apps_sources/barcode_gen/screenshots/Codabar Data Example.png


BIN
main_apps_sources/barcode_gen/screenshots/Creating Barcode.png


BIN
main_apps_sources/barcode_gen/screenshots/Flipper Barcode.png


BIN
main_apps_sources/barcode_gen/screenshots/Flipper Box Barcode.png


+ 0 - 510
main_apps_sources/barcode_gen/views/barcode_view.c

@@ -1,510 +0,0 @@
-#include "../barcode_app.h"
-#include "barcode_view.h"
-#include "../encodings.h"
-
-/**
- * @brief Draws a single bit from a barcode at a specified location
- * @param canvas 
- * @param bit  a 1 or a 0 to signify a bit of data
- * @param x  the top left x coordinate
- * @param y  the top left y coordinate
- * @param width  the width of the bit
- * @param height  the height of the bit
- */
-static void draw_bit(Canvas* canvas, int bit, int x, int y, int width, int height) {
-    if(bit == 1) {
-        canvas_set_color(canvas, ColorBlack);
-    } else {
-        canvas_set_color(canvas, ColorWhite);
-    }
-    canvas_draw_box(canvas, x, y, width, height);
-}
-
-/**
- * 
-*/
-static void draw_error_str(Canvas* canvas, const char* error) {
-    canvas_clear(canvas);
-    canvas_draw_str_aligned(canvas, 62, 30, AlignCenter, AlignCenter, error);
-}
-
-/**
- * @param bits  a string of 1's and 0's
- * @returns the x coordinate after the bits have been drawn, useful for drawing the next section of bits
-*/
-static int draw_bits(Canvas* canvas, const char* bits, int x, int y, int width, int height) {
-    int bits_length = strlen(bits);
-    for(int i = 0; i < bits_length; i++) {
-        char c = bits[i];
-        int num = c - '0';
-
-        draw_bit(canvas, num, x, y, width, height);
-
-        x += width;
-    }
-    return x;
-}
-
-/**
- * Draws an EAN-8 type barcode, does not check if the barcode is valid
- * @param canvas  the canvas
- * @param barcode_digits  the digits in the barcode, must be 8 characters long
-*/
-static void draw_ean_8(Canvas* canvas, BarcodeData* barcode_data) {
-    FuriString* barcode_digits = barcode_data->correct_data;
-    BarcodeTypeObj* type_obj = barcode_data->type_obj;
-
-    int barcode_length = furi_string_size(barcode_digits);
-
-    int x = type_obj->start_pos;
-    int y = BARCODE_Y_START;
-    int width = 1;
-    int height = BARCODE_HEIGHT;
-
-    //the guard patterns for the beginning, center, ending
-    const char* end_bits = "101";
-    const char* center_bits = "01010";
-
-    //draw the starting guard pattern
-    x = draw_bits(canvas, end_bits, x, y, width, height + 5);
-
-    FuriString* code_part = furi_string_alloc();
-
-    //loop through each digit, find the encoding, and draw it
-    for(int i = 0; i < barcode_length; i++) {
-        char current_digit = furi_string_get_char(barcode_digits, i);
-
-        //the actual number and the index of the bits
-        int index = current_digit - '0';
-        //use the L-codes for the first 4 digits and the R-Codes for the last 4 digits
-        if(i <= 3) {
-            furi_string_set_str(code_part, UPC_EAN_L_CODES[index]);
-        } else {
-            furi_string_set_str(code_part, UPC_EAN_R_CODES[index]);
-        }
-
-        //convert the current_digit char into a string so it can be printed
-        char current_digit_string[2];
-        snprintf(current_digit_string, 2, "%c", current_digit);
-
-        //set the canvas color to black to print the digit
-        canvas_set_color(canvas, ColorBlack);
-        canvas_draw_str(canvas, x + 1, y + height + 8, current_digit_string);
-
-        //draw the bits of the barcode
-        x = draw_bits(canvas, furi_string_get_cstr(code_part), x, y, width, height);
-
-        //if the index has reached 3, that means 4 digits have been drawn and now draw the center guard pattern
-        if(i == 3) {
-            x = draw_bits(canvas, center_bits, x, y, width, height + 5);
-        }
-    }
-    furi_string_free(code_part);
-
-    //draw the ending guard pattern
-    x = draw_bits(canvas, end_bits, x, y, width, height + 5);
-}
-
-static void draw_ean_13(Canvas* canvas, BarcodeData* barcode_data) {
-    FuriString* barcode_digits = barcode_data->correct_data;
-    BarcodeTypeObj* type_obj = barcode_data->type_obj;
-
-    int barcode_length = furi_string_size(barcode_digits);
-
-    int x = type_obj->start_pos;
-    int y = BARCODE_Y_START;
-    int width = 1;
-    int height = BARCODE_HEIGHT;
-
-    //the guard patterns for the beginning, center, ending
-    const char* end_bits = "101";
-    const char* center_bits = "01010";
-
-    //draw the starting guard pattern
-    x = draw_bits(canvas, end_bits, x, y, width, height + 5);
-
-    FuriString* left_structure = furi_string_alloc();
-    FuriString* code_part = furi_string_alloc();
-
-    //loop through each digit, find the encoding, and draw it
-    for(int i = 0; i < barcode_length; i++) {
-        char current_digit = furi_string_get_char(barcode_digits, i);
-        int index = current_digit - '0';
-
-        if(i == 0) {
-            furi_string_set_str(left_structure, EAN_13_STRUCTURE_CODES[index]);
-
-            //convert the current_digit char into a string so it can be printed
-            char current_digit_string[2];
-            snprintf(current_digit_string, 2, "%c", current_digit);
-
-            //set the canvas color to black to print the digit
-            canvas_set_color(canvas, ColorBlack);
-            canvas_draw_str(canvas, x - 10, y + height + 8, current_digit_string);
-
-            continue;
-        } else {
-            //use the L-codes for the first 6 digits and the R-Codes for the last 6 digits
-            if(i <= 6) {
-                //get the encoding type at the current barcode bit position
-                char encoding_type = furi_string_get_char(left_structure, i - 1);
-                if(encoding_type == 'L') {
-                    furi_string_set_str(code_part, UPC_EAN_L_CODES[index]);
-                } else {
-                    furi_string_set_str(code_part, EAN_G_CODES[index]);
-                }
-            } else {
-                furi_string_set_str(code_part, UPC_EAN_R_CODES[index]);
-            }
-
-            //convert the current_digit char into a string so it can be printed
-            char current_digit_string[2];
-            snprintf(current_digit_string, 2, "%c", current_digit);
-
-            //set the canvas color to black to print the digit
-            canvas_set_color(canvas, ColorBlack);
-            canvas_draw_str(canvas, x + 1, y + height + 8, current_digit_string);
-
-            //draw the bits of the barcode
-            x = draw_bits(canvas, furi_string_get_cstr(code_part), x, y, width, height);
-
-            //if the index has reached 6, that means 6 digits have been drawn and we now draw the center guard pattern
-            if(i == 6) {
-                x = draw_bits(canvas, center_bits, x, y, width, height + 5);
-            }
-        }
-    }
-
-    furi_string_free(left_structure);
-    furi_string_free(code_part);
-
-    //draw the ending guard pattern
-    x = draw_bits(canvas, end_bits, x, y, width, height + 5);
-}
-
-/**
- * Draw a UPC-A barcode
-*/
-static void draw_upc_a(Canvas* canvas, BarcodeData* barcode_data) {
-    FuriString* barcode_digits = barcode_data->correct_data;
-    BarcodeTypeObj* type_obj = barcode_data->type_obj;
-
-    int barcode_length = furi_string_size(barcode_digits);
-
-    int x = type_obj->start_pos;
-    int y = BARCODE_Y_START;
-    int width = 1;
-    int height = BARCODE_HEIGHT;
-
-    //the guard patterns for the beginning, center, ending
-    char* end_bits = "101";
-    char* center_bits = "01010";
-
-    //draw the starting guard pattern
-    x = draw_bits(canvas, end_bits, x, y, width, height + 5);
-
-    FuriString* code_part = furi_string_alloc();
-
-    //loop through each digit, find the encoding, and draw it
-    for(int i = 0; i < barcode_length; i++) {
-        char current_digit = furi_string_get_char(barcode_digits, i);
-        int index = current_digit - '0'; //convert the number into an int (also the index)
-
-        //use the L-codes for the first 6 digits and the R-Codes for the last 6 digits
-        if(i <= 5) {
-            furi_string_set_str(code_part, UPC_EAN_L_CODES[index]);
-        } else {
-            furi_string_set_str(code_part, UPC_EAN_R_CODES[index]);
-        }
-
-        //convert the current_digit char into a string so it can be printed
-        char current_digit_string[2];
-        snprintf(current_digit_string, 2, "%c", current_digit);
-
-        //set the canvas color to black to print the digit
-        canvas_set_color(canvas, ColorBlack);
-        canvas_draw_str(canvas, x + 1, y + height + 8, current_digit_string);
-
-        //draw the bits of the barcode
-        x = draw_bits(canvas, furi_string_get_cstr(code_part), x, y, width, height);
-
-        //if the index has reached 6, that means 6 digits have been drawn and we now draw the center guard pattern
-        if(i == 5) {
-            x = draw_bits(canvas, center_bits, x, y, width, height + 5);
-        }
-    }
-
-    furi_string_free(code_part);
-
-    //draw the ending guard pattern
-    x = draw_bits(canvas, end_bits, x, y, width, height + 5);
-}
-
-static void draw_code_39(Canvas* canvas, BarcodeData* barcode_data) {
-    FuriString* raw_data = barcode_data->raw_data;
-    FuriString* barcode_digits = barcode_data->correct_data;
-    //BarcodeTypeObj* type_obj = barcode_data->type_obj;
-
-    int barcode_length = furi_string_size(barcode_digits);
-    int total_pixels = 0;
-
-    for(int i = 0; i < barcode_length; i++) {
-        //1 for wide, 0 for narrow
-        char wide_or_narrow = furi_string_get_char(barcode_digits, i);
-        int wn_digit = wide_or_narrow - '0'; //wide(1) or narrow(0) digit
-
-        if(wn_digit == 1) {
-            total_pixels += 3;
-        } else {
-            total_pixels += 1;
-        }
-        if((i + 1) % 9 == 0) {
-            total_pixels += 1;
-        }
-    }
-
-    int x = (128 - total_pixels) / 2;
-    int y = BARCODE_Y_START;
-    int width = 1;
-    int height = BARCODE_HEIGHT;
-    bool filled_in = true;
-
-    //set the canvas color to black to print the digit
-    canvas_set_color(canvas, ColorBlack);
-    // canvas_draw_str_aligned(canvas, 62, 30, AlignCenter, AlignCenter, error);
-    canvas_draw_str_aligned(
-        canvas, 62, y + height + 8, AlignCenter, AlignBottom, furi_string_get_cstr(raw_data));
-
-    for(int i = 0; i < barcode_length; i++) {
-        //1 for wide, 0 for narrow
-        char wide_or_narrow = furi_string_get_char(barcode_digits, i);
-        int wn_digit = wide_or_narrow - '0'; //wide(1) or narrow(0) digit
-
-        if(filled_in) {
-            if(wn_digit == 1) {
-                x = draw_bits(canvas, "111", x, y, width, height);
-            } else {
-                x = draw_bits(canvas, "1", x, y, width, height);
-            }
-            filled_in = false;
-        } else {
-            if(wn_digit == 1) {
-                x = draw_bits(canvas, "000", x, y, width, height);
-            } else {
-                x = draw_bits(canvas, "0", x, y, width, height);
-            }
-            filled_in = true;
-        }
-        if((i + 1) % 9 == 0) {
-            x = draw_bits(canvas, "0", x, y, width, height);
-            filled_in = true;
-        }
-    }
-}
-
-static void draw_code_128(Canvas* canvas, BarcodeData* barcode_data) {
-    FuriString* raw_data = barcode_data->raw_data;
-    FuriString* barcode_digits = barcode_data->correct_data;
-
-    int barcode_length = furi_string_size(barcode_digits);
-
-    int x = (128 - barcode_length) / 2;
-    int y = BARCODE_Y_START;
-    int width = 1;
-    int height = BARCODE_HEIGHT;
-
-    x = draw_bits(canvas, furi_string_get_cstr(barcode_digits), x, y, width, height);
-
-    //set the canvas color to black to print the digit
-    canvas_set_color(canvas, ColorBlack);
-    // canvas_draw_str_aligned(canvas, 62, 30, AlignCenter, AlignCenter, error);
-    canvas_draw_str_aligned(
-        canvas, 62, y + height + 8, AlignCenter, AlignBottom, furi_string_get_cstr(raw_data));
-}
-
-static void draw_codabar(Canvas* canvas, BarcodeData* barcode_data) {
-    FuriString* raw_data = barcode_data->raw_data;
-    FuriString* barcode_digits = barcode_data->correct_data;
-    //BarcodeTypeObj* type_obj = barcode_data->type_obj;
-
-    int barcode_length = furi_string_size(barcode_digits);
-    int total_pixels = 0;
-
-    for(int i = 0; i < barcode_length; i++) {
-        //1 for wide, 0 for narrow
-        char wide_or_narrow = furi_string_get_char(barcode_digits, i);
-        int wn_digit = wide_or_narrow - '0'; //wide(1) or narrow(0) digit
-
-        if(wn_digit == 1) {
-            total_pixels += 3;
-        } else {
-            total_pixels += 1;
-        }
-        if((i + 1) % 7 == 0) {
-            total_pixels += 1;
-        }
-    }
-
-    int x = (128 - total_pixels) / 2;
-    int y = BARCODE_Y_START;
-    int width = 1;
-    int height = BARCODE_HEIGHT;
-    bool filled_in = true;
-
-    //set the canvas color to black to print the digit
-    canvas_set_color(canvas, ColorBlack);
-    // canvas_draw_str_aligned(canvas, 62, 30, AlignCenter, AlignCenter, error);
-    canvas_draw_str_aligned(
-        canvas, 62, y + height + 8, AlignCenter, AlignBottom, furi_string_get_cstr(raw_data));
-
-    for(int i = 0; i < barcode_length; i++) {
-        //1 for wide, 0 for narrow
-        char wide_or_narrow = furi_string_get_char(barcode_digits, i);
-        int wn_digit = wide_or_narrow - '0'; //wide(1) or narrow(0) digit
-
-        if(filled_in) {
-            if(wn_digit == 1) {
-                x = draw_bits(canvas, "111", x, y, width, height);
-            } else {
-                x = draw_bits(canvas, "1", x, y, width, height);
-            }
-            filled_in = false;
-        } else {
-            if(wn_digit == 1) {
-                x = draw_bits(canvas, "000", x, y, width, height);
-            } else {
-                x = draw_bits(canvas, "0", x, y, width, height);
-            }
-            filled_in = true;
-        }
-        if((i + 1) % 7 == 0) {
-            x = draw_bits(canvas, "0", x, y, width, height);
-            filled_in = true;
-        }
-    }
-}
-
-static void barcode_draw_callback(Canvas* canvas, void* ctx) {
-    furi_assert(ctx);
-    BarcodeModel* barcode_model = ctx;
-    BarcodeData* data = barcode_model->data;
-    // const char* barcode_digits =;
-
-    canvas_clear(canvas);
-    if(data->valid) {
-        switch(data->type_obj->type) {
-        case UPCA:
-            draw_upc_a(canvas, data);
-            break;
-        case EAN8:
-            draw_ean_8(canvas, data);
-            break;
-        case EAN13:
-            draw_ean_13(canvas, data);
-            break;
-        case CODE39:
-            draw_code_39(canvas, data);
-            break;
-        case CODE128:
-        case CODE128C:
-            draw_code_128(canvas, data);
-            break;
-        case CODABAR:
-            draw_codabar(canvas, data);
-            break;
-        case UNKNOWN:
-        default:
-            break;
-        }
-    } else {
-        switch(data->reason) {
-        case WrongNumberOfDigits:
-            draw_error_str(canvas, "Wrong # of characters");
-            break;
-        case InvalidCharacters:
-            draw_error_str(canvas, "Invalid characters");
-            break;
-        case UnsupportedType:
-            draw_error_str(canvas, "Unsupported barcode type");
-            break;
-        case FileOpening:
-            draw_error_str(canvas, "Could not open file");
-            break;
-        case InvalidFileData:
-            draw_error_str(canvas, "Invalid file data");
-            break;
-        case MissingEncodingTable:
-            draw_error_str(canvas, "Missing encoding table");
-            break;
-        case EncodingTableError:
-            draw_error_str(canvas, "Encoding table error");
-            break;
-        default:
-            draw_error_str(canvas, "Could not read barcode data");
-            break;
-        }
-    }
-}
-
-bool barcode_input_callback(InputEvent* input_event, void* ctx) {
-    UNUSED(ctx);
-    //furi_assert(ctx);
-
-    //Barcode* test_view_object = ctx;
-
-    if(input_event->key == InputKeyBack) {
-        return false;
-    } else {
-        return true;
-    }
-}
-
-Barcode* barcode_view_allocate(BarcodeApp* barcode_app) {
-    furi_assert(barcode_app);
-
-    Barcode* barcode = malloc(sizeof(Barcode));
-
-    barcode->view = view_alloc();
-    barcode->barcode_app = barcode_app;
-
-    view_set_context(barcode->view, barcode);
-    view_allocate_model(barcode->view, ViewModelTypeLocking, sizeof(BarcodeModel));
-    view_set_draw_callback(barcode->view, barcode_draw_callback);
-    view_set_input_callback(barcode->view, barcode_input_callback);
-
-    return barcode;
-}
-
-void barcode_free_model(Barcode* barcode) {
-    with_view_model(
-        barcode->view,
-        BarcodeModel * model,
-        {
-            if(model->file_path != NULL) {
-                furi_string_free(model->file_path);
-            }
-            if(model->data != NULL) {
-                if(model->data->raw_data != NULL) {
-                    furi_string_free(model->data->raw_data);
-                }
-                if(model->data->correct_data != NULL) {
-                    furi_string_free(model->data->correct_data);
-                }
-                free(model->data);
-            }
-        },
-        false);
-}
-
-void barcode_free(Barcode* barcode) {
-    furi_assert(barcode);
-
-    barcode_free_model(barcode);
-    view_free(barcode->view);
-    free(barcode);
-}
-
-View* barcode_get_view(Barcode* barcode) {
-    furi_assert(barcode);
-    return barcode->view;
-}

+ 0 - 23
main_apps_sources/barcode_gen/views/barcode_view.h

@@ -1,23 +0,0 @@
-#pragma once
-
-#include <gui/view.h>
-
-typedef struct BarcodeApp BarcodeApp;
-
-typedef struct {
-    View* view;
-    BarcodeApp* barcode_app;
-} Barcode;
-
-typedef struct {
-    FuriString* file_path;
-    BarcodeData* data;
-} BarcodeModel;
-
-Barcode* barcode_view_allocate(BarcodeApp* barcode_app);
-
-void barcode_free_model(Barcode* barcode);
-
-void barcode_free(Barcode* barcode);
-
-View* barcode_get_view(Barcode* barcode);

+ 0 - 494
main_apps_sources/barcode_gen/views/create_view.c

@@ -1,494 +0,0 @@
-#include "../barcode_app.h"
-#include "create_view.h"
-#include <math.h>
-
-#define LINE_HEIGHT 16
-#define TEXT_PADDING 4
-#define TOTAL_MENU_ITEMS 5
-
-typedef enum {
-    TypeMenuItem,
-    FileNameMenuItem,
-    BarcodeDataMenuItem,
-    SaveMenuButton,
-    DeleteMenuButton
-} MenuItems;
-
-/**
- * Took this function from blackjack
- * @author @teeebor
-*/
-void draw_menu_item(
-    Canvas* const canvas,
-    const char* text,
-    const char* value,
-    int y,
-    bool left_caret,
-    bool right_caret,
-    bool selected) {
-    UNUSED(selected);
-    if(y < 0 || y >= 64) {
-        return;
-    }
-
-    if(selected) {
-        canvas_set_color(canvas, ColorBlack);
-        canvas_draw_box(canvas, 0, y, 123, LINE_HEIGHT);
-        canvas_set_color(canvas, ColorWhite);
-    }
-
-    canvas_draw_str_aligned(canvas, 4, y + TEXT_PADDING, AlignLeft, AlignTop, text);
-    if(left_caret) {
-        canvas_draw_str_aligned(canvas, 60, y + TEXT_PADDING, AlignLeft, AlignTop, "<");
-    }
-
-    canvas_draw_str_aligned(canvas, 90, y + TEXT_PADDING, AlignCenter, AlignTop, value);
-    if(right_caret) {
-        canvas_draw_str_aligned(canvas, 120, y + TEXT_PADDING, AlignRight, AlignTop, ">");
-    }
-
-    canvas_set_color(canvas, ColorBlack);
-}
-
-void draw_button(Canvas* const canvas, const char* text, int y, bool selected) {
-    if(selected) {
-        canvas_set_color(canvas, ColorBlack);
-        canvas_draw_box(canvas, 0, y, 123, LINE_HEIGHT);
-        canvas_set_color(canvas, ColorWhite);
-    }
-
-    canvas_draw_str_aligned(canvas, 64, y + TEXT_PADDING, AlignCenter, AlignTop, text);
-
-    canvas_set_color(canvas, ColorBlack);
-}
-
-static void app_draw_callback(Canvas* canvas, void* ctx) {
-    furi_assert(ctx);
-
-    CreateViewModel* create_view_model = ctx;
-
-    BarcodeTypeObj* type_obj = create_view_model->barcode_type;
-    if(create_view_model->barcode_type == NULL) {
-        return;
-    }
-    BarcodeType selected_type = type_obj->type;
-
-    int selected_menu_item = create_view_model->selected_menu_item;
-
-    int total_menu_items = create_view_model->mode == EditMode ? TOTAL_MENU_ITEMS :
-                                                                 TOTAL_MENU_ITEMS - 1;
-
-    int startY = 0;
-
-    //the menu items index that is/would be in view
-    //int current_last_menu_item = selected_menu_item + 3;
-    if(selected_menu_item > 1) {
-        int offset = 2;
-        if(selected_menu_item + offset > total_menu_items) {
-            offset = 3;
-        }
-        startY -= (LINE_HEIGHT * (selected_menu_item - offset));
-    }
-
-    //ensure that the scroll height is atleast 1
-    int scrollHeight = ceil(64.0 / total_menu_items);
-    int scrollPos = scrollHeight * selected_menu_item;
-
-    canvas_set_color(canvas, ColorBlack);
-    //draw the scroll bar box
-    canvas_draw_box(canvas, 125, scrollPos, 3, scrollHeight);
-    //draw the scroll bar track
-    canvas_draw_box(canvas, 126, 0, 1, 64);
-
-    draw_menu_item(
-        canvas,
-        "Type",
-        type_obj->name,
-        TypeMenuItem * LINE_HEIGHT + startY,
-        selected_type > 0,
-        selected_type < NUMBER_OF_BARCODE_TYPES - 2,
-        selected_menu_item == TypeMenuItem);
-
-    draw_menu_item(
-        canvas,
-        "Name",
-        furi_string_empty(create_view_model->file_name) ?
-            "--" :
-            furi_string_get_cstr(create_view_model->file_name),
-        FileNameMenuItem * LINE_HEIGHT + startY,
-        false,
-        false,
-        selected_menu_item == FileNameMenuItem);
-
-    draw_menu_item(
-        canvas,
-        "Data",
-        furi_string_empty(create_view_model->barcode_data) ?
-            "--" :
-            furi_string_get_cstr(create_view_model->barcode_data),
-        BarcodeDataMenuItem * LINE_HEIGHT + startY,
-        false,
-        false,
-        selected_menu_item == BarcodeDataMenuItem);
-
-    draw_button(
-        canvas,
-        "Save",
-        SaveMenuButton * LINE_HEIGHT + startY,
-        selected_menu_item == SaveMenuButton);
-
-    if(create_view_model->mode == EditMode) {
-        draw_button(
-            canvas,
-            "Delete",
-            DeleteMenuButton * LINE_HEIGHT + startY,
-            selected_menu_item == DeleteMenuButton);
-    }
-}
-
-void text_input_callback(void* ctx) {
-    CreateView* create_view_object = ctx;
-
-    with_view_model(
-        create_view_object->view,
-        CreateViewModel * model,
-        {
-            if(create_view_object->setter == FileNameSetter) {
-                furi_string_set_str(model->file_name, create_view_object->input);
-            }
-            if(create_view_object->setter == BarcodeDataSetter) {
-                furi_string_set_str(model->barcode_data, create_view_object->input);
-            }
-        },
-        true);
-
-    view_dispatcher_switch_to_view(
-        create_view_object->barcode_app->view_dispatcher, CreateBarcodeView);
-}
-
-static bool app_input_callback(InputEvent* input_event, void* ctx) {
-    furi_assert(ctx);
-
-    if(input_event->key == InputKeyBack) {
-        return false;
-    }
-
-    CreateView* create_view_object = ctx;
-
-    //get the currently selected menu item from the model
-    int selected_menu_item = 0;
-    BarcodeTypeObj* barcode_type = NULL;
-    FuriString* file_name;
-    FuriString* barcode_data;
-    CreateMode mode;
-
-    with_view_model(
-        create_view_object->view,
-        CreateViewModel * model,
-        {
-            selected_menu_item = model->selected_menu_item;
-            barcode_type = model->barcode_type;
-            file_name = model->file_name;
-            barcode_data = model->barcode_data;
-            mode = model->mode;
-        },
-        true);
-
-    int total_menu_items = mode == EditMode ? TOTAL_MENU_ITEMS : TOTAL_MENU_ITEMS - 1;
-
-    if(input_event->type == InputTypePress) {
-        if(input_event->key == InputKeyUp && selected_menu_item > 0) {
-            selected_menu_item--;
-        } else if(input_event->key == InputKeyDown && selected_menu_item < total_menu_items - 1) {
-            selected_menu_item++;
-        } else if(input_event->key == InputKeyLeft) {
-            if(selected_menu_item == TypeMenuItem && barcode_type != NULL) { //Select Barcode Type
-                if(barcode_type->type > 0) {
-                    barcode_type = barcode_type_objs[barcode_type->type - 1];
-                }
-            }
-        } else if(input_event->key == InputKeyRight) {
-            if(selected_menu_item == TypeMenuItem && barcode_type != NULL) { //Select Barcode Type
-                if(barcode_type->type < NUMBER_OF_BARCODE_TYPES - 2) {
-                    barcode_type = barcode_type_objs[barcode_type->type + 1];
-                }
-            }
-        } else if(input_event->key == InputKeyOk) {
-            if(selected_menu_item == FileNameMenuItem && barcode_type != NULL) {
-                create_view_object->setter = FileNameSetter;
-
-                snprintf(
-                    create_view_object->input,
-                    sizeof(create_view_object->input),
-                    "%s",
-                    furi_string_get_cstr(file_name));
-
-                text_input_set_result_callback(
-                    create_view_object->barcode_app->text_input,
-                    text_input_callback,
-                    create_view_object,
-                    create_view_object->input,
-                    TEXT_BUFFER_SIZE - BARCODE_EXTENSION_LENGTH, //remove the barcode length
-                    //clear default text
-                    false);
-                text_input_set_header_text(
-                    create_view_object->barcode_app->text_input, "File Name");
-
-                view_dispatcher_switch_to_view(
-                    create_view_object->barcode_app->view_dispatcher, TextInputView);
-            }
-            if(selected_menu_item == BarcodeDataMenuItem && barcode_type != NULL) {
-                create_view_object->setter = BarcodeDataSetter;
-
-                snprintf(
-                    create_view_object->input,
-                    sizeof(create_view_object->input),
-                    "%s",
-                    furi_string_get_cstr(barcode_data));
-
-                text_input_set_result_callback(
-                    create_view_object->barcode_app->text_input,
-                    text_input_callback,
-                    create_view_object,
-                    create_view_object->input,
-                    TEXT_BUFFER_SIZE,
-                    //clear default text
-                    false);
-                text_input_set_header_text(
-                    create_view_object->barcode_app->text_input, "Barcode Data");
-
-                view_dispatcher_switch_to_view(
-                    create_view_object->barcode_app->view_dispatcher, TextInputView);
-            }
-            if(selected_menu_item == SaveMenuButton && barcode_type != NULL) {
-                save_barcode(create_view_object);
-            }
-            if(selected_menu_item == DeleteMenuButton && barcode_type != NULL) {
-                if(mode == EditMode) {
-                    remove_barcode(create_view_object);
-                } else if(mode == NewMode) {
-                    view_dispatcher_switch_to_view(
-                        create_view_object->barcode_app->view_dispatcher, MainMenuView);
-                }
-            }
-        }
-    }
-
-    //change the currently selected menu item
-    with_view_model(
-        create_view_object->view,
-        CreateViewModel * model,
-        {
-            model->selected_menu_item = selected_menu_item;
-            model->barcode_type = barcode_type;
-        },
-        true);
-
-    return true;
-}
-
-CreateView* create_view_allocate(BarcodeApp* barcode_app) {
-    furi_assert(barcode_app);
-
-    CreateView* create_view_object = malloc(sizeof(CreateView));
-
-    create_view_object->view = view_alloc();
-    create_view_object->barcode_app = barcode_app;
-
-    view_set_context(create_view_object->view, create_view_object);
-    view_allocate_model(create_view_object->view, ViewModelTypeLocking, sizeof(CreateViewModel));
-    view_set_draw_callback(create_view_object->view, app_draw_callback);
-    view_set_input_callback(create_view_object->view, app_input_callback);
-
-    return create_view_object;
-}
-
-void create_view_free_model(CreateView* create_view_object) {
-    with_view_model(
-        create_view_object->view,
-        CreateViewModel * model,
-        {
-            if(model->file_path != NULL) {
-                furi_string_free(model->file_path);
-            }
-            if(model->file_name != NULL) {
-                furi_string_free(model->file_name);
-            }
-            if(model->barcode_data != NULL) {
-                furi_string_free(model->barcode_data);
-            }
-        },
-        true);
-}
-
-void remove_barcode(CreateView* create_view_object) {
-    Storage* storage = furi_record_open(RECORD_STORAGE);
-
-    bool success = false;
-
-    with_view_model(
-        create_view_object->view,
-        CreateViewModel * model,
-        {
-            FURI_LOG_I(TAG, "Attempting to remove file");
-            if(model->file_path != NULL) {
-                FURI_LOG_I(TAG, "Removing File: %s", furi_string_get_cstr(model->file_path));
-                if(storage_simply_remove(storage, furi_string_get_cstr(model->file_path))) {
-                    FURI_LOG_I(
-                        TAG,
-                        "File: \"%s\" was successfully removed",
-                        furi_string_get_cstr(model->file_path));
-                    success = true;
-                } else {
-                    FURI_LOG_E(TAG, "Unable to remove file!");
-                    success = false;
-                }
-            } else {
-                FURI_LOG_E(TAG, "Could not remove barcode file");
-                success = false;
-            }
-        },
-        true);
-    furi_record_close(RECORD_STORAGE);
-
-    with_view_model(
-        create_view_object->barcode_app->message_view->view,
-        MessageViewModel * model,
-        {
-            if(success) {
-                model->message = "File Deleted";
-            } else {
-                model->message = "Could not delete file";
-            }
-        },
-        true);
-
-    view_dispatcher_switch_to_view(
-        create_view_object->barcode_app->view_dispatcher, MessageErrorView);
-}
-
-void save_barcode(CreateView* create_view_object) {
-    BarcodeTypeObj* barcode_type = NULL;
-    FuriString* file_path; //this may be empty
-    FuriString* file_name;
-    FuriString* barcode_data;
-    CreateMode mode;
-
-    with_view_model(
-        create_view_object->view,
-        CreateViewModel * model,
-        {
-            file_path = model->file_path;
-            file_name = model->file_name;
-            barcode_data = model->barcode_data;
-            barcode_type = model->barcode_type;
-            mode = model->mode;
-        },
-        true);
-
-    if(file_name == NULL || furi_string_empty(file_name)) {
-        FURI_LOG_E(TAG, "File Name cannot be empty");
-        return;
-    }
-    if(barcode_data == NULL || furi_string_empty(barcode_data)) {
-        FURI_LOG_E(TAG, "Barcode Data cannot be empty");
-        return;
-    }
-    if(barcode_type == NULL) {
-        FURI_LOG_E(TAG, "Type not defined");
-        return;
-    }
-
-    bool success = false;
-
-    FuriString* full_file_path = furi_string_alloc_set(DEFAULT_USER_BARCODES);
-    furi_string_push_back(full_file_path, '/');
-    furi_string_cat(full_file_path, file_name);
-    furi_string_cat_str(full_file_path, BARCODE_EXTENSION);
-
-    Storage* storage = furi_record_open(RECORD_STORAGE);
-
-    if(mode == EditMode) {
-        if(!furi_string_empty(file_path)) {
-            if(!furi_string_equal(file_path, full_file_path)) {
-                FS_Error error = storage_common_rename(
-                    storage,
-                    furi_string_get_cstr(file_path),
-                    furi_string_get_cstr(full_file_path));
-                if(error != FSE_OK) {
-                    FURI_LOG_E(TAG, "Rename error: %s", storage_error_get_desc(error));
-                } else {
-                    FURI_LOG_I(TAG, "Rename Success");
-                }
-            }
-        }
-    }
-
-    FlipperFormat* ff = flipper_format_file_alloc(storage);
-
-    FURI_LOG_I(TAG, "Saving Barcode to: %s", furi_string_get_cstr(full_file_path));
-
-    bool file_opened_status = false;
-    if(mode == NewMode) {
-        file_opened_status =
-            flipper_format_file_open_new(ff, furi_string_get_cstr(full_file_path));
-    } else if(mode == EditMode) {
-        file_opened_status =
-            flipper_format_file_open_always(ff, furi_string_get_cstr(full_file_path));
-    }
-
-    if(file_opened_status) {
-        // Filetype: Barcode
-        // Version: 1
-
-        // # Types - UPC-A, EAN-8, EAN-13, CODE-39
-        // Type: CODE-39
-        // Data: AB
-        flipper_format_write_string_cstr(ff, "Filetype", "Barcode");
-
-        flipper_format_write_string_cstr(ff, "Version", FILE_VERSION);
-
-        flipper_format_write_comment_cstr(
-            ff, "Types - UPC-A, EAN-8, EAN-13, CODE-39, CODE-128, Codabar");
-
-        flipper_format_write_string_cstr(ff, "Type", barcode_type->name);
-
-        flipper_format_write_string_cstr(ff, "Data", furi_string_get_cstr(barcode_data));
-
-        success = true;
-    } else {
-        FURI_LOG_E(TAG, "Save error");
-        success = false;
-    }
-    furi_string_free(full_file_path);
-    flipper_format_free(ff);
-    furi_record_close(RECORD_STORAGE);
-
-    with_view_model(
-        create_view_object->barcode_app->message_view->view,
-        MessageViewModel * model,
-        {
-            if(success) {
-                model->message = "File Saved!";
-            } else {
-                model->message = "A saving error has occurred";
-            }
-        },
-        true);
-
-    view_dispatcher_switch_to_view(
-        create_view_object->barcode_app->view_dispatcher, MessageErrorView);
-}
-
-void create_view_free(CreateView* create_view_object) {
-    furi_assert(create_view_object);
-
-    create_view_free_model(create_view_object);
-    view_free(create_view_object->view);
-    free(create_view_object);
-}
-
-View* create_get_view(CreateView* create_view_object) {
-    furi_assert(create_view_object);
-    return create_view_object->view;
-}

+ 0 - 46
main_apps_sources/barcode_gen/views/create_view.h

@@ -1,46 +0,0 @@
-#pragma once
-
-#include <gui/view.h>
-
-typedef struct BarcodeApp BarcodeApp;
-
-typedef enum {
-    FileNameSetter,
-    BarcodeDataSetter
-} InputSetter; //what value to set for the text input view
-
-typedef enum {
-    EditMode,
-
-    NewMode
-} CreateMode;
-
-typedef struct {
-    View* view;
-    BarcodeApp* barcode_app;
-
-    InputSetter setter;
-    char input[TEXT_BUFFER_SIZE];
-} CreateView;
-
-typedef struct {
-    int selected_menu_item;
-
-    CreateMode mode;
-    BarcodeTypeObj* barcode_type;
-    FuriString* file_path; //the current file that is opened
-    FuriString* file_name;
-    FuriString* barcode_data;
-} CreateViewModel;
-
-CreateView* create_view_allocate(BarcodeApp* barcode_app);
-
-void remove_barcode(CreateView* create_view_object);
-
-void save_barcode(CreateView* create_view_object);
-
-void create_view_free_model(CreateView* create_view_object);
-
-void create_view_free(CreateView* create_view_object);
-
-View* create_get_view(CreateView* create_view_object);

+ 0 - 66
main_apps_sources/barcode_gen/views/message_view.c

@@ -1,66 +0,0 @@
-#include "../barcode_app.h"
-#include "message_view.h"
-
-static void app_draw_callback(Canvas* canvas, void* ctx) {
-    furi_assert(ctx);
-
-    MessageViewModel* message_view_model = ctx;
-
-    canvas_clear(canvas);
-    if(message_view_model->message != NULL) {
-        canvas_draw_str_aligned(
-            canvas, 62, 30, AlignCenter, AlignCenter, message_view_model->message);
-    }
-
-    canvas_set_color(canvas, ColorBlack);
-    canvas_draw_box(canvas, 100, 52, 28, 12);
-    canvas_set_color(canvas, ColorWhite);
-    canvas_draw_str_aligned(canvas, 114, 58, AlignCenter, AlignCenter, "OK");
-}
-
-static bool app_input_callback(InputEvent* input_event, void* ctx) {
-    furi_assert(ctx);
-
-    MessageView* message_view_object = ctx;
-
-    if(input_event->key == InputKeyBack) {
-        view_dispatcher_switch_to_view(
-            message_view_object->barcode_app->view_dispatcher, MainMenuView);
-    }
-    if(input_event->type == InputTypeShort) {
-        if(input_event->key == InputKeyOk) {
-            view_dispatcher_switch_to_view(
-                message_view_object->barcode_app->view_dispatcher, MainMenuView);
-        }
-    }
-
-    return true;
-}
-
-MessageView* message_view_allocate(BarcodeApp* barcode_app) {
-    furi_assert(barcode_app);
-
-    MessageView* message_view_object = malloc(sizeof(MessageView));
-
-    message_view_object->view = view_alloc();
-    message_view_object->barcode_app = barcode_app;
-
-    view_set_context(message_view_object->view, message_view_object);
-    view_allocate_model(message_view_object->view, ViewModelTypeLocking, sizeof(MessageViewModel));
-    view_set_draw_callback(message_view_object->view, app_draw_callback);
-    view_set_input_callback(message_view_object->view, app_input_callback);
-
-    return message_view_object;
-}
-
-void message_view_free(MessageView* message_view_object) {
-    furi_assert(message_view_object);
-
-    view_free(message_view_object->view);
-    free(message_view_object);
-}
-
-View* message_get_view(MessageView* message_view_object) {
-    furi_assert(message_view_object);
-    return message_view_object->view;
-}

+ 0 - 22
main_apps_sources/barcode_gen/views/message_view.h

@@ -1,22 +0,0 @@
-#pragma once
-
-#include <gui/view.h>
-
-typedef struct BarcodeApp BarcodeApp;
-
-typedef struct {
-    View* view;
-    BarcodeApp* barcode_app;
-} MessageView;
-
-typedef struct {
-    const char* message;
-} MessageViewModel;
-
-MessageView* message_view_allocate(BarcodeApp* barcode_app);
-
-void message_view_free_model(MessageView* message_view_object);
-
-void message_view_free(MessageView* message_view_object);
-
-View* message_get_view(MessageView* message_view_object);

+ 0 - 22
main_apps_sources/bomberduck/LICENSE

@@ -1,22 +0,0 @@
-MIT License
-
-Copyright (c) 2023 лень
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-

+ 0 - 2
main_apps_sources/bomberduck/README.md

@@ -1,2 +0,0 @@
-# flipperzero-bomberduck
-Bomberman clone on flipper zero!

+ 0 - 17
main_apps_sources/bomberduck/application.fam

@@ -1,17 +0,0 @@
-App(
-    appid="bomberduck",
-    name="Bomberduck",
-    apptype=FlipperAppType.EXTERNAL,
-    entry_point="bomberduck_app",
-    requires=[
-        "gui",
-    ],
-    stack_size=1 * 1024,
-    order=90,
-	fap_icon="bomb.png",
-    fap_category="Games",
-    fap_icon_assets="assets",
-    fap_author="@leo-need-more-coffee & @xMasterX",
-    fap_version="1.0",
-    fap_description="Bomberduck(Bomberman) Game",
-)

BIN
main_apps_sources/bomberduck/assets/bomb0.png


BIN
main_apps_sources/bomberduck/assets/bomb1.png


BIN
main_apps_sources/bomberduck/assets/bomb2.png


BIN
main_apps_sources/bomberduck/assets/box.png


BIN
main_apps_sources/bomberduck/assets/end.png


BIN
main_apps_sources/bomberduck/assets/enemy1.png


BIN
main_apps_sources/bomberduck/assets/enemyleft.png


BIN
main_apps_sources/bomberduck/assets/enemyright.png


BIN
main_apps_sources/bomberduck/assets/explore.png


BIN
main_apps_sources/bomberduck/assets/playerleft.png


BIN
main_apps_sources/bomberduck/assets/playerright.png


BIN
main_apps_sources/bomberduck/assets/unbreakbox.png


BIN
main_apps_sources/bomberduck/bomb.png


+ 0 - 647
main_apps_sources/bomberduck/bomberduck.c

@@ -1,647 +0,0 @@
-#include <stdio.h>
-#include <furi.h>
-
-#include <gui/gui.h>
-#include <input/input.h>
-#include <notification/notification.h>
-#include <notification/notification_messages.h>
-#include "bomberduck_icons.h"
-#include <dolphin/dolphin.h>
-
-int max(int a, int b) {
-    return (a > b) ? a : b;
-}
-
-int min(int a, int b) {
-    return (a < b) ? a : b;
-}
-
-#define WorldSizeX 12
-#define WorldSizeY 6
-#define BombRange 1
-
-typedef struct {
-    FuriMutex* mutex;
-} BomberState;
-
-typedef struct {
-    int row;
-    int col;
-} Cell;
-
-typedef struct {
-    Cell cells[WorldSizeY * WorldSizeX];
-    int front;
-    int rear;
-} Queue;
-
-void enqueue(Queue* q, Cell c) {
-    q->cells[q->rear] = c;
-    q->rear++;
-}
-
-Cell dequeue(Queue* q) {
-    Cell c = q->cells[q->front];
-    q->front++;
-
-    return c;
-}
-
-bool is_empty(Queue* q) {
-    return q->front == q->rear;
-}
-
-typedef struct {
-    int x;
-    int y;
-    int planted;
-} Bomb;
-
-typedef struct {
-    int x;
-    int y;
-    bool side;
-} Player;
-
-typedef struct {
-    int x;
-    int y;
-    int last;
-    bool side;
-    int level;
-} Enemy;
-
-typedef struct {
-    int matrix[WorldSizeY][WorldSizeX];
-    Player* player;
-    bool running;
-    int level;
-
-    Enemy enemies[10];
-    int enemies_count;
-
-    Bomb bombs[100];
-    int bombs_count;
-
-    int endx;
-    int endy;
-} World;
-
-Player player = {0, 0, 1};
-World world = {{{0}}, &player, 1, 0, {}, 0, {}, 0, 0, 0};
-bool vibration = false;
-
-void init() {
-    player.x = 1;
-    player.y = 1;
-
-    world.endx = 4 + rand() % 8;
-    world.endy = rand() % 6;
-    for(int i = 0; i < WorldSizeY; i++) {
-        for(int j = 0; j < WorldSizeX; j++) {
-            world.matrix[i][j] = rand() % 3;
-        }
-    }
-    world.running = 1;
-    world.bombs_count = 0;
-    vibration = false;
-    for(int j = max(0, player.y - BombRange); j < min(WorldSizeY, player.y + BombRange + 1); j++) {
-        world.matrix[j][player.x] = 0;
-    }
-
-    for(int j = max(0, player.x - BombRange); j < min(WorldSizeX, player.x + BombRange + 1); j++) {
-        world.matrix[player.y][j] = 0;
-    }
-
-    world.enemies_count = 0;
-    for(int j = 0; j < rand() % 4 + world.level / 5; j++) {
-        Enemy enemy;
-        enemy.x = 4 + rand() % 7;
-        enemy.y = rand() % 6;
-        enemy.last = 0;
-        enemy.side = 1;
-        enemy.level = 0;
-
-        world.enemies[j] = enemy;
-        world.enemies_count++;
-
-        for(int m = max(0, world.enemies[j].y - BombRange);
-            m < min(WorldSizeY, world.enemies[j].y + BombRange + 1);
-            m++) {
-            world.matrix[m][world.enemies[j].x] = 0;
-        }
-
-        for(int m = max(0, world.enemies[j].x - BombRange);
-            m < min(WorldSizeX, world.enemies[j].x + BombRange + 1);
-            m++) {
-            world.matrix[world.enemies[j].y][m] = 0;
-        }
-    }
-    world.matrix[world.endy][world.endx] = 1;
-}
-
-const NotificationSequence end = {
-    &message_vibro_on,
-
-    &message_note_ds4,
-    &message_delay_10,
-    &message_sound_off,
-    &message_delay_10,
-
-    &message_note_ds4,
-    &message_delay_10,
-    &message_sound_off,
-    &message_delay_10,
-
-    &message_note_ds4,
-    &message_delay_10,
-    &message_sound_off,
-    &message_delay_10,
-
-    &message_vibro_off,
-    NULL,
-};
-
-static const NotificationSequence bomb2 = {
-    &message_vibro_on,
-    &message_delay_25,
-    &message_vibro_off,
-    NULL,
-};
-
-static const NotificationSequence bomb_explore = {
-    &message_vibro_on,
-    &message_delay_50,
-    &message_vibro_off,
-    NULL,
-};
-
-static const NotificationSequence vibr1 = {
-    &message_vibro_on,
-    &message_delay_10,
-    &message_vibro_off,
-    &message_delay_10,
-    &message_vibro_on,
-    &message_delay_10,
-    &message_vibro_off,
-    &message_delay_10,
-
-    NULL,
-};
-
-void intToStr(int num, char* str) {
-    int i = 0, sign = 0;
-
-    if(num < 0) {
-        num = -num;
-        sign = 1;
-    }
-
-    do {
-        str[i++] = num % 10 + '0';
-        num /= 10;
-    } while(num > 0);
-
-    if(sign) {
-        str[i++] = '-';
-    }
-
-    str[i] = '\0';
-
-    // Reverse the string
-    int j, len = i;
-    char temp;
-    for(j = 0; j < len / 2; j++) {
-        temp = str[j];
-        str[j] = str[len - j - 1];
-        str[len - j - 1] = temp;
-    }
-}
-
-bool BFS() {
-    // Initialize visited array and queue
-    int visited[WorldSizeY][WorldSizeX] = {0};
-    Queue q = {.front = 0, .rear = 0};
-    // Mark the starting cell as visited and enqueue it
-    visited[world.player->y][world.player->x] = 1;
-    Cell startCell = {.row = world.player->y, .col = world.player->x};
-    enqueue(&q, startCell);
-    // Traverse the field
-    while(!is_empty(&q)) {
-        // Dequeue a cell from the queue
-        Cell currentCell = dequeue(&q);
-        // Check if the current cell is the destination cell
-        if(currentCell.row == world.endy && currentCell.col == world.endx) {
-            return true;
-        }
-        // Check the neighboring cells
-        for(int rowOffset = -1; rowOffset <= 1; rowOffset++) {
-            for(int colOffset = -1; colOffset <= 1; colOffset++) {
-                // Skip diagonals and the current cell
-                if(rowOffset == 0 && colOffset == 0) {
-                    continue;
-                }
-                if(rowOffset != 0 && colOffset != 0) {
-                    continue;
-                }
-                // Calculate the row and column of the neighboring cell
-                int neighborRow = currentCell.row + rowOffset;
-                int neighborCol = currentCell.col + colOffset;
-                // Skip out-of-bounds cells and already visited cells
-                if(neighborRow < 0 || neighborRow >= WorldSizeY || neighborCol < 0 ||
-                   neighborCol >= WorldSizeX) {
-                    continue;
-                }
-                if(visited[neighborRow][neighborCol]) {
-                    continue;
-                }
-                // Mark the neighboring cell as visited and enqueue it
-                if(world.matrix[neighborRow][neighborCol] != 2) {
-                    visited[neighborRow][neighborCol] = 1;
-                    Cell neighborCell = {.row = neighborRow, .col = neighborCol};
-                    enqueue(&q, neighborCell);
-                }
-            }
-        }
-    }
-    return false;
-}
-
-static void draw_callback(Canvas* canvas, void* ctx) {
-    furi_assert(ctx);
-    const BomberState* bomber_state = ctx;
-
-    furi_mutex_acquire(bomber_state->mutex, FuriWaitForever);
-    if(!BFS()) {
-        init();
-    }
-    canvas_clear(canvas);
-
-    canvas_draw_icon(canvas, world.endx * 10 + 4, world.endy * 10 + 2, &I_end);
-
-    if(world.running) {
-        for(size_t i = 0; i < WorldSizeY; i++) {
-            for(size_t j = 0; j < WorldSizeX; j++) {
-                switch(world.matrix[i][j]) {
-                case 0:
-                    break;
-                case 1:
-                    canvas_draw_icon(canvas, j * 10 + 4, i * 10 + 2, &I_box);
-                    break;
-                case 2:
-                    canvas_draw_icon(canvas, j * 10 + 4, i * 10 + 2, &I_unbreakbox);
-                    break;
-                case 3:
-                    canvas_draw_icon(canvas, j * 10 + 4, i * 10 + 2, &I_bomb0);
-                    break;
-                case 4:
-                    canvas_draw_icon(canvas, j * 10 + 4, i * 10 + 2, &I_bomb1);
-                    break;
-                case 5:
-                    canvas_draw_icon(canvas, j * 10 + 4, i * 10 + 2, &I_bomb2);
-                    break;
-                case 6:
-                    canvas_draw_icon(canvas, j * 10 + 4, i * 10 + 2, &I_explore);
-                    world.matrix[i][j] = 0;
-                    break;
-                }
-            }
-        }
-
-        if(world.player->side) {
-            canvas_draw_icon(
-                canvas, world.player->x * 10 + 4, world.player->y * 10 + 2, &I_playerright);
-        } else {
-            canvas_draw_icon(
-                canvas, world.player->x * 10 + 4, world.player->y * 10 + 2, &I_playerleft);
-        }
-
-        for(int i = 0; i < world.enemies_count; i++) {
-            if(world.enemies[i].level > 0) {
-                canvas_draw_icon(
-                    canvas, world.enemies[i].x * 10 + 4, world.enemies[i].y * 10 + 2, &I_enemy1);
-            } else {
-                if(world.enemies[i].side) {
-                    canvas_draw_icon(
-                        canvas,
-                        world.enemies[i].x * 10 + 4,
-                        world.enemies[i].y * 10 + 2,
-                        &I_enemyright);
-                } else {
-                    canvas_draw_icon(
-                        canvas,
-                        world.enemies[i].x * 10 + 4,
-                        world.enemies[i].y * 10 + 2,
-                        &I_enemyleft);
-                }
-            }
-        }
-    } else {
-        canvas_set_font(canvas, FontPrimary);
-        if(world.player->x == world.endx && world.player->y == world.endy) {
-            if(world.level == 20) {
-                canvas_draw_str(canvas, 30, 35, "You win!");
-            } else {
-                canvas_draw_str(canvas, 30, 35, "Next level!");
-                char str[20];
-                intToStr(world.level, str);
-                canvas_draw_str(canvas, 90, 35, str);
-            }
-
-        } else {
-            canvas_draw_str(canvas, 30, 35, "You died :(");
-        }
-    }
-
-    furi_mutex_release(bomber_state->mutex);
-}
-
-static void input_callback(InputEvent* input_event, void* ctx) {
-    // Проверяем, что контекст не нулевой
-    furi_assert(ctx);
-    FuriMessageQueue* event_queue = ctx;
-
-    furi_message_queue_put(event_queue, input_event, FuriWaitForever);
-}
-
-int32_t bomberduck_app(void* p) {
-    UNUSED(p);
-
-    // Текущее событие типа InputEvent
-    InputEvent event;
-    // Очередь событий на 8 элементов размера InputEvent
-    FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(InputEvent));
-
-    BomberState* bomber_state = malloc(sizeof(BomberState));
-
-    bomber_state->mutex = furi_mutex_alloc(FuriMutexTypeNormal); // Alloc Mutex
-    if(!bomber_state->mutex) {
-        FURI_LOG_E("BomberDuck", "cannot create mutex\r\n");
-        furi_message_queue_free(event_queue);
-        free(bomber_state);
-        return 255;
-    }
-
-    dolphin_deed(DolphinDeedPluginGameStart);
-    // Создаем новый view port
-    ViewPort* view_port = view_port_alloc();
-    // Создаем callback отрисовки, без контекста
-    view_port_draw_callback_set(view_port, draw_callback, bomber_state);
-    // Создаем callback нажатий на клавиши, в качестве контекста передаем
-    // нашу очередь сообщений, чтоб запихивать в неё эти события
-    view_port_input_callback_set(view_port, input_callback, event_queue);
-
-    // Создаем GUI приложения
-    Gui* gui = furi_record_open(RECORD_GUI);
-    // Подключаем view port к GUI в полноэкранном режиме
-    gui_add_view_port(gui, view_port, GuiLayerFullscreen);
-    NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
-    notification_message_block(notification, &sequence_display_backlight_enforce_on);
-
-    init();
-
-    // Бесконечный цикл обработки очереди событий
-    while(1) {
-        if(furi_message_queue_get(event_queue, &event, 100) == FuriStatusOk) {
-            furi_mutex_acquire(bomber_state->mutex, FuriWaitForever);
-            // Если нажата кнопка "назад", то выходим из цикла, а следовательно и из приложения
-
-            if(event.type == InputTypePress) {
-                if(event.key == InputKeyOk) {
-                    if(world.running) {
-                        if(world.matrix[world.player->y][world.player->x] == 0 &&
-                           world.bombs_count < 2) {
-                            notification_message(notification, &bomb2);
-                            world.matrix[world.player->y][world.player->x] = 3;
-                            Bomb bomb = {world.player->x, world.player->y, furi_get_tick()};
-                            world.bombs[world.bombs_count] = bomb;
-                            world.bombs_count++;
-                        }
-                    } else {
-                        init();
-                    }
-                }
-                if(world.running) {
-                    if(event.key == InputKeyUp) {
-                        if(world.player->y > 0 &&
-                           world.matrix[world.player->y - 1][world.player->x] == 0)
-                            world.player->y--;
-                    }
-                    if(event.key == InputKeyDown) {
-                        if(world.player->y < WorldSizeY - 1 &&
-                           world.matrix[world.player->y + 1][world.player->x] == 0)
-                            world.player->y++;
-                    }
-                    if(event.key == InputKeyLeft) {
-                        world.player->side = 0;
-                        if(world.player->x > 0 &&
-                           world.matrix[world.player->y][world.player->x - 1] == 0)
-                            world.player->x--;
-                    }
-                    if(event.key == InputKeyRight) {
-                        world.player->side = 1;
-                        if(world.player->x < WorldSizeX - 1 &&
-                           world.matrix[world.player->y][world.player->x + 1] == 0)
-                            world.player->x++;
-                    }
-                }
-            } else if(event.type == InputTypeLong) {
-                if(event.key == InputKeyBack) {
-                    break;
-                }
-            }
-        }
-        if(world.running) {
-            if(world.player->x == world.endx && world.player->y == world.endy) {
-                notification_message(notification, &end);
-                world.running = 0;
-                world.level += 1;
-                if(world.level % 5 == 0) {
-                    dolphin_deed(DolphinDeedPluginGameWin);
-                }
-            }
-            for(int i = 0; i < world.bombs_count; i++) {
-                if(furi_get_tick() - world.bombs[i].planted >
-                   (unsigned long)max((3000 - world.level * 150), 1000)) {
-                    vibration = false;
-                    world.matrix[world.bombs[i].y][world.bombs[i].x] = 6;
-                    notification_message(notification, &bomb_explore);
-
-                    for(int j = max(0, world.bombs[i].y - BombRange);
-                        j < min(WorldSizeY, world.bombs[i].y + BombRange + 1);
-                        j++) {
-                        if(world.matrix[j][world.bombs[i].x] != 2) {
-                            world.matrix[j][world.bombs[i].x] = 6;
-                            if(j == world.player->y && world.bombs[i].x == world.player->x) {
-                                notification_message(notification, &end);
-                                world.running = 0;
-                            }
-                            for(int e = 0; e < world.enemies_count; e++) {
-                                if(j == world.enemies[e].y &&
-                                   world.bombs[i].x == world.enemies[e].x) {
-                                    if(world.enemies[e].level > 0) {
-                                        world.enemies[e].level--;
-                                    } else {
-                                        for(int l = e; l < world.enemies_count - 1; l++) {
-                                            world.enemies[l] = world.enemies[l + 1];
-                                        }
-                                        world.enemies_count--;
-                                    }
-                                }
-                            }
-                        }
-                    }
-
-                    for(int j = max(0, world.bombs[i].x - BombRange);
-                        j < min(WorldSizeX, world.bombs[i].x + BombRange + 1);
-                        j++) {
-                        if(world.matrix[world.bombs[i].y][j] != 2) {
-                            world.matrix[world.bombs[i].y][j] = 6;
-                            if(world.bombs[i].y == world.player->y && j == world.player->x) {
-                                notification_message(notification, &end);
-                                world.running = 0;
-                            }
-                            for(int e = 0; e < world.enemies_count; e++) {
-                                if(world.bombs[i].y == world.enemies[e].y &&
-                                   j == world.enemies[e].x) {
-                                    if(world.enemies[e].level > 0) {
-                                        world.enemies[e].level--;
-                                    } else {
-                                        for(int l = e; l < world.enemies_count - 1; l++) {
-                                            world.enemies[l] = world.enemies[l + 1];
-                                        }
-                                        world.enemies_count--;
-                                    }
-                                }
-                            }
-                        }
-                    }
-
-                    for(int j = i; j < world.bombs_count - 1; j++) {
-                        world.bombs[j] = world.bombs[j + 1];
-                    }
-                    world.bombs_count--;
-                } else if(
-                    furi_get_tick() - world.bombs[i].planted >
-                        (unsigned long)max((3000 - world.level * 150) * 2 / 3, 666) &&
-                    world.matrix[world.bombs[i].y][world.bombs[i].x] != 5) {
-                    world.matrix[world.bombs[i].y][world.bombs[i].x] = 5;
-                    vibration = true;
-
-                } else if(
-                    furi_get_tick() - world.bombs[i].planted >
-                        (unsigned long)max((3000 - world.level * 150) / 3, 333) &&
-                    world.matrix[world.bombs[i].y][world.bombs[i].x] != 4) {
-                    world.matrix[world.bombs[i].y][world.bombs[i].x] = 4;
-                }
-            }
-            for(int e = 0; e < world.enemies_count; e++) {
-                if(world.player->y == world.enemies[e].y &&
-                   world.player->x == world.enemies[e].x) {
-                    notification_message(notification, &end);
-                    world.running = 0;
-                }
-            }
-
-            for(int e = 0; e < world.enemies_count; e++) {
-                if(world.enemies[e].level > 0) {
-                    if(furi_get_tick() - world.enemies[e].last >
-                       (unsigned long)max((2000 - world.level * 100), 1000)) {
-                        world.enemies[e].last = furi_get_tick();
-                        int move = rand() % 4;
-                        switch(move) {
-                        case 0:
-                            if(world.enemies[e].y > 0 &&
-                               world.matrix[world.enemies[e].y - 1][world.enemies[e].x] != 2)
-                                world.enemies[e].y--;
-                            break;
-                        case 1:
-                            if(world.enemies[e].y < WorldSizeY - 1 &&
-                               world.matrix[world.enemies[e].y + 1][world.enemies[e].x] != 2)
-                                world.enemies[e].y++;
-                            break;
-                        case 2:
-                            world.enemies[e].side = 0;
-                            if(world.enemies[e].x > 0 &&
-                               world.matrix[world.enemies[e].y][world.enemies[e].x - 1] != 2)
-                                world.enemies[e].x--;
-                            break;
-                        case 3:
-                            world.enemies[e].side = 1;
-                            if(world.enemies[e].x < WorldSizeX - 1 &&
-                               world.matrix[world.enemies[e].y][world.enemies[e].x + 1] != 2)
-                                world.enemies[e].x++;
-                        default:
-                            break;
-                        }
-                    }
-                } else {
-                    if(furi_get_tick() - world.enemies[e].last >
-                       (unsigned long)max((1000 - world.level * 50), 500)) {
-                        world.enemies[e].last = furi_get_tick();
-                        int move = rand() % 4;
-                        switch(move) {
-                        case 0:
-                            if(world.enemies[e].y > 0 &&
-                               world.matrix[world.enemies[e].y - 1][world.enemies[e].x] == 0)
-                                world.enemies[e].y--;
-                            break;
-                        case 1:
-                            if(world.enemies[e].y < WorldSizeY - 1 &&
-                               world.matrix[world.enemies[e].y + 1][world.enemies[e].x] == 0)
-                                world.enemies[e].y++;
-                            break;
-                        case 2:
-                            world.enemies[e].side = 0;
-                            if(world.enemies[e].x > 0 &&
-                               world.matrix[world.enemies[e].y][world.enemies[e].x - 1] == 0)
-                                world.enemies[e].x--;
-                            break;
-                        case 3:
-                            world.enemies[e].side = 1;
-                            if(world.enemies[e].x < WorldSizeX - 1 &&
-                               world.matrix[world.enemies[e].y][world.enemies[e].x + 1] == 0)
-                                world.enemies[e].x++;
-                        default:
-                            break;
-                        }
-                    }
-                }
-            }
-            for(int e = 0; e < world.enemies_count; e++) {
-                for(int h = e + 1; h < world.enemies_count; h++) {
-                    if(world.enemies[e].y == world.enemies[h].y &&
-                       world.enemies[e].x == world.enemies[h].x) {
-                        world.enemies[h].level++;
-                        for(int l = e; l < world.enemies_count - 1; l++) {
-                            world.enemies[l] = world.enemies[l + 1];
-                        }
-                        world.enemies_count--;
-                    }
-                }
-            }
-            if(vibration) {
-                notification_message(notification, &vibr1);
-            }
-        }
-
-        view_port_update(view_port);
-        furi_mutex_release(bomber_state->mutex);
-    }
-
-    // Return to normal backlight settings
-    notification_message_block(notification, &sequence_display_backlight_enforce_auto);
-    furi_record_close(RECORD_NOTIFICATION);
-    // Специальная очистка памяти, занимаемой очередью
-    furi_message_queue_free(event_queue);
-
-    // Чистим созданные объекты, связанные с интерфейсом
-    gui_remove_view_port(gui, view_port);
-    view_port_free(view_port);
-
-    furi_mutex_free(bomber_state->mutex);
-    furi_record_close(RECORD_GUI);
-    free(bomber_state);
-
-    return 0;
-}

BIN
main_apps_sources/bomberduck/img/1.png


BIN
main_apps_sources/bomberduck/img/2.png


+ 0 - 4
main_apps_sources/doom/.gitignore

@@ -1,4 +0,0 @@
-dist/*
-.vscode
-.clang-format
-.editorconfig

+ 0 - 10
main_apps_sources/doom/README.md

@@ -1,10 +0,0 @@
-# Doom Flipper Zero edition
-## Will it run Doom?
-As tradition goes, Doom is being ported to almost every possible embedded electronic device. Therefore I did an attempt to come up with something close to Doom and still compatible on the Flipper Zero's hardware. This is not the actual Doom game but a port made from yet another Doom port to the Arduino Nano - https://github.com/daveruiz/doom-nano/. This port is basically a raycasting engine, using Doom sprites.
-This version is very basic and might be improved over time.
-
-## Credits
-@xMasterX - Porting to latest firmware using new plugins system, fixing many issues, adding sound
-@Svaarich - New logo screen and cool icon
-@hedger - uFBT fixes and some bugfixes
-@p4nic4ttack - First raw implementation based on doom-nano

+ 0 - 18
main_apps_sources/doom/application.fam

@@ -1,18 +0,0 @@
-App(
-    appid="doom",
-    name="DOOM",
-    apptype=FlipperAppType.EXTERNAL,
-    entry_point="doom_app",
-    requires=[
-        "gui",
-        "music_player",
-    ],
-    stack_size=4 * 1024,
-    order=75,
-    fap_icon="doom_10px.png",
-    fap_category="Games",
-    fap_icon_assets="assets",
-    fap_author="@xMasterX & @Svarich & @hedger (original code by @p4nic4ttack)",
-    fap_version="1.0",
-    fap_description="Will it run Doom?",
-)

+ 0 - 331
main_apps_sources/doom/assets.c

@@ -1,331 +0,0 @@
-#include "assets.h"
-
-const uint8_t space[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-const uint8_t zero[] = {0x00, 0x60, 0x90, 0x90, 0x90, 0x60};
-const uint8_t one[] = {0x00, 0x20, 0x20, 0x20, 0x20, 0x70};
-const uint8_t two[] = {0x00, 0x60, 0x90, 0x20, 0x40, 0xf0};
-const uint8_t three[] = {0x00, 0x60, 0x90, 0x20, 0x90, 0x60};
-const uint8_t four[] = {0x00, 0x90, 0x90, 0xf0, 0x10, 0x10};
-const uint8_t five[] = {0x00, 0xf0, 0x80, 0xe0, 0x10, 0xe0};
-const uint8_t six[] = {0x00, 0x60, 0x80, 0xe0, 0x90, 0x60};
-const uint8_t seven[] = {0x00, 0xf0, 0x10, 0x10, 0x10, 0x10};
-const uint8_t eight[] = {0x00, 0x60, 0x90, 0x60, 0x90, 0x60};
-const uint8_t nine[] = {0x00, 0x60, 0x90, 0x70, 0x10, 0x60};
-const uint8_t A[] = {0x00, 0x60, 0x90, 0xf0, 0x90, 0x90};
-const uint8_t B[] = {0x00, 0xe0, 0x90, 0xe0, 0x90, 0xe0};
-const uint8_t C[] = {0x00, 0x60, 0x90, 0x80, 0x90, 0x60};
-const uint8_t D[] = {0x00, 0xe0, 0x90, 0x90, 0x90, 0xe0};
-const uint8_t E[] = {0x00, 0xf0, 0x80, 0xe0, 0x80, 0xf0};
-const uint8_t F[] = {0x00, 0xf0, 0x80, 0xe0, 0x80, 0x80};
-const uint8_t G[] = {0x00, 0x60, 0x80, 0x80, 0x90, 0x60};
-const uint8_t H[] = {0x00, 0x90, 0x90, 0xf0, 0x90, 0x90};
-const uint8_t I[] = {0x00, 0x20, 0x20, 0x20, 0x20, 0x20};
-const uint8_t J[] = {0x00, 0x10, 0x10, 0x10, 0x90, 0x60};
-const uint8_t K[] = {0x00, 0x90, 0xa0, 0xc0, 0xa0, 0x90};
-const uint8_t L[] = {0x00, 0x80, 0x80, 0x80, 0x80, 0xf0};
-const uint8_t M[] = {0x00, 0x90, 0xf0, 0x90, 0x90, 0x90};
-const uint8_t N[] = {0x00, 0x90, 0xd0, 0xb0, 0x90, 0x90};
-const uint8_t O[] = {0x00, 0x60, 0x90, 0x90, 0x90, 0x60};
-const uint8_t P[] = {0x00, 0xe0, 0x90, 0xe0, 0x80, 0x80};
-const uint8_t Q[] = {0x00, 0x60, 0x90, 0x90, 0xb0, 0x70};
-const uint8_t R[] = {0x00, 0xe0, 0x90, 0xe0, 0x90, 0x90};
-const uint8_t S[] = {0x00, 0x60, 0x80, 0x60, 0x10, 0xe0};
-const uint8_t T[] = {0x00, 0xe0, 0x40, 0x40, 0x40, 0x40};
-const uint8_t U[] = {0x00, 0x90, 0x90, 0x90, 0x90, 0x60};
-const uint8_t V[] = {0x00, 0x90, 0x90, 0x90, 0x60, 0x60};
-const uint8_t W[] = {0x00, 0x90, 0x90, 0x90, 0xf0, 0x90};
-const uint8_t X[] = {0x00, 0x90, 0x90, 0x60, 0x90, 0x90};
-const uint8_t Y[] = {0x00, 0x90, 0x90, 0x60, 0x60, 0x60};
-const uint8_t Z[] = {0x00, 0xf0, 0x10, 0x60, 0x80, 0xf0};
-const uint8_t dot[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x40};
-const uint8_t comma[] = {0x00, 0x00, 0x00, 0x00, 0x20, 0x40};
-const uint8_t dash[] = {0x00, 0x00, 0x00, 0x60, 0x00, 0x00};
-const uint8_t underscore[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xf0};
-const uint8_t bracket_open[] = {0x00, 0x20, 0x40, 0x40, 0x40, 0x20};
-const uint8_t bracket_close[] = {0x00, 0x40, 0x20, 0x20, 0x20, 0x40};
-const uint8_t cross_left[] = {0x10, 0x10, 0x70, 0x70, 0x10, 0x10};
-const uint8_t cross_right[] = {0x80, 0x80, 0xe0, 0xe0, 0x80, 0x80};
-const uint8_t pacman_left[] = {0x00, 0x30, 0x50, 0x70, 0x70, 0x00};
-const uint8_t pacman_right[] = {0x00, 0xc0, 0x60, 0xe0, 0xe0, 0xe0};
-const uint8_t box[] = {0x00, 0xf0, 0xf0, 0xf0, 0xf0, 0x00};
-const uint8_t* char_arr[48] = {
-    space,
-    zero,
-    one,
-    two,
-    three,
-    four,
-    five,
-    six,
-    seven,
-    eight,
-    nine,
-    A,
-    B,
-    C,
-    D,
-    E,
-    F,
-    G,
-    H,
-    I,
-    J,
-    K,
-    L,
-    M,
-    N,
-    O,
-    P,
-    Q,
-    R,
-    S,
-    T,
-    U,
-    V,
-    W,
-    X,
-    Y,
-    Z,
-    dot,
-    comma,
-    dash,
-    underscore,
-    bracket_open,
-    bracket_close,
-    cross_left,
-    cross_right,
-    pacman_left,
-    pacman_right,
-    box};
-const uint8_t gradient[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88, 0x00, 0x00, 0x22, 0x22,
-                            0x00, 0x00, 0x8a, 0x8a, 0x00, 0x00, 0x22, 0x22, 0x00, 0x00, 0xaa, 0xaa,
-                            0x10, 0x10, 0xaa, 0xaa, 0x00, 0x00, 0xaa, 0xaa, 0x01, 0x01, 0xaa, 0xaa,
-                            0x44, 0x44, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x44, 0x44, 0xaa, 0xaa,
-                            0x15, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xbb, 0xbb,
-                            0x55, 0x55, 0xaa, 0xea, 0x55, 0x55, 0xbb, 0xbb, 0x55, 0x55, 0xff, 0xff,
-                            0x55, 0x55, 0xfb, 0xfb, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xbb, 0xbf,
-                            0x57, 0x57, 0xff, 0xff, 0xdd, 0xdd, 0xff, 0xff, 0x77, 0x75, 0xff, 0xff,
-                            0xdd, 0xdd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-                            0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-//const uint8_t gun[] = {0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0x27, 0xff, 0xff, 0xfe, 0x3b, 0xff, 0xff, 0xfd, 0xfb, 0xff, 0xff, 0xfd, 0xfd, 0xff, 0xff, 0xfd, 0x15, 0xff, 0xff, 0xfb, 0x2e, 0xff, 0xff, 0xf6, 0x77, 0x7f, 0xff, 0xe6, 0xff, 0xff, 0xff, 0xf2, 0x3d, 0x7f, 0xff, 0xd6, 0x7e, 0x3f, 0xff, 0xf4, 0x5d, 0xdf, 0xff, 0xce, 0xbf, 0xbf, 0xff, 0xdc, 0xff, 0x3f, 0xff, 0xec, 0xff, 0xbf, 0xff, 0x8d, 0xfd, 0xff, 0xff, 0xb6, 0xff, 0xbf, 0xfe, 0x1f, 0x57, 0xdf, 0xf8, 0x0e, 0xff, 0xcf, 0xf4, 0x46, 0x1f, 0x17, 0xf8, 0xa3, 0xfc, 0x03, 0xf8, 0x10, 0x00, 0x11, 0xf8, 0x8a, 0x80, 0x2d, 0xe4, 0x44, 0x00, 0x4d, 0xee, 0xa8, 0x82, 0x9b, 0xcd, 0x50, 0x00, 0x17, 0xec, 0xa0, 0x8a, 0x2f, 0xcc, 0x00, 0x04, 0x67, 0xe8, 0x28, 0x1a, 0xff, 0xe4, 0x70, 0x4d, 0xcf, 0xfc, 0x82, 0xa7, 0xef, 0x90, 0x40, 0x13, 0xdf};
-// const uint8_t gun_mask[] = {0xff, 0xff, 0x8f, 0xff, 0xff, 0xfe, 0x03, 0xff, 0xff, 0xfc, 0x01, 0xff, 0xff, 0xf8, 0x01, 0xff, 0xff, 0xf8, 0x00, 0xff, 0xff, 0xf8, 0x00, 0xff, 0xff, 0xf0, 0x00, 0x7f, 0xff, 0xe0, 0x00, 0x3f, 0xff, 0xc0, 0x00, 0x7f, 0xff, 0xc0, 0x00, 0x3f, 0xff, 0x80, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x0f, 0xff, 0x80, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x1f, 0xff, 0x00, 0x00, 0x3f, 0xff, 0x00, 0x00, 0x1f, 0xfc, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0f};
-const uint8_t gun[] = {0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x01, 0xc4, 0x00,
-                       0x00, 0x02, 0x04, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x02, 0xea, 0x00,
-                       0x00, 0x04, 0xd1, 0x00, 0x00, 0x09, 0x88, 0x80, 0x00, 0x19, 0x00, 0x00,
-                       0x00, 0x0d, 0xc2, 0x80, 0x00, 0x29, 0x81, 0xc0, 0x00, 0x0b, 0xa2, 0x20,
-                       0x00, 0x31, 0x40, 0x40, 0x00, 0x23, 0x00, 0xc0, 0x00, 0x13, 0x00, 0x40,
-                       0x00, 0x72, 0x02, 0x00, 0x00, 0x49, 0x00, 0x40, 0x01, 0xe0, 0xa8, 0x20,
-                       0x07, 0xf1, 0x00, 0x30, 0x0b, 0xb9, 0xe0, 0xe8, 0x07, 0x5c, 0x03, 0xfc,
-                       0x07, 0xef, 0xff, 0xee, 0x07, 0x75, 0x7f, 0xd2, 0x1b, 0xbb, 0xff, 0xb2,
-                       0x11, 0x57, 0x7d, 0x64, 0x32, 0xaf, 0xff, 0xe8, 0x13, 0x5f, 0x75, 0xd0,
-                       0x33, 0xff, 0xfb, 0x98, 0x17, 0xd7, 0xe5, 0x00, 0x1b, 0x8f, 0xb2, 0x30,
-                       0x03, 0x7d, 0x58, 0x10, 0x6f, 0xbf, 0xec, 0x20};
-const uint8_t gun_mask[] = {0x00, 0x00, 0x70, 0x00, 0x00, 0x01, 0xfc, 0x00, 0x00, 0x03, 0xfe, 0x00,
-                            0x00, 0x07, 0xfe, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0x07, 0xff, 0x00,
-                            0x00, 0x0f, 0xff, 0x80, 0x00, 0x1f, 0xff, 0xc0, 0x00, 0x3f, 0xff, 0x80,
-                            0x00, 0x3f, 0xff, 0xc0, 0x00, 0x7f, 0xff, 0xe0, 0x00, 0x7f, 0xff, 0xf0,
-                            0x00, 0x7f, 0xff, 0xe0, 0x00, 0x7f, 0xff, 0xe0, 0x00, 0x7f, 0xff, 0xe0,
-                            0x00, 0xff, 0xff, 0xc0, 0x00, 0xff, 0xff, 0xe0, 0x03, 0xff, 0xff, 0xf0,
-                            0x0f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xfc, 0x1f, 0xff, 0xff, 0xfe,
-                            0x1f, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff,
-                            0x3f, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xff, 0xf8,
-                            0x7f, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xff, 0xf8,
-                            0x7f, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xf0};
-
-const uint8_t
-    imp_inv[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
-                 0x02, 0x80, 0x00, 0x00, 0x07, 0x40, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x01,
-                 0x00, 0x00, 0x01, 0x0f, 0xb3, 0x00, 0x00, 0xd0, 0x4e, 0x00, 0x00, 0x79, 0x8c,
-                 0x00, 0x00, 0x1c, 0x19, 0x00, 0x01, 0x8a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x40, 0x02, 0x08, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x01, 0x8e,
-                 0x30, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x0c, 0x20, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x06, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-                 0x02, 0x20, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x03, 0xe0,
-                 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0xa1, 0x80, 0x01, 0x80, 0x13, 0x00,
-                 0x00, 0xf3, 0x8a, 0x00, 0x00, 0x09, 0x94, 0x00, 0x00, 0x88, 0x38, 0x80, 0x00,
-                 0x00, 0x00, 0x00, 0x00, 0x02, 0x23, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x80,
-                 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0xe2, 0x80, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x0c, 0x20, 0x00, 0x00, 0x04, 0x30, 0x00, 0x00, 0x02, 0x20, 0x00,
-                 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-                 0x02, 0x20, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0,
-                 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00,
-                 0x00, 0x1f, 0x00, 0x00, 0x02, 0x2a, 0x80, 0x00, 0x01, 0x05, 0x00, 0x00, 0x01,
-                 0xae, 0x20, 0x00, 0x01, 0x24, 0x40, 0x00, 0x02, 0xac, 0x80, 0x00, 0x02, 0x86,
-                 0x00, 0x00, 0x03, 0x20, 0x20, 0x00, 0x04, 0x30, 0x40, 0x00, 0x0c, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x08, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x1a, 0x00, 0x00, 0x00,
-                 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x98,
-                 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0a, 0x00,
-                 0x00, 0x00, 0x08, 0x40, 0x00, 0x00, 0x00, 0x80, 0x00, 0x01, 0xd6, 0x80, 0x00,
-                 0x02, 0xbf, 0x80, 0x00, 0x06, 0x61, 0xa0, 0x00, 0x0c, 0xe8, 0x80, 0x00, 0x0c,
-                 0x10, 0x00, 0x00, 0x1a, 0x22, 0x00, 0x00, 0x12, 0x40, 0x00, 0x00, 0x06, 0x0c,
-                 0x00, 0x00, 0x04, 0x0d, 0x00, 0x00, 0x3a, 0x03, 0x00, 0x00, 0x10, 0x02, 0x00,
-                 0x00, 0x60, 0x0a, 0x00, 0x00, 0x50, 0x04, 0x00, 0x00, 0x20, 0x03, 0x00, 0x00,
-                 0x00, 0x04, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
-                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x00, 0x00, 0x02, 0x24, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x01,
-                 0x18, 0x00, 0x00, 0x01, 0x41, 0x40, 0x02, 0x33, 0xb6, 0x80, 0x01, 0x9c, 0x04,
-                 0x00, 0x08, 0xfa, 0x02, 0x08, 0x05, 0x00, 0x01, 0x0c, 0x27, 0x83, 0xa2, 0x2a,
-                 0x00, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                 0x00, 0x00, 0x00}; //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x07, 0x40, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x0f, 0xb3, 0x00, 0x00, 0xd0, 0x4e, 0x00, 0x00, 0x79, 0x8c, 0x00, 0x00, 0x1c, 0x19, 0x00, 0x01, 0x8a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x08, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x01, 0x8e, 0x30, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x0c, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-const uint8_t imp_mask_inv[] = {
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x03, 0xc0, 0x00,
-    0x00, 0x07, 0xe0, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x01, 0x07, 0xf1, 0x80,
-    0x00, 0xdf, 0xfe, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x01, 0xff, 0xff, 0x80,
-    0x00, 0xff, 0xff, 0x80, 0x01, 0xff, 0xff, 0x80, 0x03, 0xcf, 0xf1, 0xc0, 0x01, 0xc7, 0xf1, 0xc0,
-    0x01, 0x87, 0xf1, 0xc0, 0x03, 0x0f, 0xf9, 0x80, 0x03, 0x0f, 0xfb, 0x80, 0x01, 0x8f, 0xff, 0x80,
-    0x03, 0x9f, 0x79, 0x00, 0x00, 0x1f, 0x7c, 0x00, 0x00, 0x0f, 0x78, 0x00, 0x00, 0x0f, 0x78, 0x00,
-    0x00, 0x07, 0x30, 0x00, 0x00, 0x07, 0x38, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x07, 0x30, 0x00,
-    0x00, 0x03, 0x78, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x07, 0xe0, 0x00,
-    0x00, 0x07, 0xc0, 0x00, 0x01, 0x07, 0xe1, 0x00, 0x00, 0x8f, 0xfa, 0x00, 0x00, 0xff, 0xfe, 0x00,
-    0x00, 0x3f, 0xfe, 0x00, 0x01, 0x7f, 0xff, 0x80, 0x00, 0xff, 0xff, 0x00, 0x01, 0xff, 0xff, 0x80,
-    0x03, 0xcf, 0xfb, 0xc0, 0x03, 0x87, 0xf1, 0xc0, 0x03, 0xcf, 0xf3, 0xc0, 0x01, 0xcf, 0xf1, 0x80,
-    0x00, 0xcf, 0xf1, 0x00, 0x00, 0x0f, 0xfb, 0x80, 0x00, 0x1e, 0x78, 0x00, 0x00, 0x0e, 0x78, 0x00,
-    0x00, 0x1e, 0x78, 0x00, 0x00, 0x0f, 0x70, 0x00, 0x00, 0x0f, 0x78, 0x00, 0x00, 0x07, 0x70, 0x00,
-    0x00, 0x07, 0x70, 0x00, 0x00, 0x07, 0x38, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x03, 0x20, 0x00,
-    0x00, 0x07, 0x30, 0x00, 0x00, 0x05, 0x70, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1f, 0x00,
-    0x00, 0x00, 0x1f, 0x00, 0x00, 0x03, 0x3f, 0x80, 0x00, 0x01, 0x3f, 0x00, 0x00, 0x01, 0xff, 0x30,
-    0x00, 0x03, 0xff, 0xc0, 0x00, 0x03, 0xff, 0xc0, 0x00, 0x03, 0xff, 0x80, 0x00, 0x07, 0xff, 0xe0,
-    0x00, 0x07, 0xff, 0xc0, 0x00, 0x05, 0xff, 0xe0, 0x00, 0x00, 0xfc, 0xe0, 0x00, 0x01, 0xfc, 0xe0,
-    0x00, 0x01, 0xfc, 0x70, 0x00, 0x03, 0xfc, 0x38, 0x00, 0x03, 0xfe, 0x70, 0x00, 0x07, 0xfc, 0x00,
-    0x00, 0x07, 0x9e, 0x00, 0x00, 0x0f, 0xbc, 0x00, 0x00, 0x0f, 0x3e, 0x00, 0x00, 0x07, 0x9c, 0x00,
-    0x00, 0x03, 0x9c, 0x00, 0x00, 0x03, 0xb8, 0x00, 0x00, 0x03, 0x98, 0x00, 0x00, 0x01, 0x98, 0x00,
-    0x00, 0x02, 0x1c, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1f, 0x00,
-    0x00, 0x00, 0x1f, 0x40, 0x00, 0x00, 0x3e, 0x80, 0x00, 0x01, 0xff, 0x80, 0x00, 0x03, 0xff, 0x80,
-    0x00, 0x07, 0xff, 0xe0, 0x00, 0x0e, 0xff, 0xc0, 0x00, 0x0c, 0xff, 0x80, 0x00, 0x1f, 0xfe, 0x00,
-    0x00, 0x13, 0xfc, 0x00, 0x00, 0x07, 0xfe, 0x00, 0x00, 0x1f, 0xff, 0x00, 0x00, 0x3f, 0x9f, 0x00,
-    0x00, 0x3e, 0x0f, 0x00, 0x00, 0x7c, 0x0f, 0x00, 0x00, 0x78, 0x0f, 0x00, 0x00, 0x78, 0x07, 0x80,
-    0x00, 0x78, 0x07, 0x40, 0x00, 0x38, 0x07, 0x80, 0x00, 0x30, 0x07, 0x00, 0x00, 0x30, 0x01, 0x00,
-    0x01, 0xf0, 0x00, 0x00, 0x01, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1c, 0x00,
-    0x00, 0x01, 0x3e, 0x00, 0x00, 0x03, 0xff, 0x00, 0x00, 0x0f, 0xff, 0xe0, 0x01, 0x3f, 0xff, 0xc0,
-    0x01, 0xff, 0xff, 0xc0, 0x19, 0xff, 0xff, 0xe8, 0x7f, 0xff, 0xff, 0xfe, 0x3f, 0xff, 0xff, 0xfe,
-    0x1f, 0xc2, 0x07, 0xe0, 0x1f, 0x00, 0x01, 0xe0, 0x0e, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
-}; //{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x01, 0x07, 0xf1, 0x80, 0x00, 0xdf, 0xfe, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x01, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x01, 0xff, 0xff, 0x80, 0x03, 0xcf, 0xf1, 0xc0, 0x01, 0xc7, 0xf1, 0xc0, 0x01, 0x87, 0xf1, 0xc0, 0x03, 0x0f, 0xf9, 0x80, 0x03, 0x0f, 0xfb, 0x80, 0x01, 0x8f, 0xff, 0x80, 0x03, 0x9f, 0x79, 0x00, 0x00, 0x1f, 0x7c, 0x00, 0x00, 0x0f, 0x78, 0x00, 0x00, 0x0f, 0x78, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x07, 0x38, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x03, 0x78, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00};
-const uint8_t fireball[] = {0x00, 0x00, 0x01, 0x40, 0x0a, 0xb0, 0x0e, 0xd0, 0x00, 0x68, 0x53,
-                            0xb4, 0x0f, 0x48, 0x27, 0x78, 0x17, 0xa8, 0x27, 0xf0, 0x21, 0xd6,
-                            0x02, 0xf8, 0x20, 0x48, 0x06, 0x20, 0x01, 0x00, 0x00, 0x00};
-const uint8_t fireball_mask[] = {0x1f, 0x40, 0x0f, 0xf0, 0x3f, 0xf8, 0x1f, 0xfc, 0x7f, 0xfd, 0x7f,
-                                 0xfc, 0x7f, 0xfd, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
-                                 0xff, 0xfe, 0x3f, 0xfe, 0x17, 0xf8, 0x07, 0xf4, 0x01, 0xe0};
-const uint8_t item[] = {0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, 0x7f, 0xfe, 0x77, 0xee, 0x3f,
-                        0xfc, 0x5f, 0xfa, 0x2f, 0xf6, 0x53, 0xcc, 0x3e, 0x7e, 0x5e, 0x7c,
-                        0x38, 0x1e, 0x58, 0x1c, 0x3e, 0x7e, 0x5e, 0x7e, 0x2e, 0xfc, 0x00,
-                        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xfc,
-                        0x17, 0xfc, 0x22, 0x6c, 0x36, 0x44, 0x3f, 0xfc, 0x1f, 0xfc, 0x2b,
-                        0xfc, 0x05, 0x54, 0x02, 0xa8, 0x00, 0x00, 0x00, 0x00};
-const uint8_t item_mask[] = {0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
-                             0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe,
-                             0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x3f, 0xfc, 0x00,
-                             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xfc,
-                             0x1f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f,
-                             0xfc, 0x07, 0xfc, 0x03, 0xf8, 0x00, 0x00, 0x00, 0x00};
-
-//const uint8_t door[] = {0xff, 0xff, 0xff, 0xff,0xb2, 0xbd, 0xcd, 0x5b,0x9a, 0xf4, 0x6d, 0x71,0xff, 0xff, 0xff, 0xff,0x00, 0x00, 0x00, 0x00,0xbf, 0xff, 0xff, 0xfd,0x3f, 0x00, 0xfe, 0xfc,0x3e, 0x00, 0xc6, 0xfc,0xbc, 0xaa, 0xfe, 0xbd,0x39, 0x54, 0xc6, 0xbc,0x32, 0x8e, 0xfe, 0xac,0xb5, 0xfe, 0xc6, 0xad,0x3f, 0xe0, 0xfe, 0xac,0x31, 0xe0, 0xc6, 0xac,0xb3, 0xf4, 0xfe, 0xad,0x3f, 0xe8, 0xc6, 0xac,0x3c, 0xf4, 0xd6, 0xac,0xb8, 0xff, 0xfe, 0xad,0x34, 0xc7, 0xfe, 0xfc,0x38, 0xd6, 0x0e, 0x0c,0xb0, 0xd6, 0x4e, 0x0d,0x3f, 0xd6, 0xaf, 0x5c,0x30, 0x47, 0xff, 0xac,0xb7, 0x57, 0xff, 0xfd,0x3f, 0xc6, 0x0e, 0x0c,0x35, 0x56, 0x40, 0x4c,0xb5, 0x46, 0xaa, 0xad,0x35, 0x56, 0x55, 0x4c,0xff, 0xff, 0xff, 0xff,0xb0, 0x1f, 0xf8, 0x0d,0xd9, 0x30, 0x0c, 0x9b,0xff, 0xe0, 0x07, 0xff};
-const uint8_t door[] = {
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x07, 0xe1, 0x8c, 0x00, 0x04,
-    0x00, 0x7c, 0x03, 0x18, 0x60, 0x08, 0x00, 0x3e, 0x0f, 0xf7, 0xdf, 0x00, 0x1f, 0x00, 0xfe, 0x0f,
-    0xbe, 0xf8, 0x3e, 0x00, 0x3f, 0x1f, 0xff, 0xdf, 0x00, 0x1f, 0x81, 0xff, 0x0f, 0xff, 0xf8, 0x7e,
-    0x00, 0x3f, 0x8f, 0xff, 0xdf, 0x00, 0xff, 0xf9, 0xff, 0x1f, 0xff, 0xf8, 0xff, 0x80, 0x3f, 0xc7,
-    0xff, 0xcc, 0x07, 0xff, 0xfc, 0xff, 0x1f, 0xff, 0xe3, 0xff, 0x80, 0x3f, 0xc7, 0xff, 0xc0, 0x07,
-    0xff, 0xfc, 0x7f, 0x0f, 0xfe, 0x03, 0xff, 0xc0, 0x3f, 0xc3, 0xf7, 0xc0, 0x07, 0xdf, 0xf8, 0x3e,
-    0x0f, 0xbe, 0x01, 0xff, 0x80, 0x1f, 0x80, 0xe3, 0x80, 0x07, 0x8f, 0xf8, 0x1e, 0x07, 0x1c, 0x01,
-    0xff, 0x80, 0x3f, 0xc1, 0xff, 0xc0, 0x0f, 0xff, 0xfc, 0x3f, 0x0f, 0xbe, 0x03, 0xff, 0xc0, 0xff,
-    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff,
-    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-    0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-    0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
-    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0x80, 0x00,
-    0x7f, 0xff, 0xff, 0xc0, 0x00, 0x00, 0xe0, 0x00, 0x1f, 0xf0, 0xff, 0x00, 0x00, 0x7f, 0xff, 0xff,
-    0xc0, 0x00, 0x00, 0xe0, 0x00, 0x0f, 0xf0, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x01,
-    0xe0, 0x00, 0x0f, 0xf0, 0xff, 0x00, 0x01, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x01, 0xf0, 0x00, 0x0f,
-    0xf0, 0xff, 0x00, 0x03, 0xff, 0xff, 0xff, 0xe0, 0x7f, 0x81, 0xf0, 0x00, 0x0f, 0xf0, 0xff, 0x00,
-    0x07, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xc1, 0xf0, 0x00, 0x0f, 0xf0, 0xff, 0x00, 0x0f, 0xff, 0xff,
-    0xff, 0xe1, 0xff, 0xe1, 0xf0, 0x00, 0x0f, 0xf0, 0xff, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xe0, 0xff,
-    0xc1, 0xf3, 0x00, 0x0f, 0xf0, 0xff, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xe0, 0xff, 0x81, 0xff, 0xc0,
-    0x0f, 0xf0, 0xff, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xe0, 0x3f, 0x01, 0xff, 0xc0, 0x0f, 0xf0, 0xff,
-    0x00, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xe0, 0x0f, 0xf0, 0xff, 0x01, 0xff, 0xff,
-    0xff, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xe0, 0x0f, 0xf0, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xe1,
-    0xff, 0xe1, 0xff, 0xe0, 0x0f, 0xf0, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xc1, 0xff,
-    0xf0, 0x0f, 0xf0, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x8f, 0xe0, 0xff, 0x81, 0xff, 0xff, 0x0f, 0xf0,
-    0xff, 0x1f, 0xff, 0xff, 0xfe, 0x07, 0xe0, 0x7f, 0x81, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff,
-    0xff, 0xfc, 0x07, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff, 0x8f, 0xfc, 0x03,
-    0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff, 0x07, 0xfc, 0x07, 0xe0, 0xff, 0xc1,
-    0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xfe, 0x00, 0x7f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f,
-    0xf0, 0xff, 0x0f, 0x9c, 0x00, 0x3f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x07,
-    0xfc, 0x00, 0x7f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x07, 0xfc, 0x00, 0x7f,
-    0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x0f, 0xfc, 0x00, 0x7f, 0xff, 0xe0, 0xff,
-    0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x0f, 0xfc, 0x00, 0x7f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff,
-    0x8f, 0xf0, 0xff, 0x1f, 0xfe, 0x00, 0x7f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff,
-    0x1f, 0xfc, 0x00, 0x3f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xfc, 0x00,
-    0x3f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xf0, 0x00, 0x1f, 0xff, 0xe0,
-    0x7f, 0x81, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x0f, 0xf0, 0x00, 0x1f, 0xff, 0xe0, 0xff, 0x81, 0xff,
-    0xff, 0x8f, 0xf0, 0xff, 0x07, 0xe0, 0x00, 0x3f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0,
-    0xff, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x00, 0x1f,
-    0x80, 0x3f, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x00, 0x3f, 0xc0, 0x1f, 0xff,
-    0xe1, 0xff, 0xe1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x00, 0x7f, 0xc0, 0x0f, 0xff, 0xe1, 0xff, 0xe1,
-    0xff, 0xff, 0x8f, 0xf0, 0xff, 0x00, 0xff, 0xc0, 0x07, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xff, 0x8f,
-    0xf0, 0xff, 0x01, 0xff, 0xc0, 0x03, 0x8f, 0xc0, 0xc1, 0x81, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x03,
-    0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x07, 0xff, 0xc0, 0xff,
-    0x80, 0x00, 0x00, 0x01, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0x0f, 0xff, 0xc1, 0xff, 0x80, 0x00, 0x00,
-    0x01, 0xf3, 0x8e, 0x0f, 0xf0, 0xff, 0x0f, 0xff, 0xc3, 0xff, 0xc0, 0x00, 0x00, 0x01, 0xff, 0x9c,
-    0x0f, 0xf0, 0xff, 0x0f, 0xff, 0xc3, 0xff, 0xc0, 0xff, 0xfc, 0x01, 0xff, 0xfe, 0x0f, 0xf0, 0xff,
-    0x0f, 0xff, 0xc3, 0xff, 0xc1, 0xff, 0xfe, 0x01, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0x07, 0xff, 0xc3,
-    0xff, 0xc3, 0xff, 0xff, 0x01, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x0f, 0xff, 0xc3, 0xff, 0xc3, 0xff,
-    0xff, 0x01, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x0f, 0xff, 0xc3, 0xff, 0xc3, 0xff, 0xff, 0x01, 0xff,
-    0xff, 0x8f, 0xf0, 0xff, 0x0f, 0xff, 0xc3, 0xff, 0xc3, 0xff, 0xff, 0x01, 0xff, 0xff, 0x8f, 0xf0,
-    0xff, 0x0f, 0xff, 0xc3, 0xff, 0xc3, 0xff, 0xff, 0x01, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0x0f, 0xff,
-    0xc3, 0xff, 0xc3, 0xff, 0xff, 0x00, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0x0f, 0xff, 0xc3, 0xff, 0xc3,
-    0xff, 0xff, 0x00, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0x07, 0xff, 0xe3, 0xff, 0xc3, 0xff, 0xff, 0x00,
-    0x3f, 0xfe, 0x0f, 0xf0, 0xff, 0x07, 0xff, 0xf3, 0xff, 0xc1, 0xef, 0xfe, 0x00, 0x3f, 0xfe, 0x0f,
-    0xf0, 0xff, 0x0f, 0xff, 0xff, 0xff, 0xc0, 0x82, 0x00, 0x00, 0x1f, 0xff, 0x0f, 0xf0, 0xff, 0x1f,
-    0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff, 0xff, 0xff,
-    0xc0, 0x00, 0x00, 0x00, 0x07, 0xff, 0x0f, 0xf0, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00,
-    0x00, 0x03, 0x8e, 0x0f, 0xf0, 0xff, 0x1f, 0xc1, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x03, 0x88,
-    0x0f, 0xf0, 0xff, 0x0f, 0x80, 0xff, 0xff, 0xc1, 0xff, 0xfc, 0x00, 0xff, 0xfe, 0x0f, 0xf0, 0xff,
-    0x06, 0x00, 0x73, 0xff, 0xc3, 0xff, 0xfe, 0x01, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0x00, 0x00, 0x03,
-    0xff, 0xc3, 0xff, 0xff, 0x83, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x07, 0x0c, 0x73, 0xff, 0xc3, 0xff,
-    0xff, 0xff, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x0f, 0xfe, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff,
-    0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xf0,
-    0xff, 0x1f, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff,
-    0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xc3,
-    0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff,
-    0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f,
-    0xf0, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0xf0, 0xfe, 0x1f,
-    0xfe, 0xfb, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xfc, 0x0f, 0x9e, 0x73, 0xff,
-    0x81, 0xf9, 0xf7, 0xe7, 0x9c, 0xff, 0x03, 0xf0, 0xfc, 0x07, 0xfe, 0xfb, 0xc0, 0x00, 0xf0, 0x00,
-    0x6f, 0xbe, 0xfe, 0x03, 0xf0, 0x3c, 0x07, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xfe,
-    0x03, 0xc0, 0x1c, 0x0f, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0x03, 0x80, 0x1e,
-    0x0f, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0x07, 0x80, 0x3f, 0x0f, 0xff, 0xff,
-    0xe0, 0xff, 0xff, 0xf0, 0x7f, 0xff, 0xff, 0x0f, 0xc0, 0x1f, 0x8f, 0xff, 0xff, 0xe7, 0xff, 0xff,
-    0xfe, 0x7f, 0xff, 0xff, 0x1f, 0x80, 0x1f, 0xc7, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff,
-    0xfe, 0x3f, 0x80, 0x07, 0xc3, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xfc, 0x3e, 0x00,
-    0x07, 0xc1, 0xfe, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xcf, 0xf7, 0xf8, 0x3e, 0x00, 0x01, 0x00, 0xfc,
-    0x7e, 0x7f, 0xff, 0xff, 0xff, 0xe7, 0xe3, 0xf0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff,
-    0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xe0,
-    0x00, 0x00, 0x00, 0x00};

+ 0 - 108
main_apps_sources/doom/assets.h

@@ -1,108 +0,0 @@
-#pragma once
-#include <gui/icon.h>
-
-#ifndef _sprites_h
-#define _sprites_h
-
-#define bmp_font_width 24 // in bytes
-#define bmp_font_height 6
-#define bmp_font_width_pxs 192
-#define bmp_font_height_pxs 48
-#define CHAR_MAP " 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.,-_(){}[]#"
-#define CHAR_WIDTH 4
-#define CHAR_HEIGHT 6
-
-#define BMP_GUN_WIDTH 32
-#define BMP_GUN_HEIGHT 32
-
-#define BMP_FIRE_WIDTH 24
-#define BMP_FIRE_HEIGHT 20
-
-#define BMP_IMP_WIDTH 32
-#define BMP_IMP_HEIGHT 32
-#define BMP_IMP_COUNT 5
-
-#define BMP_FIREBALL_WIDTH 16
-#define BMP_FIREBALL_HEIGHT 16
-
-#define BMP_DOOR_WIDTH 100
-#define BMP_DOOR_HEIGHT 100
-
-#define BMP_ITEMS_WIDTH 16
-#define BMP_ITEMS_HEIGHT 16
-#define BMP_ITEMS_COUNT 2
-
-#define BMP_LOGO_WIDTH 128
-#define BMP_LOGO_HEIGHT 64
-
-#define GRADIENT_WIDTH 2
-#define GRADIENT_HEIGHT 8
-#define GRADIENT_COUNT 8
-#define GRADIENT_WHITE 7
-#define GRADIENT_BLACK 0
-
-// Fonts
-extern const uint8_t zero[];
-extern const uint8_t one[];
-extern const uint8_t two[];
-extern const uint8_t three[];
-extern const uint8_t four[];
-extern const uint8_t five[];
-extern const uint8_t six[];
-extern const uint8_t seven[];
-extern const uint8_t eight[];
-extern const uint8_t nine[];
-extern const uint8_t A[];
-extern const uint8_t B[];
-extern const uint8_t C[];
-extern const uint8_t D[];
-extern const uint8_t E[];
-extern const uint8_t F[];
-extern const uint8_t G[];
-extern const uint8_t H[];
-extern const uint8_t I[];
-extern const uint8_t J[];
-extern const uint8_t K[];
-extern const uint8_t L[];
-extern const uint8_t M[];
-extern const uint8_t N[];
-extern const uint8_t O[];
-extern const uint8_t P[];
-extern const uint8_t Q[];
-extern const uint8_t R[];
-extern const uint8_t S[];
-extern const uint8_t T[];
-extern const uint8_t U[];
-extern const uint8_t V[];
-extern const uint8_t W[];
-extern const uint8_t X[];
-extern const uint8_t Y[];
-extern const uint8_t Z[];
-extern const uint8_t dot[];
-extern const uint8_t comma[];
-extern const uint8_t dash[];
-extern const uint8_t underscore[];
-extern const uint8_t bracket_open[];
-extern const uint8_t bracket_close[];
-extern const uint8_t cross_left[];
-extern const uint8_t cross_right[];
-extern const uint8_t pacman_left[];
-extern const uint8_t pacman_right[];
-extern const uint8_t box[];
-extern const uint8_t* char_arr[48];
-extern const uint8_t gradient[];
-//extern const uint8_t gun[]
-//extern const uint8_t gun_mask[]
-extern const uint8_t gun[];
-extern const uint8_t gun_mask[];
-
-extern const uint8_t imp_inv[];
-extern const uint8_t imp_mask_inv[];
-extern const uint8_t fireball[];
-extern const uint8_t fireball_mask[];
-extern const uint8_t item[];
-extern const uint8_t item_mask[];
-
-extern const uint8_t door[];
-
-#endif

BIN
main_apps_sources/doom/assets/door2.png


BIN
main_apps_sources/doom/assets/door_inv.png


BIN
main_apps_sources/doom/assets/fire_inv.png


BIN
main_apps_sources/doom/assets/fireball_inv.png


BIN
main_apps_sources/doom/assets/fireball_mask_inv.png


BIN
main_apps_sources/doom/assets/gradient_inv.png


BIN
main_apps_sources/doom/assets/gun_inv.png


BIN
main_apps_sources/doom/assets/gun_mask_inv.png


BIN
main_apps_sources/doom/assets/imp_inv.png


BIN
main_apps_sources/doom/assets/imp_mask_inv.png


BIN
main_apps_sources/doom/assets/item_inv.png


BIN
main_apps_sources/doom/assets/item_mask_inv.png


BIN
main_apps_sources/doom/assets/logo_inv.png


+ 0 - 91
main_apps_sources/doom/constants.h

@@ -1,91 +0,0 @@
-#ifndef _constants_h
-#define _constants_h
-#define PB_CONSTEXPR constexpr
-
-#define PI 3.14159265358979323846
-
-// Key pinout
-#define USE_INPUT_PULLUP
-#define K_LEFT 6
-#define K_RIGHT 7
-#define K_UP 8
-#define K_DOWN 3
-#define K_FIRE 10
-
-// SNES Controller
-// uncomment following line to enable snes controller support
-// #define SNES_CONTROLLER
-const uint8_t DATA_CLOCK = 11;
-const uint8_t DATA_LATCH = 12;
-const uint8_t DATA_SERIAL = 13;
-
-// Sound
-const uint8_t SOUND_PIN = 9; // do not change, belongs to used timer
-
-// GFX settings
-#define OPTIMIZE_SSD1306 // Optimizations for SSD1366 displays
-
-#define FRAME_TIME 66.666666 // Desired time per frame in ms (66.666666 is ~15 fps)
-#define RES_DIVIDER 2
-
-/* Higher values will result in lower horizontal resolution when rasterize and lower process and memory usage
- Lower will require more process and memory, but looks nicer
- */
-#define Z_RES_DIVIDER 2 // Zbuffer resolution divider. We sacrifice resolution to save memory
-#define DISTANCE_MULTIPLIER 20
-
-/* Distances are stored as uint8_t, multiplying the distance we can obtain more precision taking care 
- of keep numbers inside the type range. Max is 256 / MAX_RENDER_DEPTH 
- */
-
-#define MAX_RENDER_DEPTH 12
-#define MAX_SPRITE_DEPTH 8
-
-#define ZBUFFER_SIZE SCREEN_WIDTH / Z_RES_DIVIDER
-
-// Level
-#define LEVEL_WIDTH_BASE 6
-#define LEVEL_WIDTH (1 << LEVEL_WIDTH_BASE)
-#define LEVEL_HEIGHT 57
-#define LEVEL_SIZE LEVEL_WIDTH / 2 * LEVEL_HEIGHT
-
-// scenes
-#define INTRO 0
-#define GAME_PLAY 1
-
-// Game
-#define GUN_TARGET_POS 18
-#define GUN_SHOT_POS GUN_TARGET_POS + 4
-
-#define ROT_SPEED .12
-#define MOV_SPEED .2
-#define MOV_SPEED_INV 5 // 1 / MOV_SPEED
-
-#define JOGGING_SPEED .005
-#define ENEMY_SPEED .02
-#define FIREBALL_SPEED .2
-#define FIREBALL_ANGLES 45 // Num of angles per PI
-
-#define MAX_ENTITIES 10 // Max num of active entities
-#define MAX_STATIC_ENTITIES 28 // Max num of entities in sleep mode
-
-#define MAX_ENTITY_DISTANCE 200 // * DISTANCE_MULTIPLIER
-#define MAX_ENEMY_VIEW 80 // * DISTANCE_MULTIPLIER
-#define ITEM_COLLIDER_DIST 6 // * DISTANCE_MULTIPLIER
-#define ENEMY_COLLIDER_DIST 4 // * DISTANCE_MULTIPLIER
-#define FIREBALL_COLLIDER_DIST 2 // * DISTANCE_MULTIPLIER
-#define ENEMY_MELEE_DIST 6 // * DISTANCE_MULTIPLIER
-#define WALL_COLLIDER_DIST .2
-
-#define ENEMY_MELEE_DAMAGE 8
-#define ENEMY_FIREBALL_DAMAGE 20
-#define GUN_MAX_DAMAGE 20
-
-// display
-const uint8_t SCREEN_WIDTH = 128;
-const uint8_t SCREEN_HEIGHT = 64;
-const uint8_t HALF_WIDTH = SCREEN_WIDTH / 2;
-const uint8_t RENDER_HEIGHT = 56; // raycaster working height (the rest is for the hud)
-const uint8_t HALF_HEIGHT = SCREEN_HEIGHT / 2;
-
-#endif

+ 0 - 280
main_apps_sources/doom/display.h

@@ -1,280 +0,0 @@
-#include <gui/gui.h>
-#include <furi_hal.h>
-#include "constants.h"
-#include <doom_icons.h>
-#include "assets.h"
-
-#define CHECK_BIT(var, pos) ((var) & (1 << (pos)))
-
-static const uint8_t bit_mask[8] = {128, 64, 32, 16, 8, 4, 2, 1};
-
-#define pgm_read_byte(addr) (*(const unsigned char*)(addr))
-#define read_bit(b, n) b& pgm_read_byte(bit_mask + n) ? 1 : 0
-//#define read_bit(byte, index) (((unsigned)(byte) >> (index)) & 1)
-
-void drawVLine(uint8_t x, int8_t start_y, int8_t end_y, uint8_t intensity, Canvas* const canvas);
-void drawPixel(int8_t x, int8_t y, bool color, bool raycasterViewport, Canvas* const canvas);
-void drawSprite(
-    int8_t x,
-    int8_t y,
-    const uint8_t* bitmap,
-    const uint8_t* bitmap_mask,
-    int16_t w,
-    int16_t h,
-    uint8_t sprite,
-    double distance,
-    Canvas* const canvas);
-void drawBitmap(
-    int16_t x,
-    int16_t y,
-    const Icon* i,
-    int16_t w,
-    int16_t h,
-    uint16_t color,
-    Canvas* const canvas);
-void drawTextSpace(int8_t x, int8_t y, char* txt, uint8_t space, Canvas* const canvas);
-void drawChar(int8_t x, int8_t y, char ch, Canvas* const canvas);
-void clearRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, Canvas* const canvas);
-void drawGun(
-    int16_t x,
-    int16_t y,
-    const uint8_t* bitmap,
-    int16_t w,
-    int16_t h,
-    uint16_t color,
-    Canvas* const canvas);
-void drawRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, Canvas* const canvas);
-void drawText(uint8_t x, uint8_t y, uint8_t num, Canvas* const canvas);
-void fadeScreen(uint8_t intensity, bool color, Canvas* const canvas);
-bool getGradientPixel(uint8_t x, uint8_t y, uint8_t i);
-double getActualFps();
-void fps();
-uint8_t reverse_bits(uint8_t num);
-
-// FPS control
-double delta = 1;
-uint32_t lastFrameTime = 0;
-uint8_t zbuffer[128]; /// 128 = screen width & REMOVE WHEN DISPLAY.H IMPLEMENTED
-
-void drawGun(
-    int16_t x,
-    int16_t y,
-    const uint8_t* bitmap,
-    int16_t w,
-    int16_t h,
-    uint16_t color,
-    Canvas* const canvas) {
-    int16_t byteWidth = (w + 7) / 8;
-    uint8_t byte = 0;
-    for(int16_t j = 0; j < h; j++, y++) {
-        for(int16_t i = 0; i < w; i++) {
-            if(i & 7)
-                byte <<= 1;
-            else
-                byte = pgm_read_byte(&bitmap[j * byteWidth + i / 8]);
-            if(byte & 0x80) drawPixel(x + i, y, color, false, canvas);
-        }
-    }
-}
-
-void drawVLine(uint8_t x, int8_t start_y, int8_t end_y, uint8_t intensity, Canvas* const canvas) {
-    UNUSED(intensity);
-    uint8_t dots = end_y - start_y;
-    for(int i = 0; i < dots; i++) {
-        canvas_draw_dot(canvas, x, start_y + i);
-    }
-}
-
-void drawBitmap(
-    int16_t x,
-    int16_t y,
-    const Icon* i,
-    int16_t w,
-    int16_t h,
-    uint16_t color,
-    Canvas* const canvas) {
-    UNUSED(w);
-    UNUSED(h);
-    if(!color) {
-        canvas_invert_color(canvas);
-    }
-    canvas_draw_icon(canvas, x, y, i);
-    if(!color) {
-        canvas_invert_color(canvas);
-    }
-}
-
-void drawText(uint8_t x, uint8_t y, uint8_t num, Canvas* const canvas) {
-    char buf[4];
-    snprintf(buf, 4, "%d", num);
-    drawTextSpace(x, y, buf, 1, canvas);
-}
-
-void drawTextSpace(int8_t x, int8_t y, char* txt, uint8_t space, Canvas* const canvas) {
-    uint8_t pos = x;
-    uint8_t i = 0;
-    char ch;
-    while((ch = txt[i]) != '\0') {
-        drawChar(pos, y, ch, canvas);
-        i++;
-        pos += CHAR_WIDTH + space;
-
-        // shortcut on end of screen
-        if(pos > SCREEN_WIDTH) return;
-    }
-}
-
-// Custom drawBitmap method with scale support, mask, zindex and pattern filling
-void drawSprite(
-    int8_t x,
-    int8_t y,
-    const uint8_t* bitmap,
-    const uint8_t* bitmap_mask,
-    int16_t w,
-    int16_t h,
-    uint8_t sprite,
-    double distance,
-    Canvas* const canvas) {
-    uint8_t tw = (double)w / distance;
-    uint8_t th = (double)h / distance;
-    uint8_t byte_width = w / 8;
-    uint8_t pixel_size = fmax(1, (double)1.0 / (double)distance);
-    uint16_t sprite_offset = byte_width * h * sprite;
-
-    bool pixel;
-    bool maskPixel;
-
-    // Don't draw the whole sprite if the anchor is hidden by z buffer
-    // Not checked per pixel for performance reasons
-    if(zbuffer[(int)(fmin(fmax(x, 0), ZBUFFER_SIZE - 1) / Z_RES_DIVIDER)] <
-       distance * DISTANCE_MULTIPLIER) {
-        return;
-    }
-
-    for(uint8_t ty = 0; ty < th; ty += pixel_size) {
-        // Don't draw out of screen
-        if(y + ty < 0 || y + ty >= RENDER_HEIGHT) {
-            continue;
-        }
-
-        uint8_t sy = ty * distance; // The y from the sprite
-
-        for(uint8_t tx = 0; tx < tw; tx += pixel_size) {
-            uint8_t sx = tx * distance; // The x from the sprite
-            uint16_t byte_offset = sprite_offset + sy * byte_width + sx / 8;
-
-            // Don't draw out of screen
-            if(x + tx < 0 || x + tx >= SCREEN_WIDTH) {
-                continue;
-            }
-
-            maskPixel = read_bit(pgm_read_byte(bitmap_mask + byte_offset), sx % 8);
-
-            if(maskPixel) {
-                pixel = read_bit(pgm_read_byte(bitmap + byte_offset), sx % 8);
-                for(uint8_t ox = 0; ox < pixel_size; ox++) {
-                    for(uint8_t oy = 0; oy < pixel_size; oy++) {
-                        if(bitmap == imp_inv)
-                            drawPixel(x + tx + ox, y + ty + oy, 1, true, canvas);
-                        else
-                            drawPixel(x + tx + ox, y + ty + oy, pixel, true, canvas);
-                    }
-                }
-            }
-        }
-    }
-}
-
-void drawPixel(int8_t x, int8_t y, bool color, bool raycasterViewport, Canvas* const canvas) {
-    if(x < 0 || x >= SCREEN_WIDTH || y < 0 ||
-       y >= (raycasterViewport ? RENDER_HEIGHT : SCREEN_HEIGHT)) {
-        return;
-    }
-    if(color)
-        canvas_draw_dot(canvas, x, y);
-    else {
-        canvas_invert_color(canvas);
-        canvas_draw_dot(canvas, x, y);
-        canvas_invert_color(canvas);
-    }
-}
-
-void drawChar(int8_t x, int8_t y, char ch, Canvas* const canvas) {
-    uint8_t lsb;
-    uint8_t c = 0;
-    while(CHAR_MAP[c] != ch && CHAR_MAP[c] != '\0') c++;
-    for(uint8_t i = 0; i < 6; i++) {
-        //lsb = (char_arr[c][i] >> 4);
-        lsb = reverse_bits(char_arr[c][i]);
-        for(uint8_t n = 0; n < 4; n++) {
-            if(CHECK_BIT(lsb, n)) {
-                drawPixel(x + n, y + i, true, false, canvas);
-            }
-        }
-    }
-}
-
-void clearRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, Canvas* const canvas) {
-    canvas_invert_color(canvas);
-
-    for(int i = 0; i < w; i++) {
-        for(int j = 0; j < h; j++) {
-            canvas_draw_dot(canvas, x + i, y + j);
-        }
-    }
-
-    canvas_invert_color(canvas);
-}
-
-void drawRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, Canvas* const canvas) {
-    for(int i = 0; i < w; i++) {
-        for(int j = 0; j < h; j++) {
-            canvas_draw_dot(canvas, x + i, y + j);
-        }
-    }
-}
-
-bool getGradientPixel(uint8_t x, uint8_t y, uint8_t i) {
-    if(i == 0) return 0;
-    if(i >= GRADIENT_COUNT - 1) return 1;
-
-    uint8_t index =
-        fmax(0, fmin(GRADIENT_COUNT - 1, i)) * GRADIENT_WIDTH * GRADIENT_HEIGHT // gradient index
-        + y * GRADIENT_WIDTH % (GRADIENT_WIDTH * GRADIENT_HEIGHT) // y byte offset
-        + x / GRADIENT_HEIGHT % GRADIENT_WIDTH; // x byte offset
-    //uint8_t *gradient_data = NULL;
-    //furi_hal_compress_icon_decode(icon_get_data(&I_gradient_inv), &gradient_data);
-    // return the bit based on x
-    return read_bit(pgm_read_byte(gradient + index), x % 8);
-}
-
-void fadeScreen(uint8_t intensity, bool color, Canvas* const canvas) {
-    for(uint8_t x = 0; x < SCREEN_WIDTH; x++) {
-        for(uint8_t y = 0; y < SCREEN_HEIGHT; y++) {
-            if(getGradientPixel(x, y, intensity)) drawPixel(x, y, color, false, canvas);
-        }
-    }
-}
-
-// Adds a delay to limit play to specified fps
-// Calculates also delta to keep movement consistent in lower framerates
-void fps() {
-    while(furi_get_tick() - lastFrameTime < FRAME_TIME)
-        ;
-    delta = (double)(furi_get_tick() - lastFrameTime) / (double)FRAME_TIME;
-    lastFrameTime = furi_get_tick();
-}
-
-double getActualFps() {
-    return 1000 / ((double)FRAME_TIME * (double)delta);
-}
-
-uint8_t reverse_bits(uint8_t num) {
-    unsigned int NO_OF_BITS = sizeof(num) * 8;
-    uint8_t reverse_num = 0;
-    uint8_t i;
-    for(i = 0; i < NO_OF_BITS; i++) {
-        if((num & (1 << i))) reverse_num |= 1 << ((NO_OF_BITS - 1) - i);
-    }
-    return reverse_num;
-}

+ 0 - 1104
main_apps_sources/doom/doom.c

@@ -1,1104 +0,0 @@
-#include <furi.h>
-#include <gui/gui.h>
-#include <input/input.h>
-#include <stdlib.h>
-#include <math.h>
-#include <sys/time.h>
-#include "sound.h"
-#include "display.h"
-#include "assets.h"
-#include "constants.h"
-#include "entities.h"
-#include "types.h"
-#include "level.h"
-#include <notification/notification.h>
-#include <notification/notification_messages.h>
-#include <dolphin/dolphin.h>
-
-#define SOUND
-
-// Useful macros
-#define swap(a, b)          \
-    do {                    \
-        typeof(a) temp = a; \
-        a = b;              \
-        b = temp;           \
-    } while(0)
-#define sign(a, b) (double)(a > b ? 1 : (b > a ? -1 : 0))
-#define pgm_read_byte(addr) (*(const unsigned char*)(addr))
-
-typedef enum {
-    EventTypeTick,
-    EventTypeKey,
-} EventType;
-
-typedef struct {
-    EventType type;
-    InputEvent input;
-} PluginEvent;
-
-typedef struct {
-    FuriMutex* mutex;
-    Player player;
-    Entity entity[MAX_ENTITIES];
-    StaticEntity static_entity[MAX_STATIC_ENTITIES];
-    uint8_t num_entities;
-    uint8_t num_static_entities;
-
-    uint8_t scene;
-    uint8_t gun_pos;
-    double jogging;
-    double view_height;
-    bool init;
-
-    bool up;
-    bool down;
-    bool left;
-    bool right;
-    bool fired;
-    bool gun_fired;
-
-    double rot_speed;
-    double old_dir_x;
-    double old_plane_x;
-    NotificationApp* notify;
-#ifdef SOUND
-    MusicPlayer* music_instance;
-    bool intro_sound;
-#endif
-} PluginState;
-
-static const NotificationSequence sequence_short_sound = {
-    &message_note_c5,
-    &message_delay_50,
-    &message_sound_off,
-    NULL,
-};
-static const NotificationSequence sequence_long_sound = {
-    &message_note_c3,
-    &message_delay_100,
-    &message_sound_off,
-    NULL,
-};
-
-Coords translateIntoView(Coords* pos, PluginState* const plugin_state);
-void updateHud(Canvas* const canvas, PluginState* const plugin_state);
-// general
-
-bool invert_screen = false;
-uint8_t flash_screen = 0;
-
-// game
-// player and entities
-
-uint8_t getBlockAt(const uint8_t level[], uint8_t x, uint8_t y) {
-    if(x >= LEVEL_WIDTH || y >= LEVEL_HEIGHT) {
-        return E_FLOOR;
-    }
-
-    // y is read in inverse order
-    return pgm_read_byte(level + (((LEVEL_HEIGHT - 1 - y) * LEVEL_WIDTH + x) / 2)) >>
-               (!(x % 2) * 4) // displace part of wanted bits
-           & 0b1111; // mask wanted bits
-}
-
-// Finds the player in the map
-void initializeLevel(const uint8_t level[], PluginState* const plugin_state) {
-    for(uint8_t y = LEVEL_HEIGHT - 1; y > 0; y--) {
-        for(uint8_t x = 0; x < LEVEL_WIDTH; x++) {
-            uint8_t block = getBlockAt(level, x, y);
-
-            if(block == E_PLAYER) {
-                plugin_state->player = create_player(x, y);
-                return;
-            }
-
-            // todo create other static entities
-        }
-    }
-}
-
-bool isSpawned(UID uid, PluginState* const plugin_state) {
-    for(uint8_t i = 0; i < plugin_state->num_entities; i++) {
-        if(plugin_state->entity[i].uid == uid) return true;
-    }
-
-    return false;
-}
-
-bool isStatic(UID uid, PluginState* const plugin_state) {
-    for(uint8_t i = 0; i < plugin_state->num_static_entities; i++) {
-        if(plugin_state->static_entity[i].uid == uid) return true;
-    }
-
-    return false;
-}
-
-void spawnEntity(uint8_t type, uint8_t x, uint8_t y, PluginState* const plugin_state) {
-    // Limit the number of spawned entities
-    if(plugin_state->num_entities >= MAX_ENTITIES) {
-        return;
-    }
-
-    // todo: read static entity status
-
-    switch(type) {
-    case E_ENEMY:
-        plugin_state->entity[plugin_state->num_entities] = create_enemy(x, y);
-        plugin_state->num_entities++;
-        break;
-
-    case E_KEY:
-        plugin_state->entity[plugin_state->num_entities] = create_key(x, y);
-        plugin_state->num_entities++;
-        break;
-
-    case E_MEDIKIT:
-        plugin_state->entity[plugin_state->num_entities] = create_medikit(x, y);
-        plugin_state->num_entities++;
-        break;
-    }
-}
-
-void spawnFireball(double x, double y, PluginState* const plugin_state) {
-    // Limit the number of spawned entities
-    if(plugin_state->num_entities >= MAX_ENTITIES) {
-        return;
-    }
-
-    UID uid = create_uid(E_FIREBALL, x, y);
-    // Remove if already exists, don't throw anything. Not the best, but shouldn't happen too often
-    if(isSpawned(uid, plugin_state)) return;
-
-    // Calculate direction. 32 angles
-    int16_t dir =
-        FIREBALL_ANGLES + atan2(y - plugin_state->player.pos.y, x - plugin_state->player.pos.x) /
-                              (double)PI * FIREBALL_ANGLES;
-    if(dir < 0) dir += FIREBALL_ANGLES * 2;
-    plugin_state->entity[plugin_state->num_entities] = create_fireball(x, y, dir);
-    plugin_state->num_entities++;
-}
-
-void removeEntity(UID uid, PluginState* const plugin_state) {
-    uint8_t i = 0;
-    bool found = false;
-
-    while(i < plugin_state->num_entities) {
-        if(!found && plugin_state->entity[i].uid == uid) {
-            // todo: doze it
-            found = true;
-            plugin_state->num_entities--;
-        }
-
-        // displace entities
-        if(found) {
-            plugin_state->entity[i] = plugin_state->entity[i + 1];
-        }
-
-        i++;
-    }
-}
-
-void removeStaticEntity(UID uid, PluginState* const plugin_state) {
-    uint8_t i = 0;
-    bool found = false;
-
-    while(i < plugin_state->num_static_entities) {
-        if(!found && plugin_state->static_entity[i].uid == uid) {
-            found = true;
-            plugin_state->num_static_entities--;
-        }
-
-        // displace entities
-        if(found) {
-            plugin_state->static_entity[i] = plugin_state->static_entity[i + 1];
-        }
-
-        i++;
-    }
-}
-
-UID detectCollision(
-    const uint8_t level[],
-    Coords* pos,
-    double relative_x,
-    double relative_y,
-    bool only_walls,
-    PluginState* const plugin_state) {
-    // Wall collision
-    uint8_t round_x = (int)(pos->x + relative_x);
-    uint8_t round_y = (int)(pos->y + relative_y);
-    uint8_t block = getBlockAt(level, round_x, round_y);
-
-    if(block == E_WALL) {
-        // playSound(hit_wall_snd, HIT_WALL_SND_LEN);
-        return create_uid(block, round_x, round_y);
-    }
-
-    if(only_walls) {
-        return UID_null;
-    }
-
-    // Entity collision
-    for(uint8_t i = 0; i < plugin_state->num_entities; i++) {
-        // Don't collide with itself
-        if(&(plugin_state->entity[i].pos) == pos) {
-            continue;
-        }
-
-        uint8_t type = uid_get_type(plugin_state->entity[i].uid);
-
-        // Only ALIVE enemy collision
-        if(type != E_ENEMY || plugin_state->entity[i].state == S_DEAD ||
-           plugin_state->entity[i].state == S_HIDDEN) {
-            continue;
-        }
-
-        Coords new_coords = {
-            plugin_state->entity[i].pos.x - relative_x,
-            plugin_state->entity[i].pos.y - relative_y};
-        uint8_t distance = coords_distance(pos, &new_coords);
-
-        // Check distance and if it's getting closer
-        if(distance < ENEMY_COLLIDER_DIST && distance < plugin_state->entity[i].distance) {
-            return plugin_state->entity[i].uid;
-        }
-    }
-
-    return UID_null;
-}
-
-// Shoot
-void fire(PluginState* const plugin_state) {
-    //playSound(shoot_snd, SHOOT_SND_LEN);
-
-    for(uint8_t i = 0; i < plugin_state->num_entities; i++) {
-        // Shoot only ALIVE enemies
-        if(uid_get_type(plugin_state->entity[i].uid) != E_ENEMY ||
-           plugin_state->entity[i].state == S_DEAD || plugin_state->entity[i].state == S_HIDDEN) {
-            continue;
-        }
-
-        Coords transform = translateIntoView(&(plugin_state->entity[i].pos), plugin_state);
-        if(fabs(transform.x) < 20 && transform.y > 0) {
-            uint8_t damage = (double)fmin(
-                GUN_MAX_DAMAGE,
-                GUN_MAX_DAMAGE / (fabs(transform.x) * plugin_state->entity[i].distance) / 5);
-            if(damage > 0) {
-                plugin_state->entity[i].health = fmax(0, plugin_state->entity[i].health - damage);
-                plugin_state->entity[i].state = S_HIT;
-                plugin_state->entity[i].timer = 4;
-            }
-        }
-    }
-}
-
-UID updatePosition(
-    const uint8_t level[],
-    Coords* pos,
-    double relative_x,
-    double relative_y,
-    bool only_walls,
-    PluginState* const plugin_state) {
-    UID collide_x = detectCollision(level, pos, relative_x, 0, only_walls, plugin_state);
-    UID collide_y = detectCollision(level, pos, 0, relative_y, only_walls, plugin_state);
-
-    if(!collide_x) pos->x += relative_x;
-    if(!collide_y) pos->y += relative_y;
-
-    return collide_x || collide_y || UID_null;
-}
-
-void updateEntities(const uint8_t level[], Canvas* const canvas, PluginState* const plugin_state) {
-    uint8_t i = 0;
-    while(i < plugin_state->num_entities) {
-        // update distance
-        plugin_state->entity[i].distance =
-            coords_distance(&(plugin_state->player.pos), &(plugin_state->entity[i].pos));
-
-        // Run the timer. Works with actual frames.
-        // Todo: use delta here. But needs double type and more memory
-        if(plugin_state->entity[i].timer > 0) plugin_state->entity[i].timer--;
-
-        // too far away. put it in doze mode
-        if(plugin_state->entity[i].distance > MAX_ENTITY_DISTANCE) {
-            removeEntity(plugin_state->entity[i].uid, plugin_state);
-            // don't increase 'i', since current one has been removed
-            continue;
-        }
-
-        // bypass render if hidden
-        if(plugin_state->entity[i].state == S_HIDDEN) {
-            i++;
-            continue;
-        }
-
-        uint8_t type = uid_get_type(plugin_state->entity[i].uid);
-
-        switch(type) {
-        case E_ENEMY: {
-            // Enemy "IA"
-            if(plugin_state->entity[i].health == 0) {
-                if(plugin_state->entity[i].state != S_DEAD) {
-                    plugin_state->entity[i].state = S_DEAD;
-                    plugin_state->entity[i].timer = 6;
-                }
-            } else if(plugin_state->entity[i].state == S_HIT) {
-                if(plugin_state->entity[i].timer == 0) {
-                    // Back to alert state
-                    plugin_state->entity[i].state = S_ALERT;
-                    plugin_state->entity[i].timer = 40; // delay next fireball thrown
-                }
-            } else if(plugin_state->entity[i].state == S_FIRING) {
-                if(plugin_state->entity[i].timer == 0) {
-                    // Back to alert state
-                    plugin_state->entity[i].state = S_ALERT;
-                    plugin_state->entity[i].timer = 40; // delay next fireball throwm
-                }
-            } else {
-                // ALERT STATE
-                if(plugin_state->entity[i].distance > ENEMY_MELEE_DIST &&
-                   plugin_state->entity[i].distance < MAX_ENEMY_VIEW) {
-                    if(plugin_state->entity[i].state != S_ALERT) {
-                        plugin_state->entity[i].state = S_ALERT;
-                        plugin_state->entity[i].timer = 20; // used to throw fireballs
-                    } else {
-                        if(plugin_state->entity[i].timer == 0) {
-                            // Throw a fireball
-                            spawnFireball(
-                                plugin_state->entity[i].pos.x,
-                                plugin_state->entity[i].pos.y,
-                                plugin_state);
-                            plugin_state->entity[i].state = S_FIRING;
-                            plugin_state->entity[i].timer = 6;
-                        } else {
-                            // move towards to the player.
-                            updatePosition(
-                                level,
-                                &(plugin_state->entity[i].pos),
-                                sign(plugin_state->player.pos.x, plugin_state->entity[i].pos.x) *
-                                    (double)ENEMY_SPEED * 1, // NOT SURE (delta)
-                                sign(plugin_state->player.pos.y, plugin_state->entity[i].pos.y) *
-                                    (double)ENEMY_SPEED * 1, // NOT SURE (delta)
-                                true,
-                                plugin_state);
-                        }
-                    }
-                } else if(plugin_state->entity[i].distance <= ENEMY_MELEE_DIST) {
-                    if(plugin_state->entity[i].state != S_MELEE) {
-                        // Preparing the melee attack
-                        plugin_state->entity[i].state = S_MELEE;
-                        plugin_state->entity[i].timer = 10;
-                    } else if(plugin_state->entity[i].timer == 0) {
-                        // Melee attack
-                        plugin_state->player.health =
-                            fmax(0, plugin_state->player.health - ENEMY_MELEE_DAMAGE);
-                        plugin_state->entity[i].timer = 14;
-                        flash_screen = 1;
-                        updateHud(canvas, plugin_state);
-                    }
-                } else {
-                    // stand
-                    plugin_state->entity[i].state = S_STAND;
-                }
-            }
-            break;
-        }
-
-        case E_FIREBALL: {
-            if(plugin_state->entity[i].distance < FIREBALL_COLLIDER_DIST) {
-                // Hit the player and disappear
-                plugin_state->player.health =
-                    fmax(0, plugin_state->player.health - ENEMY_FIREBALL_DAMAGE);
-                flash_screen = 1;
-                updateHud(canvas, plugin_state);
-                removeEntity(plugin_state->entity[i].uid, plugin_state);
-                continue; // continue in the loop
-            } else {
-                // Move. Only collide with walls.
-                // Note: using health to store the angle of the movement
-                UID collided = updatePosition(
-                    level,
-                    &(plugin_state->entity[i].pos),
-                    cos((double)plugin_state->entity[i].health / FIREBALL_ANGLES * (double)PI) *
-                        (double)FIREBALL_SPEED,
-                    sin((double)plugin_state->entity[i].health / FIREBALL_ANGLES * (double)PI) *
-                        (double)FIREBALL_SPEED,
-                    true,
-                    plugin_state);
-
-                if(collided) {
-                    removeEntity(plugin_state->entity[i].uid, plugin_state);
-                    continue; // continue in the entity check loop
-                }
-            }
-            break;
-        }
-
-        case E_MEDIKIT: {
-            if(plugin_state->entity[i].distance < ITEM_COLLIDER_DIST) {
-                // pickup
-                notification_message(plugin_state->notify, &sequence_long_sound);
-                //playSound(medkit_snd, MEDKIT_SND_LEN);
-                plugin_state->entity[i].state = S_HIDDEN;
-                plugin_state->player.health = fmin(100, plugin_state->player.health + 50);
-                updateHud(canvas, plugin_state);
-                flash_screen = 1;
-            }
-            break;
-        }
-
-        case E_KEY: {
-            if(plugin_state->entity[i].distance < ITEM_COLLIDER_DIST) {
-                // pickup
-                notification_message(plugin_state->notify, &sequence_long_sound);
-                //playSound(get_key_snd, GET_KEY_SND_LEN);
-                plugin_state->entity[i].state = S_HIDDEN;
-                plugin_state->player.keys++;
-                updateHud(canvas, plugin_state);
-                flash_screen = 1;
-            }
-            break;
-        }
-        }
-
-        i++;
-    }
-}
-
-// The map raycaster. Based on https://lodev.org/cgtutor/raycasting.html
-void renderMap(
-    const uint8_t level[],
-    double view_height,
-    Canvas* const canvas,
-    PluginState* const plugin_state) {
-    UID last_uid = 0; // NOT SURE ?
-
-    for(uint8_t x = 0; x < SCREEN_WIDTH; x += RES_DIVIDER) {
-        double camera_x = 2 * (double)x / SCREEN_WIDTH - 1;
-        double ray_x = plugin_state->player.dir.x + plugin_state->player.plane.x * camera_x;
-        double ray_y = plugin_state->player.dir.y + plugin_state->player.plane.y * camera_x;
-        uint8_t map_x = (uint8_t)plugin_state->player.pos.x;
-        uint8_t map_y = (uint8_t)plugin_state->player.pos.y;
-        Coords map_coords = {plugin_state->player.pos.x, plugin_state->player.pos.y};
-        double delta_x = fabs(1 / ray_x);
-        double delta_y = fabs(1 / ray_y);
-
-        int8_t step_x;
-        int8_t step_y;
-        double side_x;
-        double side_y;
-
-        if(ray_x < 0) {
-            step_x = -1;
-            side_x = (plugin_state->player.pos.x - map_x) * delta_x;
-        } else {
-            step_x = 1;
-            side_x = (map_x + (double)1.0 - plugin_state->player.pos.x) * delta_x;
-        }
-
-        if(ray_y < 0) {
-            step_y = -1;
-            side_y = (plugin_state->player.pos.y - map_y) * delta_y;
-        } else {
-            step_y = 1;
-            side_y = (map_y + (double)1.0 - plugin_state->player.pos.y) * delta_y;
-        }
-
-        // Wall detection
-        uint8_t depth = 0;
-        bool hit = 0;
-        bool side;
-        while(!hit && depth < MAX_RENDER_DEPTH) {
-            if(side_x < side_y) {
-                side_x += delta_x;
-                map_x += step_x;
-                side = 0;
-            } else {
-                side_y += delta_y;
-                map_y += step_y;
-                side = 1;
-            }
-
-            uint8_t block = getBlockAt(level, map_x, map_y);
-
-            if(block == E_WALL) {
-                hit = 1;
-            } else {
-                // Spawning entities here, as soon they are visible for the
-                // player. Not the best place, but would be a very performance
-                // cost scan for them in another loop
-                if(block == E_ENEMY || (block & 0b00001000) /* all collectable items */) {
-                    // Check that it's close to the player
-                    if(coords_distance(&(plugin_state->player.pos), &map_coords) <
-                       MAX_ENTITY_DISTANCE) {
-                        UID uid = create_uid(block, map_x, map_y);
-                        if(last_uid != uid && !isSpawned(uid, plugin_state)) {
-                            spawnEntity(block, map_x, map_y, plugin_state);
-                            last_uid = uid;
-                        }
-                    }
-                }
-            }
-
-            depth++;
-        }
-
-        if(hit) {
-            double distance;
-
-            if(side == 0) {
-                distance =
-                    fmax(1, (map_x - plugin_state->player.pos.x + (1 - step_x) / 2) / ray_x);
-            } else {
-                distance =
-                    fmax(1, (map_y - plugin_state->player.pos.y + (1 - step_y) / 2) / ray_y);
-            }
-
-            // store zbuffer value for the column
-            zbuffer[x / Z_RES_DIVIDER] = fmin(distance * DISTANCE_MULTIPLIER, 255);
-
-            // rendered line height
-            uint8_t line_height = RENDER_HEIGHT / distance;
-
-            drawVLine(
-                x,
-                view_height / distance - line_height / 2 + RENDER_HEIGHT / 2,
-                view_height / distance + line_height / 2 + RENDER_HEIGHT / 2,
-                GRADIENT_COUNT - (int)distance / MAX_RENDER_DEPTH * GRADIENT_COUNT - side * 2,
-                canvas);
-        }
-    }
-}
-
-// Sort entities from far to close
-uint8_t sortEntities(PluginState* const plugin_state) {
-    uint8_t gap = plugin_state->num_entities;
-    bool swapped = false;
-    while(gap > 1 || swapped) {
-        //shrink factor 1.3
-        gap = (gap * 10) / 13;
-        if(gap == 9 || gap == 10) gap = 11;
-        if(gap < 1) gap = 1;
-        swapped = false;
-        for(uint8_t i = 0; i < plugin_state->num_entities - gap; i++) {
-            uint8_t j = i + gap;
-            if(plugin_state->entity[i].distance < plugin_state->entity[j].distance) {
-                swap(plugin_state->entity[i], plugin_state->entity[j]);
-                swapped = true;
-            }
-        }
-    }
-    return swapped;
-}
-
-Coords translateIntoView(Coords* pos, PluginState* const plugin_state) {
-    //translate sprite position to relative to camera
-    double sprite_x = pos->x - plugin_state->player.pos.x;
-    double sprite_y = pos->y - plugin_state->player.pos.y;
-
-    //required for correct matrix multiplication
-    double inv_det =
-        ((double)1.0 /
-         ((double)plugin_state->player.plane.x * (double)plugin_state->player.dir.y -
-          (double)plugin_state->player.dir.x * (double)plugin_state->player.plane.y));
-    double transform_x =
-        inv_det * (plugin_state->player.dir.y * sprite_x - plugin_state->player.dir.x * sprite_y);
-    double transform_y = inv_det * (-plugin_state->player.plane.y * sprite_x +
-                                    plugin_state->player.plane.x * sprite_y); // Z in screen
-    Coords res = {transform_x, transform_y};
-    return res;
-}
-
-void renderEntities(double view_height, Canvas* const canvas, PluginState* const plugin_state) {
-    sortEntities(plugin_state);
-
-    for(uint8_t i = 0; i < plugin_state->num_entities; i++) {
-        if(plugin_state->entity[i].state == S_HIDDEN) continue;
-
-        Coords transform = translateIntoView(&(plugin_state->entity[i].pos), plugin_state);
-
-        // don´t render if behind the player or too far away
-        if(transform.y <= (double)0.1 || transform.y > MAX_SPRITE_DEPTH) {
-            continue;
-        }
-
-        int16_t sprite_screen_x = HALF_WIDTH * ((double)1.0 + transform.x / transform.y);
-        int8_t sprite_screen_y = RENDER_HEIGHT / 2 + view_height / transform.y;
-        uint8_t type = uid_get_type(plugin_state->entity[i].uid);
-
-        // don´t try to render if outside of screen
-        // doing this pre-shortcut due int16 -> int8 conversion makes out-of-screen
-        // values fit into the screen space
-        if(sprite_screen_x < -HALF_WIDTH || sprite_screen_x > SCREEN_WIDTH + HALF_WIDTH) {
-            continue;
-        }
-
-        switch(type) {
-        case E_ENEMY: {
-            uint8_t sprite;
-            if(plugin_state->entity[i].state == S_ALERT) {
-                // walking
-                sprite = ((int)furi_get_tick() / 500) % 2;
-            } else if(plugin_state->entity[i].state == S_FIRING) {
-                // fireball
-                sprite = 2;
-            } else if(plugin_state->entity[i].state == S_HIT) {
-                // hit
-                sprite = 3;
-            } else if(plugin_state->entity[i].state == S_MELEE) {
-                // melee atack
-                sprite = plugin_state->entity[i].timer > 10 ? 2 : 1;
-            } else if(plugin_state->entity[i].state == S_DEAD) {
-                // dying
-                sprite = plugin_state->entity[i].timer > 0 ? 3 : 4;
-            } else {
-                // stand
-                sprite = 0;
-            }
-
-            drawSprite(
-                sprite_screen_x - BMP_IMP_WIDTH * (double).5 / transform.y,
-                sprite_screen_y - 8 / transform.y,
-                imp_inv,
-                imp_mask_inv,
-                BMP_IMP_WIDTH,
-                BMP_IMP_HEIGHT,
-                sprite,
-                transform.y,
-                canvas);
-            break;
-        }
-
-        case E_FIREBALL: {
-            drawSprite(
-                sprite_screen_x - BMP_FIREBALL_WIDTH / 2 / transform.y,
-                sprite_screen_y - BMP_FIREBALL_HEIGHT / 2 / transform.y,
-                fireball,
-                fireball_mask,
-                BMP_FIREBALL_WIDTH,
-                BMP_FIREBALL_HEIGHT,
-                0,
-                transform.y,
-                canvas);
-            break;
-        }
-
-        case E_MEDIKIT: {
-            drawSprite(
-                sprite_screen_x - BMP_ITEMS_WIDTH / 2 / transform.y,
-                sprite_screen_y + 5 / transform.y,
-                item,
-                item_mask,
-                BMP_ITEMS_WIDTH,
-                BMP_ITEMS_HEIGHT,
-                0,
-                transform.y,
-                canvas);
-            break;
-        }
-
-        case E_KEY: {
-            drawSprite(
-                sprite_screen_x - BMP_ITEMS_WIDTH / 2 / transform.y,
-                sprite_screen_y + 5 / transform.y,
-                item,
-                item_mask,
-                BMP_ITEMS_WIDTH,
-                BMP_ITEMS_HEIGHT,
-                1,
-                transform.y,
-                canvas);
-            break;
-        }
-        }
-    }
-}
-
-void renderGun(uint8_t gun_pos, double amount_jogging, Canvas* const canvas) {
-    // jogging
-    char x = 48 + sin((double)furi_get_tick() * (double)JOGGING_SPEED) * 10 * amount_jogging;
-    char y = RENDER_HEIGHT - gun_pos +
-             fabs(cos((double)furi_get_tick() * (double)JOGGING_SPEED)) * 8 * amount_jogging;
-
-    if(gun_pos > GUN_SHOT_POS - 2) {
-        // Gun fire
-        drawBitmap(x + 6, y - 11, &I_fire_inv, BMP_FIRE_WIDTH, BMP_FIRE_HEIGHT, 1, canvas);
-    }
-
-    // Don't draw over the hud!
-    uint8_t clip_height = fmax(0, fmin(y + BMP_GUN_HEIGHT, RENDER_HEIGHT) - y);
-
-    // Draw the gun (black mask + actual sprite).
-    drawBitmap(x, y, &I_gun_mask_inv, BMP_GUN_WIDTH, clip_height, 0, canvas);
-    drawBitmap(x, y, &I_gun_inv, BMP_GUN_WIDTH, clip_height, 1, canvas);
-    //drawGun(x,y,gun_mask, BMP_GUN_WIDTH, clip_height, 0, canvas);
-    //drawGun(x,y,gun, BMP_GUN_WIDTH, clip_height, 1, canvas);
-}
-
-// Only needed first time
-void renderHud(Canvas* const canvas, PluginState* plugin_state) {
-    drawTextSpace(2, 58, "{}", 0, canvas); // Health symbol
-    drawTextSpace(40, 58, "[]", 0, canvas); // Keys symbol
-    updateHud(canvas, plugin_state);
-}
-
-// Render values for the HUD
-void updateHud(Canvas* const canvas, PluginState* plugin_state) {
-    clearRect(12, 58, 15, 6, canvas);
-    clearRect(50, 58, 15, 6, canvas);
-    drawText(12, 58, plugin_state->player.health, canvas);
-    drawText(50, 58, plugin_state->player.keys, canvas);
-}
-
-// Debug stats
-void renderStats(Canvas* const canvas, PluginState* plugin_state) {
-    clearRect(58, 58, 70, 6, canvas);
-    drawText(114, 58, (int)getActualFps(), canvas);
-    drawText(82, 58, plugin_state->num_entities, canvas);
-    // drawText(94, 58, freeMemory());
-}
-
-// Intro screen
-void loopIntro(Canvas* const canvas) {
-    canvas_draw_icon(canvas, 0, 0, &I_logo_inv);
-    //drawTextSpace(SCREEN_WIDTH / 2 - 25, SCREEN_HEIGHT * .8, "PRESS FIRE", 1, canvas);
-}
-
-static void render_callback(Canvas* const canvas, void* ctx) {
-    furi_assert(ctx);
-    PluginState* plugin_state = ctx;
-    furi_mutex_acquire(plugin_state->mutex, FuriWaitForever);
-
-    canvas_set_font(canvas, FontPrimary);
-
-    switch(plugin_state->scene) {
-    case INTRO: {
-        loopIntro(canvas);
-        break;
-    }
-    case GAME_PLAY: {
-        updateEntities(sto_level_1, canvas, plugin_state);
-
-        renderGun(plugin_state->gun_pos, plugin_state->jogging, canvas);
-        renderMap(sto_level_1, plugin_state->view_height, canvas, plugin_state);
-
-        renderEntities(plugin_state->view_height, canvas, plugin_state);
-
-        renderHud(canvas, plugin_state);
-        updateHud(canvas, plugin_state);
-        renderStats(canvas, plugin_state);
-        break;
-    }
-    }
-    furi_mutex_release(plugin_state->mutex);
-}
-
-static void input_callback(InputEvent* input_event, FuriMessageQueue* event_queue) {
-    furi_assert(event_queue);
-
-    PluginEvent event = {.type = EventTypeKey, .input = *input_event};
-    furi_message_queue_put(event_queue, &event, 0);
-}
-
-static void doom_state_init(PluginState* const plugin_state) {
-    plugin_state->notify = furi_record_open(RECORD_NOTIFICATION);
-    plugin_state->num_entities = 0;
-    plugin_state->num_static_entities = 0;
-
-    plugin_state->scene = INTRO;
-    plugin_state->gun_pos = 0;
-    plugin_state->view_height = 0;
-    plugin_state->init = true;
-
-    plugin_state->up = false;
-    plugin_state->down = false;
-    plugin_state->left = false;
-    plugin_state->right = false;
-    plugin_state->fired = false;
-    plugin_state->gun_fired = false;
-#ifdef SOUND
-
-    plugin_state->music_instance = malloc(sizeof(MusicPlayer));
-    plugin_state->music_instance->model = malloc(sizeof(MusicPlayerModel));
-    memset(
-        plugin_state->music_instance->model->duration_history,
-        0xff,
-        MUSIC_PLAYER_SEMITONE_HISTORY_SIZE);
-    memset(
-        plugin_state->music_instance->model->semitone_history,
-        0xff,
-        MUSIC_PLAYER_SEMITONE_HISTORY_SIZE);
-    plugin_state->music_instance->model->volume = 2;
-
-    plugin_state->music_instance->model_mutex = furi_mutex_alloc(FuriMutexTypeNormal);
-    //plugin_state->music_instance->view_port = view_port_alloc();
-
-    plugin_state->music_instance->worker = music_player_worker_alloc();
-    //music_player_worker_set_volume(plugin_state->music_instance->worker, 0.75);
-    music_player_worker_set_volume(
-        plugin_state->music_instance->worker,
-        MUSIC_PLAYER_VOLUMES[plugin_state->music_instance->model->volume]);
-    plugin_state->intro_sound = true;
-    //init_sound(plugin_state->music_instance);
-#endif
-}
-
-static void doom_game_update_timer_callback(FuriMessageQueue* event_queue) {
-    furi_assert(event_queue);
-
-    PluginEvent event = {.type = EventTypeTick};
-    furi_message_queue_put(event_queue, &event, 0);
-}
-
-static void doom_game_tick(PluginState* const plugin_state) {
-    if(plugin_state->scene == GAME_PLAY) {
-        //fps();
-        //player is alive
-        if(plugin_state->player.health > 0) {
-            if(plugin_state->up) {
-                plugin_state->player.velocity +=
-                    ((double)MOV_SPEED - plugin_state->player.velocity) * (double).4;
-                plugin_state->jogging = fabs(plugin_state->player.velocity) * MOV_SPEED_INV;
-                //plugin_state->up = false;
-            } else if(plugin_state->down) {
-                plugin_state->player.velocity +=
-                    (-(double)MOV_SPEED - plugin_state->player.velocity) * (double).4;
-                plugin_state->jogging = fabs(plugin_state->player.velocity) * MOV_SPEED_INV;
-                //plugin_state->down = false;
-            } else {
-                plugin_state->player.velocity *= (double).5;
-                plugin_state->jogging = fabs(plugin_state->player.velocity) * MOV_SPEED_INV;
-            }
-
-            if(plugin_state->right) {
-                plugin_state->rot_speed = (double)ROT_SPEED * delta;
-                plugin_state->old_dir_x = plugin_state->player.dir.x;
-                plugin_state->player.dir.x =
-                    plugin_state->player.dir.x * cos(-(plugin_state->rot_speed)) -
-                    plugin_state->player.dir.y * sin(-(plugin_state->rot_speed));
-                plugin_state->player.dir.y =
-                    plugin_state->old_dir_x * sin(-(plugin_state->rot_speed)) +
-                    plugin_state->player.dir.y * cos(-(plugin_state->rot_speed));
-                plugin_state->old_plane_x = plugin_state->player.plane.x;
-                plugin_state->player.plane.x =
-                    plugin_state->player.plane.x * cos(-(plugin_state->rot_speed)) -
-                    plugin_state->player.plane.y * sin(-(plugin_state->rot_speed));
-                plugin_state->player.plane.y =
-                    plugin_state->old_plane_x * sin(-(plugin_state->rot_speed)) +
-                    plugin_state->player.plane.y * cos(-(plugin_state->rot_speed));
-
-                //plugin_state->right = false;
-            } else if(plugin_state->left) {
-                plugin_state->rot_speed = (double)ROT_SPEED * delta;
-                plugin_state->old_dir_x = plugin_state->player.dir.x;
-                plugin_state->player.dir.x =
-                    plugin_state->player.dir.x * cos(plugin_state->rot_speed) -
-                    plugin_state->player.dir.y * sin(plugin_state->rot_speed);
-                plugin_state->player.dir.y =
-                    plugin_state->old_dir_x * sin(plugin_state->rot_speed) +
-                    plugin_state->player.dir.y * cos(plugin_state->rot_speed);
-                plugin_state->old_plane_x = plugin_state->player.plane.x;
-                plugin_state->player.plane.x =
-                    plugin_state->player.plane.x * cos(plugin_state->rot_speed) -
-                    plugin_state->player.plane.y * sin(plugin_state->rot_speed);
-                plugin_state->player.plane.y =
-                    plugin_state->old_plane_x * sin(plugin_state->rot_speed) +
-                    plugin_state->player.plane.y * cos(plugin_state->rot_speed);
-                //plugin_state->left = false;
-            }
-            plugin_state->view_height =
-                fabs(sin((double)furi_get_tick() * (double)JOGGING_SPEED)) * 6 *
-                plugin_state->jogging;
-
-            if(plugin_state->gun_pos > GUN_TARGET_POS) {
-                // Right after fire
-                plugin_state->gun_pos -= 1;
-            } else if(plugin_state->gun_pos < GUN_TARGET_POS) {
-                plugin_state->gun_pos += 2;
-            } else if(!plugin_state->gun_fired && plugin_state->fired) {
-                //furi_hal_speaker_start(20480 / 10, 0.45f);
-                /*#ifdef SOUND
-        music_player_worker_start(plugin_state->music_instance->worker);
-#endif*/
-                plugin_state->gun_pos = GUN_SHOT_POS;
-                plugin_state->gun_fired = true;
-                plugin_state->fired = false;
-                fire(plugin_state);
-
-            } else if(plugin_state->gun_fired && !plugin_state->fired) {
-                //furi_hal_speaker_stop();
-                plugin_state->gun_fired = false;
-
-                notification_message(plugin_state->notify, &sequence_short_sound);
-
-                /*#ifdef SOUND
-        music_player_worker_stop(plugin_state->music_instance->worker);
-#endif*/
-            }
-        } else {
-            // Player is dead
-            if(plugin_state->view_height > -10) plugin_state->view_height--;
-            if(plugin_state->gun_pos > 1) plugin_state->gun_pos -= 2;
-        }
-
-        if(fabs(plugin_state->player.velocity) > (double)0.003) {
-            updatePosition(
-                sto_level_1,
-                &(plugin_state->player.pos),
-                plugin_state->player.dir.x * plugin_state->player.velocity * delta,
-                plugin_state->player.dir.y * plugin_state->player.velocity * delta,
-                false,
-                plugin_state);
-        } else {
-            plugin_state->player.velocity = 0;
-        }
-    }
-}
-
-int32_t doom_app() {
-    FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(PluginEvent));
-    PluginState* plugin_state = malloc(sizeof(PluginState));
-    doom_state_init(plugin_state);
-    plugin_state->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
-    if(!plugin_state->mutex) {
-        FURI_LOG_E("Doom_game", "cannot create mutex\r\n");
-        furi_record_close(RECORD_NOTIFICATION);
-        furi_message_queue_free(event_queue);
-        free(plugin_state);
-        return 255;
-    }
-    FuriTimer* timer =
-        furi_timer_alloc(doom_game_update_timer_callback, FuriTimerTypePeriodic, event_queue);
-    furi_timer_start(timer, furi_kernel_get_tick_frequency() / 12);
-    // Set system callbacks
-    ViewPort* view_port = view_port_alloc();
-    view_port_draw_callback_set(view_port, render_callback, plugin_state);
-    view_port_input_callback_set(view_port, input_callback, event_queue);
-
-    // Open GUI and register view_port
-    Gui* gui = furi_record_open(RECORD_GUI);
-    gui_add_view_port(gui, view_port, GuiLayerFullscreen);
-
-    //////////////////////////////////
-    plugin_state->init = false;
-
-    PluginEvent event;
-#ifdef SOUND
-    music_player_worker_load_rtttl_from_string(plugin_state->music_instance->worker, dsintro);
-    music_player_worker_start(plugin_state->music_instance->worker);
-#endif
-    // Call dolphin deed on game start
-    dolphin_deed(DolphinDeedPluginGameStart);
-
-    for(bool processing = true; processing;) {
-        FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);
-        furi_mutex_acquire(plugin_state->mutex, FuriWaitForever);
-#ifdef SOUND
-        furi_check(
-            furi_mutex_acquire(plugin_state->music_instance->model_mutex, FuriWaitForever) ==
-            FuriStatusOk);
-#endif
-        if(event_status == FuriStatusOk) {
-            // press events
-            if(event.type == EventTypeKey) {
-                if(event.input.key == InputKeyBack) {
-                    processing = false;
-#ifdef SOUND
-                    if(plugin_state->intro_sound) {
-                        furi_mutex_release(plugin_state->music_instance->model_mutex);
-                        music_player_worker_stop(plugin_state->music_instance->worker);
-                    }
-#endif
-                }
-
-                if(event.input.type == InputTypePress) {
-                    if(plugin_state->scene == INTRO && event.input.key == InputKeyOk) {
-                        plugin_state->scene = GAME_PLAY;
-                        initializeLevel(sto_level_1, plugin_state);
-#ifdef SOUND
-                        furi_mutex_release(plugin_state->music_instance->model_mutex);
-                        music_player_worker_stop(plugin_state->music_instance->worker);
-                        plugin_state->intro_sound = false;
-#endif
-                        goto skipintro;
-                    }
-
-                    //While playing game
-                    if(plugin_state->scene == GAME_PLAY) {
-                        // If the player is alive
-                        if(plugin_state->player.health > 0) {
-                            //Player speed
-                            if(event.input.key == InputKeyUp) {
-                                plugin_state->up = true;
-                            } else if(event.input.key == InputKeyDown) {
-                                plugin_state->down = true;
-                            }
-                            // Player rotation
-                            if(event.input.key == InputKeyRight) {
-                                plugin_state->right = true;
-                            } else if(event.input.key == InputKeyLeft) {
-                                plugin_state->left = true;
-                            }
-                            if(event.input.key == InputKeyOk) {
-                                /*#ifdef SOUND
-                        music_player_worker_load_rtttl_from_string(plugin_state->music_instance->worker, dspistol);
-#endif*/
-                                if(plugin_state->fired) {
-                                    plugin_state->fired = false;
-                                } else {
-                                    plugin_state->fired = true;
-                                }
-                            }
-                        } else {
-                            // Player is dead
-                            if(event.input.key == InputKeyOk) plugin_state->scene = INTRO;
-                        }
-                    }
-                }
-                if(event.input.type == InputTypeRelease) {
-                    if(plugin_state->player.health > 0) {
-                        //Player speed
-                        if(event.input.key == InputKeyUp) {
-                            plugin_state->up = false;
-                        } else if(event.input.key == InputKeyDown) {
-                            plugin_state->down = false;
-                        }
-                        // Player rotation
-                        if(event.input.key == InputKeyRight) {
-                            plugin_state->right = false;
-                        } else if(event.input.key == InputKeyLeft) {
-                            plugin_state->left = false;
-                        }
-                    }
-                }
-            }
-
-        skipintro:
-            if(event.type == EventTypeTick) {
-                doom_game_tick(plugin_state);
-            }
-        }
-#ifdef SOUND
-        furi_mutex_release(plugin_state->music_instance->model_mutex);
-#endif
-        view_port_update(view_port);
-        furi_mutex_release(plugin_state->mutex);
-    }
-#ifdef SOUND
-    music_player_worker_free(plugin_state->music_instance->worker);
-    furi_mutex_free(plugin_state->music_instance->model_mutex);
-    free(plugin_state->music_instance->model);
-    free(plugin_state->music_instance);
-#endif
-    furi_record_close(RECORD_NOTIFICATION);
-    furi_timer_free(timer);
-    view_port_enabled_set(view_port, false);
-    gui_remove_view_port(gui, view_port);
-    furi_record_close(RECORD_GUI);
-    view_port_free(view_port);
-    furi_mutex_free(plugin_state->mutex);
-    furi_message_queue_free(event_queue);
-    free(plugin_state);
-    return 0;
-}

BIN
main_apps_sources/doom/doom_10px.png


+ 0 - 504
main_apps_sources/doom/doom_music_player_worker.c

@@ -1,504 +0,0 @@
-#include "doom_music_player_worker.h"
-
-#include <furi_hal.h>
-#include <furi.h>
-
-#include <storage/storage.h>
-#include <lib/flipper_format/flipper_format.h>
-
-#include <m-array.h>
-
-#define TAG "MusicPlayerWorker"
-
-#define MUSIC_PLAYER_FILETYPE "Flipper Music Format"
-#define MUSIC_PLAYER_VERSION 0
-
-#define SEMITONE_PAUSE 0xFF
-
-#define NOTE_C4 261.63f
-#define NOTE_C4_SEMITONE (4.0f * 12.0f)
-#define TWO_POW_TWELTH_ROOT 1.059463094359f
-
-typedef struct {
-    uint8_t semitone;
-    uint8_t duration;
-    uint8_t dots;
-} NoteBlock;
-
-ARRAY_DEF(NoteBlockArray, NoteBlock, M_POD_OPLIST);
-
-struct MusicPlayerWorker {
-    FuriThread* thread;
-    bool should_work;
-
-    MusicPlayerWorkerCallback callback;
-    void* callback_context;
-
-    float volume;
-    uint32_t bpm;
-    uint32_t duration;
-    uint32_t octave;
-    NoteBlockArray_t notes;
-};
-
-static int32_t music_player_worker_thread_callback(void* context) {
-    furi_assert(context);
-    MusicPlayerWorker* instance = context;
-
-    NoteBlockArray_it_t it;
-    NoteBlockArray_it(it, instance->notes);
-    if(furi_hal_speaker_acquire(1000)) {
-        while(instance->should_work) {
-            if(NoteBlockArray_end_p(it)) {
-                NoteBlockArray_it(it, instance->notes);
-                furi_delay_ms(10);
-            } else {
-                NoteBlock* note_block = NoteBlockArray_ref(it);
-
-                float note_from_a4 = (float)note_block->semitone - NOTE_C4_SEMITONE;
-                float frequency = NOTE_C4 * powf(TWO_POW_TWELTH_ROOT, note_from_a4);
-                float duration = 60.0 * furi_kernel_get_tick_frequency() * 4 / instance->bpm /
-                                 note_block->duration;
-                uint32_t dots = note_block->dots;
-                while(dots > 0) {
-                    duration += duration / 2;
-                    dots--;
-                }
-                uint32_t next_tick = furi_get_tick() + duration;
-                float volume = instance->volume;
-
-                if(instance->callback) {
-                    instance->callback(
-                        note_block->semitone,
-                        note_block->dots,
-                        note_block->duration,
-                        0.0,
-                        instance->callback_context);
-                }
-
-                furi_hal_speaker_stop();
-                furi_hal_speaker_start(frequency, volume);
-                while(instance->should_work && furi_get_tick() < next_tick) {
-                    volume *= 0.9945679;
-                    furi_hal_speaker_set_volume(volume);
-                    furi_delay_ms(2);
-                }
-                NoteBlockArray_next(it);
-            }
-        }
-
-        furi_hal_speaker_stop();
-        furi_hal_speaker_release();
-    } else {
-        FURI_LOG_E(TAG, "Speaker system is busy with another process.");
-    }
-
-    return 0;
-}
-
-MusicPlayerWorker* music_player_worker_alloc() {
-    MusicPlayerWorker* instance = malloc(sizeof(MusicPlayerWorker));
-
-    NoteBlockArray_init(instance->notes);
-
-    instance->thread = furi_thread_alloc();
-    furi_thread_set_name(instance->thread, "MusicPlayerWorker");
-    furi_thread_set_stack_size(instance->thread, 1024);
-    furi_thread_set_context(instance->thread, instance);
-    furi_thread_set_callback(instance->thread, music_player_worker_thread_callback);
-
-    instance->volume = 1.0f;
-
-    return instance;
-}
-
-void music_player_worker_free(MusicPlayerWorker* instance) {
-    furi_assert(instance);
-    furi_thread_free(instance->thread);
-    NoteBlockArray_clear(instance->notes);
-    free(instance);
-}
-
-static bool is_digit(const char c) {
-    return isdigit(c) != 0;
-}
-
-static bool is_letter(const char c) {
-    return islower(c) != 0 || isupper(c) != 0;
-}
-
-static bool is_space(const char c) {
-    return c == ' ' || c == '\t';
-}
-
-static size_t extract_number(const char* string, uint32_t* number) {
-    size_t ret = 0;
-    while(is_digit(*string)) {
-        *number *= 10;
-        *number += (*string - '0');
-        string++;
-        ret++;
-    }
-    return ret;
-}
-
-static size_t extract_dots(const char* string, uint32_t* number) {
-    size_t ret = 0;
-    while(*string == '.') {
-        *number += 1;
-        string++;
-        ret++;
-    }
-    return ret;
-}
-
-static size_t extract_char(const char* string, char* symbol) {
-    if(is_letter(*string)) {
-        *symbol = *string;
-        return 1;
-    } else {
-        return 0;
-    }
-}
-
-static size_t extract_sharp(const char* string, char* symbol) {
-    if(*string == '#' || *string == '_') {
-        *symbol = '#';
-        return 1;
-    } else {
-        return 0;
-    }
-}
-
-static size_t skip_till(const char* string, const char symbol) {
-    size_t ret = 0;
-    while(*string != '\0' && *string != symbol) {
-        string++;
-        ret++;
-    }
-    if(*string != symbol) {
-        ret = 0;
-    }
-    return ret;
-}
-
-static bool music_player_worker_add_note(
-    MusicPlayerWorker* instance,
-    uint8_t semitone,
-    uint8_t duration,
-    uint8_t dots) {
-    NoteBlock note_block;
-
-    note_block.semitone = semitone;
-    note_block.duration = duration;
-    note_block.dots = dots;
-
-    NoteBlockArray_push_back(instance->notes, note_block);
-
-    return true;
-}
-
-static int8_t note_to_semitone(const char note) {
-    switch(note) {
-    case 'C':
-        return 0;
-    // C#
-    case 'D':
-        return 2;
-    // D#
-    case 'E':
-        return 4;
-    case 'F':
-        return 5;
-    // F#
-    case 'G':
-        return 7;
-    // G#
-    case 'A':
-        return 9;
-    // A#
-    case 'B':
-        return 11;
-    default:
-        return 0;
-    }
-}
-
-static bool music_player_worker_parse_notes(MusicPlayerWorker* instance, const char* string) {
-    const char* cursor = string;
-    bool result = true;
-
-    while(*cursor != '\0') {
-        if(!is_space(*cursor)) {
-            uint32_t duration = 0;
-            char note_char = '\0';
-            char sharp_char = '\0';
-            uint32_t octave = 0;
-            uint32_t dots = 0;
-
-            // Parsing
-            cursor += extract_number(cursor, &duration);
-            cursor += extract_char(cursor, &note_char);
-            cursor += extract_sharp(cursor, &sharp_char);
-            cursor += extract_number(cursor, &octave);
-            cursor += extract_dots(cursor, &dots);
-
-            // Post processing
-            note_char = toupper(note_char);
-            if(!duration) {
-                duration = instance->duration;
-            }
-            if(!octave) {
-                octave = instance->octave;
-            }
-
-            // Validation
-            bool is_valid = true;
-            is_valid &= (duration >= 1 && duration <= 128);
-            is_valid &= ((note_char >= 'A' && note_char <= 'G') || note_char == 'P');
-            is_valid &= (sharp_char == '#' || sharp_char == '\0');
-            is_valid &= (octave <= 16);
-            is_valid &= (dots <= 16);
-            if(!is_valid) {
-                FURI_LOG_E(
-                    TAG,
-                    "Invalid note: %lu%c%c%lu.%lu",
-                    duration,
-                    note_char == '\0' ? '_' : note_char,
-                    sharp_char == '\0' ? '_' : sharp_char,
-                    octave,
-                    dots);
-                result = false;
-                break;
-            }
-
-            // Note to semitones
-            uint8_t semitone = 0;
-            if(note_char == 'P') {
-                semitone = SEMITONE_PAUSE;
-            } else {
-                semitone += octave * 12;
-                semitone += note_to_semitone(note_char);
-                semitone += sharp_char == '#' ? 1 : 0;
-            }
-
-            if(music_player_worker_add_note(instance, semitone, duration, dots)) {
-                FURI_LOG_D(
-                    TAG,
-                    "Added note: %c%c%lu.%lu = %u %lu",
-                    note_char == '\0' ? '_' : note_char,
-                    sharp_char == '\0' ? '_' : sharp_char,
-                    octave,
-                    dots,
-                    semitone,
-                    duration);
-            } else {
-                FURI_LOG_E(
-                    TAG,
-                    "Invalid note: %c%c%lu.%lu = %u %lu",
-                    note_char == '\0' ? '_' : note_char,
-                    sharp_char == '\0' ? '_' : sharp_char,
-                    octave,
-                    dots,
-                    semitone,
-                    duration);
-            }
-            cursor += skip_till(cursor, ',');
-        }
-
-        if(*cursor != '\0') cursor++;
-    }
-
-    return result;
-}
-
-bool music_player_worker_load(MusicPlayerWorker* instance, const char* file_path) {
-    furi_assert(instance);
-    furi_assert(file_path);
-
-    bool ret = false;
-    if(strcasestr(file_path, ".fmf")) {
-        ret = music_player_worker_load_fmf_from_file(instance, file_path);
-    } else {
-        ret = music_player_worker_load_rtttl_from_file(instance, file_path);
-    }
-    return ret;
-}
-
-bool music_player_worker_load_fmf_from_file(MusicPlayerWorker* instance, const char* file_path) {
-    furi_assert(instance);
-    furi_assert(file_path);
-
-    bool result = false;
-    FuriString* temp_str;
-    temp_str = furi_string_alloc();
-
-    Storage* storage = furi_record_open(RECORD_STORAGE);
-    FlipperFormat* file = flipper_format_file_alloc(storage);
-
-    do {
-        if(!flipper_format_file_open_existing(file, file_path)) break;
-
-        uint32_t version = 0;
-        if(!flipper_format_read_header(file, temp_str, &version)) break;
-        if(furi_string_cmp_str(temp_str, MUSIC_PLAYER_FILETYPE) ||
-           (version != MUSIC_PLAYER_VERSION)) {
-            FURI_LOG_E(TAG, "Incorrect file format or version");
-            break;
-        }
-
-        if(!flipper_format_read_uint32(file, "BPM", &instance->bpm, 1)) {
-            FURI_LOG_E(TAG, "BPM is missing");
-            break;
-        }
-        if(!flipper_format_read_uint32(file, "Duration", &instance->duration, 1)) {
-            FURI_LOG_E(TAG, "Duration is missing");
-            break;
-        }
-        if(!flipper_format_read_uint32(file, "Octave", &instance->octave, 1)) {
-            FURI_LOG_E(TAG, "Octave is missing");
-            break;
-        }
-
-        if(!flipper_format_read_string(file, "Notes", temp_str)) {
-            FURI_LOG_E(TAG, "Notes is missing");
-            break;
-        }
-
-        if(!music_player_worker_parse_notes(instance, furi_string_get_cstr(temp_str))) {
-            break;
-        }
-
-        result = true;
-    } while(false);
-
-    furi_record_close(RECORD_STORAGE);
-    flipper_format_free(file);
-    furi_string_free(temp_str);
-
-    return result;
-}
-
-bool music_player_worker_load_rtttl_from_file(MusicPlayerWorker* instance, const char* file_path) {
-    furi_assert(instance);
-    furi_assert(file_path);
-
-    bool result = false;
-    FuriString* content;
-    content = furi_string_alloc();
-    Storage* storage = furi_record_open(RECORD_STORAGE);
-    File* file = storage_file_alloc(storage);
-
-    do {
-        if(!storage_file_open(file, file_path, FSAM_READ, FSOM_OPEN_EXISTING)) {
-            FURI_LOG_E(TAG, "Unable to open file");
-            break;
-        };
-
-        uint16_t ret = 0;
-        do {
-            uint8_t buffer[65] = {0};
-            ret = storage_file_read(file, buffer, sizeof(buffer) - 1);
-            for(size_t i = 0; i < ret; i++) {
-                furi_string_push_back(content, buffer[i]);
-            }
-        } while(ret > 0);
-
-        furi_string_trim(content);
-        if(!furi_string_size(content)) {
-            FURI_LOG_E(TAG, "Empty file");
-            break;
-        }
-
-        if(!music_player_worker_load_rtttl_from_string(instance, furi_string_get_cstr(content))) {
-            FURI_LOG_E(TAG, "Invalid file content");
-            break;
-        }
-
-        result = true;
-    } while(0);
-
-    storage_file_free(file);
-    furi_record_close(RECORD_STORAGE);
-    furi_string_free(content);
-
-    return result;
-}
-
-bool music_player_worker_load_rtttl_from_string(MusicPlayerWorker* instance, const char* string) {
-    furi_assert(instance);
-
-    const char* cursor = string;
-
-    // Skip name
-    cursor += skip_till(cursor, ':');
-    if(*cursor != ':') {
-        return false;
-    }
-
-    // Duration
-    cursor += skip_till(cursor, '=');
-    if(*cursor != '=') {
-        return false;
-    }
-    cursor++;
-    cursor += extract_number(cursor, &instance->duration);
-
-    // Octave
-    cursor += skip_till(cursor, '=');
-    if(*cursor != '=') {
-        return false;
-    }
-    cursor++;
-    cursor += extract_number(cursor, &instance->octave);
-
-    // BPM
-    cursor += skip_till(cursor, '=');
-    if(*cursor != '=') {
-        return false;
-    }
-    cursor++;
-    cursor += extract_number(cursor, &instance->bpm);
-
-    // Notes
-    cursor += skip_till(cursor, ':');
-    if(*cursor != ':') {
-        return false;
-    }
-    cursor++;
-    if(!music_player_worker_parse_notes(instance, cursor)) {
-        return false;
-    }
-
-    return true;
-}
-
-void music_player_worker_set_callback(
-    MusicPlayerWorker* instance,
-    MusicPlayerWorkerCallback callback,
-    void* context) {
-    furi_assert(instance);
-    instance->callback = callback;
-    instance->callback_context = context;
-}
-
-void music_player_worker_set_volume(MusicPlayerWorker* instance, float volume) {
-    furi_assert(instance);
-    instance->volume = volume;
-}
-
-void music_player_worker_start(MusicPlayerWorker* instance) {
-    furi_assert(instance);
-    furi_assert(instance->should_work == false);
-
-    instance->should_work = true;
-    furi_thread_start(instance->thread);
-}
-
-void music_player_worker_stop(MusicPlayerWorker* instance) {
-    furi_assert(instance);
-    furi_assert(instance->should_work == true);
-
-    instance->should_work = false;
-    furi_thread_join(instance->thread);
-}

+ 0 - 44
main_apps_sources/doom/doom_music_player_worker.h

@@ -1,44 +0,0 @@
-#pragma once
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (*MusicPlayerWorkerCallback)(
-    uint8_t semitone,
-    uint8_t dots,
-    uint8_t duration,
-    float position,
-    void* context);
-
-typedef struct MusicPlayerWorker MusicPlayerWorker;
-
-MusicPlayerWorker* music_player_worker_alloc();
-
-void music_player_worker_free(MusicPlayerWorker* instance);
-
-bool music_player_worker_load(MusicPlayerWorker* instance, const char* file_path);
-
-bool music_player_worker_load_fmf_from_file(MusicPlayerWorker* instance, const char* file_path);
-
-bool music_player_worker_load_rtttl_from_file(MusicPlayerWorker* instance, const char* file_path);
-
-bool music_player_worker_load_rtttl_from_string(MusicPlayerWorker* instance, const char* string);
-
-void music_player_worker_set_callback(
-    MusicPlayerWorker* instance,
-    MusicPlayerWorkerCallback callback,
-    void* context);
-
-void music_player_worker_set_volume(MusicPlayerWorker* instance, float volume);
-
-void music_player_worker_start(MusicPlayerWorker* instance);
-
-void music_player_worker_stop(MusicPlayerWorker* instance);
-
-#ifdef __cplusplus
-}
-#endif

+ 0 - 42
main_apps_sources/doom/entities.c

@@ -1,42 +0,0 @@
-#include "entities.h"
-
-//extern "C"
-/*Player create_player(double x, double y){
-	return {create_coords((double) x + (double)0.5, (double) y + (double)0.5), create_coords(1, 0), create_coords(0, -0.66), 0, 100, 0};
-}*/
-
-Player create_player(double x, double y) {
-    Player p;
-    p.pos = create_coords((double)x + (double)0.5, (double)y + (double)0.5);
-    p.dir = create_coords(1, 0);
-    p.plane = create_coords(0, -0.66);
-    p.velocity = 0;
-    p.health = 100;
-    p.keys = 0;
-    return p; //{create_coords((double) x + (double)0.5, (double) y + (double)0.5), create_coords(1, 0), create_coords(0, -0.66), 0, 100, 0};
-}
-
-//extern "C"
-Entity
-    create_entity(uint8_t type, uint8_t x, uint8_t y, uint8_t initialState, uint8_t initialHealth) {
-    UID uid = create_uid(type, x, y);
-    Coords pos = create_coords((double)x + (double).5, (double)y + (double).5);
-    Entity new_entity; // = { uid, pos, initialState, initialHealth, 0, 0 };
-    new_entity.uid = uid;
-    new_entity.pos = pos;
-    new_entity.state = initialState;
-    new_entity.health = initialHealth;
-    new_entity.distance = 0;
-    new_entity.timer = 0;
-    return new_entity;
-}
-
-//extern "C"
-StaticEntity crate_static_entity(UID uid, uint8_t x, uint8_t y, bool active) {
-    StaticEntity ent;
-    ent.uid = uid;
-    ent.x = x;
-    ent.y = y;
-    ent.active = active;
-    return ent;
-}

+ 0 - 56
main_apps_sources/doom/entities.h

@@ -1,56 +0,0 @@
-#ifndef _entities_h
-#define _entities_h
-#include <stdint.h>
-#include <stdbool.h>
-#include "types.h"
-
-// Shortcuts
-//#define create_player(x, y)   {create_coords((double) x + (double)0.5, (double) y + (double)0.5), create_coords(1, 0), create_coords(0, -0.66), 0, 100}
-
-#define create_enemy(x, y) create_entity(E_ENEMY, x, y, S_STAND, 50)
-#define create_medikit(x, y) create_entity(E_MEDIKIT, x, y, S_STAND, 0)
-#define create_key(x, y) create_entity(E_KEY, x, y, S_STAND, 0)
-#define create_fireball(x, y, dir) create_entity(E_FIREBALL, x, y, S_STAND, dir)
-#define create_door(x, y) create_entity(E_DOOR, x, y, S_STAND, 0)
-
-// entity statuses
-#define S_STAND 0
-#define S_ALERT 1
-#define S_FIRING 2
-#define S_MELEE 3
-#define S_HIT 4
-#define S_DEAD 5
-#define S_HIDDEN 6
-#define S_OPEN 7
-#define S_CLOSE 8
-
-typedef struct Player {
-    Coords pos;
-    Coords dir;
-    Coords plane;
-    double velocity;
-    uint8_t health;
-    uint8_t keys;
-} Player;
-
-typedef struct Entity {
-    UID uid;
-    Coords pos;
-    uint8_t state;
-    uint8_t health; // angle for fireballs
-    uint8_t distance;
-    uint8_t timer;
-} Entity;
-
-typedef struct StaticEntity {
-    UID uid;
-    uint8_t x;
-    uint8_t y;
-    bool active;
-} StaticEntity;
-
-Entity
-    create_entity(uint8_t type, uint8_t x, uint8_t y, uint8_t initialState, uint8_t initialHealth);
-StaticEntity create_static_entity(UID uid, uint8_t x, uint8_t y, bool active);
-Player create_player(double x, double y);
-#endif

BIN
main_apps_sources/doom/img/1.png


BIN
main_apps_sources/doom/img/2.png


BIN
main_apps_sources/doom/img/3.png


+ 0 - 188
main_apps_sources/doom/level.h

@@ -1,188 +0,0 @@
-#ifndef _level_h
-#define _level_h
-
-#include "constants.h"
-
-/*
-  Based on E1M1 from Wolfenstein 3D
-
-  ################################################################
-  #############################...........########################
-  ######....###################........E..########################
-  ######....########..........#...........#...####################
-  ######.....#######..........L.....E.......M.####################
-  ######.....#######..........#...........#...####################
-  ##################...########...........########################
-  ######.........###...########...........########################
-  ######.........###...#############D#############################
-  ######.........#......E##########...############################
-  ######....E....D...E...##########...############################
-  ######.........#.......##########...############################
-  ######....E....##################...############################
-  #...##.........##################...############################
-  #.K.######D######################...############################
-  #...#####...###############...#E.....K##########################
-  ##D######...###############..####...############################
-  #...#####...###############..####...############################
-  #...#...#...###############..####...############################
-  #...D...#...#####################...############################
-  #...#...#...#####################...############################
-  #...######D#######################L#############################
-  #.E.##.........#################.....#################........##
-  #...##.........############...............############........##
-  #...##...E.....############...............############........##
-  #....#.........############...E.......E....#.........#........##
-  #....L....K....############................D....E....D....E...##
-  #....#.........############................#.........#........##
-  #...##.....E...############...............####....####........##
-  #...##.........############...............#####..#####.....M..##
-  #...##.........#################.....##########..#####........##
-  #...######L#######################D############..###############
-  #...#####...#####################...###########..###############
-  #E.E#####...#####################...###########..###############
-  #...#...#...#####################.E.###########..###############
-  #...D.M.#...#####################...###########..###############
-  #...#...#...#####################...###########..###.#.#.#.#####
-  #...#####...#####################...###########...#.........####
-  #...#####...#####################...###########...D....E..K.####
-  #................##......########...###########...#.........####
-  #....E........E...L...E...X######...################.#.#.#.#####
-  #................##......########...############################
-  #################################...############################
-  #############..#..#..#############L#############################
-  ###########....#..#.########....#...#....#######################
-  #############.....##########.P..D...D....#######################
-  ############################....#...#....#######################
-  ##############..#################...############################
-  ##############..############....#...#....#######################
-  ############################....D...D....#######################
-  ############################....#...#....#######################
-  #################################...############################
-  ############################.............#######################
-  ############################..........EK.#######################
-  ############################.............#######################
-  ################################################################
-*/
-
-/*
-   Same map above built from some regexp replacements using the legend above.
-   Using this way lets me use only 4 bit to store each block
-*/
-const uint8_t sto_level_1[LEVEL_SIZE] = {
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
-    0x00, 0x00, 0x02, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00,
-    0x00, 0x20, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xF0, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0x4F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x2F, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x02, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x20, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x90, 0xFF, 0xFF, 0xFF, 0x4F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xF2,
-    0x00, 0x00, 0x09, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0x4F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0F, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0F, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xF0, 0x00, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0F, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0x40, 0x00, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xF0, 0x00, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x4F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0x5F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x20, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF,
-    0xF0, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF,
-    0xF0, 0x00, 0xFF, 0x00, 0x02, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF,
-    0xF0, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x20,
-    0x00, 0x00, 0x00, 0x20, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF,
-    0xF0, 0x00, 0x05, 0x00, 0x00, 0x90, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x20, 0x00, 0xFF,
-    0xF0, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF,
-    0xF0, 0x00, 0xFF, 0x00, 0x00, 0x02, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF,
-    0xF0, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xF0, 0x0F, 0xFF, 0xFF, 0x00, 0x00, 0x08, 0x00, 0xFF,
-    0xF0, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0F, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x5F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0x4F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF2, 0x02, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xF0, 0x00, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x20, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0x40, 0x80, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xF0, 0x00, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0F, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x40, 0x00, 0x02, 0x00, 0x90, 0xFF, 0xFF,
-    0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
-    0xF0, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x50, 0x00, 0x20, 0x00, 0x7F, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF,
-    0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0F, 0x00, 0xF0, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0x5F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x0F, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
-    0xF0, 0x00, 0xF0, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00,
-    0x40, 0x00, 0x40, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
-    0xF0, 0x00, 0xF0, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
-    0xF0, 0x00, 0xF0, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
-    0x40, 0x00, 0x40, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
-    0xF0, 0x00, 0xF0, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x29, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-};
-
-#endif

+ 0 - 34
main_apps_sources/doom/sound.h

@@ -1,34 +0,0 @@
-#ifndef sound_h
-#define sound_h
-#include <furi.h>
-#include <furi_hal.h>
-#include <stdint.h>
-#include "doom_music_player_worker.h"
-
-//static const char dspistol[] = "AnyConv:d=,o=,b=120:408,40p,40p,40p,40p,405,40p,40p,40p,405,30p.,30p.,30p.,13p";
-static const char dsintro[] =
-    "Doom:d=32,o=4,b=56:f,f,f5,f,f,d#5,f,f,c#5,f,f,b,f,f,c5,c#5,f,f,f5,f,f,d#5,f,f,c#5,f,f,8b.,f,f,f5,f,f,d#5,f,f,c#5,f,f,b,f,f,c5,c#5,f,f,f5,f,f,d#5,f,f,c#5,f,f,8b.,a#,a#,a#5,a#,a#,g#5,a#,a#,f#5,a#,a#,e5,a#,a#,f5,f#5,a#,a#,a#5,a#,a#,g#5,a#,a#,f#5,a#,a#,8e5";
-//static const char dsgetpow[] = "dsgetpow:d=,o=,b=120:407,40p,30.6,407,40p,406,40p,407,40p,40p,407,30p.,407";
-//static const char dsnoway[] = "dsnoway:d=,o=,b=120:407,30.4";
-
-#define MUSIC_PLAYER_SEMITONE_HISTORY_SIZE 4
-static const float MUSIC_PLAYER_VOLUMES[] = {0, .25, .5, .75, 1};
-
-typedef struct {
-    uint8_t semitone_history[MUSIC_PLAYER_SEMITONE_HISTORY_SIZE];
-    uint8_t duration_history[MUSIC_PLAYER_SEMITONE_HISTORY_SIZE];
-
-    uint8_t volume;
-    uint8_t semitone;
-    uint8_t dots;
-    uint8_t duration;
-    float position;
-} MusicPlayerModel;
-
-typedef struct {
-    MusicPlayerModel* model;
-    MusicPlayerWorker* worker;
-    FuriMutex** model_mutex;
-} MusicPlayer;
-
-#endif

+ 0 - 33
main_apps_sources/doom/types.c

@@ -1,33 +0,0 @@
-#include "types.h"
-
-/*template <class T>
-inline T sq(T value) {
-    return value * value;
-}*/
-
-double sq(double val) {
-    return val * val;
-}
-
-//extern "C"
-Coords create_coords(double x, double y) {
-    Coords cord;
-    cord.x = x;
-    cord.y = y;
-    return cord;
-}
-
-//extern "C"
-uint8_t coords_distance(Coords* a, Coords* b) {
-    return sqrt(sq(a->x - b->x) + sq(a->y - b->y)) * 20;
-}
-
-//extern "C"
-UID create_uid(uint8_t type, uint8_t x, uint8_t y) {
-    return ((y << 6) | x) << 4 | type;
-}
-
-//extern "C"
-uint8_t uid_get_type(UID uid) {
-    return uid & 0x0F;
-}

+ 0 - 36
main_apps_sources/doom/types.h

@@ -1,36 +0,0 @@
-#ifndef _types_h
-#define _types_h
-
-#include <stdint.h>
-#include <math.h>
-//#include "constants.h"
-
-#define UID_null 0
-
-// Entity types (legend applies to level.h)
-#define E_FLOOR 0x0 // . (also null)
-#define E_WALL 0xF // #
-#define E_PLAYER 0x1 // P
-#define E_ENEMY 0x2 // E
-#define E_DOOR 0x4 // D
-#define E_LOCKEDDOOR 0x5 // L
-#define E_EXIT 0x7 // X
-// collectable entities >= 0x8
-#define E_MEDIKIT 0x8 // M
-#define E_KEY 0x9 // K
-#define E_FIREBALL 0xA // not in map
-
-typedef uint16_t UID;
-typedef uint8_t EType;
-
-typedef struct Coords {
-    double x;
-    double y;
-} Coords;
-
-UID create_uid(EType type, uint8_t x, uint8_t y);
-EType uid_get_type(UID uid);
-Coords create_coords(double x, double y);
-uint8_t coords_distance(Coords* a, Coords* b);
-
-#endif

+ 0 - 674
main_apps_sources/dtmf_dolphin/LICENSE

@@ -1,674 +0,0 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<https://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<https://www.gnu.org/licenses/why-not-lgpl.html>.

+ 0 - 18
main_apps_sources/dtmf_dolphin/README.md

@@ -1,18 +0,0 @@
-![Image](pics/dialer.jpg)
-
-[Original Link](https://github.com/litui/dtmf_dolphin)
-
-## DTMF Dolphin
-
-DTMF (Dual-Tone Multi-Frequency) dialer, Bluebox, and Redbox.
-
-Now in a release-ready state for both Dialer, Bluebox, and Redbox (US/UK) functionality!
-
-Please note that using the current tone output method, the 2600 tone is scaled about 33 Hz higher than it should be. This is a limitation of the current sample rate.
-
-### Educational Links:
-
-* http://www.phrack.org/issues/25/7.html#article
-* https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling
-* https://en.wikipedia.org/wiki/Blue_box
-* https://en.wikipedia.org/wiki/Red_box_(phreaking)

+ 0 - 18
main_apps_sources/dtmf_dolphin/application.fam

@@ -1,18 +0,0 @@
-App(
-    appid="dtmf_dolphin",
-    name="DTMF Dolphin",
-    apptype=FlipperAppType.EXTERNAL,
-    entry_point="dtmf_dolphin_app",
-    requires=[
-        "storage",
-        "gui",
-        "dialogs",
-    ],
-    fap_icon="phone.png",
-    stack_size=8 * 1024,
-    order=20,
-    fap_category="Tools",
-    fap_author="@litui & @xMasterX",
-    fap_version="1.1",
-    fap_description="DTMF (Dual-Tone Multi-Frequency) dialer, Bluebox, and Redbox.",
-)

+ 0 - 89
main_apps_sources/dtmf_dolphin/dtmf_dolphin.c

@@ -1,89 +0,0 @@
-#include "dtmf_dolphin_i.h"
-
-#include <furi.h>
-#include <furi_hal.h>
-
-static bool dtmf_dolphin_app_custom_event_callback(void* context, uint32_t event) {
-    furi_assert(context);
-    DTMFDolphinApp* app = context;
-    return scene_manager_handle_custom_event(app->scene_manager, event);
-}
-
-static bool dtmf_dolphin_app_back_event_callback(void* context) {
-    furi_assert(context);
-    DTMFDolphinApp* app = context;
-    return scene_manager_handle_back_event(app->scene_manager);
-}
-
-static void dtmf_dolphin_app_tick_event_callback(void* context) {
-    furi_assert(context);
-    DTMFDolphinApp* app = context;
-
-    scene_manager_handle_tick_event(app->scene_manager);
-}
-
-static DTMFDolphinApp* app_alloc() {
-    DTMFDolphinApp* app = malloc(sizeof(DTMFDolphinApp));
-
-    app->gui = furi_record_open(RECORD_GUI);
-    app->view_dispatcher = view_dispatcher_alloc();
-    app->scene_manager = scene_manager_alloc(&dtmf_dolphin_scene_handlers, app);
-    view_dispatcher_enable_queue(app->view_dispatcher);
-    view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
-
-    view_dispatcher_set_custom_event_callback(
-        app->view_dispatcher, dtmf_dolphin_app_custom_event_callback);
-    view_dispatcher_set_navigation_event_callback(
-        app->view_dispatcher, dtmf_dolphin_app_back_event_callback);
-    view_dispatcher_set_tick_event_callback(
-        app->view_dispatcher, dtmf_dolphin_app_tick_event_callback, 100);
-
-    view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
-
-    app->main_menu_list = variable_item_list_alloc();
-    view_dispatcher_add_view(
-        app->view_dispatcher,
-        DTMFDolphinViewMainMenu,
-        variable_item_list_get_view(app->main_menu_list));
-
-    app->dtmf_dolphin_dialer = dtmf_dolphin_dialer_alloc();
-    view_dispatcher_add_view(
-        app->view_dispatcher,
-        DTMFDolphinViewDialer,
-        dtmf_dolphin_dialer_get_view(app->dtmf_dolphin_dialer));
-
-    app->notification = furi_record_open(RECORD_NOTIFICATION);
-    notification_message(app->notification, &sequence_display_backlight_enforce_on);
-
-    scene_manager_next_scene(app->scene_manager, DTMFDolphinSceneStart);
-
-    return app;
-}
-
-static void app_free(DTMFDolphinApp* app) {
-    furi_assert(app);
-    view_dispatcher_remove_view(app->view_dispatcher, DTMFDolphinViewMainMenu);
-    view_dispatcher_remove_view(app->view_dispatcher, DTMFDolphinViewDialer);
-    variable_item_list_free(app->main_menu_list);
-
-    dtmf_dolphin_dialer_free(app->dtmf_dolphin_dialer);
-
-    view_dispatcher_free(app->view_dispatcher);
-    scene_manager_free(app->scene_manager);
-
-    notification_message(app->notification, &sequence_display_backlight_enforce_auto);
-
-    furi_record_close(RECORD_GUI);
-    furi_record_close(RECORD_NOTIFICATION);
-    free(app);
-}
-
-int32_t dtmf_dolphin_app(void* p) {
-    UNUSED(p);
-    DTMFDolphinApp* app = app_alloc();
-
-    view_dispatcher_run(app->view_dispatcher);
-
-    app_free(app);
-    return 0;
-}

+ 0 - 270
main_apps_sources/dtmf_dolphin/dtmf_dolphin_audio.c

@@ -1,270 +0,0 @@
-#include "dtmf_dolphin_audio.h"
-
-DTMFDolphinAudio* current_player;
-
-static void dtmf_dolphin_audio_dma_isr(void* ctx) {
-    FuriMessageQueue* event_queue = ctx;
-
-    if(LL_DMA_IsActiveFlag_HT1(DMA1)) {
-        LL_DMA_ClearFlag_HT1(DMA1);
-
-        DTMFDolphinCustomEvent event = {.type = DTMFDolphinEventDMAHalfTransfer};
-        furi_message_queue_put(event_queue, &event, 0);
-    }
-
-    if(LL_DMA_IsActiveFlag_TC1(DMA1)) {
-        LL_DMA_ClearFlag_TC1(DMA1);
-
-        DTMFDolphinCustomEvent event = {.type = DTMFDolphinEventDMAFullTransfer};
-        furi_message_queue_put(event_queue, &event, 0);
-    }
-}
-
-void dtmf_dolphin_audio_clear_samples(DTMFDolphinAudio* player) {
-    for(size_t i = 0; i < player->buffer_length; i++) {
-        player->sample_buffer[i] = 0;
-    }
-}
-
-DTMFDolphinOsc* dtmf_dolphin_osc_alloc() {
-    DTMFDolphinOsc* osc = malloc(sizeof(DTMFDolphinOsc));
-    osc->cached_freq = 0;
-    osc->offset = 0;
-    osc->period = 0;
-    osc->lookup_table = NULL;
-    return osc;
-}
-
-DTMFDolphinPulseFilter* dtmf_dolphin_pulse_filter_alloc() {
-    DTMFDolphinPulseFilter* pf = malloc(sizeof(DTMFDolphinPulseFilter));
-    pf->duration = 0;
-    pf->period = 0;
-    pf->offset = 0;
-    pf->lookup_table = NULL;
-    return pf;
-}
-
-DTMFDolphinAudio* dtmf_dolphin_audio_alloc() {
-    DTMFDolphinAudio* player = malloc(sizeof(DTMFDolphinAudio));
-    player->buffer_length = SAMPLE_BUFFER_LENGTH;
-    player->half_buffer_length = SAMPLE_BUFFER_LENGTH / 2;
-    player->sample_buffer = malloc(sizeof(uint16_t) * player->buffer_length);
-    player->osc1 = dtmf_dolphin_osc_alloc();
-    player->osc2 = dtmf_dolphin_osc_alloc();
-    player->volume = 1.0f;
-    player->queue = furi_message_queue_alloc(10, sizeof(DTMFDolphinCustomEvent));
-    player->filter = dtmf_dolphin_pulse_filter_alloc();
-    player->playing = false;
-    dtmf_dolphin_audio_clear_samples(player);
-
-    return player;
-}
-
-size_t calc_waveform_period(float freq) {
-    if(!freq) {
-        return 0;
-    }
-    // DMA Rate calculation, thanks to Dr_Zlo
-    float dma_rate = CPU_CLOCK_FREQ / 2 / DTMF_DOLPHIN_HAL_DMA_PRESCALER /
-                     (DTMF_DOLPHIN_HAL_DMA_AUTORELOAD + 1);
-
-    // Using a constant scaling modifier, which likely represents
-    // the combined system overhead and isr latency.
-    return (uint16_t)dma_rate * 2 / freq * 0.801923;
-}
-
-void osc_generate_lookup_table(DTMFDolphinOsc* osc, float freq) {
-    if(osc->lookup_table != NULL) {
-        free(osc->lookup_table);
-    }
-    osc->offset = 0;
-    osc->cached_freq = freq;
-    osc->period = calc_waveform_period(freq);
-    if(!osc->period) {
-        osc->lookup_table = NULL;
-        return;
-    }
-    osc->lookup_table = malloc(sizeof(float) * osc->period);
-
-    for(size_t i = 0; i < osc->period; i++) {
-        osc->lookup_table[i] = sin(i * PERIOD_2_PI / osc->period) + 1;
-    }
-}
-
-void filter_generate_lookup_table(
-    DTMFDolphinPulseFilter* pf,
-    uint16_t pulses,
-    uint16_t pulse_ms,
-    uint16_t gap_ms) {
-    if(pf->lookup_table != NULL) {
-        free(pf->lookup_table);
-    }
-    pf->offset = 0;
-
-    uint16_t gap_period = calc_waveform_period(1000 / (float)gap_ms);
-    uint16_t pulse_period = calc_waveform_period(1000 / (float)pulse_ms);
-    pf->period = pulse_period + gap_period;
-
-    if(!pf->period) {
-        pf->lookup_table = NULL;
-        return;
-    }
-    pf->duration = pf->period * pulses;
-    pf->lookup_table = malloc(sizeof(bool) * pf->duration);
-
-    for(size_t i = 0; i < pf->duration; i++) {
-        pf->lookup_table[i] = i % pf->period < pulse_period;
-    }
-}
-
-float sample_frame(DTMFDolphinOsc* osc) {
-    float frame = 0.0;
-
-    if(osc->period) {
-        frame = osc->lookup_table[osc->offset];
-        osc->offset = (osc->offset + 1) % osc->period;
-    }
-
-    return frame;
-}
-
-bool sample_filter(DTMFDolphinPulseFilter* pf) {
-    bool frame = true;
-
-    if(pf->duration) {
-        if(pf->offset < pf->duration) {
-            frame = pf->lookup_table[pf->offset];
-            pf->offset = pf->offset + 1;
-        } else {
-            frame = false;
-        }
-    }
-
-    return frame;
-}
-
-void dtmf_dolphin_osc_free(DTMFDolphinOsc* osc) {
-    if(osc->lookup_table != NULL) {
-        free(osc->lookup_table);
-    }
-    free(osc);
-}
-
-void dtmf_dolphin_filter_free(DTMFDolphinPulseFilter* pf) {
-    if(pf->lookup_table != NULL) {
-        free(pf->lookup_table);
-    }
-    free(pf);
-}
-
-void dtmf_dolphin_audio_free(DTMFDolphinAudio* player) {
-    furi_message_queue_free(player->queue);
-    dtmf_dolphin_osc_free(player->osc1);
-    dtmf_dolphin_osc_free(player->osc2);
-    dtmf_dolphin_filter_free(player->filter);
-    free(player->sample_buffer);
-    free(player);
-    current_player = NULL;
-}
-
-bool generate_waveform(DTMFDolphinAudio* player, uint16_t buffer_index) {
-    uint16_t* sample_buffer_start = &player->sample_buffer[buffer_index];
-
-    for(size_t i = 0; i < player->half_buffer_length; i++) {
-        float data = 0;
-        if(player->osc2->period) {
-            data = (sample_frame(player->osc1) / 2) + (sample_frame(player->osc2) / 2);
-        } else {
-            data = (sample_frame(player->osc1));
-        }
-        data *= sample_filter(player->filter) ? player->volume : 0.0;
-        data *= UINT8_MAX / 2; // scale -128..127
-        data += UINT8_MAX / 2; // to unsigned
-
-        if(data < 0) {
-            data = 0;
-        }
-
-        if(data > 255) {
-            data = 255;
-        }
-
-        sample_buffer_start[i] = data;
-    }
-
-    return true;
-}
-
-bool dtmf_dolphin_audio_play_tones(
-    float freq1,
-    float freq2,
-    uint16_t pulses,
-    uint16_t pulse_ms,
-    uint16_t gap_ms) {
-    if(current_player != NULL && current_player->playing) {
-        // Cannot start playing while still playing something else
-        return false;
-    }
-    current_player = dtmf_dolphin_audio_alloc();
-
-    osc_generate_lookup_table(current_player->osc1, freq1);
-    osc_generate_lookup_table(current_player->osc2, freq2);
-    filter_generate_lookup_table(current_player->filter, pulses, pulse_ms, gap_ms);
-
-    generate_waveform(current_player, 0);
-    generate_waveform(current_player, current_player->half_buffer_length);
-
-    dtmf_dolphin_dma_init((uint32_t)current_player->sample_buffer, current_player->buffer_length);
-
-    furi_hal_interrupt_set_isr(
-        FuriHalInterruptIdDma1Ch1, dtmf_dolphin_audio_dma_isr, current_player->queue);
-    if(furi_hal_speaker_acquire(1000)) {
-        dtmf_dolphin_speaker_init();
-        dtmf_dolphin_dma_start();
-        dtmf_dolphin_speaker_start();
-        current_player->playing = true;
-        return true;
-    } else {
-        current_player->playing = false;
-        return false;
-    }
-}
-
-bool dtmf_dolphin_audio_stop_tones() {
-    if(current_player != NULL && !current_player->playing) {
-        // Can't stop a player that isn't playing.
-        return false;
-    }
-    while(current_player->filter->offset > 0 &&
-          current_player->filter->offset < current_player->filter->duration) {
-        // run remaining ticks if needed to complete filter sequence
-        dtmf_dolphin_audio_handle_tick();
-    }
-    dtmf_dolphin_speaker_stop();
-    dtmf_dolphin_dma_stop();
-    furi_hal_speaker_release();
-
-    furi_hal_interrupt_set_isr(FuriHalInterruptIdDma1Ch1, NULL, NULL);
-
-    dtmf_dolphin_audio_free(current_player);
-
-    return true;
-}
-
-bool dtmf_dolphin_audio_handle_tick() {
-    bool handled = false;
-
-    if(current_player) {
-        DTMFDolphinCustomEvent event;
-        if(furi_message_queue_get(current_player->queue, &event, 250) == FuriStatusOk) {
-            if(event.type == DTMFDolphinEventDMAHalfTransfer) {
-                generate_waveform(current_player, 0);
-                handled = true;
-            } else if(event.type == DTMFDolphinEventDMAFullTransfer) {
-                generate_waveform(current_player, current_player->half_buffer_length);
-                handled = true;
-            }
-        }
-    }
-    return handled;
-}

+ 0 - 54
main_apps_sources/dtmf_dolphin/dtmf_dolphin_audio.h

@@ -1,54 +0,0 @@
-#pragma once
-// #include "dtmf_dolphin_i.h"
-#include "dtmf_dolphin_event.h"
-#include "dtmf_dolphin_hal.h"
-
-#define SAMPLE_BUFFER_LENGTH 8192
-#define PERIOD_2_PI 6.2832
-#define CPU_CLOCK_FREQ 64000000
-
-typedef struct {
-    float cached_freq;
-    size_t period;
-    float* lookup_table;
-    uint16_t offset;
-} DTMFDolphinOsc;
-
-typedef struct {
-    float duration;
-    size_t period;
-    bool* lookup_table;
-    uint16_t offset;
-} DTMFDolphinPulseFilter;
-
-typedef struct {
-    size_t buffer_length;
-    size_t half_buffer_length;
-    uint8_t* buffer_buffer;
-    uint16_t* sample_buffer;
-    float volume;
-    FuriMessageQueue* queue;
-    DTMFDolphinOsc* osc1;
-    DTMFDolphinOsc* osc2;
-    DTMFDolphinPulseFilter* filter;
-    bool playing;
-} DTMFDolphinAudio;
-
-DTMFDolphinOsc* dtmf_dolphin_osc_alloc();
-
-DTMFDolphinAudio* dtmf_dolphin_audio_alloc();
-
-void dtmf_dolphin_audio_free(DTMFDolphinAudio* player);
-
-void dtmf_dolphin_osc_free(DTMFDolphinOsc* osc);
-
-bool dtmf_dolphin_audio_play_tones(
-    float freq1,
-    float freq2,
-    uint16_t pulses,
-    uint16_t pulse_ms,
-    uint16_t gap_ms);
-
-bool dtmf_dolphin_audio_stop_tones();
-
-bool dtmf_dolphin_audio_handle_tick();

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff