mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-05 17:14:22 -04:00
set.mitm: fake compatibility for usb!usb30_force_enabled on 9.0.0+ (#1391)
* set.mitm: fake compatibility for usb!usb30_force_enabled on 9.0.0+ * set.mitm: add value meaning comment for usb!usb30_force_enabled * loader: pretend to be polite about patch ordering
This commit is contained in:
parent
c9015581ca
commit
a6729171d3
14 changed files with 205 additions and 24 deletions
|
@ -33,6 +33,7 @@
|
|||
#define EXOSPHERE_FLAG_ENABLE_USERMODE_PMU_ACCESS (1 << 4u)
|
||||
#define EXOSPHERE_FLAG_BLANK_PRODINFO (1 << 5u)
|
||||
#define EXOSPHERE_FLAG_ALLOW_WRITING_TO_CAL_SYSMMC (1 << 6u)
|
||||
#define EXOSPHERE_FLAG_FORCE_ENABLE_USB_30 (1 << 7u)
|
||||
|
||||
#define EXOSPHERE_LOG_FLAG_INVERTED (1 << 0u)
|
||||
|
||||
|
|
|
@ -256,6 +256,24 @@ static int stratosphere_ini_handler(void *user, const char *section, const char
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int system_settings_ini_handler(void *user, const char *section, const char *name, const char *value) {
|
||||
uint32_t *flags = (uint32_t *)user;
|
||||
if (strcmp(section, "usb") == 0) {
|
||||
if (strcmp(name, "usb30_force_enabled") == 0) {
|
||||
if (strcmp(value, "u8!0x1") == 0) {
|
||||
*flags |= EXOSPHERE_FLAG_FORCE_ENABLE_USB_30;
|
||||
} else if (strcmp(value, "u8!0x0") == 0) {
|
||||
*flags &= ~(EXOSPHERE_FLAG_FORCE_ENABLE_USB_30);
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool is_nca_present(const char *nca_name) {
|
||||
char path[0x100];
|
||||
snprintf(path, sizeof(path), "system:/contents/registered/%s.nca", nca_name);
|
||||
|
@ -537,6 +555,15 @@ static void nxboot_configure_exosphere(uint32_t target_firmware, unsigned int ke
|
|||
/* Apply lcd vendor. */
|
||||
exo_cfg.lcd_vendor = display_get_lcd_vendor();
|
||||
|
||||
/* Read and parse system settings.ini to determine usb 3.0 enable. */
|
||||
char *settings_ini = calloc(1, 0x20000);
|
||||
if (read_from_file(settings_ini, 0x1FFFF, "atmosphere/config/system_settings.ini")) {
|
||||
if (ini_parse_string(settings_ini, system_settings_ini_handler, &exo_cfg.flags[0]) < 0) {
|
||||
fatal_error("[NXBOOT] Failed to parse system_settings.ini!\n");
|
||||
}
|
||||
}
|
||||
free(settings_ini);
|
||||
|
||||
if ((exo_cfg.target_firmware < ATMOSPHERE_TARGET_FIRMWARE_MIN) || (exo_cfg.target_firmware > ATMOSPHERE_TARGET_FIRMWARE_MAX)) {
|
||||
fatal_error("[NXBOOT] Invalid Exosphere target firmware!\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue