diff --git a/fs_defs.h b/fs_defs.h index 450abfe..c520468 100644 --- a/fs_defs.h +++ b/fs_defs.h @@ -7,6 +7,7 @@ extern "C" { #endif +#include "os_types.h" /* FS defines and types */ #define FS_MAX_LOCALPATH_SIZE 511 @@ -15,6 +16,7 @@ extern "C" { #define FS_MAX_ARGPATH_SIZE FS_MAX_FULLPATH_SIZE #define FS_STATUS_OK 0 +#define FS_STATUS_EOF -2 #define FS_RET_UNSUPPORTED_CMD 0x0400 #define FS_RET_NO_ERROR 0x0000 #define FS_RET_ALL_ERROR (u32)(-1) @@ -65,9 +67,24 @@ typedef struct { FSAsyncCallback userCallback; void *userContext; - void *ioMsgQueue; + OSMessageQueue *ioMsgQueue; } FSAsyncParams; +typedef struct{ + void* data; // pointer to a FSAsyncResult; + u32 unkwn1; + u32 unkwn2; + u32 unkwn3; // always 0x08 +} __attribute__((packed)) FSMessage; + +typedef struct FSAsyncResult_{ + FSAsyncParams userParams; + FSMessage ioMsg; + + struct FSClient * client; + struct FSCmdBlock * block; + u32 result; +} FSAsyncResult; #ifdef __cplusplus } diff --git a/fs_functions.c b/fs_functions.c index e4629a0..abf6f09 100644 --- a/fs_functions.c +++ b/fs_functions.c @@ -67,7 +67,7 @@ EXPORT_DECL(s32, FSCloseFile, void *pClient, void *pCmd, s32 fd, s32 errHandling EXPORT_DECL(s32, FSFlushFile, void *pClient, void *pCmd, s32 fd, s32 error); EXPORT_DECL(s32, FSTruncateFile, void *pClient, void *pCmd, s32 fd, s32 error); EXPORT_DECL(s32, FSGetStatFile, void *pClient, void *pCmd, s32 fd, void *buffer, s32 error); -EXPORT_DECL(s32, FSSetPosFile, void *pClient, void *pCmd, s32 fd, s32 pos, s32 error); +EXPORT_DECL(s32, FSSetPosFile, void *pClient, void *pCmd, s32 fd, u32 pos, s32 error); EXPORT_DECL(s32, FSWriteFile, void *pClient, void *pCmd, const void *source, s32 block_size, s32 block_count, s32 fd, s32 flag, s32 error); EXPORT_DECL(s32, FSBindMount, void *pClient, void *pCmd, char *source, char *target, s32 error); diff --git a/fs_functions.h b/fs_functions.h index 325bf5c..4fefb59 100644 --- a/fs_functions.h +++ b/fs_functions.h @@ -80,7 +80,7 @@ extern s32 (* FSCloseFile)(void *pClient, void *pCmd, s32 fd, s32 errHandling); extern s32 (* FSFlushFile)(void *pClient, void *pCmd, s32 fd, s32 error); extern s32 (* FSTruncateFile)(void *pClient, void *pCmd, s32 fd, s32 error); extern s32 (* FSGetStatFile)(void *pClient, void *pCmd, s32 fd, void *buffer, s32 error); -extern s32 (* FSSetPosFile)(void *pClient, void *pCmd, s32 fd, s32 pos, s32 error); +extern s32 (* FSSetPosFile)(void *pClient, void *pCmd, s32 fd, u32 pos, s32 error); extern s32 (* FSWriteFile)(void *pClient, void *pCmd, const void *source, s32 block_size, s32 block_count, s32 fd, s32 flag, s32 error); extern s32 (* FSBindMount)(void *pClient, void *pCmd, char *source, char *target, s32 error); diff --git a/os_types.h b/os_types.h index 0440c4b..a600e51 100644 --- a/os_types.h +++ b/os_types.h @@ -94,6 +94,26 @@ typedef struct OSContext_ { u32 mmcr1; } OSContext; +typedef enum OSExceptionType +{ + OS_EXCEPTION_TYPE_SYSTEM_RESET = 0, + OS_EXCEPTION_TYPE_MACHINE_CHECK = 1, + OS_EXCEPTION_TYPE_DSI = 2, + OS_EXCEPTION_TYPE_ISI = 3, + OS_EXCEPTION_TYPE_EXTERNAL_INTERRUPT = 4, + OS_EXCEPTION_TYPE_ALIGNMENT = 5, + OS_EXCEPTION_TYPE_PROGRAM = 6, + OS_EXCEPTION_TYPE_FLOATING_POINT = 7, + OS_EXCEPTION_TYPE_DECREMENTER = 8, + OS_EXCEPTION_TYPE_SYSTEM_CALL = 9, + OS_EXCEPTION_TYPE_TRACE = 10, + OS_EXCEPTION_TYPE_PERFORMANCE_MONITOR = 11, + OS_EXCEPTION_TYPE_BREAKPOINT = 12, + OS_EXCEPTION_TYPE_SYSTEM_INTERRUPT = 13, + OS_EXCEPTION_TYPE_ICI = 14, +} OSExceptionType; + + typedef int (*ThreadFunc)(int argc, void *argv); struct OSThread_ {