From 390b301f456774030cccc5bbeddccd3251eb1e3a Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Sun, 3 Dec 2023 18:44:35 +0300 Subject: [PATCH] upd hex viewer --- base_pack/hex_viewer/helpers/hex_viewer_storage.c | 2 +- base_pack/hex_viewer/hex_viewer.c | 5 ++++- base_pack/hex_viewer/hex_viewer.h | 1 - base_pack/hex_viewer/views/hex_viewer_startscreen.c | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/base_pack/hex_viewer/helpers/hex_viewer_storage.c b/base_pack/hex_viewer/helpers/hex_viewer_storage.c index 6b4217dc265..b7eb6b0c4b1 100644 --- a/base_pack/hex_viewer/helpers/hex_viewer_storage.c +++ b/base_pack/hex_viewer/helpers/hex_viewer_storage.c @@ -123,7 +123,7 @@ bool hex_viewer_open_file(void* context, const char* file_path) { // TODO Separate function? if(hex_viewer->model->stream) { buffered_file_stream_close(hex_viewer->model->stream); - stream_free(hex_viewer->model->stream); // TODO Check + stream_free(hex_viewer->model->stream); hex_viewer->model->file_offset = 0; } diff --git a/base_pack/hex_viewer/hex_viewer.c b/base_pack/hex_viewer/hex_viewer.c index 4d731558812..591719fd6b5 100644 --- a/base_pack/hex_viewer/hex_viewer.c +++ b/base_pack/hex_viewer/hex_viewer.c @@ -87,7 +87,10 @@ HexViewer* hex_viewer_app_alloc() { void hex_viewer_app_free(HexViewer* app) { furi_assert(app); - if(app->model->stream) buffered_file_stream_close(app->model->stream); + if(app->model->stream) { + buffered_file_stream_close(app->model->stream); + stream_free(app->model->stream); + } // Scene manager scene_manager_free(app->scene_manager); diff --git a/base_pack/hex_viewer/hex_viewer.h b/base_pack/hex_viewer/hex_viewer.h index d1c1adba319..c8b98926f1e 100644 --- a/base_pack/hex_viewer/hex_viewer.h +++ b/base_pack/hex_viewer/hex_viewer.h @@ -43,7 +43,6 @@ typedef struct { Stream* stream; } HexViewerModel; -// TODO Clean typedef struct { HexViewerModel* model; diff --git a/base_pack/hex_viewer/views/hex_viewer_startscreen.c b/base_pack/hex_viewer/views/hex_viewer_startscreen.c index 036cbe124de..515a0b13908 100644 --- a/base_pack/hex_viewer/views/hex_viewer_startscreen.c +++ b/base_pack/hex_viewer/views/hex_viewer_startscreen.c @@ -61,7 +61,7 @@ void hex_viewer_startscreen_draw(Canvas* canvas, HexViewerStartscreenModel* mode width, 0, ROW_HEIGHT * HEX_VIEWER_LINES_ON_SCREEN, - first_line_on_screen, // TODO + first_line_on_screen, line_count - (HEX_VIEWER_LINES_ON_SCREEN - 1)); } @@ -128,7 +128,7 @@ bool hex_viewer_startscreen_input(InputEvent* event, void* context) { furi_assert(context); HexViewerStartscreen* instance = context; HexViewer* app = instance->context; // TO so good, but works - // TODO InputTypeShort? + if(event->type == InputTypeRelease || event->type == InputTypeRepeat) { switch(event->key) { case InputKeyBack: