hos: Add identification for hos 5.1.0

This commit is contained in:
CTCaer 2020-06-14 13:58:03 +03:00
parent 3c6c92aa9c
commit 3aa195943d
2 changed files with 16 additions and 6 deletions

View file

@ -610,7 +610,7 @@ static void _free_launch_components(launch_ctxt_t *ctxt)
free(ctxt->kip1_patches); free(ctxt->kip1_patches);
} }
static bool _get_fs_exfat_compatible(link_t *info) static bool _get_fs_exfat_compatible(link_t *info, bool *fs_is_510)
{ {
u32 fs_idx; u32 fs_idx;
u32 fs_ids_cnt; u32 fs_ids_cnt;
@ -631,6 +631,10 @@ static bool _get_fs_exfat_compatible(link_t *info)
if (!memcmp(sha_buf, kip_ids[fs_idx].hash, 8)) if (!memcmp(sha_buf, kip_ids[fs_idx].hash, 8))
break; break;
// Check if it's 5.1.0.
if ((fs_idx & ~1) == 16)
*fs_is_510 = true;
// Return false if FAT32 only. // Return false if FAT32 only.
if (fs_ids_cnt <= fs_idx && !(fs_idx & 1)) if (fs_ids_cnt <= fs_idx && !(fs_idx & 1))
return false; return false;
@ -888,14 +892,19 @@ int hos_launch(ini_sec_t *cfg)
LIST_FOREACH_ENTRY(merge_kip_t, mki, &ctxt.kip1_list, link) LIST_FOREACH_ENTRY(merge_kip_t, mki, &ctxt.kip1_list, link)
pkg2_merge_kip(&kip1_info, (pkg2_kip1_t *)mki->kip1); pkg2_merge_kip(&kip1_info, (pkg2_kip1_t *)mki->kip1);
// Check if FS is compatible with exFAT. // Check if FS is compatible with exFAT and if 5.1.0.
if (!ctxt.stock && sd_fs.fs_type == FS_EXFAT && !_get_fs_exfat_compatible(&kip1_info)) if (!ctxt.stock && (sd_fs.fs_type == FS_EXFAT || kb == KB_FIRMWARE_VERSION_500))
{ {
_hos_crit_error("SD Card is exFAT and the installed\nFS only supports FAT32!"); bool exfat_compat = _get_fs_exfat_compatible(&kip1_info, &ctxt.exo_ctx.fs_is_510);
if (sd_fs.fs_type == FS_EXFAT && !exfat_compat)
{
_hos_crit_error("SD Card is exFAT and installed HOS driver\nonly supports FAT32!");
_free_launch_components(&ctxt); _free_launch_components(&ctxt);
goto error; goto error;
} }
}
// Patch kip1s in memory if needed. // Patch kip1s in memory if needed.
const char* unappliedPatch = pkg2_patch_kips(&kip1_info, ctxt.kip1_patches); const char* unappliedPatch = pkg2_patch_kips(&kip1_info, ctxt.kip1_patches);

View file

@ -44,6 +44,7 @@
typedef struct _exo_ctxt_t typedef struct _exo_ctxt_t
{ {
bool fs_is_510;
bool no_user_exceptions; bool no_user_exceptions;
bool user_pmu; bool user_pmu;
bool *cal0_blank; bool *cal0_blank;