mirror of
https://github.com/CTCaer/hekate
synced 2024-11-16 08:59:26 +00:00
Bug fixes, wording, etc
This commit is contained in:
parent
236ac03331
commit
1521315450
5 changed files with 76 additions and 76 deletions
98
ipl/ff.c
98
ipl/ff.c
|
@ -26,7 +26,7 @@
|
|||
#include "gfx.h"
|
||||
extern gfx_ctxt_t gfx_ctxt;
|
||||
extern gfx_con_t gfx_con;
|
||||
#define EFSPRINTF(text, ...) gfx_printf(&gfx_con, "\n\n\n%k[FatFS] "text"%k\n", 0xFF00FFFF, 0xFFFFFFFF)
|
||||
#define EFSPRINTF(text, ...) gfx_printf(&gfx_con, "\n\n\n%k[FatFS] Error: "text"%k\n", 0xFF00FFFF, 0xFFFFFFFF)
|
||||
//#define EFSPRINTF(...)
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
|
@ -3259,7 +3259,7 @@ FRESULT find_volume ( /* FR_OK(0): successful, !=0: any error occurred */
|
|||
stat = disk_status(fs->pdrv);
|
||||
if (!(stat & STA_NOINIT)) { /* and the physical drive is kept initialized */
|
||||
if (!FF_FS_READONLY && mode && (stat & STA_PROTECT)) { /* Check write protection if needed */
|
||||
EFSPRINTF("Error: Write protected!");
|
||||
EFSPRINTF("Write protected!");
|
||||
return FR_WRITE_PROTECTED;
|
||||
}
|
||||
return FR_OK; /* The filesystem object is valid */
|
||||
|
@ -3273,11 +3273,11 @@ FRESULT find_volume ( /* FR_OK(0): successful, !=0: any error occurred */
|
|||
fs->pdrv = LD2PD(vol); /* Bind the logical drive and a physical drive */
|
||||
stat = disk_initialize(fs->pdrv); /* Initialize the physical drive */
|
||||
if (stat & STA_NOINIT) { /* Check if the initialization succeeded */
|
||||
EFSPRINTF("Error: Medium not ready or hard error!");
|
||||
EFSPRINTF("Medium not ready or hard error!");
|
||||
return FR_NOT_READY; /* Failed to initialize due to no medium or hard error */
|
||||
}
|
||||
if (!FF_FS_READONLY && mode && (stat & STA_PROTECT)) { /* Check disk write protection if needed */
|
||||
EFSPRINTF("Error: Write protected!");
|
||||
EFSPRINTF("Write protected!");
|
||||
return FR_WRITE_PROTECTED;
|
||||
}
|
||||
#if FF_MAX_SS != FF_MIN_SS /* Get sector size (multiple sector size cfg only) */
|
||||
|
@ -3301,11 +3301,11 @@ FRESULT find_volume ( /* FR_OK(0): successful, !=0: any error occurred */
|
|||
} while (LD2PT(vol) == 0 && fmt >= 2 && ++i < 4);
|
||||
}
|
||||
if (fmt == 4) {
|
||||
EFSPRINTF("Error: Disk I/O error - Could not load boot record!");
|
||||
EFSPRINTF("Disk I/O error - Could not load boot record!");
|
||||
return FR_DISK_ERR; /* An error occured in the disk I/O layer */
|
||||
}
|
||||
if (fmt >= 2) {
|
||||
EFSPRINTF("Error: No FAT/FAT32/exFAT filesystem found!");
|
||||
EFSPRINTF("No FAT/FAT32/exFAT filesystem found!");
|
||||
return FR_NO_FILESYSTEM; /* No FAT volume is found */
|
||||
}
|
||||
|
||||
|
@ -3316,21 +3316,24 @@ FRESULT find_volume ( /* FR_OK(0): successful, !=0: any error occurred */
|
|||
QWORD maxlba;
|
||||
|
||||
for (i = BPB_ZeroedEx; i < BPB_ZeroedEx + 53 && fs->win[i] == 0; i++) ; /* Check zero filler */
|
||||
if (i < BPB_ZeroedEx + 53) return FR_NO_FILESYSTEM;
|
||||
if (i < BPB_ZeroedEx + 53) {
|
||||
EFSPRINTF("exFAT - Zero filler check failed!");
|
||||
return FR_NO_FILESYSTEM;
|
||||
}
|
||||
|
||||
if (ld_word(fs->win + BPB_FSVerEx) != 0x100) {
|
||||
EFSPRINTF("Error: exFAT - Version check failed!");
|
||||
EFSPRINTF("exFAT - Version check failed!");
|
||||
return FR_NO_FILESYSTEM; /* Check exFAT version (must be version 1.0) */
|
||||
}
|
||||
|
||||
if (1 << fs->win[BPB_BytsPerSecEx] != SS(fs)) { /* (BPB_BytsPerSecEx must be equal to the physical sector size) */
|
||||
EFSPRINTF("Error: exFAT - Bytes per sector does not match physical sector size!");
|
||||
EFSPRINTF("exFAT - Bytes per sector does not match physical sector size!");
|
||||
return FR_NO_FILESYSTEM;
|
||||
}
|
||||
|
||||
maxlba = ld_qword(fs->win + BPB_TotSecEx) + bsect; /* Last LBA + 1 of the volume */
|
||||
if (maxlba >= 0x100000000) {
|
||||
EFSPRINTF("Error: exFAT - Cannot handle volume LBA with 32-bit LBA!");
|
||||
EFSPRINTF("exFAT - Cannot handle volume LBA with 32-bit LBA!");
|
||||
return FR_NO_FILESYSTEM; /* (It cannot be handled in 32-bit LBA) */
|
||||
}
|
||||
|
||||
|
@ -3338,19 +3341,19 @@ FRESULT find_volume ( /* FR_OK(0): successful, !=0: any error occurred */
|
|||
|
||||
fs->n_fats = fs->win[BPB_NumFATsEx]; /* Number of FATs */
|
||||
if (fs->n_fats != 1) {
|
||||
EFSPRINTF("Error: exFAT - Multiple or no file allocation tables found!");
|
||||
EFSPRINTF("exFAT - Multiple or no file allocation tables found!");
|
||||
return FR_NO_FILESYSTEM; /* (Supports only 1 FAT) */
|
||||
}
|
||||
|
||||
fs->csize = 1 << fs->win[BPB_SecPerClusEx]; /* Cluster size */
|
||||
if (fs->csize == 0) {
|
||||
EFSPRINTF("Error: exFAT - Cluster size is not between 1KB - 32KB!");
|
||||
EFSPRINTF("exFAT - Cluster size is not between 1KB - 32KB!");
|
||||
return FR_NO_FILESYSTEM; /* (Must be 1..32768) */
|
||||
}
|
||||
|
||||
nclst = ld_dword(fs->win + BPB_NumClusEx); /* Number of clusters */
|
||||
if (nclst > MAX_EXFAT) {
|
||||
EFSPRINTF("Error: exFAT - Total clusters exceed allowed!");
|
||||
EFSPRINTF("exFAT - Total clusters exceed allowed!");
|
||||
return FR_NO_FILESYSTEM; /* (Too many clusters) */
|
||||
}
|
||||
fs->n_fatent = nclst + 2;
|
||||
|
@ -3360,20 +3363,23 @@ FRESULT find_volume ( /* FR_OK(0): successful, !=0: any error occurred */
|
|||
fs->database = bsect + ld_dword(fs->win + BPB_DataOfsEx);
|
||||
fs->fatbase = bsect + ld_dword(fs->win + BPB_FatOfsEx);
|
||||
if (maxlba < (QWORD)fs->database + nclst * fs->csize) {
|
||||
EFSPRINTF("Error: exFAT - Volume size is lower than required!");
|
||||
EFSPRINTF("exFAT - Volume size is lower than required!");
|
||||
return FR_NO_FILESYSTEM; /* (Volume size must not be smaller than the size required) */
|
||||
}
|
||||
fs->dirbase = ld_dword(fs->win + BPB_RootClusEx);
|
||||
|
||||
/* Check if bitmap location is in assumption (at the first cluster) */
|
||||
if (move_window(fs, clst2sect(fs, fs->dirbase)) != FR_OK) {
|
||||
EFSPRINTF("Error: exFAT - Bitmap location not at first cluster!");
|
||||
EFSPRINTF("exFAT - Bitmap location not at first cluster!");
|
||||
return FR_DISK_ERR;
|
||||
}
|
||||
for (i = 0; i < SS(fs); i += SZDIRE) {
|
||||
if (fs->win[i] == 0x81 && ld_dword(fs->win + i + 20) == 2) break; /* 81 entry with cluster #2? */
|
||||
}
|
||||
if (i == SS(fs)) return FR_NO_FILESYSTEM;
|
||||
if (i == SS(fs)) {
|
||||
EFSPRINTF("exFAT - Bitmap allocation is missing!");
|
||||
return FR_NO_FILESYSTEM;
|
||||
}
|
||||
#if !FF_FS_READONLY
|
||||
fs->last_clst = fs->free_clst = 0xFFFFFFFF; /* Initialize cluster allocation information */
|
||||
#endif
|
||||
|
@ -3382,7 +3388,7 @@ FRESULT find_volume ( /* FR_OK(0): successful, !=0: any error occurred */
|
|||
#endif /* FF_FS_EXFAT */
|
||||
{
|
||||
if (ld_word(fs->win + BPB_BytsPerSec) != SS(fs)) {
|
||||
EFSPRINTF("Error: FAT - Bytes per sector does not match physical sector size!");
|
||||
EFSPRINTF("FAT - Bytes per sector does not match physical sector size!");
|
||||
return FR_NO_FILESYSTEM; /* (BPB_BytsPerSec must be equal to the physical sector size) */
|
||||
}
|
||||
|
||||
|
@ -3392,20 +3398,20 @@ FRESULT find_volume ( /* FR_OK(0): successful, !=0: any error occurred */
|
|||
|
||||
fs->n_fats = fs->win[BPB_NumFATs]; /* Number of FATs */
|
||||
if (fs->n_fats != 1 && fs->n_fats != 2) {
|
||||
EFSPRINTF("Error: FAT - No or more than 2 file allocation tables found!");
|
||||
EFSPRINTF("FAT - No or more than 2 file allocation tables found!");
|
||||
return FR_NO_FILESYSTEM; /* (Must be 1 or 2) */
|
||||
}
|
||||
fasize *= fs->n_fats; /* Number of sectors for FAT area */
|
||||
|
||||
fs->csize = fs->win[BPB_SecPerClus]; /* Cluster size */
|
||||
if (fs->csize == 0 || (fs->csize & (fs->csize - 1))) {
|
||||
EFSPRINTF("Error: FAT - Cluster size is not a power of 2!");
|
||||
EFSPRINTF("FAT - Cluster size is not a power of 2!");
|
||||
return FR_NO_FILESYSTEM; /* (Must be power of 2) */
|
||||
}
|
||||
|
||||
fs->n_rootdir = ld_word(fs->win + BPB_RootEntCnt); /* Number of root directory entries */
|
||||
if (fs->n_rootdir % (SS(fs) / SZDIRE)) {
|
||||
EFSPRINTF("Error: FAT - Root directory entries are not sector aligned!");
|
||||
EFSPRINTF("FAT - Root directory entries are not sector aligned!");
|
||||
return FR_NO_FILESYSTEM; /* (Must be sector aligned) */
|
||||
}
|
||||
|
||||
|
@ -3414,19 +3420,19 @@ FRESULT find_volume ( /* FR_OK(0): successful, !=0: any error occurred */
|
|||
|
||||
nrsv = ld_word(fs->win + BPB_RsvdSecCnt); /* Number of reserved sectors */
|
||||
if (nrsv == 0) {
|
||||
EFSPRINTF("Error: FAT - Zero reserved sectors!");
|
||||
EFSPRINTF("FAT - Zero reserved sectors!");
|
||||
return FR_NO_FILESYSTEM; /* (Must not be 0) */
|
||||
}
|
||||
|
||||
/* Determine the FAT sub type */
|
||||
sysect = nrsv + fasize + fs->n_rootdir / (SS(fs) / SZDIRE); /* RSV + FAT + DIR */
|
||||
if (tsect < sysect) {
|
||||
EFSPRINTF("Error: FAT - Invalid volume size!");
|
||||
EFSPRINTF("FAT - Invalid volume size!");
|
||||
return FR_NO_FILESYSTEM; /* (Invalid volume size) */
|
||||
}
|
||||
nclst = (tsect - sysect) / fs->csize; /* Number of clusters */
|
||||
if (nclst == 0) {
|
||||
EFSPRINTF("Error: FAT - Invalid volume size!");
|
||||
EFSPRINTF("FAT - Invalid volume size!");
|
||||
return FR_NO_FILESYSTEM; /* (Invalid volume size) */
|
||||
}
|
||||
fmt = 0;
|
||||
|
@ -3434,7 +3440,7 @@ FRESULT find_volume ( /* FR_OK(0): successful, !=0: any error occurred */
|
|||
if (nclst <= MAX_FAT16) fmt = FS_FAT16;
|
||||
if (nclst <= MAX_FAT12) fmt = FS_FAT12;
|
||||
if (fmt == 0) {
|
||||
EFSPRINTF("Error: FAT - Not compatible FAT12/16/32 filesystem!");
|
||||
EFSPRINTF("FAT - Not compatible FAT12/16/32 filesystem!");
|
||||
return FR_NO_FILESYSTEM;
|
||||
}
|
||||
|
||||
|
@ -3445,18 +3451,18 @@ FRESULT find_volume ( /* FR_OK(0): successful, !=0: any error occurred */
|
|||
fs->database = bsect + sysect; /* Data start sector */
|
||||
if (fmt == FS_FAT32) {
|
||||
if (ld_word(fs->win + BPB_FSVer32) != 0) {
|
||||
EFSPRINTF("Error: FAT32 - Not a 0.0 revision!");
|
||||
EFSPRINTF("FAT32 - Not a 0.0 revision!");
|
||||
return FR_NO_FILESYSTEM; /* (Must be FAT32 revision 0.0) */
|
||||
}
|
||||
if (fs->n_rootdir != 0) {
|
||||
EFSPRINTF("Error: FAT32 - Root entry sector is not 0!");
|
||||
EFSPRINTF("FAT32 - Root entry sector is not 0!");
|
||||
return FR_NO_FILESYSTEM; /* (BPB_RootEntCnt must be 0) */
|
||||
}
|
||||
fs->dirbase = ld_dword(fs->win + BPB_RootClus32); /* Root directory start cluster */
|
||||
szbfat = fs->n_fatent * 4; /* (Needed FAT size) */
|
||||
} else {
|
||||
if (fs->n_rootdir == 0) {
|
||||
EFSPRINTF("Error: FAT - Root entry sector is 0!");
|
||||
EFSPRINTF("FAT - Root entry sector is 0!");
|
||||
return FR_NO_FILESYSTEM; /* (BPB_RootEntCnt must not be 0) */
|
||||
}
|
||||
fs->dirbase = fs->fatbase + fasize; /* Root directory start sector */
|
||||
|
@ -3464,7 +3470,7 @@ FRESULT find_volume ( /* FR_OK(0): successful, !=0: any error occurred */
|
|||
fs->n_fatent * 2 : fs->n_fatent * 3 / 2 + (fs->n_fatent & 1);
|
||||
}
|
||||
if (fs->fsize < (szbfat + (SS(fs) - 1)) / SS(fs)) {
|
||||
EFSPRINTF("Error: FAT - FAT size is not the required size!");
|
||||
EFSPRINTF("FAT - FAT size is not the required size!");
|
||||
return FR_NO_FILESYSTEM; /* (BPB_FATSz must not be less than the size needed) */
|
||||
}
|
||||
|
||||
|
@ -3578,7 +3584,7 @@ FRESULT f_mount (
|
|||
/* Get logical drive number */
|
||||
vol = get_ldnumber(&rp);
|
||||
if (vol < 0) {
|
||||
EFSPRINTF("Error: Invalid drive!");
|
||||
EFSPRINTF("Invalid drive!");
|
||||
return FR_INVALID_DRIVE;
|
||||
}
|
||||
cfs = FatFs[vol]; /* Pointer to fs object */
|
||||
|
@ -3822,11 +3828,11 @@ FRESULT f_read (
|
|||
*br = 0; /* Clear read byte counter */
|
||||
res = validate(&fp->obj, &fs); /* Check validity of the file object */
|
||||
if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) {
|
||||
EFSPRINTF("Error: File object Validation!");
|
||||
EFSPRINTF("File object Validation!");
|
||||
LEAVE_FF(fs, res); /* Check validity */
|
||||
}
|
||||
if (!(fp->flag & FA_READ)) {
|
||||
EFSPRINTF("Error: Access denied!");
|
||||
EFSPRINTF("Access denied!");
|
||||
LEAVE_FF(fs, FR_DENIED); /* Check access mode */
|
||||
}
|
||||
remain = fp->obj.objsize - fp->fptr;
|
||||
|
@ -3850,18 +3856,18 @@ FRESULT f_read (
|
|||
}
|
||||
}
|
||||
if (clst < 2) {
|
||||
EFSPRINTF("Error: Cluster status check or Internal error!");
|
||||
EFSPRINTF("Cluster status check or Internal error!");
|
||||
ABORT(fs, FR_INT_ERR);
|
||||
}
|
||||
if (clst == 0xFFFFFFFF) {
|
||||
EFSPRINTF("Error: Disk error (cluster hard error)!");
|
||||
EFSPRINTF("Disk error (cluster hard error)!");
|
||||
ABORT(fs, FR_DISK_ERR);
|
||||
}
|
||||
fp->clust = clst; /* Update current cluster */
|
||||
}
|
||||
sect = clst2sect(fs, fp->clust); /* Get current sector */
|
||||
if (sect == 0) {
|
||||
EFSPRINTF("Error: Get current sector error!");
|
||||
EFSPRINTF("Get current sector error!");
|
||||
ABORT(fs, FR_INT_ERR);
|
||||
}
|
||||
sect += csect;
|
||||
|
@ -3871,7 +3877,7 @@ FRESULT f_read (
|
|||
cc = fs->csize - csect;
|
||||
}
|
||||
if (disk_read(fs->pdrv, rbuff, sect, cc) != RES_OK) {
|
||||
EFSPRINTF("Error: Read - Low level disk I/O!");
|
||||
EFSPRINTF("Read - Low level disk I/O!");
|
||||
ABORT(fs, FR_DISK_ERR);
|
||||
}
|
||||
#if !FF_FS_READONLY && FF_FS_MINIMIZE <= 2 /* Replace one of the read sectors with cached data if it contains a dirty sector */
|
||||
|
@ -3893,14 +3899,14 @@ FRESULT f_read (
|
|||
#if !FF_FS_READONLY
|
||||
if (fp->flag & FA_DIRTY) { /* Write-back dirty sector cache */
|
||||
if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) {
|
||||
EFSPRINTF("Error: Write-back dirty sector cache!");
|
||||
EFSPRINTF("Write-back dirty sector cache!");
|
||||
ABORT(fs, FR_DISK_ERR);
|
||||
}
|
||||
fp->flag &= (BYTE)~FA_DIRTY;
|
||||
}
|
||||
#endif
|
||||
if (disk_read(fs->pdrv, fp->buf, sect, 1) != RES_OK) {
|
||||
EFSPRINTF("Error: Read - Low level disk I/O!\n(fill sector cache)");
|
||||
EFSPRINTF("Read - Low level disk I/O!\n(fill sector cache)");
|
||||
ABORT(fs, FR_DISK_ERR); /* Fill sector cache */
|
||||
}
|
||||
}
|
||||
|
@ -3945,11 +3951,11 @@ FRESULT f_write (
|
|||
*bw = 0; /* Clear write byte counter */
|
||||
res = validate(&fp->obj, &fs); /* Check validity of the file object */
|
||||
if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) {
|
||||
EFSPRINTF("Error: File object Validation!");
|
||||
EFSPRINTF("File object Validation!");
|
||||
LEAVE_FF(fs, res); /* Check validity */
|
||||
}
|
||||
if (!(fp->flag & FA_WRITE)) {
|
||||
EFSPRINTF("Error: Access denied!");
|
||||
EFSPRINTF("Access denied!");
|
||||
LEAVE_FF(fs, FR_DENIED); /* Check access mode */
|
||||
}
|
||||
|
||||
|
@ -3979,15 +3985,15 @@ FRESULT f_write (
|
|||
}
|
||||
}
|
||||
if (clst == 0) {
|
||||
EFSPRINTF("Error: Could not allocate a new cluster\n(disk full or low level disk I/O error)!");
|
||||
EFSPRINTF("Could not allocate a new cluster\n(disk full or low level disk I/O error)!");
|
||||
break; /* Could not allocate a new cluster (disk full) */
|
||||
}
|
||||
if (clst == 1) {
|
||||
EFSPRINTF("Error: Cluster status check or Internal error!");
|
||||
EFSPRINTF("Cluster status check or Internal error!");
|
||||
ABORT(fs, FR_INT_ERR);
|
||||
}
|
||||
if (clst == 0xFFFFFFFF) {
|
||||
EFSPRINTF("Error: Disk error (cluster hard error)!");
|
||||
EFSPRINTF("Disk error (cluster hard error)!");
|
||||
ABORT(fs, FR_DISK_ERR);
|
||||
}
|
||||
fp->clust = clst; /* Update current cluster */
|
||||
|
@ -3998,7 +4004,7 @@ FRESULT f_write (
|
|||
#else
|
||||
if (fp->flag & FA_DIRTY) { /* Write-back sector cache */
|
||||
if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) {
|
||||
EFSPRINTF("Error: Write-back sector cache!");
|
||||
EFSPRINTF("Write-back sector cache!");
|
||||
ABORT(fs, FR_DISK_ERR);
|
||||
}
|
||||
fp->flag &= (BYTE)~FA_DIRTY;
|
||||
|
@ -4006,7 +4012,7 @@ FRESULT f_write (
|
|||
#endif
|
||||
sect = clst2sect(fs, fp->clust); /* Get current sector */
|
||||
if (sect == 0) {
|
||||
EFSPRINTF("Error: Get current sector error!");
|
||||
EFSPRINTF("Get current sector error!");
|
||||
ABORT(fs, FR_INT_ERR);
|
||||
}
|
||||
sect += csect;
|
||||
|
@ -4016,7 +4022,7 @@ FRESULT f_write (
|
|||
cc = fs->csize - csect;
|
||||
}
|
||||
if (disk_write(fs->pdrv, wbuff, sect, cc) != RES_OK) {
|
||||
EFSPRINTF("Error: Write - Low level disk I/O!");
|
||||
EFSPRINTF("Write - Low level disk I/O!");
|
||||
ABORT(fs, FR_DISK_ERR);
|
||||
}
|
||||
#if FF_FS_MINIMIZE <= 2
|
||||
|
@ -4044,7 +4050,7 @@ FRESULT f_write (
|
|||
if (fp->sect != sect && /* Fill sector cache with file data */
|
||||
fp->fptr < fp->obj.objsize &&
|
||||
disk_read(fs->pdrv, fp->buf, sect, 1) != RES_OK) {
|
||||
EFSPRINTF("Error: Read - Low level disk I/O!\n(Could not fill sector cache with file data)");
|
||||
EFSPRINTF("Read - Low level disk I/O!\n(Could not fill sector cache with file data)");
|
||||
ABORT(fs, FR_DISK_ERR);
|
||||
}
|
||||
#endif
|
||||
|
|
30
ipl/hos.c
30
ipl/hos.c
|
@ -35,8 +35,8 @@
|
|||
#include "gfx.h"
|
||||
extern gfx_ctxt_t gfx_ctxt;
|
||||
extern gfx_con_t gfx_con;
|
||||
#define DPRINTF(...) gfx_printf(&gfx_con, __VA_ARGS__)
|
||||
//#define DPRINTF(...)
|
||||
//#define DPRINTF(...) gfx_printf(&gfx_con, __VA_ARGS__)
|
||||
#define DPRINTF(...)
|
||||
|
||||
enum KB_FIRMWARE_VERSION {
|
||||
KB_FIRMWARE_VERSION_100_200 = 0,
|
||||
|
@ -213,10 +213,10 @@ static int _read_emmc_pkg1(launch_ctxt_t *ctxt)
|
|||
ctxt->pkg1_id = pkg1_identify(ctxt->pkg1);
|
||||
if (!ctxt->pkg1_id)
|
||||
{
|
||||
DPRINTF("%kCould not identify package1 version (= '%s').%k\n", 0xFF0000FF, (char *)ctxt->pkg1 + 0x10, 0xFFFFFFFF);
|
||||
gfx_printf(&gfx_con, "%kCould not identify package1 version (= '%s').%k\n", 0xFF0000FF, (char *)ctxt->pkg1 + 0x10, 0xFFFFFFFF);
|
||||
goto out;
|
||||
}
|
||||
DPRINTF("Identified package1 ('%s'), keyblob version %d\n", (char *)(ctxt->pkg1 + 0x10), ctxt->pkg1_id->kb);
|
||||
gfx_printf(&gfx_con, "Identified package1 ('%s'), Keyblob version %d\n\n", (char *)(ctxt->pkg1 + 0x10), ctxt->pkg1_id->kb);
|
||||
|
||||
//Read the correct keyblob.
|
||||
ctxt->keyblob = (u8 *)malloc(NX_EMMC_BLOCKSIZE);
|
||||
|
@ -241,7 +241,7 @@ static int _read_emmc_pkg2(launch_ctxt_t *ctxt)
|
|||
//Parse eMMC GPT.
|
||||
LIST_INIT(gpt);
|
||||
nx_emmc_gpt_parse(&gpt, &storage);
|
||||
DPRINTF("parsed GPT\n");
|
||||
DPRINTF("Parsed GPT\n");
|
||||
//Find package2 partition.
|
||||
emmc_part_t *pkg2_part = nx_emmc_part_find(&gpt, "BCPKG2-1-Normal-Main");
|
||||
if (!pkg2_part)
|
||||
|
@ -315,7 +315,7 @@ static int _config_kip1(launch_ctxt_t *ctxt, const char *value)
|
|||
merge_kip_t *mkip1 = (merge_kip_t *)malloc(sizeof(merge_kip_t));
|
||||
mkip1->kip1 = malloc(f_size(&fp));
|
||||
f_read(&fp, mkip1->kip1, f_size(&fp), NULL);
|
||||
DPRINTF("loaded kip from SD (size %08X)\n", f_size(&fp));
|
||||
DPRINTF("Loaded kip1 from SD (size %08X)\n", f_size(&fp));
|
||||
f_close(&fp);
|
||||
list_append(&ctxt->kip1_list, &mkip1->link);
|
||||
return 1;
|
||||
|
@ -358,11 +358,7 @@ int hos_launch(ini_sec_t *cfg)
|
|||
if (!_read_emmc_pkg1(&ctxt))
|
||||
return 0;
|
||||
|
||||
//XXX: remove this once we support 3+.
|
||||
//if (ctxt.pkg1_id->kb > 0)
|
||||
// return 0;
|
||||
|
||||
DPRINTF("loaded pkg1 and keyblob\n");
|
||||
gfx_printf(&gfx_con, "Loaded package1 and keyblob\n");
|
||||
//Generate keys.
|
||||
keygen(ctxt.keyblob, ctxt.pkg1_id->kb, (u8 *)ctxt.pkg1 + ctxt.pkg1_id->tsec_off);
|
||||
DPRINTF("generated keys\n");
|
||||
|
@ -373,7 +369,7 @@ DPRINTF("generated keys\n");
|
|||
pkg1_unpack((void *)0x8000D000, (void *)ctxt.pkg1_id->secmon_base, ctxt.pkg1_id, ctxt.pkg1);
|
||||
//gfx_hexdump(&gfx_con, 0x8000D000, (void *)0x8000D000, 0x100);
|
||||
//gfx_hexdump(&gfx_con, ctxt.pkg1_id->secmon_base, (void *)ctxt.pkg1_id->secmon_base, 0x100);
|
||||
DPRINTF("decrypted and unpacked pkg1\n");
|
||||
gfx_printf(&gfx_con, "Decrypted and unpacked package1\n");
|
||||
}
|
||||
//Replace 'warmboot.bin' if requested.
|
||||
if (ctxt.warmboot)
|
||||
|
@ -399,14 +395,14 @@ DPRINTF("decrypted and unpacked pkg1\n");
|
|||
if (!_read_emmc_pkg2(&ctxt))
|
||||
return 0;
|
||||
|
||||
DPRINTF("read pkg2\n");
|
||||
gfx_printf(&gfx_con, "Read package2\n");
|
||||
//Decrypt package2 and parse KIP1 blobs in INI1 section.
|
||||
pkg2_hdr_t *pkg2_hdr = pkg2_decrypt(ctxt.pkg2);
|
||||
|
||||
LIST_INIT(kip1_info);
|
||||
pkg2_parse_kips(&kip1_info, pkg2_hdr);
|
||||
|
||||
DPRINTF("parsed ini1\n");
|
||||
gfx_printf(&gfx_con, "Parsed ini1\n");
|
||||
|
||||
//Use the kernel included in package2 in case we didn't load one already.
|
||||
if (!ctxt.kernel)
|
||||
|
@ -421,13 +417,13 @@ DPRINTF("decrypted and unpacked pkg1\n");
|
|||
|
||||
//Rebuild and encrypt package2.
|
||||
pkg2_build_encrypt((void *)0xA9800000, ctxt.kernel, ctxt.kernel_size, &kip1_info);
|
||||
DPRINTF("rebuilt pkg2\n");
|
||||
gfx_printf(&gfx_con, "Rebuilt and loaded package2\n");
|
||||
} else {
|
||||
//Read package2.
|
||||
if (!_read_emmc_pkg2(&ctxt))
|
||||
return 0;
|
||||
|
||||
DPRINTF("read pkg2\n");
|
||||
gfx_printf(&gfx_con, "Loaded package2\n");
|
||||
memcpy((void *)0xA9800000, ctxt.pkg2, ctxt.pkg2_size);
|
||||
}
|
||||
}
|
||||
|
@ -446,8 +442,6 @@ DPRINTF("decrypted and unpacked pkg1\n");
|
|||
case KB_FIRMWARE_VERSION_400:
|
||||
case KB_FIRMWARE_VERSION_500:
|
||||
se_key_acc_ctrl(0xC, 0xFF);
|
||||
//se_key_acc_ctrl(0xD, 0xFF);
|
||||
//se_key_acc_ctrl(0xE, 0xFF);
|
||||
se_key_acc_ctrl(0xF, 0xFF);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -516,7 +516,7 @@ void print_mmc_info()
|
|||
boot_size / 1024, boot_size / 1024 / 512);
|
||||
gfx_printf(&gfx_con, " 3: %kRPMB %kSize: %5d KiB (LBA Sectors: 0x%07X)\n", 0xFF00FF96, 0xFFCCCCCC,
|
||||
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_printf(&gfx_con, " 0: %kGPP (USER) %kSize: %5d MiB (LBA Sectors: 0x%07X)\n\n", 0xFF00FF96, 0xFFCCCCCC,
|
||||
storage.sec_cnt >> SECTORS_TO_MIB_COEFF, storage.sec_cnt);
|
||||
gfx_printf(&gfx_con, "%kGPP (eMMC USER) partition table:%k\n", 0xFFFFDD00, 0xFFCCCCCC);
|
||||
|
||||
|
@ -1287,12 +1287,12 @@ out:;
|
|||
void about()
|
||||
{
|
||||
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"
|
||||
"Greetings to: fincs, hexkyz, SciresM, Shiny Quagsire, WinterMute\n\n"
|
||||
"Open source and free packages used:\n"
|
||||
" - FatFs R0.13a (Copyright (C) 2017, ChaN)\n"
|
||||
" - bcl-1.2.0 (Copyright (c) 2003-2006 Marcus Geelnard)\n\n"
|
||||
" - FatFs R0.13a, (Copyright (C) 2017, ChaN)\n"
|
||||
" - bcl-1.2.0, (Copyright (C) 2003-2006, Marcus Geelnard)\n\n"
|
||||
" %k___\n"
|
||||
" .-' `'.\n"
|
||||
" / \\\n"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "tui.h"
|
||||
#include "btn.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, u32 fgcol, u32 bgcol)
|
||||
{
|
||||
u32 cx, cy;
|
||||
|
||||
|
@ -25,14 +25,14 @@ void tui_pbar(gfx_con_t *con, int x, int y, u32 val)
|
|||
|
||||
gfx_con_setpos(con, x, y);
|
||||
|
||||
gfx_printf(con, "[%3d%%]", val);
|
||||
gfx_printf(con, "%k[%3d%%]%k", fgcol, val, bgcol);
|
||||
|
||||
x += 7 * 8;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
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, y + i + 1, x + 3 * val, y + i + 1, fgcol);
|
||||
gfx_line(con->gfx_ctxt, x + 3 * val, y + i + 1, x + 3 * 100, y + i + 1, bgcol);
|
||||
}
|
||||
|
||||
gfx_con_setpos(con, cx, cy);
|
||||
|
|
|
@ -57,7 +57,7 @@ typedef struct _menu_t
|
|||
#define MDEF_CAPTION(caption, color) { MENT_CAPTION, caption, color }
|
||||
#define MDEF_CHGLINE() {MENT_CHGLINE}
|
||||
|
||||
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, u32 fgcol, u32 bgcol);
|
||||
void *tui_do_menu(gfx_con_t *con, menu_t *menu);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue