From 75b29e777b4a58fe8e664c8a0e408df820042a71 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 11 Apr 2018 22:32:45 -0600 Subject: [PATCH] Fusee: Update INI1 size after patching --- fusee/fusee-secondary/src/package2.c | 2 +- fusee/fusee-secondary/src/stratosphere.c | 4 +++- fusee/fusee-secondary/src/stratosphere.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fusee/fusee-secondary/src/package2.c b/fusee/fusee-secondary/src/package2.c index 1c3092711..753391223 100644 --- a/fusee/fusee-secondary/src/package2.c +++ b/fusee/fusee-secondary/src/package2.c @@ -219,7 +219,7 @@ void package2_patch_ini1(void) { inis_to_merge[STRATOSPHERE_INI1_PACKAGE2] = (ini1_header_t *)g_package2_sections[PACKAGE2_SECTION_INI1]; /* Merge all of the INI1s. */ - stratosphere_merge_inis(g_package2_sections[PACKAGE2_SECTION_INI1], inis_to_merge, STRATOSPHERE_INI1_MAX); + g_patched_package2_header->metadata.section_sizes[PACKAGE2_SECTION_INI1] = stratosphere_merge_inis(g_package2_sections[PACKAGE2_SECTION_INI1], inis_to_merge, STRATOSPHERE_INI1_MAX); } void package2_fixup_header_and_section_hashes(void) { diff --git a/fusee/fusee-secondary/src/stratosphere.c b/fusee/fusee-secondary/src/stratosphere.c index 25a2f2f43..18ce3ebac 100644 --- a/fusee/fusee-secondary/src/stratosphere.c +++ b/fusee/fusee-secondary/src/stratosphere.c @@ -27,7 +27,7 @@ ini1_header_t *stratosphere_get_ini1(void) { } /* Merges some number of INI1s into a single INI1. It's assumed that the INIs are in order of preference. */ -void stratosphere_merge_inis(void *dst, ini1_header_t **inis, unsigned int num_inis) { +size_t stratosphere_merge_inis(void *dst, ini1_header_t **inis, unsigned int num_inis) { char sd_path[0x300] = {0}; /* Validate all ini headers. */ for (unsigned int i = 0; i < num_inis; i++) { @@ -102,4 +102,6 @@ void stratosphere_merge_inis(void *dst, ini1_header_t **inis, unsigned int num_i /* Copy merged INI1 to destination. */ memcpy(dst, merged, merged->size); + + return merged->size; } \ No newline at end of file diff --git a/fusee/fusee-secondary/src/stratosphere.h b/fusee/fusee-secondary/src/stratosphere.h index c611ac2c7..89160b688 100644 --- a/fusee/fusee-secondary/src/stratosphere.h +++ b/fusee/fusee-secondary/src/stratosphere.h @@ -10,6 +10,6 @@ ini1_header_t *stratosphere_get_ini1(void); -void stratosphere_merge_inis(void *dst, ini1_header_t **inis, unsigned int num_inis); +size_t stratosphere_merge_inis(void *dst, ini1_header_t **inis, unsigned int num_inis); #endif \ No newline at end of file