mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
Added fsOpenDataStorageByDataId and romfsMountFromDataArchive
This commit is contained in:
parent
43128b613b
commit
1bea504732
@ -84,6 +84,13 @@ static inline Result romfsInitFromStorage(FsStorage storage, u64 offset)
|
||||
return romfsMountFromStorage(storage, offset, "romfs");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Mounts RomFS from a system data archive.
|
||||
* @param dataId Title ID of system data archive to mount.
|
||||
* @param storageId Storage ID to mount from.
|
||||
* @param name Device mount name.
|
||||
*/
|
||||
Result romfsMountFromDataArchive(u64 dataId, FsStorageId storageId, const char *name);
|
||||
|
||||
/// Unmounts the RomFS device.
|
||||
Result romfsUnmount(const char *name);
|
||||
|
@ -175,6 +175,7 @@ Result fsMountSaveData(FsFileSystem* out, u8 inval, FsSave *save);
|
||||
Result fsMountSystemSaveData(FsFileSystem* out, u8 inval, FsSave *save);
|
||||
Result fsOpenSaveDataIterator(FsSaveDataIterator* out, s32 SaveDataSpaceId);
|
||||
Result fsOpenDataStorageByCurrentProcess(FsStorage* out);
|
||||
Result fsOpenDataStorageByDataId(FsStorage* out, u64 dataId, FsStorageId storageId);
|
||||
Result fsOpenDeviceOperator(FsDeviceOperator* out);
|
||||
Result fsOpenSdCardDetectionEventNotifier(FsEventNotifier* out);
|
||||
// todo: Rest of commands here
|
||||
|
@ -305,7 +305,16 @@ Result romfsMountFromStorage(FsStorage storage, u64 offset, const char *name)
|
||||
mount->offset = offset;
|
||||
|
||||
return romfsMountCommon(name, mount);
|
||||
}
|
||||
|
||||
Result romfsMountFromDataArchive(u64 dataId, FsStorageId storageId, const char *name) {
|
||||
FsStorage storage;
|
||||
|
||||
Result rc = fsOpenDataStorageByDataId(&storage, dataId, storageId);
|
||||
if (R_FAILED(rc))
|
||||
return rc;
|
||||
|
||||
return romfsMountFromStorage(storage, 0, name);
|
||||
}
|
||||
|
||||
Result romfsMountCommon(const char *name, romfs_mount *mount)
|
||||
|
@ -353,6 +353,46 @@ Result fsOpenDataStorageByCurrentProcess(FsStorage* out) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result fsOpenDataStorageByDataId(FsStorage* out, u64 dataId, FsStorageId storageId) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
u64 storage_id;
|
||||
u64 data_id;
|
||||
} *raw;
|
||||
|
||||
raw = serviceIpcPrepareHeader(&g_fsSrv, &c, sizeof(*raw));
|
||||
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = 202;
|
||||
raw->storage_id = storageId;
|
||||
raw->data_id = dataId;
|
||||
|
||||
Result rc = serviceIpcDispatch(&g_fsSrv);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
} *resp;
|
||||
|
||||
serviceIpcParse(&g_fsSrv, &r, sizeof(*resp));
|
||||
resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
serviceCreateSubservice(&out->s, &g_fsSrv, &r, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result fsOpenDeviceOperator(FsDeviceOperator* out) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
Loading…
Reference in New Issue
Block a user