fusee: Implement built-in support for togglable nogc patches

This commit is contained in:
Michael Scire 2018-11-30 04:10:23 -08:00
parent 72a2c10896
commit 72f028efae
15 changed files with 92 additions and 1 deletions

View file

@ -29,6 +29,8 @@
#include "se.h"
#include "pmc.h"
#include "i2c.h"
#include "ips.h"
#include "stratosphere.h"
#include "max77620.h"
#include "cluster.h"
#include "flow.h"
@ -82,6 +84,23 @@ static int exosphere_ini_handler(void *user, const char *section, const char *na
return 1;
}
static int stratosphere_ini_handler(void *user, const char *section, const char *name, const char *value) {
int tmp = 0;
if (strcmp(section, "stratosphere") == 0) {
if (strcmp(name, STRATOSPHERE_NOGC_KEY) == 0) {
sscanf(value, "%d", &tmp);
if (tmp) {
kip_patches_set_enable_nogc();
}
} else {
return 0;
}
} else {
return 0;
}
return 1;
}
static uint32_t nxboot_get_target_firmware(const void *package1loader) {
const package1loader_header_t *package1loader_header = (const package1loader_header_t *)package1loader;
switch (package1loader_header->version) {
@ -427,6 +446,9 @@ uint32_t nxboot_main(void) {
print(SCREEN_LOG_LEVEL_MANDATORY, "[NXBOOT]: Rebuilding package2...\n");
/* Patch package2, adding Thermosphère + custom KIPs. */
if (ini_parse_string(get_loader_ctx()->bct0, stratosphere_ini_handler, NULL) < 0) {
fatal_error("[NXBOOT]: Failed to parse BCT.ini!\n");
}
package2_rebuild_and_copy(package2, MAILBOX_EXOSPHERE_CONFIGURATION->target_firmware);
print(SCREEN_LOG_LEVEL_INFO, u8"[NXBOOT]: Reading Exosphère...\n");