Compare commits

..

1 Commits
2.0.5 ... dev

Author SHA1 Message Date
suchmememanyskill
5adb95095e create some helper functions in gfx.c 2020-08-04 01:16:50 +02:00
8 changed files with 77 additions and 24 deletions

View File

@@ -8,14 +8,27 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: devkitpro/devkita64_devkitarm
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
- name: Install devkitpro
run: |
wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb
sudo dpkg -i devkitpro-pacman.deb
sudo dkp-pacman -S switch-dev --noconfirm
sudo dkp-pacman -S devkitARM --noconfirm
- name: Build TegraExplorer - name: Build TegraExplorer
run: make -j$(nproc) run: |
echo # SETTING PATH #
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=${DEVKITPRO}/devkitARM
export DEVKITPPC=${DEVKITPRO}/devkitPPC
export PATH=${DEVKITPRO}/tools/bin:$PATH
echo # MAKE #
make -j$(nproc)
- uses: actions/upload-artifact@master - uses: actions/upload-artifact@master
with: with:

View File

@@ -11,7 +11,7 @@ include $(DEVKITARM)/base_rules
IPL_LOAD_ADDR := 0x40003000 IPL_LOAD_ADDR := 0x40003000
LPVERSION_MAJOR := 3 LPVERSION_MAJOR := 3
LPVERSION_MINOR := 0 LPVERSION_MINOR := 0
LPVERSION_BUGFX := 5 LPVERSION_BUGFX := 4
################################################################################ ################################################################################

View File

