mirror of
https://github.com/CTCaer/hekate.git
synced 2024-12-25 15:17:19 +00:00
exo: add usb3 force enable support
Like the other configs, it can be read from system_settings.ini and be set. Additionally a new `usb3force` key was added to allow user to override and enable/disable that setting via a boot entry. This allows for fast (re)boot into an entry that disables that (important because of the huge interference that USB3 creates to Bluetooth and WiFi 2.4GHz).
This commit is contained in:
parent
4958bd6a52
commit
c01b8aa89c
@ -81,15 +81,16 @@ typedef struct _fss_content_t
|
||||
char name[0x10];
|
||||
} fss_content_t;
|
||||
|
||||
static void _update_r2p(const char *path)
|
||||
static void _update_r2p(launch_ctxt_t *ctxt, const char *path)
|
||||
{
|
||||
char *r2p_path = malloc(256);
|
||||
char *r2p_path = malloc(512);
|
||||
u32 path_len = strlen(path);
|
||||
|
||||
strcpy(r2p_path, path);
|
||||
|
||||
while(path_len)
|
||||
{
|
||||
if ((r2p_path[path_len - 1] == '/') || (r2p_path[path_len - 1] == 0x5C))
|
||||
if ((r2p_path[path_len - 1] == '/') || (r2p_path[path_len - 1] == '\\'))
|
||||
{
|
||||
r2p_path[path_len] = 0;
|
||||
strcat(r2p_path, "reboot_payload.bin");
|
||||
@ -98,6 +99,15 @@ static void _update_r2p(const char *path)
|
||||
is_ipl_updated(r2p_payload, r2p_path, h_cfg.updater2p ? true : false);
|
||||
|
||||
free(r2p_payload);
|
||||
|
||||
// Save fss0 parrent path.
|
||||
if (ctxt)
|
||||
{
|
||||
r2p_path[path_len] = 0;
|
||||
ctxt->fss0_main_path = r2p_path;
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
path_len--;
|
||||
@ -264,7 +274,7 @@ out:
|
||||
gfx_printf("Done!\n");
|
||||
f_close(&fp);
|
||||
|
||||
_update_r2p(path);
|
||||
_update_r2p(ctxt, path);
|
||||
|
||||
return (!sept_ctxt ? 1 : sept_used);
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ typedef struct _exo_ctxt_t
|
||||
bool fs_is_510;
|
||||
bool no_user_exceptions;
|
||||
bool user_pmu;
|
||||
bool *usb3_force;
|
||||
bool *cal0_blank;
|
||||
bool *cal0_allow_writes_sys;
|
||||
} exo_ctxt_t;
|
||||
@ -107,14 +108,16 @@ typedef struct _launch_ctxt_t
|
||||
link_t kip1_list;
|
||||
char* kip1_patches;
|
||||
|
||||
u32 fss0_hosver;
|
||||
bool svcperm;
|
||||
bool debugmode;
|
||||
bool stock;
|
||||
bool atmosphere;
|
||||
bool fss0_experimental;
|
||||
bool emummc_forced;
|
||||
|
||||
char *fss0_main_path;
|
||||
u32 fss0_hosver;
|
||||
bool fss0_experimental;
|
||||
bool atmosphere;
|
||||
|
||||
exo_ctxt_t exo_ctx;
|
||||
|
||||
ini_sec_t *cfg;
|
||||
|
@ -220,6 +220,19 @@ static int _config_exo_user_pmu_access(launch_ctxt_t *ctxt, const char *value)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _config_exo_usb3_force(launch_ctxt_t *ctxt, const char *value)
|
||||
{
|
||||
// Override key found.
|
||||
ctxt->exo_ctx.usb3_force = calloc(sizeof(bool), 1);
|
||||
|
||||
if (*value == '1')
|
||||
{
|
||||
DPRINTF("Enabled USB 3.0\n");
|
||||
*ctxt->exo_ctx.usb3_force = true;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _config_exo_cal0_blanking(launch_ctxt_t *ctxt, const char *value)
|
||||
{
|
||||
// Override key found.
|
||||
@ -291,6 +304,7 @@ static const cfg_handler_t _config_handlers[] = {
|
||||
{ "emummcforce", _config_emummc_forced },
|
||||
{ "nouserexceptions", _config_dis_exo_user_exceptions },
|
||||
{ "userpmu", _config_exo_user_pmu_access },
|
||||
{ "usb3force", _config_exo_usb3_force },
|
||||
{ "cal0blank", _config_exo_cal0_blanking },
|
||||
{ "cal0writesys", _config_exo_cal0_writes_enable },
|
||||
{ NULL, NULL },
|
||||
|
@ -145,6 +145,7 @@ typedef struct _atm_fatal_error_ctx
|
||||
#define EXO_FLAG_USER_PMU BIT(4)
|
||||
#define EXO_FLAG_CAL0_BLANKING BIT(5)
|
||||
#define EXO_FLAG_CAL0_WRITES_SYS BIT(6)
|
||||
#define EXO_FLAG_ENABLE_USB3 BIT(7)
|
||||
|
||||
#define EXO_FW_VER(mj, mn, rv) (((mj) << 24) | ((mn) << 16) | ((rv) << 8))
|
||||
|
||||
@ -152,6 +153,7 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base, bool exo_new)
|
||||
{
|
||||
u32 exo_fw_no = 0;
|
||||
u32 exo_flags = 0;
|
||||
bool usb3_force = false;
|
||||
bool user_debug = false;
|
||||
bool cal0_blanking = false;
|
||||
bool cal0_allow_writes_sys = false;
|
||||
@ -252,6 +254,34 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base, bool exo_new)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Parse usb mtim settings. Avoid parsing if it's overridden.
|
||||
if (ctxt->fss0_main_path && !ctxt->exo_ctx.usb3_force)
|
||||
{
|
||||
char set_path[256];
|
||||
strcpy(set_path, ctxt->fss0_main_path);
|
||||
strcat(set_path, "config/system_settings.ini");
|
||||
LIST_INIT(sys_settings);
|
||||
if (ini_parse(&ini_sections, set_path, false))
|
||||
{
|
||||
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sections, link)
|
||||
{
|
||||
// Only parse usb section.
|
||||
if (!(ini_sec->type == INI_CHOICE) || strcmp(ini_sec->name, "usb"))
|
||||
continue;
|
||||
|
||||
LIST_FOREACH_ENTRY(ini_kv_t, kv, &ini_sec->kvs, link)
|
||||
{
|
||||
if (!strcmp("usb30_force_enabled", kv->key))
|
||||
{
|
||||
usb3_force = !strcmp("u8!0x1", kv->val);
|
||||
break; // Only parse usb30_force_enabled key.
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// To avoid problems, make private debug mode always on if not semi-stock.
|
||||
@ -270,6 +300,11 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base, bool exo_new)
|
||||
if (ctxt->exo_ctx.user_pmu)
|
||||
exo_flags |= EXO_FLAG_USER_PMU;
|
||||
|
||||
// Enable USB 3.0. Check if system_settings ini value is overridden. If not, check if enabled in ini.
|
||||
if ((ctxt->exo_ctx.usb3_force && *ctxt->exo_ctx.usb3_force)
|
||||
|| (!ctxt->exo_ctx.usb3_force && usb3_force))
|
||||
exo_flags |= EXO_FLAG_ENABLE_USB3;
|
||||
|
||||
// Enable prodinfo blanking. Check if exo ini value is overridden. If not, check if enabled in exo ini.
|
||||
if ((ctxt->exo_ctx.cal0_blank && *ctxt->exo_ctx.cal0_blank)
|
||||
|| (!ctxt->exo_ctx.cal0_blank && cal0_blanking))
|
||||
|
Loading…
Reference in New Issue
Block a user