mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 19:31:12 +00:00
Whitespace/typo cleanup + others
Others: *Add cluster size in SD card info *Add error message for emmc read failure. Also fix return value. *Added more comments and more constant naming
This commit is contained in:
parent
34981763a5
commit
dcb77115c9
1 changed files with 41 additions and 35 deletions
42
ipl/main.c
42
ipl/main.c
|
@ -257,7 +257,7 @@ void config_se_brom()
|
||||||
|
|
||||||
void config_hw()
|
void config_hw()
|
||||||
{
|
{
|
||||||
//Bootrom stuff we skipped by going thru rcm.
|
//Bootrom stuff we skipped by going through rcm.
|
||||||
config_se_brom();
|
config_se_brom();
|
||||||
//FUSE(FUSE_PRIVATEKEYDISABLE) = 0x11;
|
//FUSE(FUSE_PRIVATEKEYDISABLE) = 0x11;
|
||||||
SYSREG(0x110) &= 0xFFFFFF9F;
|
SYSREG(0x110) &= 0xFFFFFF9F;
|
||||||
|
@ -591,9 +591,9 @@ void print_sdcard_info()
|
||||||
|
|
||||||
gfx_puts(&gfx_con, "Acquiring FAT volume info...\n\n");
|
gfx_puts(&gfx_con, "Acquiring FAT volume info...\n\n");
|
||||||
f_getfree("", &sd_fs.free_clst, NULL);
|
f_getfree("", &sd_fs.free_clst, NULL);
|
||||||
gfx_printf(&gfx_con, "%kFound %s volume:%k\n Free: %d MiB\n", 0xFFFFDD00,
|
gfx_printf(&gfx_con, "%kFound %s volume:%k\n Free: %d MiB\n Cluster: %d B\n",
|
||||||
sd_fs.fs_type == FS_EXFAT ? "exFAT" : "FAT32", 0xFFFFFFFF,
|
0xFFFFDD00, sd_fs.fs_type == FS_EXFAT ? "exFAT" : "FAT32", 0xFFFFFFFF,
|
||||||
sd_fs.free_clst * sd_fs.csize / SECTORS_TO_MIB_COEFF);
|
sd_fs.free_clst * sd_fs.csize / SECTORS_TO_MIB_COEFF, sd_fs.csize * 512);
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep(1000000);
|
sleep(1000000);
|
||||||
|
@ -618,7 +618,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_printf(&gfx_con, "%kCould not identify package 1 version to read TSEC firmware (= '%s').%k\n",
|
gfx_printf(&gfx_con, "%kCould not identify package1 version to read TSEC firmware (= '%s').%k\n",
|
||||||
0xFF0000FF, (char *)pkg1 + 0x10, 0xFFFFFFFF);
|
0xFF0000FF, (char *)pkg1 + 0x10, 0xFFFFFFFF);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -755,7 +755,7 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||||
else
|
else
|
||||||
outFilename[sdPathLen+1] = 0;
|
outFilename[sdPathLen+1] = 0;
|
||||||
}
|
}
|
||||||
// Continue from where we left, if partial dump in proggress.
|
// Continue from where we left, if partial dump in progress.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (numSplitParts >= 10 && currPartIdx < 10)
|
if (numSplitParts >= 10 && currPartIdx < 10)
|
||||||
|
@ -784,7 +784,7 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||||
u32 prevPct = 200;
|
u32 prevPct = 200;
|
||||||
int retryCount = 0;
|
int retryCount = 0;
|
||||||
|
|
||||||
// Continue from where we left, if partial dump in proggress.
|
// Continue from where we left, if partial dump in progress.
|
||||||
if (partialDumpInProgress)
|
if (partialDumpInProgress)
|
||||||
{
|
{
|
||||||
lba_curr += currPartIdx * (MULTIPART_SPLIT_SIZE / NX_EMMC_BLOCKSIZE);
|
lba_curr += currPartIdx * (MULTIPART_SPLIT_SIZE / NX_EMMC_BLOCKSIZE);
|
||||||
|
@ -827,17 +827,18 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||||
// More parts to dump that do not currently fit the sd card free space or fatal error
|
// More parts to dump that do not currently fit the sd card free space or fatal error
|
||||||
if (currPartIdx >= maxSplitParts)
|
if (currPartIdx >= maxSplitParts)
|
||||||
{
|
{
|
||||||
gfx_puts(&gfx_con, "\n1. Press any key and Power off Switch from the main menu.\n\
|
gfx_puts(&gfx_con, "\n\n1. Press any key and Power off Switch from the main menu.\n\
|
||||||
2. Move the files from SD card to free space.\n \
|
2. Move the files from SD card to free space.\n\
|
||||||
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");
|
4. Run hekate - ipl again and press Dump RAW eMMC or eMMC USER to continue\n");
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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_printf(&gfx_con, "%kError creating file %s.%k\n", 0xFF0000FF, outFilename, 0xFFFFFFFF);
|
gfx_printf(&gfx_con, "%kError creating file %s.%k\n", 0xFF0000FF, outFilename, 0xFFFFFFFF);
|
||||||
|
@ -857,7 +858,14 @@ 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)
|
||||||
goto out;
|
{
|
||||||
|
gfx_printf(&gfx_con, "%k\nFailed to read %d blocks @ LBA %08X from eMMC. Aborting..%k\n",
|
||||||
|
0xFF0000FF, num, lba_curr, 0xFFFFFFFF);
|
||||||
|
|
||||||
|
free(buf);
|
||||||
|
f_close(&fp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
res = f_write(&fp, buf, NX_EMMC_BLOCKSIZE * num, NULL);
|
res = f_write(&fp, buf, NX_EMMC_BLOCKSIZE * num, NULL);
|
||||||
if (res)
|
if (res)
|
||||||
|
@ -883,7 +891,7 @@ int dump_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
|
||||||
totalSectors -= num;
|
totalSectors -= num;
|
||||||
bytesWritten += num * NX_EMMC_BLOCKSIZE;
|
bytesWritten += num * NX_EMMC_BLOCKSIZE;
|
||||||
|
|
||||||
//force a flush after a lot of data if not splitting
|
// Force a flush after a lot of data if not splitting
|
||||||
if (numSplitParts == 0 && bytesWritten >= MULTIPART_SPLIT_SIZE)
|
if (numSplitParts == 0 && bytesWritten >= MULTIPART_SPLIT_SIZE)
|
||||||
{
|
{
|
||||||
f_sync(&fp);
|
f_sync(&fp);
|
||||||
|
@ -895,7 +903,7 @@ 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);
|
||||||
// Partial dump done. Remove partial dump index file.
|
// Remove partial dump index file if no fatal errors occurred.
|
||||||
if(isSmallSdCard)
|
if(isSmallSdCard)
|
||||||
{
|
{
|
||||||
f_unlink(partialIdxFilename);
|
f_unlink(partialIdxFilename);
|
||||||
|
@ -1057,7 +1065,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_printf(&gfx_con, "%kCould not identify package 1 version to read TSEC firmware (= '%s').%k\n", 0xFF0000FF, (char *)pkg1 + 0x10, 0xFFFFFFFF);
|
gfx_printf(&gfx_con, "%kCould not identify package1 version to read TSEC firmware (= '%s').%k\n", 0xFF0000FF, (char *)pkg1 + 0x10, 0xFFFFFFFF);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1082,7 +1090,7 @@ void dump_package1()
|
||||||
gfx_printf(&gfx_con, "Failed to create pkg_decr.bin\n");
|
gfx_printf(&gfx_con, "Failed to create pkg_decr.bin\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
gfx_puts(&gfx_con, "%kPackage1 dumped to pkg_decr.bin\n");
|
gfx_puts(&gfx_con, "%kpackage1 dumped to pkg_decr.bin\n");
|
||||||
|
|
||||||
// dump sm
|
// dump sm
|
||||||
if (save_to_file(secmon, 0x40000, "sm.bin") == -1) {
|
if (save_to_file(secmon, 0x40000, "sm.bin") == -1) {
|
||||||
|
@ -1153,8 +1161,6 @@ void launch_firmware()
|
||||||
else
|
else
|
||||||
gfx_printf(&gfx_con, "%kFailed to load 'hekate_ipl.ini'.%k\n", 0xFF0000FF, 0xFFFFFFFF);
|
gfx_printf(&gfx_con, "%kFailed to load 'hekate_ipl.ini'.%k\n", 0xFF0000FF, 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
gfx_printf(&gfx_con, "%kFailed to mount SD card (make sure that it is inserted).%k\n", 0xFF0000FF, 0xFFFFFFFF);
|
|
||||||
|
|
||||||
if (!cfg_sec)
|
if (!cfg_sec)
|
||||||
gfx_printf(&gfx_con, "Using default launch configuration.\n");
|
gfx_printf(&gfx_con, "Using default launch configuration.\n");
|
||||||
|
@ -1227,7 +1233,7 @@ ment_t ment_tools[] = {
|
||||||
MDEF_HANDLER("Dump eMMC SYS", dump_emmc_system),
|
MDEF_HANDLER("Dump eMMC SYS", dump_emmc_system),
|
||||||
MDEF_HANDLER("Dump eMMC USER", dump_emmc_user),
|
MDEF_HANDLER("Dump eMMC USER", dump_emmc_user),
|
||||||
MDEF_HANDLER("Dump eMMC BOOT", dump_emmc_boot),
|
MDEF_HANDLER("Dump eMMC BOOT", dump_emmc_boot),
|
||||||
MDEF_HANDLER("Dump Package1", dump_package1),
|
MDEF_HANDLER("Dump package1", dump_package1),
|
||||||
MDEF_END()
|
MDEF_END()
|
||||||
};
|
};
|
||||||
menu_t menu_tools = {
|
menu_t menu_tools = {
|
||||||
|
|
Loading…
Reference in a new issue