mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-05 19:51:45 +00:00
Use the bloated string formatting functions from newlib
This commit is contained in:
parent
67b76cc8f1
commit
30b9873ab3
6 changed files with 19 additions and 1723 deletions
|
@ -12,7 +12,7 @@ dir_source := src
|
||||||
dir_build := build
|
dir_build := build
|
||||||
dir_out := out
|
dir_out := out
|
||||||
|
|
||||||
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
|
ARCH := -march=armv4t -mtune=arm7tdmi -marm
|
||||||
|
|
||||||
ASFLAGS := -g $(ARCH)
|
ASFLAGS := -g $(ARCH)
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
* Kernel print functions.
|
* Kernel print functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include "printk.h"
|
#include "printk.h"
|
||||||
|
|
||||||
#include "vsprintf.h"
|
|
||||||
#include "../display/video_fb.h"
|
#include "../display/video_fb.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,28 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2011 Andrei Warkentin <andrey.warkentin@gmail.com>
|
|
||||||
*
|
|
||||||
* This program is free software ; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#ifndef VSPRINTF_H
|
|
||||||
#define VSPRINTF_H
|
|
||||||
|
|
||||||
struct va_format {
|
|
||||||
const char *fmt;
|
|
||||||
va_list *va;
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base);
|
|
||||||
|
|
||||||
int sprintf(char *buf, const char *fmt, ...);
|
|
||||||
int scnprintf(char *buf, size_t size, const char *fmt, ...);
|
|
||||||
int snprintf(char *buf, size_t size, const char *fmt, ...);
|
|
||||||
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
|
|
||||||
int sscanf(const char *buf, const char *fmt, ...);
|
|
||||||
|
|
||||||
#endif /* VSPRINTF_H */
|
|
|
@ -1,10 +1,10 @@
|
||||||
#include "utils.h"
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "utils.h"
|
||||||
#include "loader.h"
|
#include "loader.h"
|
||||||
#include "sd_utils.h"
|
#include "sd_utils.h"
|
||||||
#include "stage2.h"
|
#include "stage2.h"
|
||||||
#include "lib/printk.h"
|
#include "lib/printk.h"
|
||||||
#include "lib/vsprintf.h"
|
|
||||||
#include "lib/ini.h"
|
#include "lib/ini.h"
|
||||||
|
|
||||||
const char *g_bct0 = NULL;
|
const char *g_bct0 = NULL;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
#include <stdio.h>
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "package2.h"
|
#include "package2.h"
|
||||||
#include "stratosphere.h"
|
#include "stratosphere.h"
|
||||||
#include "sd_utils.h"
|
#include "sd_utils.h"
|
||||||
#include "lib/printk.h"
|
#include "lib/printk.h"
|
||||||
#include "lib/vsprintf.h"
|
|
||||||
|
|
||||||
unsigned char g_stratosphere_ini1[PACKAGE2_SIZE_MAX];
|
unsigned char g_stratosphere_ini1[PACKAGE2_SIZE_MAX];
|
||||||
static bool g_initialized_stratosphere_ini1 = false;
|
static bool g_initialized_stratosphere_ini1 = false;
|
||||||
|
@ -19,9 +19,9 @@ ini1_header_t *stratosphere_get_ini1(void) {
|
||||||
ini1_header->size = sizeof(ini1_header_t);
|
ini1_header->size = sizeof(ini1_header_t);
|
||||||
ini1_header->num_processes = 0;
|
ini1_header->num_processes = 0;
|
||||||
ini1_header->_0xC = 0;
|
ini1_header->_0xC = 0;
|
||||||
|
|
||||||
/* TODO: When we have processes, copy them into ini1_header->kip_data here. */
|
/* TODO: When we have processes, copy them into ini1_header->kip_data here. */
|
||||||
|
|
||||||
g_initialized_stratosphere_ini1 = true;
|
g_initialized_stratosphere_ini1 = true;
|
||||||
return ini1_header;
|
return ini1_header;
|
||||||
}
|
}
|
||||||
|
@ -36,18 +36,18 @@ size_t stratosphere_merge_inis(void *dst, ini1_header_t **inis, unsigned int num
|
||||||
generic_panic();
|
generic_panic();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t process_list[INI1_MAX_KIPS] = {0};
|
uint64_t process_list[INI1_MAX_KIPS] = {0};
|
||||||
|
|
||||||
memset(g_ini1_buffer, 0, sizeof(g_ini1_buffer));
|
memset(g_ini1_buffer, 0, sizeof(g_ini1_buffer));
|
||||||
ini1_header_t *merged = (ini1_header_t *)g_ini1_buffer;
|
ini1_header_t *merged = (ini1_header_t *)g_ini1_buffer;
|
||||||
merged->magic = MAGIC_INI1;
|
merged->magic = MAGIC_INI1;
|
||||||
merged->num_processes = 0;
|
merged->num_processes = 0;
|
||||||
merged->_0xC = 0;
|
merged->_0xC = 0;
|
||||||
size_t remaining_size = PACKAGE2_SIZE_MAX - sizeof(ini1_header_t);
|
size_t remaining_size = PACKAGE2_SIZE_MAX - sizeof(ini1_header_t);
|
||||||
|
|
||||||
unsigned char *current_dst_kip = merged->kip_data;
|
unsigned char *current_dst_kip = merged->kip_data;
|
||||||
|
|
||||||
/* Actually merge into the inis. */
|
/* Actually merge into the inis. */
|
||||||
for (unsigned int i = 0; i < num_inis; i++) {
|
for (unsigned int i = 0; i < num_inis; i++) {
|
||||||
uint64_t offset = 0;
|
uint64_t offset = 0;
|
||||||
|
@ -57,8 +57,8 @@ size_t stratosphere_merge_inis(void *dst, ini1_header_t **inis, unsigned int num
|
||||||
printk("Error: INI1s[%d][%d] appears not to be a KIP1!\n", i, p);
|
printk("Error: INI1s[%d][%d] appears not to be a KIP1!\n", i, p);
|
||||||
generic_panic();
|
generic_panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool already_loaded = false;
|
bool already_loaded = false;
|
||||||
for (unsigned int j = 0; j < merged->num_processes; j++) {
|
for (unsigned int j = 0; j < merged->num_processes; j++) {
|
||||||
if (process_list[j] == current_kip->title_id) {
|
if (process_list[j] == current_kip->title_id) {
|
||||||
|
@ -69,10 +69,10 @@ size_t stratosphere_merge_inis(void *dst, ini1_header_t **inis, unsigned int num
|
||||||
if (already_loaded) {
|
if (already_loaded) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: What folder should these be read out of? */
|
/* 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), "atmosph\xe8re/titles/%016llx/%016llx.kip", current_kip->title_id, current_kip->title_id);
|
||||||
|
|
||||||
/* Try to load an override KIP from SD, if possible. */
|
/* Try to load an override KIP from SD, if possible. */
|
||||||
if (read_sd_file(current_dst_kip, remaining_size, sd_path)) {
|
if (read_sd_file(current_dst_kip, remaining_size, sd_path)) {
|
||||||
kip1_header_t *sd_kip = (kip1_header_t *)(current_dst_kip);
|
kip1_header_t *sd_kip = (kip1_header_t *)(current_dst_kip);
|
||||||
|
@ -96,14 +96,14 @@ size_t stratosphere_merge_inis(void *dst, ini1_header_t **inis, unsigned int num
|
||||||
remaining_size -= current_kip_size;
|
remaining_size -= current_kip_size;
|
||||||
current_dst_kip += current_kip_size;
|
current_dst_kip += current_kip_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
process_list[merged->num_processes++] = current_kip->title_id;
|
process_list[merged->num_processes++] = current_kip->title_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
merged->size = sizeof(ini1_header_t) + (uint32_t)(current_dst_kip - merged->kip_data);
|
merged->size = sizeof(ini1_header_t) + (uint32_t)(current_dst_kip - merged->kip_data);
|
||||||
|
|
||||||
/* Copy merged INI1 to destination. */
|
/* Copy merged INI1 to destination. */
|
||||||
memcpy(dst, merged, merged->size);
|
memcpy(dst, merged, merged->size);
|
||||||
|
|
||||||
return merged->size;
|
return merged->size;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue