1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-26 20:22:17 +00:00
nxdumptool/source/fs_ext.c

49 lines
1.2 KiB
C
Raw Normal View History

2018-05-15 13:57:40 +01:00
#include <switch/kernel/ipc.h>
2019-12-11 08:56:58 +00:00
#include <switch/services/fs.h>
#include <stdlib.h>
#include <string.h>
2018-05-15 13:57:40 +01:00
2019-06-05 23:44:18 +01:00
#include "fs_ext.h"
2018-05-15 13:57:40 +01:00
// IFileSystemProxy
2019-04-21 17:27:33 +01:00
Result fsOpenGameCardStorage(FsStorage* out, const FsGameCardHandle* handle, u32 partition)
{
2019-04-21 17:27:33 +01:00
struct {
u32 handle;
u32 partition;
2019-12-11 08:56:58 +00:00
} in = { handle->value, partition };
2019-04-21 17:27:33 +01:00
2019-12-11 08:56:58 +00:00
return serviceDispatchIn(fsGetServiceSession(), 30, in,
.out_num_objects = 1,
.out_objects = &out->s
);
2018-05-15 13:57:40 +01:00
}
2019-04-21 17:27:33 +01:00
Result fsOpenGameCardDetectionEventNotifier(FsEventNotifier* out)
{
2019-12-11 08:56:58 +00:00
return serviceDispatch(fsGetServiceSession(), 501,
.out_num_objects = 1,
.out_objects = &out->s
);
2018-05-15 13:57:40 +01:00
}
2019-04-21 17:27:33 +01:00
// IDeviceOperator
Result fsDeviceOperatorUpdatePartitionInfo(FsDeviceOperator* d, const FsGameCardHandle* handle, u32* out_title_version, u64* out_title_id)
{
2019-04-21 17:27:33 +01:00
struct {
u32 handle;
2019-12-11 08:56:58 +00:00
} in = { handle->value };
2019-04-21 17:27:33 +01:00
2019-12-11 08:56:58 +00:00
struct {
u32 title_ver;
u64 title_id;
} out;
2019-04-21 17:27:33 +01:00
2019-12-11 08:56:58 +00:00
Result rc = serviceDispatchInOut(&d->s, 203, in, out);
2019-04-21 17:27:33 +01:00
2019-12-11 08:56:58 +00:00
if (R_SUCCEEDED(rc) && out_title_version) *out_title_version = out.title_ver;
if (R_SUCCEEDED(rc) && out_title_id) *out_title_id = out.title_id;
2019-04-21 17:27:33 +01:00
return rc;
2018-05-15 13:57:40 +01:00
}