From 90620daf05dc8246c275dbce8029be33f7bd4ccb Mon Sep 17 00:00:00 2001 From: yellows8 Date: Fri, 17 May 2019 11:15:43 -0400 Subject: [PATCH] Added romfsMountFromCurrentProcess(). --- nx/include/switch/runtime/devices/romfs_dev.h | 6 ++++++ nx/source/runtime/devices/romfs_dev.c | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/nx/include/switch/runtime/devices/romfs_dev.h b/nx/include/switch/runtime/devices/romfs_dev.h index c5e7b8c8..af08df12 100644 --- a/nx/include/switch/runtime/devices/romfs_dev.h +++ b/nx/include/switch/runtime/devices/romfs_dev.h @@ -84,6 +84,12 @@ static inline Result romfsInitFromStorage(FsStorage storage, u64 offset) return romfsMountFromStorage(storage, offset, "romfs"); } +/** + * @brief Mounts RomFS using the current process host title RomFS. + * @param name Device mount name. + */ +Result romfsMountFromCurrentProcess(const char *name); + /** * @brief Mounts RomFS from a file path in a mounted fsdev device. * @param path File path. diff --git a/nx/source/runtime/devices/romfs_dev.c b/nx/source/runtime/devices/romfs_dev.c index c0e18c19..719cb1f0 100644 --- a/nx/source/runtime/devices/romfs_dev.c +++ b/nx/source/runtime/devices/romfs_dev.c @@ -317,6 +317,16 @@ Result romfsMountFromStorage(FsStorage storage, u64 offset, const char *name) return romfsMountCommon(name, mount); } +Result romfsMountFromCurrentProcess(const char *name) { + FsStorage storage; + + Result rc = fsOpenDataStorageByCurrentProcess(&storage); + if (R_FAILED(rc)) + return rc; + + return romfsMountFromStorage(storage, 0, name); +} + Result romfsMountFromFsdev(const char *path, u64 offset, const char *name) { FsFileSystem *tmpfs = NULL;