From bd99e2a138640e4421eea42e63cfe67eb02a21c3 Mon Sep 17 00:00:00 2001 From: "Such Meme, Many Skill" Date: Thu, 23 Apr 2020 14:40:55 +0200 Subject: [PATCH] Optimise screen scroll a bit, Edit display of filesizes --- source/gfx/gfx.c | 12 ++++++++++++ source/gfx/gfx.h | 1 + source/tegraexplorer/common/common.h | 2 +- source/tegraexplorer/common/strings.c | 4 ++-- source/tegraexplorer/common/structs.c | 6 +++--- source/tegraexplorer/gfx/gfxutils.c | 5 +++++ source/tegraexplorer/gfx/menu.c | 5 ++++- 7 files changed, 28 insertions(+), 7 deletions(-) diff --git a/source/gfx/gfx.c b/source/gfx/gfx.c index 0d0fc11..98a9254 100644 --- a/source/gfx/gfx.c +++ b/source/gfx/gfx.c @@ -269,6 +269,12 @@ void gfx_putc(char c) if (gfx_con.y > gfx_ctxt.height - 8) gfx_con.y = 0; } + else if (c == '\e') + gfx_con.x = 672; + else if (c == '\a') + gfx_con.x = 608; + else if (c == '\r') + gfx_con.x = 0; break; } @@ -513,6 +519,12 @@ void gfx_set_rect_grey(const u8 *buf, u32 size_x, u32 size_y, u32 pos_x, u32 pos } } +void gfx_boxGrey(int x0, int y0, int x1, int y1, u8 shade){ + for (int y = y0; y <= y1; y++){ + memset(gfx_ctxt.fb + y * gfx_ctxt.stride + x0, shade, (x1 - x0) * 4); + } +} + void gfx_box(int x0, int y0, int x1, int y1, u32 color){ for (int x = x0; x < x1 + 1; x++){ for (int y = y0; y < y1 + 1; y++){ diff --git a/source/gfx/gfx.h b/source/gfx/gfx.h index f3533b8..58687a7 100644 --- a/source/gfx/gfx.h +++ b/source/gfx/gfx.h @@ -50,6 +50,7 @@ void gfx_set_rect_rgb(const u8 *buf, u32 size_x, u32 size_y, u32 pos_x, u32 pos_ void gfx_set_rect_argb(const u32 *buf, u32 size_x, u32 size_y, u32 pos_x, u32 pos_y); void gfx_render_bmp_argb(const u32 *buf, u32 size_x, u32 size_y, u32 pos_x, u32 pos_y); void gfx_box(int x0, int y0, int x1, int y1, u32 color); +void gfx_boxGrey(int x0, int y0, int x1, int y1, u8 shade); // Global gfx console and context. gfx_ctxt_t gfx_ctxt; diff --git a/source/tegraexplorer/common/common.h b/source/tegraexplorer/common/common.h index df681de..6561e4e 100644 --- a/source/tegraexplorer/common/common.h +++ b/source/tegraexplorer/common/common.h @@ -5,7 +5,7 @@ extern const char *gfx_file_size_names[]; extern const char *menu_sd_states[]; extern const char *emmc_fs_entries[]; extern const char *utils_err_codes[]; -extern const char *pkg2names[]; +//extern const char *pkg2names[]; extern const char *mainmenu_credits; enum utils_err_codes_te_call { diff --git a/source/tegraexplorer/common/strings.c b/source/tegraexplorer/common/strings.c index 86297f6..d90dac7 100644 --- a/source/tegraexplorer/common/strings.c +++ b/source/tegraexplorer/common/strings.c @@ -54,7 +54,7 @@ const char *utils_err_codes_te[] = { // these start at 50 "CANNOT COPY FILE TO FS PART", "NO DESTENATION" }; - +/* const char *pkg2names[] = { "BCPKG2-1-Normal-Main", "BCPKG2-2-Normal-Sub", @@ -63,5 +63,5 @@ const char *pkg2names[] = { "BCPKG2-5-Repair-Main", "BCPKG2-6-Repair-Sub" }; - +*/ const char *mainmenu_credits = "\nTegraexplorer, made by:\nSuch Meme, Many Skill\n\nProject based on:\nLockpick_RCM\nHekate\n\nCool people:\nshchmue\ndennthecafebabe\nDax"; \ No newline at end of file diff --git a/source/tegraexplorer/common/structs.c b/source/tegraexplorer/common/structs.c index 06592bc..dc80e7b 100644 --- a/source/tegraexplorer/common/structs.c +++ b/source/tegraexplorer/common/structs.c @@ -64,9 +64,9 @@ menu_entry fs_menu_folder[] = { }; menu_entry fs_menu_startdir[] = { - {"Folder -> previous folder ", COLOR_ORANGE, ISMENU}, - {"Clipboard -> Current folder ", COLOR_ORANGE, ISMENU}, - {"Current folder menu ", COLOR_ORANGE, ISMENU} + {"Folder -> previous folder ", COLOR_ORANGE, ISMENU}, + {"Clipboard -> Current folder", COLOR_ORANGE, ISMENU}, + {"Current folder menu ", COLOR_ORANGE, ISMENU} }; gpt_entry_rule gpt_fs_rules[] = { diff --git a/source/tegraexplorer/gfx/gfxutils.c b/source/tegraexplorer/gfx/gfxutils.c index 4d3b68a..a8e62a5 100644 --- a/source/tegraexplorer/gfx/gfxutils.c +++ b/source/tegraexplorer/gfx/gfxutils.c @@ -115,8 +115,13 @@ void gfx_printandclear(char *in, int length){ gfx_con_getpos(&x, &y); RESETCOLOR; + + /* for (int i = (703 - x) / 16; i > 0; i--) gfx_printf(" "); + */ + + gfx_boxGrey(x, y, 703, y + 16, 0x1B); gfx_con_setpos(x, y); diff --git a/source/tegraexplorer/gfx/menu.c b/source/tegraexplorer/gfx/menu.c index 2367a21..c7665df 100644 --- a/source/tegraexplorer/gfx/menu.c +++ b/source/tegraexplorer/gfx/menu.c @@ -53,7 +53,10 @@ void _printentry(menu_entry entry, bool highlighted, bool refresh){ else { SWAPCOLOR(COLOR_BLUE); SWAPBGCOLOR(COLOR_DEFAULT); - gfx_printf("\a%d\e%s", entry.storage, gfx_file_size_names[size - 4]); + gfx_printf("\a%4d", entry.storage); + gfx_con.fntsz = 8; + gfx_printf("\n\e%s\n", gfx_file_size_names[size - 4]); + gfx_con.fntsz = 16; } }