mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-09 22:56:35 +00:00
Rename sd_utils to fs_utils, etc
This commit is contained in:
parent
a3792d94dc
commit
8df624a10d
12 changed files with 34 additions and 34 deletions
|
@ -1,4 +1,4 @@
|
||||||
#include "sd_utils.h"
|
#include "fs_utils.h"
|
||||||
#include "hwinit.h"
|
#include "hwinit.h"
|
||||||
#include "sdmmc.h"
|
#include "sdmmc.h"
|
||||||
#include "lib/printk.h"
|
#include "lib/printk.h"
|
||||||
|
@ -18,7 +18,7 @@ int mount_sd(void) {
|
||||||
return mounted_sd;
|
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) {
|
if (!mounted_sd && mount_sd() == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
9
fusee/fusee-primary/src/fs_utils.h
Normal file
9
fusee/fusee-primary/src/fs_utils.h
Normal file
|
@ -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
|
|
@ -2,7 +2,7 @@
|
||||||
#include "hwinit.h"
|
#include "hwinit.h"
|
||||||
#include "fuse.h"
|
#include "fuse.h"
|
||||||
#include "se.h"
|
#include "se.h"
|
||||||
#include "sd_utils.h"
|
#include "fs_utils.h"
|
||||||
#include "stage2.h"
|
#include "stage2.h"
|
||||||
#include "chainloader.h"
|
#include "chainloader.h"
|
||||||
#include "sdmmc.h"
|
#include "sdmmc.h"
|
||||||
|
@ -23,7 +23,7 @@ static char g_bct0_buffer[BCTO_MAX_SIZE];
|
||||||
"stage2_entrypoint = 0xF0000000\n"
|
"stage2_entrypoint = 0xF0000000\n"
|
||||||
|
|
||||||
static const char *load_config(void) {
|
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("Failed to read BCT0 from SD!\n");
|
||||||
printk("[DEBUG] Using default BCT0!\n");
|
printk("[DEBUG] Using default BCT0!\n");
|
||||||
memcpy(g_bct0_buffer, DEFAULT_BCT0_FOR_DEBUG, sizeof(DEFAULT_BCT0_FOR_DEBUG));
|
memcpy(g_bct0_buffer, DEFAULT_BCT0_FOR_DEBUG, sizeof(DEFAULT_BCT0_FOR_DEBUG));
|
||||||
|
|
|
@ -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
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "display/video_fb.h"
|
#include "display/video_fb.h"
|
||||||
#include "sd_utils.h"
|
#include "fs_utils.h"
|
||||||
#include "stage2.h"
|
#include "stage2.h"
|
||||||
#include "chainloader.h"
|
#include "chainloader.h"
|
||||||
#include "lib/printk.h"
|
#include "lib/printk.h"
|
||||||
|
@ -105,7 +105,7 @@ void load_stage2(const char *bct0) {
|
||||||
tmp_addr = config.load_address;
|
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);
|
printk("Error: Failed to read stage2 (%s)!\n", config.path);
|
||||||
generic_panic();
|
generic_panic();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "sd_utils.h"
|
#include "fs_utils.h"
|
||||||
#include "hwinit.h"
|
#include "hwinit.h"
|
||||||
#include "sdmmc.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");
|
FILE *file = fopen(filename, "rb");
|
||||||
if (file == NULL) {
|
if (file == NULL) {
|
||||||
return 0;
|
return 0;
|
9
fusee/fusee-secondary/src/fs_utils.h
Normal file
9
fusee/fusee-secondary/src/fs_utils.h
Normal file
|
@ -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
|
|
@ -5,7 +5,7 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "loader.h"
|
#include "loader.h"
|
||||||
#include "sd_utils.h"
|
#include "fs_utils.h"
|
||||||
#include "stage2.h"
|
#include "stage2.h"
|
||||||
#include "lib/ini.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++) {
|
for (size_t i = 0; i < ctx->nb_files; i++) {
|
||||||
chainloader_entry_t *entry = &g_chainloader_entries[i];
|
chainloader_entry_t *entry = &g_chainloader_entries[i];
|
||||||
entry->src_address = entry->load_address;
|
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));
|
printf("Error: Failed to read file %s: %s!\n", ctx->file_paths[entry->num], strerror(errno));
|
||||||
generic_panic();
|
generic_panic();
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ void load_payload(const char *bct0) {
|
||||||
for (size_t i = 0; i < ctx->nb_files; i++) {
|
for (size_t i = 0; i < ctx->nb_files; i++) {
|
||||||
chainloader_entry_t *entry = &g_chainloader_entries[i];
|
chainloader_entry_t *entry = &g_chainloader_entries[i];
|
||||||
entry->src_address = pos;
|
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));
|
printf("Error: Failed to read file %s: %s!\n", ctx->file_paths[entry->num], strerror(errno));
|
||||||
generic_panic();
|
generic_panic();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "stage2.h"
|
#include "stage2.h"
|
||||||
#include "nxboot.h"
|
#include "nxboot.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "sd_utils.h"
|
#include "fs_utils.h"
|
||||||
#include "switch_fs.h"
|
#include "switch_fs.h"
|
||||||
#include "gpt.h"
|
#include "gpt.h"
|
||||||
#include "display/video_fb.h"
|
#include "display/video_fb.h"
|
||||||
|
|
|
@ -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
|
|
|
@ -2,13 +2,13 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
#include "splash_screen.h"
|
#include "splash_screen.h"
|
||||||
#include "sd_utils.h"
|
#include "fs_utils.h"
|
||||||
#include "display/video_fb.h"
|
#include "display/video_fb.h"
|
||||||
|
|
||||||
void display_splash_screen_bmp(const char *custom_splash_path) {
|
void display_splash_screen_bmp(const char *custom_splash_path) {
|
||||||
uint8_t *splash_screen = g_default_splash_screen;
|
uint8_t *splash_screen = g_default_splash_screen;
|
||||||
if (custom_splash_path != NULL && custom_splash_path[0] != '\x00') {
|
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);
|
printf("Error: Failed to read custom splash screen from %s!\n", custom_splash_path);
|
||||||
generic_panic();
|
generic_panic();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "package2.h"
|
#include "package2.h"
|
||||||
#include "stratosphere.h"
|
#include "stratosphere.h"
|
||||||
#include "sd_utils.h"
|
#include "fs_utils.h"
|
||||||
|
|
||||||
static ini1_header_t *g_stratosphere_ini1 = NULL;
|
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);
|
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. */
|
/* 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) {
|
if (read_size != 0) {
|
||||||
kip1_header_t *sd_kip = (kip1_header_t *)(current_dst_kip);
|
kip1_header_t *sd_kip = (kip1_header_t *)(current_dst_kip);
|
||||||
if (read_size < sizeof(kip1_header_t) || sd_kip->magic != MAGIC_KIP1) {
|
if (read_size < sizeof(kip1_header_t) || sd_kip->magic != MAGIC_KIP1) {
|
||||||
|
|
Loading…
Reference in a new issue