hos: homogenize return values

This commit is contained in:
CTCaer
2026-02-22 04:14:00 +02:00
committed by NaGa
parent 89b71d9e81
commit c5eefcb609
14 changed files with 255 additions and 245 deletions

View File

@@ -33,27 +33,27 @@ static int _config_warmboot(launch_ctxt_t *ctxt, const char *value)
{
ctxt->warmboot = emusd_file_read(value, &ctxt->warmboot_size);
if (!ctxt->warmboot)
return 0;
return 1;
return 1;
return 0;
}
static int _config_secmon(launch_ctxt_t *ctxt, const char *value)
{
ctxt->secmon = emusd_file_read(value, &ctxt->secmon_size);
if (!ctxt->secmon)
return 0;
return 1;
return 1;
return 0;
}
static int _config_kernel(launch_ctxt_t *ctxt, const char *value)
{
ctxt->kernel = emusd_file_read(value, &ctxt->kernel_size);
if (!ctxt->kernel)
return 0;
return 1;
return 1;
return 0;
}
static int _config_kip1(launch_ctxt_t *ctxt, const char *value)
@@ -91,7 +91,7 @@ static int _config_kip1(launch_ctxt_t *ctxt, const char *value)
free(dir);
free(filelist);
return 0;
return 1;
}
DPRINTF("Loaded kip1 from SD (size %08X)\n", size);
list_append(&ctxt->kip1_list, &mkip1->link);
@@ -111,20 +111,20 @@ static int _config_kip1(launch_ctxt_t *ctxt, const char *value)
{
free(mkip1);
return 0;
return 1;
}
DPRINTF("Loaded kip1 from SD (size %08X)\n", size);
list_append(&ctxt->kip1_list, &mkip1->link);
}
return 1;
return 0;
}
int config_kip1patch(launch_ctxt_t *ctxt, const char *value)
int hos_config_kip1patch(launch_ctxt_t *ctxt, const char *value)
{
int len = strlen(value);
if (!len)
return 0;
return 1;
if (ctxt->kip1_patches == NULL)
{
@@ -145,7 +145,8 @@ int config_kip1patch(launch_ctxt_t *ctxt, const char *value)
memcpy(&ctxt->kip1_patches[old_len], value, len);
ctxt->kip1_patches[old_len + len] = 0;
}
return 1;
return 0;
}
static int _config_svcperm(launch_ctxt_t *ctxt, const char *value)
@@ -155,7 +156,8 @@ static int _config_svcperm(launch_ctxt_t *ctxt, const char *value)
DPRINTF("Disabled SVC verification\n");
ctxt->svcperm = true;
}
return 1;
return 0;
}
static int _config_debugmode(launch_ctxt_t *ctxt, const char *value)
@@ -165,7 +167,8 @@ static int _config_debugmode(launch_ctxt_t *ctxt, const char *value)
DPRINTF("Enabled Debug mode\n");
ctxt->debugmode = true;
}
return 1;
return 0;
}
static int _config_stock(launch_ctxt_t *ctxt, const char *value)
@@ -175,7 +178,8 @@ static int _config_stock(launch_ctxt_t *ctxt, const char *value)
DPRINTF("Enabled stock mode\n");
ctxt->stock = true;
}
return 1;
return 0;
}
static int _config_emummc_forced(launch_ctxt_t *ctxt, const char *value)
@@ -185,7 +189,8 @@ static int _config_emummc_forced(launch_ctxt_t *ctxt, const char *value)
DPRINTF("Forced emuMMC\n");
ctxt->emummc_forced = true;
}
return 1;
return 0;
}
static int _config_kernel_proc_id(launch_ctxt_t *ctxt, const char *value)
@@ -195,7 +200,8 @@ static int _config_kernel_proc_id(launch_ctxt_t *ctxt, const char *value)
DPRINTF("Enabled kernel process id send/recv patching\n");
ctxt->patch_krn_proc_id = true;
}
return 1;
return 0;
}
static int _config_dis_exo_user_exceptions(launch_ctxt_t *ctxt, const char *value)
@@ -205,7 +211,8 @@ static int _config_dis_exo_user_exceptions(launch_ctxt_t *ctxt, const char *valu
DPRINTF("Disabled exosphere user exception handlers\n");
ctxt->exo_ctx.no_user_exceptions = true;
}
return 1;
return 0;
}
static int _config_exo_user_pmu_access(launch_ctxt_t *ctxt, const char *value)
@@ -215,7 +222,8 @@ static int _config_exo_user_pmu_access(launch_ctxt_t *ctxt, const char *value)
DPRINTF("Enabled user access to PMU\n");
ctxt->exo_ctx.user_pmu = true;
}
return 1;
return 0;
}
static int _config_exo_usb3_force(launch_ctxt_t *ctxt, const char *value)
@@ -228,7 +236,8 @@ static int _config_exo_usb3_force(launch_ctxt_t *ctxt, const char *value)
DPRINTF("Enabled USB 3.0\n");
*ctxt->exo_ctx.usb3_force = true;
}
return 1;
return 0;
}
static int _config_exo_cal0_blanking(launch_ctxt_t *ctxt, const char *value)
@@ -241,7 +250,8 @@ static int _config_exo_cal0_blanking(launch_ctxt_t *ctxt, const char *value)
DPRINTF("Enabled prodinfo blanking\n");
*ctxt->exo_ctx.cal0_blank = true;
}
return 1;
return 0;
}
static int _config_exo_cal0_writes_enable(launch_ctxt_t *ctxt, const char *value)
@@ -255,7 +265,7 @@ static int _config_exo_cal0_writes_enable(launch_ctxt_t *ctxt, const char *value
*ctxt->exo_ctx.cal0_allow_writes_sys = true;
}
return 1;
return 0;
}
static int _config_pkg3(launch_ctxt_t *ctxt, const char *value)
@@ -267,9 +277,9 @@ static int _config_exo_fatal_payload(launch_ctxt_t *ctxt, const char *value)
{
ctxt->exofatal = emusd_file_read(value, &ctxt->exofatal_size);
if (!ctxt->exofatal)
return 0;
return 1;
return 1;
return 0;
}
static int _config_ucid(launch_ctxt_t *ctxt, const char *value)
@@ -277,7 +287,7 @@ static int _config_ucid(launch_ctxt_t *ctxt, const char *value)
// Override uCID if set.
ctxt->ucid = atoi(value);
return 1;
return 0;
}
typedef struct _cfg_handler_t
@@ -312,10 +322,10 @@ static const cfg_handler_t _config_handlers[] = {
{ NULL, NULL },
};
int parse_boot_config(launch_ctxt_t *ctxt)
int hos_parse_boot_config(launch_ctxt_t *ctxt)
{
if (!ctxt->cfg)
return 1;
return 0;
// Check each config key.
LIST_FOREACH_ENTRY(ini_kv_t, kv, &ctxt->cfg->kvs, link)
@@ -325,12 +335,12 @@ int parse_boot_config(launch_ctxt_t *ctxt)
// If key matches, call its handler.
if (!strcmp(_config_handlers[i].key, kv->key))
{
if (!_config_handlers[i].handler(ctxt, kv->val))
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;
return 1;
}
break;
@@ -338,5 +348,5 @@ int parse_boot_config(launch_ctxt_t *ctxt)
}
}
return 1;
return 0;
}