hos: Fix compilation

This commit is contained in:
CTCaer 2021-08-28 17:55:03 +03:00
parent f5ec4a3a37
commit 063abb3e23
4 changed files with 39 additions and 43 deletions

View file

@ -691,7 +691,7 @@ static void _free_launch_components(launch_ctxt_t *ctxt)
free(ctxt->kip1_patches);
}
static bool _get_fs_exfat_compatible(link_t *info, bool *fs_is_510)
static bool _get_fs_exfat_compatible(link_t *info, u32 *hos_revision)
{
u32 fs_ids_cnt;
u32 sha_buf[32 / sizeof(u32)];
@ -711,9 +711,11 @@ static bool _get_fs_exfat_compatible(link_t *info, bool *fs_is_510)
{
if (!memcmp(sha_buf, kip_ids[fs_idx].hash, 8))
{
// Check if it's 5.1.0.
if ((fs_idx & ~1) == 16)
*fs_is_510 = true;
// HOS Api special handling.
if ((fs_idx & ~1) == 16) // Check if it's 5.1.0.
*hos_revision = 1;
else if ((fs_idx & ~1) == 34) // Check if it's 10.2.0.
*hos_revision = 2;
// Check if FAT32-only.
if (!(fs_idx & 1))
@ -827,7 +829,7 @@ int hos_launch(ini_sec_t *cfg)
config_kip1patch(&ctxt, "nogc");
}
gfx_puts("Loaded config, pkg1 and keyblob\n");
gfx_printf("Loaded config and pkg1\n%s mode\n", ctxt.stock ? "Stock" : "CFW");
// Check if secmon is exosphere.
if (ctxt.secmon)
@ -1005,7 +1007,7 @@ int hos_launch(ini_sec_t *cfg)
// Check if FS is compatible with exFAT and if 5.1.0.
if (!ctxt.stock && (sd_fs.fs_type == FS_EXFAT || kb == KB_FIRMWARE_VERSION_500))
{
bool exfat_compat = _get_fs_exfat_compatible(&kip1_info, &ctxt.exo_ctx.fs_is_510);
bool exfat_compat = _get_fs_exfat_compatible(&kip1_info, &ctxt.exo_ctx.hos_revision);
if (sd_fs.fs_type == FS_EXFAT && !exfat_compat)
{

View file

@ -49,7 +49,7 @@
typedef struct _exo_ctxt_t
{
bool fs_is_510;
u32 hos_revision;
bool no_user_exceptions;
bool user_pmu;
bool *usb3_force;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020 CTCaer
* Copyright (c) 2018-2021 CTCaer
* Copyright (c) 2019 Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
@ -149,7 +149,7 @@ typedef struct _atm_fatal_error_ctx
#define EXO_FW_VER(mj, mn, rv) (((mj) << 24) | ((mn) << 16) | ((rv) << 8))
void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base, bool exo_new)
void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base)
{
u32 exo_fw_no = 0;
u32 exo_flags = 0;
@ -175,8 +175,6 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base, bool exo_new)
exo_fw_no++;
// Feed old exosphere target versioning to new.
if (exo_new)
{
switch (exo_fw_no)
{
case 1 ... 4:
@ -184,10 +182,7 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base, bool exo_new)
exo_fw_no = EXO_FW_VER(exo_fw_no, 0, 0);
break;
case 5:
if (!ctxt->exo_ctx.fs_is_510)
exo_fw_no = EXO_FW_VER(5, 0, 0);
else
exo_fw_no = EXO_FW_VER(5, 1, 0);
exo_fw_no = EXO_FW_VER(5, ctxt->exo_ctx.hos_revision, 0);
break;
case 7:
exo_fw_no = EXO_FW_VER(6, 2, 0);
@ -205,10 +200,9 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base, bool exo_new)
exo_fw_no = EXO_FW_VER(9, 1, 0);
break;
case 13 ... 15:
exo_fw_no = EXO_FW_VER(exo_fw_no - 3, 0, 0);
exo_fw_no = EXO_FW_VER(exo_fw_no - 3, ctxt->exo_ctx.hos_revision, 0);
break;
}
}
// Parse exosphere.ini.
if (!ctxt->stock)

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2019 CTCaer
* Copyright (c) 2018-2021 CTCaer
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@ -19,7 +19,7 @@
#include <utils/types.h>
void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base, bool exo_new);
void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base);
void secmon_exo_check_panic();
#endif