Add FSMountSource struct, use filesystem structs in devoptab

This commit is contained in:
shinyquagsire23 2016-07-31 22:28:28 -07:00
parent e8067e8754
commit 0d4fe1f052
2 changed files with 16 additions and 9 deletions

View File

@ -31,6 +31,7 @@ typedef struct FSClient FSClient;
typedef struct FSDirectoryEntry FSDirectoryEntry; typedef struct FSDirectoryEntry FSDirectoryEntry;
typedef struct FSStat FSStat; typedef struct FSStat FSStat;
typedef struct FSStateChangeInfo FSStateChangeInfo; typedef struct FSStateChangeInfo FSStateChangeInfo;
typedef struct FSMountSource FSMountSource;
typedef enum FSStatus typedef enum FSStatus
{ {
@ -189,6 +190,12 @@ struct FSDirectoryEntry
CHECK_OFFSET(FSDirectoryEntry, 0x64, name); CHECK_OFFSET(FSDirectoryEntry, 0x64, name);
CHECK_SIZE(FSDirectoryEntry, 0x164); CHECK_SIZE(FSDirectoryEntry, 0x164);
struct FSMountSource
{
UNKNOWN(0x300);
};
CHECK_SIZE(FSMountSource, 0x300);
FSStatus FSStatus
fsDevInit(); fsDevInit();
@ -548,13 +555,13 @@ FSStatus
FSGetMountSource(FSClient *client, FSGetMountSource(FSClient *client,
FSCmdBlock *cmd, FSCmdBlock *cmd,
FSMountSourceType type, FSMountSourceType type,
void *out, FSMountSource *out,
uint32_t flags); uint32_t flags);
FSStatus FSStatus
FSMount(FSClient *client, FSMount(FSClient *client,
FSCmdBlock *cmd, FSCmdBlock *cmd,
void *source, FSMountSource *source,
const char *target, const char *target,
uint32_t bytes, uint32_t bytes,
uint32_t flags); uint32_t flags);

View File

@ -90,8 +90,8 @@ fs_devoptab =
}; };
/* FS structs */ /* FS structs */
void *fsClient; FSClient *fsClient;
void *fsCmd; FSCmdBlock *fsCmd;
static bool fsInitialised = false; static bool fsInitialised = false;
@ -103,9 +103,9 @@ FSStatus fsDevInit(void)
if(fsInitialised) if(fsInitialised)
return rc; return rc;
fsClient = memalign(0x20, 0x1700); fsClient = memalign(0x20, sizeof(FSClient));
fsCmd = memalign(0x20, 0xA80); fsCmd = memalign(0x20, sizeof(FSCmdBlock));
u8 mountSource[0x300]; FSMountSource mountSource;
char mountPath[0x80]; char mountPath[0x80];
char workDir[0x83]; char workDir[0x83];
@ -130,11 +130,11 @@ FSStatus fsDevInit(void)
fsInitialised = true; fsInitialised = true;
// Mount the SD card // 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) if(rc < 0)
return rc; return rc;
rc = FSMount(fsClient, fsCmd, (void*)mountSource, mountPath, 0x80, -1); rc = FSMount(fsClient, fsCmd, &mountSource, mountPath, 0x80, -1);
if(rc >= 0) if(rc >= 0)
{ {
// chdir to SD root for general use // chdir to SD root for general use