diff --git a/fusee/fusee-primary/src/sd_utils.c b/fusee/fusee-primary/src/fs_utils.c similarity index 86% rename from fusee/fusee-primary/src/sd_utils.c rename to fusee/fusee-primary/src/fs_utils.c index bbb2bb66a..ecc5a0d20 100644 --- a/fusee/fusee-primary/src/sd_utils.c +++ b/fusee/fusee-primary/src/fs_utils.c @@ -1,4 +1,4 @@ -#include "sd_utils.h" +#include "fs_utils.h" #include "hwinit.h" #include "sdmmc.h" #include "lib/printk.h" @@ -18,7 +18,7 @@ int mount_sd(void) { return mounted_sd; } -size_t read_sd_file(void *dst, size_t dst_size, const char *filename) { +size_t read_from_file(void *dst, size_t dst_size, const char *filename) { if (!mounted_sd && mount_sd() == 0) { return 0; } diff --git a/fusee/fusee-primary/src/fs_utils.h b/fusee/fusee-primary/src/fs_utils.h new file mode 100644 index 000000000..2f71275ff --- /dev/null +++ b/fusee/fusee-primary/src/fs_utils.h @@ -0,0 +1,9 @@ +#ifndef FUSEE_FS_UTILS_H +#define FUSEE_FS_UTILS_H + +#include "utils.h" +#include "sdmmc.h" + +size_t read_from_file(void *dst, size_t dst_size, const char *filename); + +#endif diff --git a/fusee/fusee-primary/src/main.c b/fusee/fusee-primary/src/main.c index 4234b1672..04470fa3d 100644 --- a/fusee/fusee-primary/src/main.c +++ b/fusee/fusee-primary/src/main.c @@ -2,7 +2,7 @@ #include "hwinit.h" #include "fuse.h" #include "se.h" -#include "sd_utils.h" +#include "fs_utils.h" #include "stage2.h" #include "chainloader.h" #include "sdmmc.h" @@ -23,7 +23,7 @@ static char g_bct0_buffer[BCTO_MAX_SIZE]; "stage2_entrypoint = 0xF0000000\n" static const char *load_config(void) { - if (!read_sd_file(g_bct0_buffer, BCTO_MAX_SIZE, "BCT.ini")) { + if (!read_from_file(g_bct0_buffer, BCTO_MAX_SIZE, "BCT.ini")) { printk("Failed to read BCT0 from SD!\n"); printk("[DEBUG] Using default BCT0!\n"); memcpy(g_bct0_buffer, DEFAULT_BCT0_FOR_DEBUG, sizeof(DEFAULT_BCT0_FOR_DEBUG)); diff --git a/fusee/fusee-primary/src/sd_utils.h b/fusee/fusee-primary/src/sd_utils.h deleted file mode 100644 index f796e5aa9..000000000 --- a/fusee/fusee-primary/src/sd_utils.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef FUSEE_SD_UTILS_H -#define FUSEE_SD_UTILS_H - -#include "utils.h" -#include "sdmmc.h" - -size_t read_sd_file(void *dst, size_t dst_size, const char *filename); - -#endif diff --git a/fusee/fusee-primary/src/stage2.c b/fusee/fusee-primary/src/stage2.c index 59c214878..b20ce7419 100644 --- a/fusee/fusee-primary/src/stage2.c +++ b/fusee/fusee-primary/src/stage2.c @@ -1,7 +1,7 @@ #include "utils.h" #include #include "display/video_fb.h" -#include "sd_utils.h" +#include "fs_utils.h" #include "stage2.h" #include "chainloader.h" #include "lib/printk.h" @@ -105,7 +105,7 @@ void load_stage2(const char *bct0) { tmp_addr = config.load_address; } - if (read_sd_file((void *)tmp_addr, size, config.path) != size) { + if (read_from_file((void *)tmp_addr, size, config.path) != size) { printk("Error: Failed to read stage2 (%s)!\n", config.path); generic_panic(); } diff --git a/fusee/fusee-secondary/src/sd_utils.c b/fusee/fusee-secondary/src/fs_utils.c similarity index 72% rename from fusee/fusee-secondary/src/sd_utils.c rename to fusee/fusee-secondary/src/fs_utils.c index 1aef91611..59b2daa48 100644 --- a/fusee/fusee-secondary/src/sd_utils.c +++ b/fusee/fusee-secondary/src/fs_utils.c @@ -1,9 +1,9 @@ #include -#include "sd_utils.h" +#include "fs_utils.h" #include "hwinit.h" #include "sdmmc.h" -size_t read_sd_file(void *dst, size_t dst_size, const char *filename) { +size_t read_from_file(void *dst, size_t dst_size, const char *filename) { FILE *file = fopen(filename, "rb"); if (file == NULL) { return 0; diff --git a/fusee/fusee-secondary/src/fs_utils.h b/fusee/fusee-secondary/src/fs_utils.h new file mode 100644 index 000000000..2f71275ff --- /dev/null +++ b/fusee/fusee-secondary/src/fs_utils.h @@ -0,0 +1,9 @@ +#ifndef FUSEE_FS_UTILS_H +#define FUSEE_FS_UTILS_H + +#include "utils.h" +#include "sdmmc.h" + +size_t read_from_file(void *dst, size_t dst_size, const char *filename); + +#endif diff --git a/fusee/fusee-secondary/src/loader.c b/fusee/fusee-secondary/src/loader.c index 72d7eaed3..d308acfde 100644 --- a/fusee/fusee-secondary/src/loader.c +++ b/fusee/fusee-secondary/src/loader.c @@ -5,7 +5,7 @@ #include #include "utils.h" #include "loader.h" -#include "sd_utils.h" +#include "fs_utils.h" #include "stage2.h" #include "lib/ini.h" @@ -266,7 +266,7 @@ void load_payload(const char *bct0) { for (size_t i = 0; i < ctx->nb_files; i++) { chainloader_entry_t *entry = &g_chainloader_entries[i]; entry->src_address = entry->load_address; - if (read_sd_file((void *)entry->src_address, entry->size, ctx->file_paths[entry->num]) != entry->size) { + if (read_from_file((void *)entry->src_address, entry->size, ctx->file_paths[entry->num]) != entry->size) { printf("Error: Failed to read file %s: %s!\n", ctx->file_paths[entry->num], strerror(errno)); generic_panic(); } @@ -303,7 +303,7 @@ void load_payload(const char *bct0) { for (size_t i = 0; i < ctx->nb_files; i++) { chainloader_entry_t *entry = &g_chainloader_entries[i]; entry->src_address = pos; - if (read_sd_file((void *)entry->src_address, entry->size, ctx->file_paths[entry->num]) != entry->size) { + if (read_from_file((void *)entry->src_address, entry->size, ctx->file_paths[entry->num]) != entry->size) { printf("Error: Failed to read file %s: %s!\n", ctx->file_paths[entry->num], strerror(errno)); generic_panic(); } diff --git a/fusee/fusee-secondary/src/main.c b/fusee/fusee-secondary/src/main.c index 4584ae793..aa7363e0c 100644 --- a/fusee/fusee-secondary/src/main.c +++ b/fusee/fusee-secondary/src/main.c @@ -9,7 +9,7 @@ #include "stage2.h" #include "nxboot.h" #include "console.h" -#include "sd_utils.h" +#include "fs_utils.h" #include "switch_fs.h" #include "gpt.h" #include "display/video_fb.h" diff --git a/fusee/fusee-secondary/src/sd_utils.h b/fusee/fusee-secondary/src/sd_utils.h deleted file mode 100644 index f796e5aa9..000000000 --- a/fusee/fusee-secondary/src/sd_utils.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef FUSEE_SD_UTILS_H -#define FUSEE_SD_UTILS_H - -#include "utils.h" -#include "sdmmc.h" - -size_t read_sd_file(void *dst, size_t dst_size, const char *filename); - -#endif diff --git a/fusee/fusee-secondary/src/splash_screen.c b/fusee/fusee-secondary/src/splash_screen.c index 51276d37e..b49db6798 100644 --- a/fusee/fusee-secondary/src/splash_screen.c +++ b/fusee/fusee-secondary/src/splash_screen.c @@ -2,13 +2,13 @@ #include "utils.h" #include "timers.h" #include "splash_screen.h" -#include "sd_utils.h" +#include "fs_utils.h" #include "display/video_fb.h" void display_splash_screen_bmp(const char *custom_splash_path) { uint8_t *splash_screen = g_default_splash_screen; if (custom_splash_path != NULL && custom_splash_path[0] != '\x00') { - if (!read_sd_file(splash_screen, sizeof(g_default_splash_screen), custom_splash_path)) { + if (!read_from_file(splash_screen, sizeof(g_default_splash_screen), custom_splash_path)) { printf("Error: Failed to read custom splash screen from %s!\n", custom_splash_path); generic_panic(); } diff --git a/fusee/fusee-secondary/src/stratosphere.c b/fusee/fusee-secondary/src/stratosphere.c index a1023ebc8..0cac7b0cd 100644 --- a/fusee/fusee-secondary/src/stratosphere.c +++ b/fusee/fusee-secondary/src/stratosphere.c @@ -4,7 +4,7 @@ #include "utils.h" #include "package2.h" #include "stratosphere.h" -#include "sd_utils.h" +#include "fs_utils.h" static ini1_header_t *g_stratosphere_ini1 = NULL; @@ -97,7 +97,7 @@ ini1_header_t *stratosphere_merge_inis(ini1_header_t **inis, size_t num_inis) { 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. */ - read_size = read_sd_file(current_dst_kip, remaining_size, sd_path); + read_size = read_from_file(current_dst_kip, remaining_size, sd_path); if (read_size != 0) { kip1_header_t *sd_kip = (kip1_header_t *)(current_dst_kip); if (read_size < sizeof(kip1_header_t) || sd_kip->magic != MAGIC_KIP1) {