2018-09-07 16:00:13 +01:00
|
|
|
/*
|
2020-01-24 10:10:40 +00:00
|
|
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
2018-09-07 16:00:13 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2018-04-07 22:43:54 +01:00
|
|
|
#ifndef FUSEE_LOADER_H
|
|
|
|
#define FUSEE_LOADER_H
|
|
|
|
|
2018-04-09 22:34:23 +01:00
|
|
|
#include "utils.h"
|
2018-05-07 22:32:45 +01:00
|
|
|
#include "chainloader.h"
|
2018-04-07 22:43:54 +01:00
|
|
|
|
2018-05-14 20:17:06 +01:00
|
|
|
#define LOADER_MAX_PATH_SIZE 255
|
|
|
|
|
2018-04-08 12:51:57 +01:00
|
|
|
typedef struct {
|
2018-05-07 22:32:45 +01:00
|
|
|
char path[0x100];
|
2018-04-08 12:51:57 +01:00
|
|
|
const char *key;
|
|
|
|
uintptr_t load_address;
|
2018-04-26 11:47:22 +01:00
|
|
|
size_t load_size;
|
2018-04-08 12:51:57 +01:00
|
|
|
} load_file_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2018-04-09 22:34:23 +01:00
|
|
|
const char *bct0;
|
2018-05-07 22:32:45 +01:00
|
|
|
uintptr_t chainload_entrypoint;
|
|
|
|
size_t file_id_of_entrypoint;
|
2018-05-14 20:17:06 +01:00
|
|
|
size_t nb_files_to_load;
|
|
|
|
char package2_path[LOADER_MAX_PATH_SIZE+1];
|
|
|
|
char exosphere_path[LOADER_MAX_PATH_SIZE+1];
|
|
|
|
char tsecfw_path[LOADER_MAX_PATH_SIZE+1];
|
|
|
|
char warmboot_path[LOADER_MAX_PATH_SIZE+1];
|
|
|
|
char custom_splash_path[LOADER_MAX_PATH_SIZE+1];
|
|
|
|
char file_paths_to_load[CHAINLOADER_MAX_ENTRIES][LOADER_MAX_PATH_SIZE+1];
|
2018-04-08 12:51:57 +01:00
|
|
|
} loader_ctx_t;
|
|
|
|
|
|
|
|
#define LOADER_ENTRYPOINT_KEY "entrypoint"
|
|
|
|
#define LOADER_LOADLIST_KEY "loadlist"
|
2018-04-10 23:09:00 +01:00
|
|
|
#define LOADER_CUSTOMSPLASH_KEY "custom_splash"
|
2018-04-08 12:51:57 +01:00
|
|
|
|
2018-04-09 22:34:23 +01:00
|
|
|
#define LOADER_PACKAGE2_KEY "package2"
|
|
|
|
#define LOADER_EXOSPHERE_KEY "exosphere"
|
|
|
|
#define LOADER_TSECFW_KEY "tsecfw"
|
|
|
|
#define LOADER_WARMBOOT_KEY "warmboot"
|
|
|
|
|
2018-04-08 12:51:57 +01:00
|
|
|
/* TODO: Should we allow files bigger than 16 MB? */
|
2018-05-07 22:32:45 +01:00
|
|
|
//#define LOADER_FILESIZE_MAX 0x01000000
|
2018-04-08 12:51:57 +01:00
|
|
|
|
2018-04-09 22:34:23 +01:00
|
|
|
loader_ctx_t *get_loader_ctx(void);
|
|
|
|
|
|
|
|
void load_payload(const char *bct0);
|
2018-04-07 22:43:54 +01:00
|
|
|
|
2018-05-07 22:32:45 +01:00
|
|
|
#endif
|