Compare commits

..

7 Commits
v1.5 ... v1.5.1

Author SHA1 Message Date
Kostas Missos
875d65033a [Tools] Fix stray message 2018-05-22 04:13:10 -07:00
Chris Atkin
4e90f92b09 Ignore built ipl.bin file
This adds  to the .gitignore definition, to prevent it being included in the source after a build.
2018-05-21 21:26:41 -07:00
Kostas Missos
6e82dabb22 [Tools] Dump in 1GB parts if sd <=8GB + tui tweak
Tui tweak:
Support auto scroll.
2018-05-21 12:34:03 -07:00
Kostas Missos
f0d88f61ca [Main] Remove redundant
And change some divisions into bitshifting
2018-05-21 12:34:03 -07:00
Kostas Missos
8fdfb55f74 [Tools+Info] Utilize sd_save_to_file 2018-05-21 12:34:03 -07:00
Kostas Missos
08a7511760 [Main] Use printf macros to reduce clutter 2018-05-21 12:34:03 -07:00
Kostas Missos
526ffd4414 [FatFS] Add error printing for important functions
So much needed
2018-05-21 12:34:03 -07:00
8 changed files with 26 additions and 2311 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.vs .vs
.vscode .vscode
build_ipl/* build_ipl/*
/ipl.bin

File diff suppressed because it is too large Load Diff

View File

@@ -89,7 +89,7 @@ void gfx_con_init(gfx_con_t *con, gfx_ctxt_t *ctxt)
con->y = 0; con->y = 0;
con->fgcol = 0xFFFFFFFF; con->fgcol = 0xFFFFFFFF;
con->fillbg = 0; con->fillbg = 0;
con->bgcol = 0xFF1B1B1B; con->bgcol = 0xFF000000;
} }
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)
@@ -307,17 +307,3 @@ 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, u16 pos_x, u16 pos_y,
const u16 size_x, const u16 size_y, const u8 *buf)
{
u32 pos = 0;
for (u32 y = pos_y; y < pos_y + size_y; y++)
{
for (u32 x = pos_x; x < pos_x + size_x; x++)
{
ctxt->fb[x + y*ctxt->stride] = (0xFF << 24) | buf[pos] | (buf[pos + 1] << 8) | (buf[pos + 2] << 16);
pos+=3;
}
}
}

View File

@@ -50,6 +50,5 @@ 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_set_logo(gfx_ctxt_t *ctxt, u16 pos_x, u16 pos_y, const u16 size_x, const u16 size_y, const u8 *buf);
#endif #endif

View File

@@ -433,21 +433,12 @@ DPRINTF("decrypted and unpacked pkg1\n");
se_aes_key_clear(8); se_aes_key_clear(8);
se_aes_key_clear(11); se_aes_key_clear(11);
//se_aes_key_clear(13);
switch (ctxt.pkg1_id->kb) { //se_key_acc_ctrl(10, 0xFF);
case KB_FIRMWARE_VERSION_100_200: se_key_acc_ctrl(12, 0xFF);
case KB_FIRMWARE_VERSION_300: //se_key_acc_ctrl(13, 0xFF);
case KB_FIRMWARE_VERSION_301: //se_key_acc_ctrl(14, 0xFF);
se_key_acc_ctrl(12, 0xFF); se_key_acc_ctrl(15, 0xFF);
se_key_acc_ctrl(13, 0xFF);
break;
default:
case KB_FIRMWARE_VERSION_400:
case KB_FIRMWARE_VERSION_500:
se_key_acc_ctrl(12, 0xFF);
se_key_acc_ctrl(15, 0xFF);
break;
}
//Clear 'BootConfig'. //Clear 'BootConfig'.
memset((void *)0x4003D000, 0, 0x3000); memset((void *)0x4003D000, 0, 0x3000);

View File

@@ -336,7 +336,7 @@ void config_hw()
void print_fuseinfo() void print_fuseinfo()
{ {
gfx_clear(&gfx_ctxt, 0xFF1B1B1B); gfx_clear(&gfx_ctxt, 0xFF000000);
gfx_con_setpos(&gfx_con, 0, 0); gfx_con_setpos(&gfx_con, 0, 0);
gfx_printf(&gfx_con, "%k(Unlocked) fuse cache:\n\n%k", 0xFFFF9955, 0xFFFFFFFF); gfx_printf(&gfx_con, "%k(Unlocked) fuse cache:\n\n%k", 0xFFFF9955, 0xFFFFFFFF);
@@ -368,7 +368,7 @@ void print_fuseinfo()
void print_kfuseinfo() void print_kfuseinfo()
{ {
gfx_clear(&gfx_ctxt, 0xFF1B1B1B); gfx_clear(&gfx_ctxt, 0xFF000000);
gfx_con_setpos(&gfx_con, 0, 0); gfx_con_setpos(&gfx_con, 0, 0);
gfx_printf(&gfx_con, "%kKFuse contents:\n\n%k", 0xFFFF9955, 0xFFFFFFFF); gfx_printf(&gfx_con, "%kKFuse contents:\n\n%k", 0xFFFF9955, 0xFFFFFFFF);
@@ -404,7 +404,7 @@ void print_kfuseinfo()
void print_mmc_info() void print_mmc_info()
{ {
gfx_clear(&gfx_ctxt, 0xFF1B1B1B); gfx_clear(&gfx_ctxt, 0xFF000000);
gfx_con_setpos(&gfx_con, 0, 0); gfx_con_setpos(&gfx_con, 0, 0);
static const u32 SECTORS_TO_MIB_COEFF = 11; static const u32 SECTORS_TO_MIB_COEFF = 11;
@@ -547,7 +547,7 @@ out:
void print_sdcard_info() void print_sdcard_info()
{ {
gfx_clear(&gfx_ctxt, 0xFF1B1B1B); gfx_clear(&gfx_ctxt, 0xFF000000);
gfx_con_setpos(&gfx_con, 0, 0); gfx_con_setpos(&gfx_con, 0, 0);
static const u32 SECTORS_TO_MIB_COEFF = 11; static const u32 SECTORS_TO_MIB_COEFF = 11;
@@ -600,7 +600,7 @@ void print_sdcard_info()
void print_tsec_key() void print_tsec_key()
{ {
gfx_clear(&gfx_ctxt, 0xFF1B1B1B); gfx_clear(&gfx_ctxt, 0xFF000000);
gfx_con_setpos(&gfx_con, 0, 0); gfx_con_setpos(&gfx_con, 0, 0);
sdmmc_storage_t storage; sdmmc_storage_t storage;
@@ -732,7 +732,7 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
// Increase maxSplitParts to accommodate previously dumped parts // Increase maxSplitParts to accommodate previously dumped parts
maxSplitParts += currPartIdx; maxSplitParts += currPartIdx;
} }
else else if (isSmallSdCard)
gfx_printf(&gfx_con, "%kPartial dumping enabled (with %d MiB parts)...%k\n\n", 0xFF00BAFF, multipartSplitSize >> 20, 0xFFFFFFFF); gfx_printf(&gfx_con, "%kPartial dumping enabled (with %d MiB parts)...%k\n\n", 0xFF00BAFF, multipartSplitSize >> 20, 0xFFFFFFFF);
// Check if filesystem is FAT32 or the free space is smaller and dump in parts // Check if filesystem is FAT32 or the free space is smaller and dump in parts
@@ -924,7 +924,7 @@ static void dump_emmc_selected(dumpType_t dumpType)
{ {
int res = 0; int res = 0;
u32 timer = 0; u32 timer = 0;
gfx_clear(&gfx_ctxt, 0xFF1B1B1B); gfx_clear(&gfx_ctxt, 0xFF000000);
gfx_con_setpos(&gfx_con, 0, 0); gfx_con_setpos(&gfx_con, 0, 0);
if (!sd_mount()) if (!sd_mount())
@@ -1028,7 +1028,7 @@ void dump_package1()
u8 * warmboot = (u8 *)malloc(0x40000); u8 * warmboot = (u8 *)malloc(0x40000);
u8 * secmon = (u8 *)malloc(0x40000); u8 * secmon = (u8 *)malloc(0x40000);
gfx_clear(&gfx_ctxt, 0xFF1B1B1B); gfx_clear(&gfx_ctxt, 0xFF000000);
gfx_con_setpos(&gfx_con, 0, 0); gfx_con_setpos(&gfx_con, 0, 0);
if (!sd_mount()) if (!sd_mount())
@@ -1107,7 +1107,7 @@ void launch_firmware()
ini_sec_t *cfg_sec = NULL; ini_sec_t *cfg_sec = NULL;
LIST_INIT(ini_sections); LIST_INIT(ini_sections);
gfx_clear(&gfx_ctxt, 0xFF1B1B1B); gfx_clear(&gfx_ctxt, 0xFF000000);
gfx_con_setpos(&gfx_con, 0, 0); gfx_con_setpos(&gfx_con, 0, 0);
if (sd_mount()) if (sd_mount())
@@ -1187,7 +1187,7 @@ void about()
" (/` ( (` ) ) '-; %k[switchbrew]%k\n" " (/` ( (` ) ) '-; %k[switchbrew]%k\n"
" ` '-; (-'%k"; " ` '-; (-'%k";
gfx_clear(&gfx_ctxt, 0xFF1B1B1B); gfx_clear(&gfx_ctxt, 0xFF000000);
gfx_con_setpos(&gfx_con, 0, 0); gfx_con_setpos(&gfx_con, 0, 0);
gfx_printf(&gfx_con, octopus, 0xFFFFCC00, 0xFFFFFFFF, gfx_printf(&gfx_con, octopus, 0xFFFFCC00, 0xFFFFFFFF,
@@ -1237,7 +1237,7 @@ ment_t ment_top[] = {
}; };
menu_t menu_top = { menu_t menu_top = {
ment_top, ment_top,
"hekate - ipl (CTCaer mod v1.5)", 0, 0 "hekate - ipl", 0, 0
}; };
extern void pivot_stack(u32 stack_top); extern void pivot_stack(u32 stack_top);
@@ -1259,7 +1259,7 @@ void ipl_main()
//display_color_screen(0xAABBCCDD); //display_color_screen(0xAABBCCDD);
u32 *fb = display_init_framebuffer(); u32 *fb = display_init_framebuffer();
gfx_init_ctxt(&gfx_ctxt, fb, 720, 1280, 768); gfx_init_ctxt(&gfx_ctxt, fb, 720, 1280, 768);
gfx_clear(&gfx_ctxt, 0xFF1B1B1B); gfx_clear(&gfx_ctxt, 0xFF000000);
gfx_con_init(&gfx_con, &gfx_ctxt); gfx_con_init(&gfx_con, &gfx_ctxt);
while (1) while (1)

View File

@@ -42,7 +42,6 @@ PATCHSET_DEF(_secmon_2_patchset,
PATCHSET_DEF(_secmon_3_patchset, PATCHSET_DEF(_secmon_3_patchset,
//Patch package2 decryption and signature/hash checks. //Patch package2 decryption and signature/hash checks.
{ 0xAC8 + 0xAB4, _NOP() },
{ 0xAC8 + 0xA30, _NOP() }, //Header signature. { 0xAC8 + 0xA30, _NOP() }, //Header signature.
{ 0xAC8 + 0xAC0, _NOP() }, //Version. { 0xAC8 + 0xAC0, _NOP() }, //Version.
{ 0xAC8 + 0xADC, _NOP() } //Sections SHA2. { 0xAC8 + 0xADC, _NOP() } //Sections SHA2.
@@ -79,7 +78,7 @@ PATCHSET_DEF(_secmon_6_patchset,
static const pkg1_id_t _pkg1_ids[] = { static const pkg1_id_t _pkg1_ids[] = {
{ "20161121183008", 0, 0x1900, 0x3FE0, { 2, 1, 0 }, 0x40014020, _secmon_1_patchset }, //1.0.0 { "20161121183008", 0, 0x1900, 0x3FE0, { 2, 1, 0 }, 0x40014020, _secmon_1_patchset }, //1.0.0
{ "20170210155124", 0, 0x1900, 0x3FE0, { 0, 1, 2 }, 0x4002D000, _secmon_2_patchset }, //2.0.0 { "20170210155124", 0, 0x1900, 0x3FE0, { 0, 1, 2 }, 0x4002D000, _secmon_2_patchset }, //2.0.0
{ "20170519101410", 1, 0x1A00, 0x3FE0, { 0, 1, 2 }, 0x4002D000, _secmon_3_patchset }, //3.0.0 { "20170519101410", 1, 0x1A00, 0x3FE0, { 0, 1, 2 }, 0x4002D000, NULL }, //3.0.0
{ "20170710161758", 2, 0x1A00, 0x3FE0, { 0, 1, 2 }, 0x4002D000, NULL }, //3.0.1 { "20170710161758", 2, 0x1A00, 0x3FE0, { 0, 1, 2 }, 0x4002D000, NULL }, //3.0.1
{ "20170921172629", 3, 0x1800, 0x3FE0, { 1, 2, 0 }, 0x4002B000, _secmon_5_patchset }, //4.0.0 { "20170921172629", 3, 0x1800, 0x3FE0, { 1, 2, 0 }, 0x4002B000, _secmon_5_patchset }, //4.0.0
{ "20180220163747", 4, 0x1900, 0x3FE0, { 1, 2, 0 }, 0x4002B000, _secmon_6_patchset }, //5.0.0 { "20180220163747", 4, 0x1900, 0x3FE0, { 1, 2, 0 }, 0x4002B000, _secmon_6_patchset }, //5.0.0

View File

@@ -16,7 +16,6 @@
#include "tui.h" #include "tui.h"
#include "btn.h" #include "btn.h"
#include "ctc_logo.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)
{ {
@@ -43,12 +42,11 @@ void *tui_do_menu(gfx_con_t *con, menu_t *menu)
{ {
int idx = 0, cnt; int idx = 0, cnt;
gfx_clear(con->gfx_ctxt, 0xFF1B1B1B); gfx_clear(con->gfx_ctxt, 0xFF000000);
gfx_set_logo(con->gfx_ctxt, 538, 1180, LOGO_WIDTH, LOGO_HEIGHT, CTC_LOGO);
while (1) while (1)
{ {
gfx_con_setcol(con, 0xFFFFFFFF, 1, 0xFF1B1B1B); gfx_con_setcol(con, 0xFFFFFFFF, 1, 0xFF000000);
gfx_con_setpos(con, menu->x, menu->y); gfx_con_setpos(con, menu->x, menu->y);
gfx_printf(con, "[%s]\n\n", menu->caption); gfx_printf(con, "[%s]\n\n", menu->caption);
@@ -57,7 +55,7 @@ void *tui_do_menu(gfx_con_t *con, menu_t *menu)
if (cnt == idx) if (cnt == idx)
gfx_con_setcol(con, 0xFF000000, 1, 0xFFCCCCCC); gfx_con_setcol(con, 0xFF000000, 1, 0xFFCCCCCC);
else else
gfx_con_setcol(con, 0xFFFFFFFF, 1, 0xFF1B1B1B); gfx_con_setcol(con, 0xFFFFFFFF, 1, 0xFF000000);
con->x += 8; con->x += 8;
gfx_printf(con, "%s", menu->ents[cnt].caption); gfx_printf(con, "%s", menu->ents[cnt].caption);
if(menu->ents[cnt].type == MENT_MENU) if(menu->ents[cnt].type == MENT_MENU)
@@ -65,7 +63,7 @@ void *tui_do_menu(gfx_con_t *con, menu_t *menu)
gfx_putc(con, '\n'); gfx_putc(con, '\n');
} }
gfx_con_setcol(con, 0xFFFFFFFF, 1, 0xFF1B1B1B); gfx_con_setcol(con, 0xFFFFFFFF, 1, 0xFF000000);
gfx_putc(con, '\n'); gfx_putc(con, '\n');
u32 btn = btn_wait(); u32 btn = btn_wait();
@@ -96,8 +94,7 @@ void *tui_do_menu(gfx_con_t *con, menu_t *menu)
return NULL; return NULL;
break; break;
} }
gfx_clear(con->gfx_ctxt, 0xFF1B1B1B); gfx_clear(con->gfx_ctxt, 0xFF000000);
gfx_set_logo(con->gfx_ctxt, 538, 1180, LOGO_WIDTH, LOGO_HEIGHT, CTC_LOGO);
} }
} }