1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2025-02-16 21:45:39 +00:00
nxdumptool/source/fs_ext.c

48 lines
1.1 KiB
C
Raw Normal View History

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