From 0d4fe1f052edaedecf5fc6c5de71720c3b016bb4 Mon Sep 17 00:00:00 2001 From: shinyquagsire23 Date: Sun, 31 Jul 2016 22:28:28 -0700 Subject: [PATCH] Add FSMountSource struct, use filesystem structs in devoptab --- include/coreinit/filesystem.h | 11 +++++++++-- rpl/libcoreinit/fs_dev.c | 14 +++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/include/coreinit/filesystem.h b/include/coreinit/filesystem.h index 712aa5b..277ad44 100644 --- a/include/coreinit/filesystem.h +++ b/include/coreinit/filesystem.h @@ -31,6 +31,7 @@ typedef struct FSClient FSClient; typedef struct FSDirectoryEntry FSDirectoryEntry; typedef struct FSStat FSStat; typedef struct FSStateChangeInfo FSStateChangeInfo; +typedef struct FSMountSource FSMountSource; typedef enum FSStatus { @@ -189,6 +190,12 @@ struct FSDirectoryEntry CHECK_OFFSET(FSDirectoryEntry, 0x64, name); CHECK_SIZE(FSDirectoryEntry, 0x164); +struct FSMountSource +{ + UNKNOWN(0x300); +}; +CHECK_SIZE(FSMountSource, 0x300); + FSStatus fsDevInit(); @@ -548,13 +555,13 @@ FSStatus FSGetMountSource(FSClient *client, FSCmdBlock *cmd, FSMountSourceType type, - void *out, + FSMountSource *out, uint32_t flags); FSStatus FSMount(FSClient *client, FSCmdBlock *cmd, - void *source, + FSMountSource *source, const char *target, uint32_t bytes, uint32_t flags); diff --git a/rpl/libcoreinit/fs_dev.c b/rpl/libcoreinit/fs_dev.c index d8a772c..17caddf 100644 --- a/rpl/libcoreinit/fs_dev.c +++ b/rpl/libcoreinit/fs_dev.c @@ -90,8 +90,8 @@ fs_devoptab = }; /* FS structs */ -void *fsClient; -void *fsCmd; +FSClient *fsClient; +FSCmdBlock *fsCmd; static bool fsInitialised = false; @@ -103,9 +103,9 @@ FSStatus fsDevInit(void) if(fsInitialised) return rc; - fsClient = memalign(0x20, 0x1700); - fsCmd = memalign(0x20, 0xA80); - u8 mountSource[0x300]; + fsClient = memalign(0x20, sizeof(FSClient)); + fsCmd = memalign(0x20, sizeof(FSCmdBlock)); + FSMountSource mountSource; char mountPath[0x80]; char workDir[0x83]; @@ -130,11 +130,11 @@ FSStatus fsDevInit(void) fsInitialised = true; // Mount the SD card - rc = FSGetMountSource(fsClient, fsCmd, FS_MOUNT_SOURCE_SD, (void*)mountSource, -1); + rc = FSGetMountSource(fsClient, fsCmd, FS_MOUNT_SOURCE_SD, &mountSource, -1); if(rc < 0) return rc; - rc = FSMount(fsClient, fsCmd, (void*)mountSource, mountPath, 0x80, -1); + rc = FSMount(fsClient, fsCmd, &mountSource, mountPath, 0x80, -1); if(rc >= 0) { // chdir to SD root for general use