fusee: Hook up kip/kernel patch support (needs testing).

This commit is contained in:
Michael Scire
2018-10-16 16:17:30 -07:00
parent b78a3f7065
commit 472059134a
4 changed files with 27 additions and 7 deletions

View File

@@ -23,6 +23,7 @@
#include "package2.h"
#include "stratosphere.h"
#include "fs_utils.h"
#include "ips.h"
#include "lib/log.h"
#define u8 uint8_t
@@ -300,9 +301,20 @@ ini1_header_t *stratosphere_merge_inis(ini1_header_t **inis, size_t num_inis) {
if (current_kip_size > remaining_size) {
fatal_error("Not enough space for all the KIP1s!\n");
}
memcpy(current_dst_kip, current_kip, current_kip_size);
remaining_size -= current_kip_size;
current_dst_kip += current_kip_size;
kip1_header_t *patched_kip = apply_kip_ips_patches(current_kip, current_kip_size);
if (patched_kip != NULL) {
size_t patched_kip_size = kip1_get_size_from_header(patched_kip);
memcpy(current_dst_kip, patched_kip, patched_kip_size);
remaining_size -= patched_kip_size;
current_dst_kip += patched_kip_size;
free(patched_kip);
} else {
memcpy(current_dst_kip, current_kip, current_kip_size);
remaining_size -= current_kip_size;
current_dst_kip += current_kip_size;
}
process_list[merged->num_processes++] = current_kip->title_id;
}