exo: Refactor exo_cfg context to exo_ctx

This commit is contained in:
CTCaer 2020-06-14 01:29:41 +03:00
parent 53325617bb
commit ba77de3dc5
4 changed files with 14 additions and 22 deletions

View file

@ -100,7 +100,7 @@ typedef struct _launch_ctxt_t
bool fss0_enable_experimental;
bool emummc_forced;
exo_ctxt_t exo_cfg;
exo_ctxt_t exo_ctx;
ini_sec_t *cfg;
} launch_ctxt_t;

View file

@ -68,7 +68,7 @@ static int _config_kip1(launch_ctxt_t *ctxt, const char *value)
u32 dirlen = 0;
dir[strlen(dir) - 2] = 0;
char *filelist = dirlist(dir, "*.kip*", false);
char *filelist = dirlist(dir, "*.kip*", false, false);
strcat(dir, "/");
dirlen = strlen(dir);
@ -205,7 +205,7 @@ static int _config_dis_exo_user_exceptions(launch_ctxt_t *ctxt, const char *valu
if (*value == '1')
{
DPRINTF("Disabled exosphere user exception handlers\n");
ctxt->exo_cfg.no_user_exceptions = true;
ctxt->exo_ctx.no_user_exceptions = true;
}
return 1;
}
@ -215,7 +215,7 @@ static int _config_exo_user_pmu_access(launch_ctxt_t *ctxt, const char *value)
if (*value == '1')
{
DPRINTF("Enabled user access to PMU\n");
ctxt->exo_cfg.user_pmu = true;
ctxt->exo_ctx.user_pmu = true;
}
return 1;
}
@ -223,12 +223,12 @@ static int _config_exo_user_pmu_access(launch_ctxt_t *ctxt, const char *value)
static int _config_exo_cal0_blanking(launch_ctxt_t *ctxt, const char *value)
{
// Override key found.
ctxt->exo_cfg.cal0_blank = calloc(sizeof(bool), 1);
ctxt->exo_ctx.cal0_blank = calloc(sizeof(bool), 1);
if (*value == '1')
{
DPRINTF("Enabled prodinfo blanking\n");
*ctxt->exo_cfg.cal0_blank = true;
*ctxt->exo_ctx.cal0_blank = true;
}
return 1;
}
@ -236,12 +236,12 @@ static int _config_exo_cal0_blanking(launch_ctxt_t *ctxt, const char *value)
static int _config_exo_cal0_writes_enable(launch_ctxt_t *ctxt, const char *value)
{
// Override key found.
ctxt->exo_cfg.cal0_allow_writes_sys = calloc(sizeof(bool), 1);
ctxt->exo_ctx.cal0_allow_writes_sys = calloc(sizeof(bool), 1);
if (*value == '1')
{
DPRINTF("Enabled prodinfo writes\n");
*ctxt->exo_cfg.cal0_allow_writes_sys = true;
*ctxt->exo_ctx.cal0_allow_writes_sys = true;
}
return 1;

View file

@ -214,21 +214,21 @@ void config_exosphere(launch_ctxt_t *ctxt)
exoFlags |= EXO_FLAG_DBG_USER;
// Disable proper failure handling.
if (ctxt->exo_cfg.no_user_exceptions)
if (ctxt->exo_ctx.no_user_exceptions)
exoFlags |= EXO_FLAG_NO_USER_EXC;
// Enable user access to PMU.
if (ctxt->exo_cfg.user_pmu)
if (ctxt->exo_ctx.user_pmu)
exoFlags |= EXO_FLAG_USER_PMU;
// Enable prodinfo blanking. Check if exo ini value is overridden. If not, check if enabled in exo ini.
if ((ctxt->exo_cfg.cal0_blank && *ctxt->exo_cfg.cal0_blank)
|| (!ctxt->exo_cfg.cal0_blank && cal0_blanking))
if ((ctxt->exo_ctx.cal0_blank && *ctxt->exo_ctx.cal0_blank)
|| (!ctxt->exo_ctx.cal0_blank && cal0_blanking))
exoFlags |= EXO_FLAG_CAL0_BLANKING;
// Allow prodinfo writes. Check if exo ini value is overridden. If not, check if enabled in exo ini.
if ((ctxt->exo_cfg.cal0_allow_writes_sys && *ctxt->exo_cfg.cal0_allow_writes_sys)
|| (!ctxt->exo_cfg.cal0_allow_writes_sys && cal0_allow_writes_sys))
if ((ctxt->exo_ctx.cal0_allow_writes_sys && *ctxt->exo_ctx.cal0_allow_writes_sys)
|| (!ctxt->exo_ctx.cal0_allow_writes_sys && cal0_allow_writes_sys))
exoFlags |= EXO_FLAG_CAL0_WRITES_SYS;
// Set mailbox values.

View file

@ -42,14 +42,6 @@
#define HOS_PKG11_MAGIC 0x31314B50
#define HOS_EKS_MAGIC 0x30534B45
typedef struct _exo_ctxt_t
{
bool no_user_exceptions;
bool user_pmu;
bool *cal0_blank;
bool *cal0_allow_writes_sys;
} exo_ctxt_t;
typedef struct _hos_eks_keys_t
{
u8 dkg[0x10];