exo: Add exosphere.ini support and cal0 blanking

exosphere.ini will always be loaded and the values set by it.

User can still choose to override them with the `cal0blank` and `cal0writesys` in a boot entry.

Override keys get a 0 or 1.
This commit is contained in:
CTCaer
2020-04-30 16:21:38 +03:00
parent f9b0ff70f7
commit 2094ac2bba
3 changed files with 97 additions and 11 deletions

View File

@@ -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_no_user_exceptions = true;
ctxt->exo_cfg.no_user_exceptions = true;
}
return 1;
}
@@ -215,11 +215,38 @@ 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_user_pmu = true;
ctxt->exo_cfg.user_pmu = true;
}
return 1;
}
static int _config_exo_cal0_blanking(launch_ctxt_t *ctxt, const char *value)
{
// Override key found.
ctxt->exo_cfg.cal0_blank = calloc(1, 1);
if (*value == '1')
{
DPRINTF("Enabled prodinfo blanking\n");
*ctxt->exo_cfg.cal0_blank = true;
}
return 1;
}
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(1, 1);
if (*value == '1')
{
DPRINTF("Enabled prodinfo writes\n");
*ctxt->exo_cfg.cal0_allow_writes_sys = true;
}
return 1;
}
static int _config_fss(launch_ctxt_t *ctxt, const char *value)
{
LIST_FOREACH_ENTRY(ini_kv_t, kv, &ctxt->cfg->kvs, link)
@@ -254,6 +281,8 @@ static const cfg_handler_t _config_handlers[] = {
{ "emummcforce", _config_emummc_forced },
{ "nouserexceptions", _config_dis_exo_user_exceptions },
{ "userpmu", _config_exo_user_pmu_access },
{ "cal0blank", _config_exo_cal0_blanking },
{ "cal0writesys", _config_exo_cal0_writes_enable },
{ NULL, NULL },
};
@@ -264,11 +293,15 @@ int parse_boot_config(launch_ctxt_t *ctxt)
for(u32 i = 0; _config_handlers[i].key; i++)
{
if (!strcmp(_config_handlers[i].key, kv->key))
{
if (!_config_handlers[i].handler(ctxt, kv->val))
{
gfx_con.mute = false;
EPRINTFARGS("Error while loading %s:\n%s", kv->key, kv->val);
return 0;
}
}
}
}