Sync system apps --nobuild

This commit is contained in:
Willy-JL
2023-12-08 22:22:31 +00:00
parent 76534b04a4
commit efbcdc2a8b
38 changed files with 1490 additions and 413 deletions
@@ -8,11 +8,10 @@ App(
"dialogs",
],
stack_size=2 * 1024,
order=20,
fap_icon="icons/hex_10px.png",
fap_icon="icons/hex_10px.bmp",
fap_icon_assets="icons",
fap_category="Tools",
fap_author="@QtRoS",
fap_version="2.0",
fap_description="App allows to view various files as HEX.",
fap_description="App allows to view various files as HEX",
)
@@ -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;
}
+4 -1
View File
@@ -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);
@@ -43,7 +43,6 @@ typedef struct {
Stream* stream;
} HexViewerModel;
// TODO Clean
typedef struct {
HexViewerModel* model;
Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

@@ -13,7 +13,7 @@ void hex_viewer_scene_scroll_on_enter(void* context) {
TextInput* text_input = app->text_input;
text_input_set_header_text(text_input, "Scroll to percent (0..100)");
text_input_set_header_text(text_input, "Scroll to percentage (0..100)");
text_input_set_result_callback(
text_input,
hex_viewer_scene_scroll_callback,
@@ -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));
}
@@ -69,6 +69,9 @@ void hex_viewer_startscreen_draw(Canvas* canvas, HexViewerStartscreenModel* mode
uint32_t row_iters = model->file_read_bytes / HEX_VIEWER_BYTES_PER_LINE;
if(model->file_read_bytes % HEX_VIEWER_BYTES_PER_LINE != 0) row_iters += 1;
// For the rest of drawing.
canvas_set_font(canvas, FontKeyboard);
for(uint32_t i = 0; i < row_iters; ++i) {
uint32_t bytes_left_per_row = model->file_read_bytes - i * HEX_VIEWER_BYTES_PER_LINE;
bytes_left_per_row = MIN(bytes_left_per_row, HEX_VIEWER_BYTES_PER_LINE);
@@ -79,13 +82,13 @@ void hex_viewer_startscreen_draw(Canvas* canvas, HexViewerStartscreenModel* mode
for(uint32_t j = 0; j < bytes_left_per_row; ++j)
if(!isprint((int)temp_buf[j])) temp_buf[j] = '.';
canvas_set_font(canvas, FontKeyboard);
//canvas_set_font(canvas, FontKeyboard);
canvas_draw_str(canvas, LEFT_OFFSET, TOP_OFFSET + i * ROW_HEIGHT, temp_buf);
} else {
uint32_t addr = model->file_offset + i * HEX_VIEWER_BYTES_PER_LINE;
snprintf(temp_buf, 32, "%04lX", addr);
canvas_set_font(canvas, FontKeyboard);
//canvas_set_font(canvas, FontKeyboard);
canvas_draw_str(canvas, LEFT_OFFSET, TOP_OFFSET + i * ROW_HEIGHT, temp_buf);
}
@@ -93,7 +96,7 @@ void hex_viewer_startscreen_draw(Canvas* canvas, HexViewerStartscreenModel* mode
for(uint32_t j = 0; j < bytes_left_per_row; ++j)
p += snprintf(p, 32, "%02X ", model->file_bytes[i][j]);
canvas_set_font(canvas, FontKeyboard);
//canvas_set_font(canvas, FontKeyboard);
canvas_draw_str(canvas, LEFT_OFFSET + 41, TOP_OFFSET + i * ROW_HEIGHT, temp_buf);
}
@@ -125,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: