[stage2] Remove printk, introduce UTF-8 console stdio

This commit is contained in:
TuxSH
2018-05-05 23:55:40 +02:00
parent 02217bde55
commit 8648cac77b
15 changed files with 246 additions and 149 deletions

View File

@@ -3,7 +3,6 @@
#include "package2.h"
#include "stratosphere.h"
#include "sd_utils.h"
#include "lib/printk.h"
unsigned char g_stratosphere_ini1[PACKAGE2_SIZE_MAX];
static bool g_initialized_stratosphere_ini1 = false;
@@ -32,7 +31,7 @@ size_t stratosphere_merge_inis(void *dst, ini1_header_t **inis, unsigned int num
/* Validate all ini headers. */
for (unsigned int i = 0; i < num_inis; i++) {
if (inis[i] == NULL || inis[i]->magic != MAGIC_INI1 || inis[i]->num_processes > INI1_MAX_KIPS) {
printk("Error: INI1s[%d] section appears to not contain an INI1!\n", i);
printf("Error: INI1s[%d] section appears to not contain an INI1!\n", i);
generic_panic();
}
}
@@ -54,7 +53,7 @@ size_t stratosphere_merge_inis(void *dst, ini1_header_t **inis, unsigned int num
for (unsigned int p = 0; p < inis[i]->num_processes; p++) {
kip1_header_t *current_kip = (kip1_header_t *)(inis[i]->kip_data + offset);
if (current_kip->magic != MAGIC_KIP1) {
printk("Error: INI1s[%d][%d] appears not to be a KIP1!\n", i, p);
printf("Error: INI1s[%d][%d] appears not to be a KIP1!\n", i, p);
generic_panic();
}
@@ -71,16 +70,16 @@ size_t stratosphere_merge_inis(void *dst, ini1_header_t **inis, unsigned int num
}
/* TODO: What folder should these be read out of? */
snprintf(sd_path, sizeof(sd_path), "atmosph\xe8re/titles/%016llx/%016llx.kip", current_kip->title_id, current_kip->title_id);
snprintf(sd_path, sizeof(sd_path), "atmosphere/titles/%016llx/%016llx.kip", current_kip->title_id, current_kip->title_id);
/* Try to load an override KIP from SD, if possible. */
if (read_sd_file(current_dst_kip, remaining_size, sd_path)) {
kip1_header_t *sd_kip = (kip1_header_t *)(current_dst_kip);
if (sd_kip->magic != MAGIC_KIP1) {
printk("Error: %s is not a KIP1?\n", sd_path);
printf("Error: %s is not a KIP1?\n", sd_path);
generic_panic();
} else if (sd_kip->title_id != current_kip->title_id) {
printk("Error: %s has wrong Title ID!\n", sd_path);
printf("Error: %s has wrong Title ID!\n", sd_path);
generic_panic();
}
uint64_t sd_kip_size = kip1_get_size_from_header(sd_kip);
@@ -89,7 +88,7 @@ size_t stratosphere_merge_inis(void *dst, ini1_header_t **inis, unsigned int num
} else {
uint64_t current_kip_size = kip1_get_size_from_header(current_kip);
if (current_kip_size > remaining_size) {
printk("Error: Not enough space for all the KIP1s!\n");
printf("Error: Not enough space for all the KIP1s!\n");
generic_panic();
}
memcpy(current_dst_kip, current_kip, current_kip_size);