mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-26 05:42:07 +00:00
Change gui around
This commit is contained in:
parent
7ad77cffb0
commit
9178813338
6 changed files with 64 additions and 26 deletions
|
@ -21,6 +21,8 @@
|
|||
#include "gfx.h"
|
||||
|
||||
static const u8 _gfx_font[] = {
|
||||
0x00, 0x0C, 0x12, 0x7E, 0x42, 0x42, 0x7E, 0x00, // Char 030 (folder)
|
||||
0x00, 0x0E, 0x12, 0x22, 0x22, 0x22, 0x3E, 0x00, // Char 031 (file)
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Char 032 ( )
|
||||
0x00, 0x30, 0x30, 0x18, 0x18, 0x00, 0x0C, 0x00, // Char 033 (!)
|
||||
0x00, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, // Char 034 (")
|
||||
|
@ -181,9 +183,9 @@ void gfx_putc(char c)
|
|||
switch (gfx_con.fntsz)
|
||||
{
|
||||
case 16:
|
||||
if (c >= 32 && c <= 126)
|
||||
if (c >= 30 && c <= 126)
|
||||
{
|
||||
u8 *cbuf = (u8 *)&_gfx_font[8 * (c - 32)];
|
||||
u8 *cbuf = (u8 *)&_gfx_font[8 * (c - 30)];
|
||||
u32 *fb = gfx_ctxt.fb + gfx_con.x + gfx_con.y * gfx_ctxt.stride;
|
||||
|
||||
for (u32 i = 0; i < 16; i+=2)
|
||||
|
@ -238,18 +240,18 @@ void gfx_putc(char c)
|
|||
gfx_con.x = 0;
|
||||
}
|
||||
else if (c == '\e')
|
||||
gfx_con.y = 607;
|
||||
gfx_con.y = 575;
|
||||
else if (c == '\a')
|
||||
gfx_con.y = 671;
|
||||
gfx_con.y = 639;
|
||||
else if (c == '\r')
|
||||
gfx_con.y = YLEFT;
|
||||
|
||||
break;
|
||||
case 8:
|
||||
default:
|
||||
if (c >= 32 && c <= 126)
|
||||
if (c >= 30 && c <= 126)
|
||||
{
|
||||
u8 *cbuf = (u8 *)&_gfx_font[8 * (c - 32)];
|
||||
u8 *cbuf = (u8 *)&_gfx_font[8 * (c - 30)];
|
||||
u32 *fb = gfx_ctxt.fb + gfx_con.x + gfx_con.y * gfx_ctxt.stride;
|
||||
for (u32 i = 0; i < 8; i++)
|
||||
{
|
||||
|
@ -281,9 +283,9 @@ void gfx_putc(char c)
|
|||
gfx_con.x = 0;
|
||||
}
|
||||
else if (c == '\e')
|
||||
gfx_con.y = 607;
|
||||
gfx_con.y = 575;
|
||||
else if (c == '\a')
|
||||
gfx_con.y = 671;
|
||||
gfx_con.y = 639;
|
||||
else if (c == '\r')
|
||||
gfx_con.y = YLEFT;
|
||||
|
||||
|
@ -401,6 +403,8 @@ void gfx_vprintf(const char *fmt, va_list ap)
|
|||
case '%':
|
||||
gfx_putc('%');
|
||||
break;
|
||||
case 'j':
|
||||
gfx_con.y = YLEFT - va_arg(ap, u32);
|
||||
case '\0':
|
||||
return;
|
||||
default:
|
||||
|
|
|
@ -26,7 +26,7 @@ Inputs *hidRead(){
|
|||
inputs.cap = controller->cap;
|
||||
|
||||
if (controller->conn_l){
|
||||
if (LbaseX == 0 || LbaseY == 0){
|
||||
if ((LbaseX == 0 || LbaseY == 0) || controller->l3){
|
||||
LbaseX = controller->lstick_x;
|
||||
LbaseY = controller->lstick_y;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ Inputs *hidRead(){
|
|||
}
|
||||
|
||||
if (controller->conn_r){
|
||||
if (RbaseX == 0 || RbaseY == 0){
|
||||
if ((RbaseX == 0 || RbaseY == 0) || controller->r3){
|
||||
RbaseX = controller->rstick_x;
|
||||
RbaseY = controller->rstick_y;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ int fsact_del_recursive(char *path){
|
|||
else {
|
||||
SWAPCOLOR(COLOR_RED);
|
||||
gfx_printf("\r");
|
||||
gfx_printandclear(fno.fname, 37);
|
||||
gfx_printandclear(fno.fname, 37, 720);
|
||||
|
||||
if ((res = f_unlink(fsutil_getnextloc(localpath, fno.fname)))){
|
||||
gfx_errDisplay("del_recursive", res, 2);
|
||||
|
@ -160,7 +160,7 @@ int fsact_copy_recursive(char *path, char *dstpath){
|
|||
else {
|
||||
SWAPCOLOR(COLOR_GREEN);
|
||||
gfx_printf("\r");
|
||||
gfx_printandclear(fno.fname, 37);
|
||||
gfx_printandclear(fno.fname, 37, 720);
|
||||
|
||||
utils_copystring(fsutil_getnextloc(startpath, fno.fname), &temp);
|
||||
|
||||
|
|
|
@ -20,12 +20,9 @@ void gfx_clearscreen(){
|
|||
SWAPBGCOLOR(COLOR_WHITE);
|
||||
|
||||
gfx_boxGrey(0, 703, 1279, 719, 0xFF);
|
||||
gfx_con_setpos(0, 703);
|
||||
gfx_printf("Move: Vol+/- | Select: Pow | Battery: %3d%%", battery >> 8);
|
||||
|
||||
gfx_boxGrey(0, 0, 1279, 15, 0xFF);
|
||||
gfx_con_setpos(0, 0);
|
||||
gfx_printf("Tegraexplorer v1.5.2\n");
|
||||
gfx_printf("Tegraexplorer v1.5.2 | Battery: %3d%%", battery >> 8);
|
||||
|
||||
RESETCOLOR;
|
||||
}
|
||||
|
@ -108,7 +105,7 @@ void gfx_printlength(int size, char *toprint){
|
|||
free(temp);
|
||||
}
|
||||
|
||||
void gfx_printandclear(char *in, int length){
|
||||
void gfx_printandclear(char *in, int length, int endX){
|
||||
u32 x, y;
|
||||
|
||||
gfx_printlength(length, in);
|
||||
|
@ -121,7 +118,7 @@ void gfx_printandclear(char *in, int length){
|
|||
gfx_printf(" ");
|
||||
*/
|
||||
|
||||
gfx_boxGrey(x, y, 687, y + 15, 0x1B);
|
||||
gfx_boxGrey(x, y, endX, y + 15, 0x1B);
|
||||
|
||||
gfx_con_setpos(x, y);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ int gfx_message(u32 color, const char* message, ...);
|
|||
int gfx_errDisplay(char *src_func, int err, int loc);
|
||||
int gfx_makewaitmenu(char *hiddenmessage, int timer);
|
||||
void gfx_printlength(int size, char *toprint);
|
||||
void gfx_printandclear(char *in, int length);
|
||||
void gfx_printandclear(char *in, int length, int endX);
|
||||
void gfx_printfilesize(int size, char *type);
|
||||
|
||||
extern int printerrors;
|
|
@ -1,3 +1,4 @@
|
|||
#include <string.h>
|
||||
#include "menu.h"
|
||||
#include "gfxutils.h"
|
||||
#include "../common/types.h"
|
||||
|
@ -43,9 +44,11 @@ void _printentry(menu_entry entry, bool highlighted, bool refresh){
|
|||
SWAPCOLOR((highlighted) ? COLOR_DEFAULT : color);
|
||||
SWAPBGCOLOR((highlighted) ? color : COLOR_DEFAULT);
|
||||
|
||||
if (!(entry.property & ISMENU))
|
||||
gfx_printf("%c ", (entry.property & ISDIR) ? 30 : 31);
|
||||
|
||||
if (refresh)
|
||||
gfx_printandclear(entry.name, 37);
|
||||
gfx_printandclear(entry.name, 37, 720);
|
||||
else
|
||||
gfx_printlength(37, entry.name);
|
||||
|
||||
|
@ -61,9 +64,10 @@ void _printentry(menu_entry entry, bool highlighted, bool refresh){
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool disableB = false;
|
||||
int menu_make(menu_entry *entries, int amount, char *toptext){
|
||||
int currentpos = 0, offset = 0, delay = 300, minscreen = 0, maxscreen = 29, calculatedamount = 0;
|
||||
int currentpos = 0, offset = 0, delay = 300, minscreen = 0, maxscreen = 39, calculatedamount = 0;
|
||||
u32 scrolltimer, timer;
|
||||
bool refresh = false;
|
||||
Inputs *input = hidRead();
|
||||
|
@ -75,7 +79,8 @@ int menu_make(menu_entry *entries, int amount, char *toptext){
|
|||
if (!(entries[i].property & ISMENU))
|
||||
calculatedamount++;
|
||||
|
||||
gfx_con_setpos(1071, 0);
|
||||
gfx_con_setpos(0, 16);
|
||||
/*
|
||||
if (calculatedamount){
|
||||
SWAPCOLOR(COLOR_DEFAULT);
|
||||
SWAPBGCOLOR(COLOR_WHITE);
|
||||
|
@ -84,13 +89,28 @@ int menu_make(menu_entry *entries, int amount, char *toptext){
|
|||
}
|
||||
else
|
||||
gfx_printf("\n");
|
||||
*/
|
||||
|
||||
|
||||
|
||||
SWAPCOLOR(COLOR_GREEN);
|
||||
gfx_printlength(42, toptext);
|
||||
RESETCOLOR;
|
||||
|
||||
char *currentfolder = strrchr(toptext, '/');
|
||||
if (currentfolder != NULL){
|
||||
gfx_con_setpos(800, 48);
|
||||
if (calculatedamount)
|
||||
gfx_printf("%d items in curr. folder\n%j", calculatedamount, 800);
|
||||
gfx_printf("Current directory:\n%j", 800);
|
||||
if (*(currentfolder + 1) != 0)
|
||||
currentfolder++;
|
||||
SWAPCOLOR(COLOR_GREEN);
|
||||
gfx_printlength(28, currentfolder);
|
||||
}
|
||||
|
||||
while (!(input->a)){
|
||||
gfx_con_setpos(0, 47);
|
||||
gfx_con_setpos(0, 48);
|
||||
timer = get_tmr_ms();
|
||||
refresh = false;
|
||||
|
||||
|
@ -117,11 +137,28 @@ int menu_make(menu_entry *entries, int amount, char *toptext){
|
|||
refresh = true;
|
||||
}
|
||||
|
||||
for (int i = 0 + offset; i < amount && i < 30 + offset; i++)
|
||||
for (int i = 0 + offset; i < amount && i < 40 + offset; i++)
|
||||
if (!(entries[i].property & ISHIDE))
|
||||
_printentry(entries[i], (i == currentpos), refresh);
|
||||
|
||||
gfx_printf("\n%k%K %s %s\n\nTime taken for screen draw: %dms ", COLOR_BLUE, COLOR_DEFAULT, (offset + 30 < amount) ? "v" : " ", (offset > 0) ? "^" : " ", get_tmr_ms() - timer);
|
||||
RESETCOLOR;
|
||||
|
||||
if (!(entries[currentpos].property & ISMENU)){
|
||||
gfx_con_setpos(800, 144);
|
||||
gfx_printf("Current selection:\n%j", 800);
|
||||
SWAPCOLOR(COLOR_YELLOW);
|
||||
gfx_printandclear(entries[currentpos].name, 28, 1279);
|
||||
RESETCOLOR;
|
||||
gfx_con_setpos(800, 175);
|
||||
gfx_printf("Type: %s", (entries[currentpos].property & ISDIR) ? "Dir " : "File");
|
||||
}
|
||||
else
|
||||
gfx_boxGrey(800, 223, 1279, 271, 0x1B);
|
||||
|
||||
gfx_con_setpos(0, 703);
|
||||
SWAPCOLOR(COLOR_DEFAULT);
|
||||
SWAPBGCOLOR(COLOR_WHITE);
|
||||
gfx_printf("%s %s | Time taken for screen draw: %dms ", (offset + 40 < amount) ? "v" : " ", (offset > 0) ? "^" : " ", get_tmr_ms() - timer);
|
||||
|
||||
while ((input = hidRead())->buttons & (KEY_B | KEY_A));
|
||||
|
||||
|
|
Loading…
Reference in a new issue