mirror of
https://github.com/CTCaer/hekate
synced 2024-11-16 08:59:26 +00:00
v2.0 (and like always, transfer unmerged PRs)
This includes big 16px font support
This commit is contained in:
parent
a9ef85f5ff
commit
3877eddc3e
6 changed files with 2364 additions and 29 deletions
2256
ipl/ctc_logo2.h
Normal file
2256
ipl/ctc_logo2.h
Normal file
File diff suppressed because it is too large
Load diff
60
ipl/gfx.c
60
ipl/gfx.c
|
@ -82,6 +82,12 @@ void gfx_clear(gfx_ctxt_t *ctxt, u32 color)
|
||||||
ctxt->fb[i] = color;
|
ctxt->fb[i] = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gfx_con_setfontsz(gfx_con_t *con, u8 font_size)
|
||||||
|
{
|
||||||
|
con->fntsz = font_size;
|
||||||
|
con->fontmult = font_size / 8;
|
||||||
|
}
|
||||||
|
|
||||||
void gfx_con_init(gfx_con_t *con, gfx_ctxt_t *ctxt)
|
void gfx_con_init(gfx_con_t *con, gfx_ctxt_t *ctxt)
|
||||||
{
|
{
|
||||||
con->gfx_ctxt = ctxt;
|
con->gfx_ctxt = ctxt;
|
||||||
|
@ -90,6 +96,7 @@ void gfx_con_init(gfx_con_t *con, gfx_ctxt_t *ctxt)
|
||||||
con->fgcol = 0xFFCCCCCC;
|
con->fgcol = 0xFFCCCCCC;
|
||||||
con->fillbg = 0;
|
con->fillbg = 0;
|
||||||
con->bgcol = 0xFF1B1B1B;
|
con->bgcol = 0xFF1B1B1B;
|
||||||
|
gfx_con_setfontsz(con, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfx_con_setcol(gfx_con_t *con, u32 fgcol, int fillbg, u32 bgcol)
|
void gfx_con_setcol(gfx_con_t *con, u32 fgcol, int fillbg, u32 bgcol)
|
||||||
|
@ -117,27 +124,45 @@ void gfx_putc(gfx_con_t *con, char c)
|
||||||
{
|
{
|
||||||
u8 *cbuf = (u8 *)&_gfx_font[8 * (c - 32)];
|
u8 *cbuf = (u8 *)&_gfx_font[8 * (c - 32)];
|
||||||
u32 *fb = con->gfx_ctxt->fb + con->x + con->y * con->gfx_ctxt->stride;
|
u32 *fb = con->gfx_ctxt->fb + con->x + con->y * con->gfx_ctxt->stride;
|
||||||
for (u32 i = 0; i < 8; i++)
|
for (u32 i = 0; i < con->fntsz; i+=con->fontmult)
|
||||||
{
|
{
|
||||||
u8 v = *cbuf++;
|
u8 v = *cbuf++;
|
||||||
for (u32 j = 0; j < 8; j++)
|
for (u32 k = 0; k < con->fontmult; k++)
|
||||||
|
{
|
||||||
|
for (u32 j = 0; j < con->fntsz; j+=con->fontmult)
|
||||||
{
|
{
|
||||||
if (v & 1)
|
if (v & 1)
|
||||||
|
{
|
||||||
*fb = con->fgcol;
|
*fb = con->fgcol;
|
||||||
|
for(u32 l = 0; l < con->fontmult - 1; l++)
|
||||||
|
{
|
||||||
|
fb++;
|
||||||
|
*fb = con->fgcol;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (con->fillbg)
|
else if (con->fillbg)
|
||||||
|
{
|
||||||
*fb = con->bgcol;
|
*fb = con->bgcol;
|
||||||
|
for(u32 l = 0; l < con->fontmult - 1; l++)
|
||||||
|
{
|
||||||
|
fb++;
|
||||||
|
*fb = con->bgcol;
|
||||||
|
}
|
||||||
|
}
|
||||||
v >>= 1;
|
v >>= 1;
|
||||||
fb++;
|
fb++;
|
||||||
}
|
}
|
||||||
fb += con->gfx_ctxt->stride - 8;
|
fb += con->gfx_ctxt->stride - con->fntsz;
|
||||||
|
v = *cbuf;
|
||||||
}
|
}
|
||||||
con->x += 8;
|
}
|
||||||
|
con->x += con->fntsz;
|
||||||
}
|
}
|
||||||
else if (c == '\n')
|
else if (c == '\n')
|
||||||
{
|
{
|
||||||
con->x = 0;
|
con->x = 0;
|
||||||
con->y += 8;
|
con->y += con->fntsz;
|
||||||
if (con->y > con->gfx_ctxt->height - 8)
|
if (con->y > con->gfx_ctxt->height - con->fntsz)
|
||||||
con->y = 0;
|
con->y = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,6 +207,13 @@ static void _gfx_putn(gfx_con_t *con, u32 v, int base, char fill, int fcnt)
|
||||||
gfx_puts(con, p);
|
gfx_puts(con, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gfx_putsep(gfx_con_t *con)
|
||||||
|
{
|
||||||
|
gfx_con_setfontsz(con, 8);
|
||||||
|
gfx_putc(con, '\n');
|
||||||
|
gfx_con_setfontsz(con, 16);
|
||||||
|
}
|
||||||
|
|
||||||
void gfx_printf(gfx_con_t *con, const char *fmt, ...)
|
void gfx_printf(gfx_con_t *con, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -255,6 +287,8 @@ void gfx_printf(gfx_con_t *con, const char *fmt, ...)
|
||||||
|
|
||||||
void gfx_hexdump(gfx_con_t *con, u32 base, const u8 *buf, u32 len)
|
void gfx_hexdump(gfx_con_t *con, u32 base, const u8 *buf, u32 len)
|
||||||
{
|
{
|
||||||
|
u8 prevFontSize = con->fntsz;
|
||||||
|
gfx_con_setfontsz(con, 8);
|
||||||
for(u32 i = 0; i < len; i++)
|
for(u32 i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
if(i % 0x10 == 0)
|
if(i % 0x10 == 0)
|
||||||
|
@ -277,6 +311,7 @@ void gfx_hexdump(gfx_con_t *con, u32 base, const u8 *buf, u32 len)
|
||||||
gfx_printf(con, "%02x ", buf[i]);
|
gfx_printf(con, "%02x ", buf[i]);
|
||||||
}
|
}
|
||||||
gfx_putc(con, '\n');
|
gfx_putc(con, '\n');
|
||||||
|
gfx_con_setfontsz(con, prevFontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int abs(int x)
|
static int abs(int x)
|
||||||
|
@ -307,3 +342,16 @@ void gfx_line(gfx_ctxt_t *ctxt, int x0, int y0, int x1, int y1, u32 color)
|
||||||
if (e2 < dy) { err += dx; y0 += sy; }
|
if (e2 < dy) { err += dx; y0 += sy; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gfx_set_logo(gfx_ctxt_t *ctxt, const u8 *buf)
|
||||||
|
{
|
||||||
|
u32 pos = 0;
|
||||||
|
for (u32 y = 1180; y < 1256; y++)
|
||||||
|
{
|
||||||
|
for (u32 x = 538; x < 696; x++)
|
||||||
|
{
|
||||||
|
ctxt->fb[x + y*ctxt->stride] = (0xFF << 24) | buf[pos] | (buf[pos + 1] << 8) | (buf[pos + 2] << 16);
|
||||||
|
pos+=3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ typedef struct _gfx_con_t
|
||||||
u32 fgcol;
|
u32 fgcol;
|
||||||
int fillbg;
|
int fillbg;
|
||||||
u32 bgcol;
|
u32 bgcol;
|
||||||
|
u32 fntsz;
|
||||||
|
u32 fontmult;
|
||||||
} gfx_con_t;
|
} gfx_con_t;
|
||||||
|
|
||||||
void gfx_init_ctxt(gfx_ctxt_t *ctxt, u32 *fb, u32 width, u32 height, u32 stride);
|
void gfx_init_ctxt(gfx_ctxt_t *ctxt, u32 *fb, u32 width, u32 height, u32 stride);
|
||||||
|
@ -43,6 +45,7 @@ void gfx_con_init(gfx_con_t *con, gfx_ctxt_t *ctxt);
|
||||||
void gfx_con_setcol(gfx_con_t *con, u32 fgcol, int fillbg, u32 bgcol);
|
void gfx_con_setcol(gfx_con_t *con, u32 fgcol, int fillbg, u32 bgcol);
|
||||||
void gfx_con_getpos(gfx_con_t *con, u32 *x, u32 *y);
|
void gfx_con_getpos(gfx_con_t *con, u32 *x, u32 *y);
|
||||||
void gfx_con_setpos(gfx_con_t *con, u32 x, u32 y);
|
void gfx_con_setpos(gfx_con_t *con, u32 x, u32 y);
|
||||||
|
void gfx_con_setfontsz(gfx_con_t *con, u8 font_size);
|
||||||
void gfx_putc(gfx_con_t *con, char c);
|
void gfx_putc(gfx_con_t *con, char c);
|
||||||
void gfx_puts(gfx_con_t *con, const char *s);
|
void gfx_puts(gfx_con_t *con, const char *s);
|
||||||
void gfx_printf(gfx_con_t *con, const char *fmt, ...);
|
void gfx_printf(gfx_con_t *con, const char *fmt, ...);
|
||||||
|
@ -50,5 +53,7 @@ void gfx_hexdump(gfx_con_t *con, u32 base, const u8 *buf, u32 len);
|
||||||
|
|
||||||
void gfx_set_pixel(gfx_ctxt_t *ctxt, u32 x, u32 y, u32 color);
|
void gfx_set_pixel(gfx_ctxt_t *ctxt, u32 x, u32 y, u32 color);
|
||||||
void gfx_line(gfx_ctxt_t *ctxt, int x0, int y0, int x1, int y1, u32 color);
|
void gfx_line(gfx_ctxt_t *ctxt, int x0, int y0, int x1, int y1, u32 color);
|
||||||
|
void gfx_putsep(gfx_con_t *con);
|
||||||
|
void gfx_set_logo(gfx_ctxt_t *ctxt, const u8 *buf);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -213,10 +213,10 @@ static int _read_emmc_pkg1(launch_ctxt_t *ctxt)
|
||||||
ctxt->pkg1_id = pkg1_identify(ctxt->pkg1);
|
ctxt->pkg1_id = pkg1_identify(ctxt->pkg1);
|
||||||
if (!ctxt->pkg1_id)
|
if (!ctxt->pkg1_id)
|
||||||
{
|
{
|
||||||
DPRINTF("%kCould not identify package1 version (= '%s').%k\n", 0xFF0000FF, (char *)ctxt->pkg1 + 0x10, 0xFFFFFFFF);
|
DPRINTF("%kCould not identify package1,\nversion (= '%s').%k\n", 0xFF0000FF, (char *)ctxt->pkg1 + 0x10, 0xFFFFFFFF);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
DPRINTF("Identified package1 ('%s'), keyblob version %d\n", (char *)(ctxt->pkg1 + 0x10), ctxt->pkg1_id->kb);
|
DPRINTF("Identified package1 ('%s'),\nkeyblob version %d\n", (char *)(ctxt->pkg1 + 0x10), ctxt->pkg1_id->kb);
|
||||||
|
|
||||||
//Read the correct keyblob.
|
//Read the correct keyblob.
|
||||||
ctxt->keyblob = (u8 *)malloc(NX_EMMC_BLOCKSIZE);
|
ctxt->keyblob = (u8 *)malloc(NX_EMMC_BLOCKSIZE);
|
||||||
|
|
48
ipl/main.c
48
ipl/main.c
|
@ -503,21 +503,29 @@ void print_mmc_info()
|
||||||
Cmd Classes: %02X\n\
|
Cmd Classes: %02X\n\
|
||||||
Capacity: %s\n\
|
Capacity: %s\n\
|
||||||
Max Speed: %d MB/s (%d MHz)\n\
|
Max Speed: %d MB/s (%d MHz)\n\
|
||||||
Type Support: %s\n\n",
|
Type Support: ",
|
||||||
storage.csd.mmca_vsn, storage.ext_csd.rev, storage.ext_csd.dev_version, storage.csd.cmdclass,
|
storage.csd.mmca_vsn, storage.ext_csd.rev, storage.ext_csd.dev_version, storage.csd.cmdclass,
|
||||||
storage.csd.capacity == (4096 * 512) ? "High" : "Low", speed & 0xFFFF, (speed >> 16) & 0xFFFF, card_type_support);
|
storage.csd.capacity == (4096 * 512) ? "High" : "Low", speed & 0xFFFF, (speed >> 16) & 0xFFFF);
|
||||||
|
gfx_con_setfontsz(&gfx_con, 8);
|
||||||
|
gfx_printf(&gfx_con, "%s", card_type_support);
|
||||||
|
gfx_con_setfontsz(&gfx_con, 16);
|
||||||
|
gfx_printf(&gfx_con, "\n\n", card_type_support);
|
||||||
|
|
||||||
u32 boot_size = storage.ext_csd.boot_mult << 17;
|
u32 boot_size = storage.ext_csd.boot_mult << 17;
|
||||||
u32 rpmb_size = storage.ext_csd.rpmb_mult << 17;
|
u32 rpmb_size = storage.ext_csd.rpmb_mult << 17;
|
||||||
gfx_printf(&gfx_con, "%keMMC Partitions:%k\n", 0xFFFFDD00, 0xFFCCCCCC);
|
gfx_printf(&gfx_con, "%keMMC Partitions:%k\n", 0xFFFFDD00, 0xFFCCCCCC);
|
||||||
gfx_printf(&gfx_con, " 1: %kBOOT0 %kSize: %5d KiB (LBA Sectors: 0x%07X)\n", 0xFF00FF96, 0xFFCCCCCC,
|
gfx_printf(&gfx_con, " 1: %kBOOT0 %k\n Size: %5d KiB (LBA Sectors: 0x%07X)\n", 0xFF00FF96, 0xFFCCCCCC,
|
||||||
boot_size / 1024, boot_size / 1024 / 512);
|
boot_size / 1024, boot_size / 1024 / 512);
|
||||||
gfx_printf(&gfx_con, " 2: %kBOOT1 %kSize: %5d KiB (LBA Sectors: 0x%07X)\n", 0xFF00FF96, 0xFFCCCCCC,
|
gfx_putsep(&gfx_con);
|
||||||
|
gfx_printf(&gfx_con, " 2: %kBOOT1 %k\n Size: %5d KiB (LBA Sectors: 0x%07X)\n", 0xFF00FF96, 0xFFCCCCCC,
|
||||||
boot_size / 1024, boot_size / 1024 / 512);
|
boot_size / 1024, boot_size / 1024 / 512);
|
||||||
gfx_printf(&gfx_con, " 3: %kRPMB %kSize: %5d KiB (LBA Sectors: 0x%07X)\n", 0xFF00FF96, 0xFFCCCCCC,
|
gfx_putsep(&gfx_con);
|
||||||
|
gfx_printf(&gfx_con, " 3: %kRPMB %k\n Size: %5d KiB (LBA Sectors: 0x%07X)\n", 0xFF00FF96, 0xFFCCCCCC,
|
||||||
rpmb_size / 1024, rpmb_size / 1024 / 512);
|
rpmb_size / 1024, rpmb_size / 1024 / 512);
|
||||||
gfx_printf(&gfx_con, " 0: %kGPP (USER) %kSize: %05d MiB (LBA Sectors: 0x%07X)\n\n", 0xFF00FF96, 0xFFCCCCCC,
|
gfx_putsep(&gfx_con);
|
||||||
|
gfx_printf(&gfx_con, " 0: %kGPP (USER) %k\n Size: %5d MiB (LBA Sectors: 0x%07X)\n\n", 0xFF00FF96, 0xFFCCCCCC,
|
||||||
storage.sec_cnt >> SECTORS_TO_MIB_COEFF, storage.sec_cnt);
|
storage.sec_cnt >> SECTORS_TO_MIB_COEFF, storage.sec_cnt);
|
||||||
|
gfx_putsep(&gfx_con);
|
||||||
gfx_printf(&gfx_con, "%kGPP (eMMC USER) partition table:%k\n", 0xFFFFDD00, 0xFFCCCCCC);
|
gfx_printf(&gfx_con, "%kGPP (eMMC USER) partition table:%k\n", 0xFFFFDD00, 0xFFCCCCCC);
|
||||||
|
|
||||||
sdmmc_storage_set_mmc_partition(&storage, 0);
|
sdmmc_storage_set_mmc_partition(&storage, 0);
|
||||||
|
@ -526,9 +534,10 @@ void print_mmc_info()
|
||||||
int gpp_idx = 0;
|
int gpp_idx = 0;
|
||||||
LIST_FOREACH_ENTRY(emmc_part_t, part, &gpt, link)
|
LIST_FOREACH_ENTRY(emmc_part_t, part, &gpt, link)
|
||||||
{
|
{
|
||||||
gfx_printf(&gfx_con, " %02d: %k%s%k\n Size: % 5d MiB (LBA Sectors 0x%07X, LBA Range: %08X-%08X)\n",
|
gfx_printf(&gfx_con, " %02d: %k%s%k\n Size: % 5d MiB (LBA Sectors 0x%07X)\n LBA Range: %08X-%08X\n",
|
||||||
gpp_idx++, 0xFF14FDAE, part->name, 0xFFCCCCCC, (part->lba_end - part->lba_start + 1) >> SECTORS_TO_MIB_COEFF,
|
gpp_idx++, 0xFF14FDAE, part->name, 0xFFCCCCCC, (part->lba_end - part->lba_start + 1) >> SECTORS_TO_MIB_COEFF,
|
||||||
part->lba_end - part->lba_start + 1, part->lba_start, part->lba_end);
|
part->lba_end - part->lba_start + 1, part->lba_start, part->lba_end);
|
||||||
|
gfx_putsep(&gfx_con);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -607,6 +616,7 @@ void print_tsec_key()
|
||||||
const pkg1_id_t *pkg1_id = pkg1_identify(pkg1);
|
const pkg1_id_t *pkg1_id = pkg1_identify(pkg1);
|
||||||
if (!pkg1_id)
|
if (!pkg1_id)
|
||||||
{
|
{
|
||||||
|
gfx_con_setfontsz(&gfx_con, 8);
|
||||||
EPRINTFARGS("Could not identify package1 version to read TSEC firmware (= '%s').",
|
EPRINTFARGS("Could not identify package1 version to read TSEC firmware (= '%s').",
|
||||||
(char *)pkg1 + 0x10);
|
(char *)pkg1 + 0x10);
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -679,6 +689,7 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||||
memcpy(partialIdxFilename, "partial.idx", 11);
|
memcpy(partialIdxFilename, "partial.idx", 11);
|
||||||
partialIdxFilename[11] = 0;
|
partialIdxFilename[11] = 0;
|
||||||
|
|
||||||
|
gfx_con_setfontsz(&gfx_con, 8);
|
||||||
gfx_printf(&gfx_con, "\nSD Card free space: %d MiB, Total dump size %d MiB\n\n",
|
gfx_printf(&gfx_con, "\nSD Card free space: %d MiB, Total dump size %d MiB\n\n",
|
||||||
sd_fs.free_clst * sd_fs.csize >> SECTORS_TO_MIB_COEFF,
|
sd_fs.free_clst * sd_fs.csize >> SECTORS_TO_MIB_COEFF,
|
||||||
totalSectors >> SECTORS_TO_MIB_COEFF);
|
totalSectors >> SECTORS_TO_MIB_COEFF);
|
||||||
|
@ -698,6 +709,7 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||||
|
|
||||||
if (!maxSplitParts)
|
if (!maxSplitParts)
|
||||||
{
|
{
|
||||||
|
gfx_con_setfontsz(&gfx_con, 16);
|
||||||
EPRINTF("Not enough free space for partial dumping.");
|
EPRINTF("Not enough free space for partial dumping.");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -717,6 +729,7 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||||
|
|
||||||
if (!maxSplitParts)
|
if (!maxSplitParts)
|
||||||
{
|
{
|
||||||
|
gfx_con_setfontsz(&gfx_con, 16);
|
||||||
EPRINTF("Not enough free space for partial dumping.");
|
EPRINTF("Not enough free space for partial dumping.");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -765,6 +778,7 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||||
FIL fp;
|
FIL fp;
|
||||||
if (f_open(&fp, outFilename, FA_CREATE_ALWAYS | FA_WRITE) != FR_OK)
|
if (f_open(&fp, outFilename, FA_CREATE_ALWAYS | FA_WRITE) != FR_OK)
|
||||||
{
|
{
|
||||||
|
gfx_con_setfontsz(&gfx_con, 16);
|
||||||
EPRINTFARGS("Error creating file %s.\n", outFilename);
|
EPRINTFARGS("Error creating file %s.\n", outFilename);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -812,6 +826,7 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
gfx_con_setfontsz(&gfx_con, 16);
|
||||||
EPRINTF("\nError creating partial.idx file.\n");
|
EPRINTF("\nError creating partial.idx file.\n");
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
@ -826,6 +841,7 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||||
Don\'t move the partial.idx file!\n\
|
Don\'t move the partial.idx file!\n\
|
||||||
3. Unplug and re-plug USB while pressing Vol+.\n\
|
3. Unplug and re-plug USB while pressing Vol+.\n\
|
||||||
4. Run hekate - ipl again and press Dump RAW eMMC or eMMC USER to continue\n");
|
4. Run hekate - ipl again and press Dump RAW eMMC or eMMC USER to continue\n");
|
||||||
|
gfx_con_setfontsz(&gfx_con, 16);
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -835,6 +851,7 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||||
// Create next part
|
// Create next part
|
||||||
if (f_open(&fp, outFilename, FA_CREATE_ALWAYS | FA_WRITE) != FR_OK)
|
if (f_open(&fp, outFilename, FA_CREATE_ALWAYS | FA_WRITE) != FR_OK)
|
||||||
{
|
{
|
||||||
|
gfx_con_setfontsz(&gfx_con, 16);
|
||||||
EPRINTFARGS("Error creating file %s.\n", outFilename);
|
EPRINTFARGS("Error creating file %s.\n", outFilename);
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
@ -853,7 +870,8 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||||
sleep(500000);
|
sleep(500000);
|
||||||
if (retryCount >= 10)
|
if (retryCount >= 10)
|
||||||
{
|
{
|
||||||
EPRINTFARGS("\nFailed to read %d blocks @ LBA %08X from eMMC. Aborting..\n",
|
gfx_con_setfontsz(&gfx_con, 16);
|
||||||
|
EPRINTFARGS("\nFailed to read %d blocks @ LBA %08X\nfrom eMMC. Aborting..\n",
|
||||||
num, lba_curr);
|
num, lba_curr);
|
||||||
EPRINTF("\nPress any key and try again.\n");
|
EPRINTF("\nPress any key and try again.\n");
|
||||||
|
|
||||||
|
@ -865,6 +883,7 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||||
res = f_write(&fp, buf, NX_EMMC_BLOCKSIZE * num, NULL);
|
res = f_write(&fp, buf, NX_EMMC_BLOCKSIZE * num, NULL);
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
|
gfx_con_setfontsz(&gfx_con, 16);
|
||||||
EPRINTFARGS("\nFatal error (%d) when writing to SD Card", res);
|
EPRINTFARGS("\nFatal error (%d) when writing to SD Card", res);
|
||||||
EPRINTF("\nPress any key and try again.\n");
|
EPRINTF("\nPress any key and try again.\n");
|
||||||
|
|
||||||
|
@ -895,11 +914,12 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||||
out:;
|
out:;
|
||||||
free(buf);
|
free(buf);
|
||||||
f_close(&fp);
|
f_close(&fp);
|
||||||
|
gfx_con_setfontsz(&gfx_con, 16);
|
||||||
// Remove partial dump index file if no fatal errors occurred.
|
// Remove partial dump index file if no fatal errors occurred.
|
||||||
if(isSmallSdCard)
|
if(isSmallSdCard)
|
||||||
{
|
{
|
||||||
f_unlink(partialIdxFilename);
|
f_unlink(partialIdxFilename);
|
||||||
gfx_printf(&gfx_con, "\n\nYou can now join the files and get the complete raw eMMC dump.");
|
gfx_printf(&gfx_con, "\n\nYou can now join the files\nand get the complete raw eMMC dump.");
|
||||||
}
|
}
|
||||||
gfx_puts(&gfx_con, "\n\n");
|
gfx_puts(&gfx_con, "\n\n");
|
||||||
|
|
||||||
|
@ -952,7 +972,7 @@ static void dump_emmc_selected(dumpType_t dumpType)
|
||||||
bootPart.name[4] = (u8)('0' + i);
|
bootPart.name[4] = (u8)('0' + i);
|
||||||
bootPart.name[5] = 0;
|
bootPart.name[5] = 0;
|
||||||
|
|
||||||
gfx_printf(&gfx_con, "%k%02d: %s (%08X-%08X)%k\n", 0xFFFFDD00, i,
|
gfx_printf(&gfx_con, "%k%02d: %s (%07X-%07X)%k\n", 0xFFFFDD00, i,
|
||||||
bootPart.name, bootPart.lba_start, bootPart.lba_end, 0xFFCCCCCC);
|
bootPart.name, bootPart.lba_start, bootPart.lba_end, 0xFFCCCCCC);
|
||||||
|
|
||||||
sdmmc_storage_set_mmc_partition(&storage, i+1);
|
sdmmc_storage_set_mmc_partition(&storage, i+1);
|
||||||
|
@ -975,7 +995,7 @@ static void dump_emmc_selected(dumpType_t dumpType)
|
||||||
if ((dumpType & DUMP_SYSTEM) == 0 && strcmp(part->name, "USER"))
|
if ((dumpType & DUMP_SYSTEM) == 0 && strcmp(part->name, "USER"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
gfx_printf(&gfx_con, "%k%02d: %s (%08X-%08X)%k\n", 0xFFFFDD00, i++,
|
gfx_printf(&gfx_con, "%k%02d: %s (%07X-%07X)%k\n", 0xFFFFDD00, i++,
|
||||||
part->name, part->lba_start, part->lba_end, 0xFFCCCCCC);
|
part->name, part->lba_start, part->lba_end, 0xFFCCCCCC);
|
||||||
|
|
||||||
res = dump_emmc_part(part->name, &storage, part);
|
res = dump_emmc_part(part->name, &storage, part);
|
||||||
|
@ -992,7 +1012,7 @@ static void dump_emmc_selected(dumpType_t dumpType)
|
||||||
rawPart.lba_end = RAW_AREA_NUM_SECTORS-1;
|
rawPart.lba_end = RAW_AREA_NUM_SECTORS-1;
|
||||||
strcpy(rawPart.name, "rawnand.bin");
|
strcpy(rawPart.name, "rawnand.bin");
|
||||||
{
|
{
|
||||||
gfx_printf(&gfx_con, "%k%02d: %s (%08X-%08X)%k\n", 0xFFFFDD00, i++,
|
gfx_printf(&gfx_con, "%k%02d: %s (%07X-%07X)%k\n", 0xFFFFDD00, i++,
|
||||||
rawPart.name, rawPart.lba_start, rawPart.lba_end, 0xFFCCCCCC);
|
rawPart.name, rawPart.lba_start, rawPart.lba_end, 0xFFCCCCCC);
|
||||||
|
|
||||||
res = dump_emmc_part(rawPart.name, &storage, &rawPart);
|
res = dump_emmc_part(rawPart.name, &storage, &rawPart);
|
||||||
|
@ -1042,6 +1062,7 @@ void dump_package1()
|
||||||
const pk11_hdr_t *hdr = (pk11_hdr_t *)(pkg1 + pkg1_id->pkg11_off + 0x20);
|
const pk11_hdr_t *hdr = (pk11_hdr_t *)(pkg1 + pkg1_id->pkg11_off + 0x20);
|
||||||
if (!pkg1_id)
|
if (!pkg1_id)
|
||||||
{
|
{
|
||||||
|
gfx_con_setfontsz(&gfx_con, 8);
|
||||||
EPRINTFARGS("Could not identify package1 version to read TSEC firmware (= '%s').", (char *)pkg1 + 0x10);
|
EPRINTFARGS("Could not identify package1 version to read TSEC firmware (= '%s').", (char *)pkg1 + 0x10);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1186,6 +1207,7 @@ out:;
|
||||||
|
|
||||||
void about()
|
void about()
|
||||||
{
|
{
|
||||||
|
gfx_con_setfontsz(&gfx_con, 8);
|
||||||
static const char octopus[] =
|
static const char octopus[] =
|
||||||
"hekate (c) 2018 naehrwert, st4rk\n\n"
|
"hekate (c) 2018 naehrwert, st4rk\n\n"
|
||||||
"Thanks to: %kderrek, nedwill, plutoo, shuffle2, smea, thexyz, yellows8%k\n\n"
|
"Thanks to: %kderrek, nedwill, plutoo, shuffle2, smea, thexyz, yellows8%k\n\n"
|
||||||
|
@ -1297,7 +1319,7 @@ ment_t ment_top[] = {
|
||||||
};
|
};
|
||||||
menu_t menu_top = {
|
menu_t menu_top = {
|
||||||
ment_top,
|
ment_top,
|
||||||
"hekate - ipl", 0, 0
|
"hekate - ipl (CTCaer mod v2.0)", 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void pivot_stack(u32 stack_top);
|
extern void pivot_stack(u32 stack_top);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "tui.h"
|
#include "tui.h"
|
||||||
#include "btn.h"
|
#include "btn.h"
|
||||||
|
#include "ctc_logo2.h"
|
||||||
|
|
||||||
void tui_pbar(gfx_con_t *con, int x, int y, u32 val)
|
void tui_pbar(gfx_con_t *con, int x, int y, u32 val)
|
||||||
{
|
{
|
||||||
|
@ -27,9 +28,9 @@ void tui_pbar(gfx_con_t *con, int x, int y, u32 val)
|
||||||
|
|
||||||
gfx_printf(con, "[%3d%%]", val);
|
gfx_printf(con, "[%3d%%]", val);
|
||||||
|
|
||||||
x += 7 * 8;
|
x += 7 * con->fntsz;
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < con->fontmult * 6; i++)
|
||||||
{
|
{
|
||||||
gfx_line(con->gfx_ctxt, x, y + i + 1, x + 3 * val, y + i + 1, 0xFFCCCCCC);
|
gfx_line(con->gfx_ctxt, x, y + i + 1, x + 3 * val, y + i + 1, 0xFFCCCCCC);
|
||||||
gfx_line(con->gfx_ctxt, x + 3 * val, y + i + 1, x + 3 * 100, y + i + 1, 0xFF555555);
|
gfx_line(con->gfx_ctxt, x + 3 * val, y + i + 1, x + 3 * 100, y + i + 1, 0xFF555555);
|
||||||
|
@ -44,6 +45,7 @@ void *tui_do_menu(gfx_con_t *con, menu_t *menu)
|
||||||
int prev_idx = 0;
|
int prev_idx = 0;
|
||||||
|
|
||||||
gfx_clear(con->gfx_ctxt, 0xFF1B1B1B);
|
gfx_clear(con->gfx_ctxt, 0xFF1B1B1B);
|
||||||
|
gfx_set_logo(con->gfx_ctxt, Kc_HEKATE_LOGO);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -124,7 +126,9 @@ void *tui_do_menu(gfx_con_t *con, menu_t *menu)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
gfx_con_setfontsz(con, 16);
|
||||||
gfx_clear(con->gfx_ctxt, 0xFF1B1B1B);
|
gfx_clear(con->gfx_ctxt, 0xFF1B1B1B);
|
||||||
|
gfx_set_logo(con->gfx_ctxt, Kc_HEKATE_LOGO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue