mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-04 02:22:15 +02:00
add commands for accessing process storage
This commit is contained in:
parent
eb9d377320
commit
ca1cc2c83c
@ -313,9 +313,10 @@ void fsSetPriority(FsPriority prio);
|
|||||||
|
|
||||||
/// Mount requested filesystem type from content file
|
/// Mount requested filesystem type from content file
|
||||||
Result fsOpenFileSystem(FsFileSystem* out, FsFileSystemType fsType, const char* contentPath); ///< same as calling fsOpenFileSystemWithId with 0 as id
|
Result fsOpenFileSystem(FsFileSystem* out, FsFileSystemType fsType, const char* contentPath); ///< same as calling fsOpenFileSystemWithId with 0 as id
|
||||||
|
Result fsOpenDataFileSystemByCurrentProcess(FsFileSystem *out);
|
||||||
Result fsOpenFileSystemWithPatch(FsFileSystem* out, u64 id, FsFileSystemType fsType); ///< [2.0.0+], like OpenFileSystemWithId but without content path.
|
Result fsOpenFileSystemWithPatch(FsFileSystem* out, u64 id, FsFileSystemType fsType); ///< [2.0.0+], like OpenFileSystemWithId but without content path.
|
||||||
Result fsOpenFileSystemWithId(FsFileSystem* out, u64 id, FsFileSystemType fsType, const char* contentPath); ///< works on all firmwares, id is ignored on [1.0.0]
|
Result fsOpenFileSystemWithId(FsFileSystem* out, u64 id, FsFileSystemType fsType, const char* contentPath); ///< works on all firmwares, id is ignored on [1.0.0]
|
||||||
|
Result fsOpenDataFileSystemByProgramId(FsFileSystem *out, u64 program_id);
|
||||||
Result fsOpenBisFileSystem(FsFileSystem* out, FsBisPartitionId partitionId, const char* string);
|
Result fsOpenBisFileSystem(FsFileSystem* out, FsBisPartitionId partitionId, const char* string);
|
||||||
Result fsOpenBisStorage(FsStorage* out, FsBisPartitionId partitionId);
|
Result fsOpenBisStorage(FsStorage* out, FsBisPartitionId partitionId);
|
||||||
|
|
||||||
@ -346,7 +347,9 @@ Result fsOpenContentStorageFileSystem(FsFileSystem* out, FsContentStorageId cont
|
|||||||
Result fsOpenCustomStorageFileSystem(FsFileSystem* out, FsCustomStorageId custom_storage_id); ///< [7.0.0+]
|
Result fsOpenCustomStorageFileSystem(FsFileSystem* out, FsCustomStorageId custom_storage_id); ///< [7.0.0+]
|
||||||
|
|
||||||
Result fsOpenDataStorageByCurrentProcess(FsStorage* out);
|
Result fsOpenDataStorageByCurrentProcess(FsStorage* out);
|
||||||
|
Result fsOpenDataStorageByProgramId(FsStorage *out, u64 program_id);
|
||||||
Result fsOpenDataStorageByDataId(FsStorage* out, u64 dataId, NcmStorageId storageId);
|
Result fsOpenDataStorageByDataId(FsStorage* out, u64 dataId, NcmStorageId storageId);
|
||||||
|
Result fsOpenPatchDataStorageByCurrentProcess(FsStorage* out);
|
||||||
|
|
||||||
Result fsOpenDeviceOperator(FsDeviceOperator* out);
|
Result fsOpenDeviceOperator(FsDeviceOperator* out);
|
||||||
Result fsOpenSdCardDetectionEventNotifier(FsEventNotifier* out);
|
Result fsOpenSdCardDetectionEventNotifier(FsEventNotifier* out);
|
||||||
|
@ -146,6 +146,10 @@ static Result _fsOpenFileSystem(FsFileSystem* out, FsFileSystemType fsType, cons
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result fsOpenDataFileSystemByCurrentProcess(FsFileSystem *out) {
|
||||||
|
return _fsCmdGetSession(&g_fsSrv, &out->s, 2);
|
||||||
|
}
|
||||||
|
|
||||||
Result fsOpenFileSystemWithPatch(FsFileSystem* out, u64 id, FsFileSystemType fsType) {
|
Result fsOpenFileSystemWithPatch(FsFileSystem* out, u64 id, FsFileSystemType fsType) {
|
||||||
if (hosversionBefore(2,0,0))
|
if (hosversionBefore(2,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
@ -175,6 +179,13 @@ static Result _fsOpenFileSystemWithId(FsFileSystem* out, u64 id, FsFileSystemTyp
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result fsOpenDataFileSystemByProgramId(FsFileSystem *out, u64 program_id) {
|
||||||
|
return _fsObjectDispatchIn(&g_fsSrv, 9, program_id,
|
||||||
|
.out_num_objects = 1,
|
||||||
|
.out_objects = &out->s,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Result fsOpenFileSystemWithId(FsFileSystem* out, u64 id, FsFileSystemType fsType, const char* contentPath) {
|
Result fsOpenFileSystemWithId(FsFileSystem* out, u64 id, FsFileSystemType fsType, const char* contentPath) {
|
||||||
char sendStr[FS_MAX_PATH] = {0};
|
char sendStr[FS_MAX_PATH] = {0};
|
||||||
strncpy(sendStr, contentPath, sizeof(sendStr)-1);
|
strncpy(sendStr, contentPath, sizeof(sendStr)-1);
|
||||||
@ -398,6 +409,13 @@ Result fsOpenDataStorageByCurrentProcess(FsStorage* out) {
|
|||||||
return _fsCmdGetSession(&g_fsSrv, &out->s, 200);
|
return _fsCmdGetSession(&g_fsSrv, &out->s, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result fsOpenDataStorageByProgramId(FsStorage *out, u64 program_id) {
|
||||||
|
return _fsObjectDispatchIn(&g_fsSrv, 201, program_id,
|
||||||
|
.out_num_objects = 1,
|
||||||
|
.out_objects = &out->s,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Result fsOpenDataStorageByDataId(FsStorage* out, u64 dataId, NcmStorageId storageId) {
|
Result fsOpenDataStorageByDataId(FsStorage* out, u64 dataId, NcmStorageId storageId) {
|
||||||
const struct {
|
const struct {
|
||||||
u8 storage_id;
|
u8 storage_id;
|
||||||
@ -410,6 +428,10 @@ Result fsOpenDataStorageByDataId(FsStorage* out, u64 dataId, NcmStorageId storag
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result fsOpenPatchDataStorageByCurrentProcess(FsStorage* out) {
|
||||||
|
return _fsCmdGetSession(&g_fsSrv, &out->s, 203);
|
||||||
|
}
|
||||||
|
|
||||||
Result fsOpenDeviceOperator(FsDeviceOperator* out) {
|
Result fsOpenDeviceOperator(FsDeviceOperator* out) {
|
||||||
return _fsCmdGetSession(&g_fsSrv, &out->s, 400);
|
return _fsCmdGetSession(&g_fsSrv, &out->s, 400);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user