Skip to content

Commit

Permalink
upd hex viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Dec 3, 2023
1 parent a2f906f commit 390b301
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion base_pack/hex_viewer/helpers/hex_viewer_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
5 changes: 4 additions & 1 deletion base_pack/hex_viewer/hex_viewer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion base_pack/hex_viewer/hex_viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ typedef struct {
Stream* stream;
} HexViewerModel;

// TODO Clean
typedef struct {
HexViewerModel* model;

Expand Down
4 changes: 2 additions & 2 deletions base_pack/hex_viewer/views/hex_viewer_startscreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 390b301

Please sign in to comment.