mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
Implement fsOpenGameCardFileSystem
This commit is contained in:
parent
6942c8db75
commit
bc5d01400f
@ -192,6 +192,12 @@ typedef enum {
|
||||
FsGameCardAttribute_Repair = (1 << 2), ///< Indicates that this gamecard is a repair tool.
|
||||
} FsGameCardAttribute;
|
||||
|
||||
typedef enum {
|
||||
FsGameCardPartiton_Update = 0,
|
||||
FsGameCardPartiton_Normal = 1,
|
||||
FsGameCardPartiton_Secure = 2,
|
||||
} FsGameCardPartiton;
|
||||
|
||||
typedef struct {
|
||||
u32 value;
|
||||
} FsGameCardHandle;
|
||||
@ -242,6 +248,7 @@ Result fsCreateSaveDataFileSystemBySystemSaveDataId(const FsSave* save, const Fs
|
||||
Result fsDeleteSaveDataFileSystemBySaveDataSpaceId(FsSaveDataSpaceId saveDataSpaceId, u64 saveID);
|
||||
|
||||
Result fsIsExFatSupported(bool* out);
|
||||
Result fsOpenGameCardFileSystem(FsFileSystem* out, const FsGameCardHandle* handle, FsGameCardPartiton partition);
|
||||
|
||||
/// Do not call this directly, see fs_dev.h.
|
||||
Result fsMountSdcard(FsFileSystem* out);
|
||||
|
@ -736,6 +736,46 @@ Result fsIsExFatSupported(bool* out)
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result fsOpenGameCardFileSystem(FsFileSystem* out, const FsGameCardHandle* handle, FsGameCardPartiton partition) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
u32 handle;
|
||||
u32 partition;
|
||||
} *raw;
|
||||
|
||||
raw = serviceIpcPrepareHeader(&g_fsSrv, &c, sizeof(*raw));
|
||||
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = 31;
|
||||
raw->handle = handle->value;
|
||||
raw->partition = partition;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// Wrapper(s) for fsCreateSaveDataFileSystemBySystemSaveDataId.
|
||||
Result fsCreate_SystemSaveDataWithOwner(FsSaveDataSpaceId saveDataSpaceId, u64 saveID, u128 userID, u64 ownerId, u64 size, u64 journalSize, u32 flags) {
|
||||
FsSave save = {
|
||||
|
Loading…
Reference in New Issue
Block a user