@@ -180,6 +180,8 @@ void gfx_con_setpos(u32 x, u32 y)
gfx_con.y = YLEFT - x; gfx_con.y = YLEFT - x;
} }
u32 YLeftConfig = YLEFT;
void gfx_putc(char c) void gfx_putc(char c)
{ {
// Duplicate code for performance reasons. // Duplicate code for performance reasons.
@@ -231,13 +233,13 @@ void gfx_putc(char c)
*/ */
gfx_con.y -= 16; gfx_con.y -= 16;
if (gfx_con.y < 16){ if (gfx_con.y < 16){
gfx_con.y = YLEFT; gfx_con.y = YLeftConfig;
gfx_con.x += 16; gfx_con.x += 16;
} }
} }
else if (c == '\n') else if (c == '\n')
{ {
gfx_con.y = YLEFT; gfx_con.y = YLeftConfig;
gfx_con.x += 16; gfx_con.x += 16;
if (gfx_con.x > gfx_ctxt.width - 16) if (gfx_con.x > gfx_ctxt.width - 16)
gfx_con.x = 0; gfx_con.x = 0;
@@ -247,7 +249,7 @@ void gfx_putc(char c)
else if (c == '\a') else if (c == '\a')
gfx_con.y = 639; gfx_con.y = 639;
else if (c == '\r') else if (c == '\r')
gfx_con.y = YLEFT; gfx_con.y = YLeftConfig;
break; break;
case 8: case 8:
@@ -273,14 +275,14 @@ void gfx_putc(char c)
gfx_con.y -= 8; gfx_con.y -= 8;
if (gfx_con.y < 8){ if (gfx_con.y < 8){
gfx_con.y = YLEFT; gfx_con.y = YLeftConfig;
gfx_con.x += 8; gfx_con.x += 8;
} }
} }
else if (c == '\n') else if (c == '\n')
{ {
gfx_con.y = YLEFT; gfx_con.y = YLeftConfig;
gfx_con.x += 8; gfx_con.x += 8;
if (gfx_con.x > gfx_ctxt.width - 8) if (gfx_con.x > gfx_ctxt.width - 8)
gfx_con.x = 0; gfx_con.x = 0;
@@ -290,7 +292,7 @@ void gfx_putc(char c)
else if (c == '\a') else if (c == '\a')
gfx_con.y = 639; gfx_con.y = 639;
else if (c == '\r') else if (c == '\r')
gfx_con.y = YLEFT; gfx_con.y = YLeftConfig;
break; break;
} }
@@ -305,6 +307,46 @@ void gfx_puts(const char *s)
gfx_putc(*s); gfx_putc(*s);
} }
u32 _strLenLimit(const char *s, u32 limit){
u32 len = 0;
for (; *s; s++){
len++;
if (len >= limit)
return len;
}
return len;
}
void gfx_puts_limit(const char *s, u32 limit)
{
if (!s || gfx_con.mute)
return;
for (u32 i = 0; i < limit; i++){
if (i == limit - 3){
if (_strLenLimit(&s[i], 4) >= 4){
gfx_puts("...");
return;
}
}
gfx_putc(s[i]);
}
/*
for (u32 i = 0; *s && i < limit; s++, i++){
if (i == limit - 3){
if (!(!(*s) || !(*(s + 1)) || !(*(s + 2)))){
gfx_puts("...");
return;
}
}
gfx_putc(*s);
}
*/
}
static void _gfx_putn(u32 v, int base, char fill, int fcnt) static void _gfx_putn(u32 v, int base, char fill, int fcnt)
{ {
char buf[65]; char buf[65];
@@ -381,6 +423,11 @@ void gfx_vprintf(const char *fmt, va_list ap)
} }
switch(*fmt) switch(*fmt)
{ {
case 'b':;
u32 begin = YLEFT - va_arg(ap, u32);
YLeftConfig = begin;
gfx_con.y = begin;
break;
case 'c': case 'c':
gfx_putc(va_arg(ap, u32)); gfx_putc(va_arg(ap, u32));
break; break;

View File

@@ -53,6 +53,7 @@ void gfx_set_rect_argb(const u32 *buf, u32 size_x, u32 size_y, u32 pos_x, u32 po
void gfx_render_bmp_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_box(int x0, int y0, int x1, int y1, u32 color);
void gfx_boxGrey(int x0, int y0, int x1, int y1, u8 shade); void gfx_boxGrey(int x0, int y0, int x1, int y1, u8 shade);
void gfx_puts_limit(const char *s, u32 limit);
/* /*
#define GFX_SETPOSCORRECTED(x, y) gfx_con_setpos(y - YLEFT, x) #define GFX_SETPOSCORRECTED(x, y) gfx_con_setpos(y - YLEFT, x)

View File

@@ -43,7 +43,6 @@ static const pkg1_id_t _pkg1_ids[] = {
{ "20190809135709", 9, {0x2ec10, 0x5573, 0, 1, 12, HASH_ORDER_700_10x, 0x6495, 0x1d807} }, //9.0.0 - 9.0.1 { "20190809135709", 9, {0x2ec10, 0x5573, 0, 1, 12, HASH_ORDER_700_10x, 0x6495, 0x1d807} }, //9.0.0 - 9.0.1
{ "20191021113848", 10,{0x2ec10, 0x5573, 0, 1, 12, HASH_ORDER_700_10x, 0x6495, 0x1d807} }, //9.1.0 { "20191021113848", 10,{0x2ec10, 0x5573, 0, 1, 12, HASH_ORDER_700_10x, 0x6495, 0x1d807} }, //9.1.0
{ "20200303104606", 10,{0x30ea0, 0x5e4b, 0, 1, 12, HASH_ORDER_700_10x, 0x663c, 0x1d9a4} }, //10.0.0 { "20200303104606", 10,{0x30ea0, 0x5e4b, 0, 1, 12, HASH_ORDER_700_10x, 0x663c, 0x1d9a4} }, //10.0.0
{ "20201030110885", 10,{0x30ea0, 0x5e4b, 0, 1, 12, HASH_ORDER_700_10x, 0x663c, 0x1d9a4} }, //11.0.0
{ NULL } //End. { NULL } //End.
}; };

View File

@@ -99,4 +99,4 @@ menu_entry fwDump_typeMenu[] = {
{"Firmware format type:", COLOR_WHITE, {ISMENU | ISSKIP}}, {"Firmware format type:", COLOR_WHITE, {ISMENU | ISSKIP}},
{"Daybreak (prod.keys required!)", COLOR_BLUE, {ISMENU}}, {"Daybreak (prod.keys required!)", COLOR_BLUE, {ISMENU}},
{"ChoiNX", COLOR_VIOLET, {ISMENU}} {"ChoiNX", COLOR_VIOLET, {ISMENU}}
}; };

View File

@@ -28,7 +28,6 @@ extern sdmmc_storage_t storage;
extern emmc_part_t *system_part; extern emmc_part_t *system_part;
extern char *clipboard; extern char *clipboard;
extern u8 clipboardhelper; extern u8 clipboardhelper;
extern bool sd_mounted;
void addEntry(emmc_part_t *part, u8 property_GPT, int spot){ void addEntry(emmc_part_t *part, u8 property_GPT, int spot){
@@ -74,12 +73,6 @@ int fillMmcMenu(short mmcType){
mu_createObjects(count, &mmcMenuEntries); mu_createObjects(count, &mmcMenuEntries);
if (!sd_mounted)
sd_mount();
SETBIT(mmcmenu_filemenu[3].property, ISHIDE, !sd_mounted);
SETBIT(mmcmenu_start[1].property, ISHIDE, !sd_mounted);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
mu_copySingle(mmcmenu_start[i].name, mmcmenu_start[i].storage, mmcmenu_start[i].property, &mmcMenuEntries[i]); mu_copySingle(mmcmenu_start[i].name, mmcmenu_start[i].storage, mmcmenu_start[i].property, &mmcMenuEntries[i]);
@@ -99,13 +92,13 @@ int handleEntries(short mmcType, menu_entry part){
return -1; return -1;
} }
if (!mount_mmc(part.name, part.storage)) if (!mount_mmc(part.name, part.storage))
fileexplorer("emmc:/", 1); fileexplorer("emmc:/", 1);
} }
else { else {
/* /*
if (mmcmenu_filemenu[1].name != NULL) if (mmcmenu_filemenu[1].name != NULL)
free(mmcmenu_filemenu[1].name); free(mmcmenu_filemenu[1].name);
utils_copystring(part.name, &mmcmenu_filemenu[1].name); utils_copystring(part.name, &mmcmenu_filemenu[1].name);
*/ */
@@ -169,7 +162,7 @@ int makeMmcMenu(short mmcType){
if (!mmcFlashFile(clipboard, mmcType, true)){ if (!mmcFlashFile(clipboard, mmcType, true)){
gfx_printf("\nDone!"); gfx_printf("\nDone!");
hidWait(); hidWait();
} }
clipboardhelper = 0; clipboardhelper = 0;
} }
else else
@@ -180,4 +173,4 @@ int makeMmcMenu(short mmcType){
break; break;
} }
} }
} }

View File

@@ -23,7 +23,7 @@ void gfx_clearscreen(){
gfx_boxGrey(0, 703, 1279, 719, 0xFF); gfx_boxGrey(0, 703, 1279, 719, 0xFF);
gfx_boxGrey(0, 0, 1279, 15, 0xFF); gfx_boxGrey(0, 0, 1279, 15, 0xFF);
gfx_con_setpos(0, 0); gfx_con_setpos(0, 0);
gfx_printf("Tegraexplorer v2.0.5 | Battery: %3d%%\n", battery >> 8); gfx_printf("Tegraexplorer v2.0.4 | Battery: %3d%%\n", battery >> 8);
RESETCOLOR; RESETCOLOR;
} }