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 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);

View File

@ -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