mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-04 15:29:25 +00:00
fusee: Disable built-in PM system module.
This commit is contained in:
parent
3cf37330ca
commit
97d1ca3cc9
1 changed files with 49 additions and 16 deletions
|
@ -19,6 +19,11 @@
|
|||
|
||||
static ini1_header_t *g_stratosphere_ini1 = NULL;
|
||||
|
||||
static bool g_stratosphere_loader_enabled = true;
|
||||
static bool g_stratosphere_sm_enabled = true;
|
||||
static bool g_stratosphere_pm_enabled = false;
|
||||
static bool g_stratosphere_boot_enabled = false;
|
||||
|
||||
extern const uint8_t boot_100_kip[], boot_200_kip[];
|
||||
extern const uint8_t loader_kip[], pm_kip[], sm_kip[];
|
||||
extern const uint32_t boot_100_kip_size, boot_200_kip_size;
|
||||
|
@ -27,8 +32,9 @@ extern const uint32_t loader_kip_size, pm_kip_size, sm_kip_size;
|
|||
/* GCC doesn't consider the size as const... we have to write it ourselves. */
|
||||
|
||||
ini1_header_t *stratosphere_get_ini1(uint32_t target_firmware) {
|
||||
/* const uint8_t *boot_kip = NULL; */
|
||||
const uint8_t *boot_kip = NULL;
|
||||
uint32_t boot_kip_size = 0;
|
||||
uint32_t num_processes = 0;
|
||||
uint8_t *data;
|
||||
|
||||
if (g_stratosphere_ini1 != NULL) {
|
||||
|
@ -36,14 +42,36 @@ ini1_header_t *stratosphere_get_ini1(uint32_t target_firmware) {
|
|||
}
|
||||
|
||||
if (target_firmware <= EXOSPHERE_TARGET_FIRMWARE_100) {
|
||||
/* boot_kip = boot_100_kip; */
|
||||
boot_kip = boot_100_kip;
|
||||
boot_kip_size = boot_100_kip_size;
|
||||
} else {
|
||||
/* boot_kip = boot_200_kip; */
|
||||
boot_kip = boot_200_kip;
|
||||
boot_kip_size = boot_200_kip_size;
|
||||
}
|
||||
|
||||
size_t size = sizeof(ini1_header_t) + loader_kip_size + pm_kip_size + sm_kip_size + boot_kip_size;
|
||||
size_t size = sizeof(ini1_header_t);
|
||||
|
||||
/* Calculate our processes' sizes. */
|
||||
if (g_stratosphere_loader_enabled) {
|
||||
size += loader_kip_size;
|
||||
num_processes++;
|
||||
}
|
||||
|
||||
if (g_stratosphere_pm_enabled) {
|
||||
size += pm_kip_size;
|
||||
num_processes++;
|
||||
}
|
||||
|
||||
if (g_stratosphere_sm_enabled) {
|
||||
size += sm_kip_size;
|
||||
num_processes++;
|
||||
}
|
||||
|
||||
if (g_stratosphere_boot_enabled) {
|
||||
size += boot_kip_size;
|
||||
num_processes++;
|
||||
}
|
||||
|
||||
g_stratosphere_ini1 = (ini1_header_t *)malloc(size);
|
||||
|
||||
if (g_stratosphere_ini1 == NULL) {
|
||||
|
@ -52,26 +80,31 @@ ini1_header_t *stratosphere_get_ini1(uint32_t target_firmware) {
|
|||
|
||||
g_stratosphere_ini1->magic = MAGIC_INI1;
|
||||
g_stratosphere_ini1->size = size;
|
||||
g_stratosphere_ini1->num_processes = 3; /*TODO: Change to 4 when boot is supported. */
|
||||
g_stratosphere_ini1->num_processes = num_processes;
|
||||
g_stratosphere_ini1->_0xC = 0;
|
||||
|
||||
data = g_stratosphere_ini1->kip_data;
|
||||
|
||||
/* Copy our processes. */
|
||||
memcpy(data, loader_kip, loader_kip_size);
|
||||
data += loader_kip_size;
|
||||
if (g_stratosphere_loader_enabled) {
|
||||
memcpy(data, loader_kip, loader_kip_size);
|
||||
data += loader_kip_size;
|
||||
}
|
||||
|
||||
memcpy(data, pm_kip, pm_kip_size);
|
||||
data += pm_kip_size;
|
||||
if (g_stratosphere_pm_enabled) {
|
||||
memcpy(data, pm_kip, pm_kip_size);
|
||||
data += pm_kip_size;
|
||||
}
|
||||
|
||||
memcpy(data, sm_kip, sm_kip_size);
|
||||
data += sm_kip_size;
|
||||
if (g_stratosphere_sm_enabled) {
|
||||
memcpy(data, sm_kip, sm_kip_size);
|
||||
data += sm_kip_size;
|
||||
}
|
||||
|
||||
/* TODO: Uncomment when boot is supported. */
|
||||
/*
|
||||
memcpy(data, boot_kip, boot_kip_size);
|
||||
data += boot_kip_size;
|
||||
*/
|
||||
if (g_stratosphere_boot_enabled) {
|
||||
memcpy(data, boot_kip, boot_kip_size);
|
||||
data += boot_kip_size;
|
||||
}
|
||||
|
||||
return g_stratosphere_ini1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue