2020-04-11 06:28:26 +01:00
|
|
|
#include <switch/services/fs.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "fs_ext.h"
|
|
|
|
|
2020-04-15 06:59:12 +01:00
|
|
|
/* IFileSystemProxy */
|
2020-04-11 06:28:26 +01:00
|
|
|
Result fsOpenGameCardStorage(FsStorage *out, const FsGameCardHandle *handle, u32 partition)
|
|
|
|
{
|
|
|
|
struct {
|
2020-04-15 06:59:12 +01:00
|
|
|
FsGameCardHandle handle;
|
2020-04-11 06:28:26 +01:00
|
|
|
u32 partition;
|
2020-04-15 06:59:12 +01:00
|
|
|
} in = { *handle, partition };
|
2020-04-11 06:28:26 +01:00
|
|
|
|
|
|
|
return serviceDispatchIn(fsGetServiceSession(), 30, in,
|
|
|
|
.out_num_objects = 1,
|
|
|
|
.out_objects = &out->s
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Result fsOpenGameCardDetectionEventNotifier(FsEventNotifier *out)
|
|
|
|
{
|
|
|
|
return serviceDispatch(fsGetServiceSession(), 501,
|
|
|
|
.out_num_objects = 1,
|
|
|
|
.out_objects = &out->s
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-04-15 06:59:12 +01:00
|
|
|
/* IDeviceOperator */
|
2020-04-11 06:28:26 +01:00
|
|
|
Result fsDeviceOperatorUpdatePartitionInfo(FsDeviceOperator *d, const FsGameCardHandle *handle, u32 *out_title_version, u64 *out_title_id)
|
|
|
|
{
|
|
|
|
struct {
|
2020-04-15 06:59:12 +01:00
|
|
|
FsGameCardHandle handle;
|
|
|
|
} in = { *handle };
|
2020-04-11 06:28:26 +01:00
|
|
|
|
|
|
|
struct {
|
2020-04-15 06:59:12 +01:00
|
|
|
u32 title_version;
|
2020-04-11 06:28:26 +01:00
|
|
|
u64 title_id;
|
|
|
|
} out;
|
|
|
|
|
|
|
|
Result rc = serviceDispatchInOut(&d->s, 203, in, out);
|
|
|
|
|
2020-04-15 06:59:12 +01:00
|
|
|
if (R_SUCCEEDED(rc) && out_title_version) *out_title_version = out.title_version;
|
2020-04-11 06:28:26 +01:00
|
|
|
if (R_SUCCEEDED(rc) && out_title_id) *out_title_id = out.title_id;
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
2020-04-15 06:59:12 +01:00
|
|
|
|
|
|
|
Result fsDeviceOperatorGetGameCardDeviceCertificate(FsDeviceOperator *d, const FsGameCardHandle *handle, FsGameCardCertificate *out)
|
|
|
|
{
|
|
|
|
struct {
|
|
|
|
FsGameCardHandle handle;
|
|
|
|
u64 buf_size;
|
|
|
|
} in = { *handle, sizeof(FsGameCardCertificate) };
|
|
|
|
|
|
|
|
Result rc = serviceDispatchIn(&d->s, 206, in,
|
|
|
|
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
|
|
|
.buffers = { { out, sizeof(FsGameCardCertificate) } }
|
|
|
|
);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|