From b364790a9ac3041b76cace3c4a5ae691bb20fc87 Mon Sep 17 00:00:00 2001 From: fincs Date: Sat, 23 Jan 2016 00:59:39 +0100 Subject: [PATCH] Add fallback RomFS path for when argv isn't available (e.g. boot.3dsx) --- libctru/source/romfs_dev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libctru/source/romfs_dev.c b/libctru/source/romfs_dev.c index a6841a9..9410f0a 100644 --- a/libctru/source/romfs_dev.c +++ b/libctru/source/romfs_dev.c @@ -114,14 +114,19 @@ typedef struct static Result romfsInitCommon(void); +__attribute__((weak)) const char* __romfs_path = NULL; + Result romfsInit(void) { if (romFS_active) return 0; if (envIsHomebrew()) { // RomFS appended to a 3DSX file - if (__system_argc == 0 || !__system_argv[0]) return 1; - const char* filename = __system_argv[0]; + const char* filename = __romfs_path; + if (__system_argc > 0 && __system_argv[0]) + filename = __system_argv[0]; + if (!filename) return 1; + if (strncmp(filename, "sdmc:/", 6) == 0) filename += 5; else if (strncmp(filename, "3dslink:/", 9) == 0)